Skip to main content

Crate daimon_core

Crate daimon_core 

Source
Expand description

§daimon-core

Core traits and types for the Daimon AI agent framework. This crate is the plugin interface — implement Model to add a new LLM provider.

Provider crates depend on daimon-core for the shared types and trait. The main daimon crate re-exports everything from here, so end users typically never need to depend on daimon-core directly.

§Implementing a Provider

use daimon_core::{Model, ChatRequest, ChatResponse, Result, ResponseStream};

pub struct MyProvider { /* ... */ }

impl Model for MyProvider {
    async fn generate(&self, request: &ChatRequest) -> Result<ChatResponse> {
        // call your LLM API
        todo!()
    }

    async fn generate_stream(&self, request: &ChatRequest) -> Result<ResponseStream> {
        todo!()
    }
}

Re-exports§

pub use distributed::AgentTask;
pub use distributed::ErasedTaskBroker;
pub use distributed::TaskBroker;
pub use distributed::TaskResult;
pub use distributed::TaskStatus;
pub use vector_store::ErasedVectorStore;
pub use vector_store::SharedVectorStore;
pub use vector_store::VectorStore;

Modules§

distributed
Core types and trait for distributed agent execution.
vector_store
Trait-based plugin system for vector stores.

Structs§

ChatRequest
A request to send to a model.
ChatResponse
A complete response from a model.
Document
A retrieved document fragment with optional metadata and relevance score.
Message
A single message in a conversation.
ScoredDocument
A document paired with a similarity score from a vector query.
ToolCall
A tool invocation requested by a model, containing the tool name and arguments.
ToolSpec
Describes a tool that can be passed to a model.
Usage
Token usage statistics for a single model request.

Enums§

DaimonError
The central error type for all Daimon operations.
Role
The role of a participant in a conversation.
StopReason
Why the model stopped generating.
StreamEvent
An event emitted during a streaming model response.

Traits§

EmbeddingModel
Trait for models that produce vector embeddings from text.
ErasedEmbeddingModel
Object-safe wrapper for EmbeddingModel.
ErasedModel
Object-safe wrapper for Model, enabling dynamic dispatch via Arc<dyn ErasedModel>.
Model
Trait for LLM providers. Supports both synchronous and streaming generation.

Type Aliases§

ResponseStream
A boxed, pinned stream of StreamEvent results.
Result
A type alias for Result<T, DaimonError>.
SharedEmbeddingModel
Shared ownership of an embedding model.
SharedModel
Shared ownership of a model via Arc<dyn ErasedModel>.