Initial scaffold: GyanDoot v2.0 in Rust
Full Cargo workspace with 11 crates: - gyandoot-core: Shared types, config, error types - gyandoot-agent: Agent loop, tool execution, context compression - gyandoot-providers: LLM provider abstraction (OpenAI, Anthropic, Ollama) - gyandoot-memory: MemPalace persistent memory system - gyandoot-platform: Platform adapters (Telegram, Discord, Webhook, CLI) - gyandoot-security: Credential vault, sanitizer, threat detector - gyandoot-kanban: Task decomposition, swarm orchestration, diagnostics - gyandoot-subagents: Sub-agent spawning and orchestration - gyandoot-skills: Skills discovery, loading, preprocessing, bundles - gyandoot-profile: Multi-agent profile manager - gyandoot-gateway: Gateway sessions, routing, access control Plus: CLI entry point with clap, cross-platform installer script, KANBAN.md, .gnpl/AGENTS.md Workspace compiles clean: cargo check passes with 0 errors.
This commit is contained in:
34
crates/gyandoot-providers/src/lib.rs
Normal file
34
crates/gyandoot-providers/src/lib.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
//! GyanDoot Providers — LLM provider abstraction layer.
|
||||
//!
|
||||
//! Defines the `Provider` trait and implementations for OpenAI, Anthropic,
|
||||
//! and Ollama. Each provider handles authentication, request formatting,
|
||||
//! response parsing, and streaming.
|
||||
|
||||
use async_trait::async_trait;
|
||||
use gyandoot_core::{ConversationContext, ProviderResult};
|
||||
|
||||
pub mod openai;
|
||||
pub mod anthropic;
|
||||
pub mod ollama;
|
||||
pub mod streaming;
|
||||
|
||||
/// A provider response containing the generated text and any tool calls.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ProviderResponse {
|
||||
pub content: String,
|
||||
pub tool_calls: Option<Vec<gyandoot_core::ToolCall>>,
|
||||
pub finish_reason: String,
|
||||
}
|
||||
|
||||
/// The trait that all LLM providers must implement.
|
||||
#[async_trait]
|
||||
pub trait Provider: Send + Sync {
|
||||
/// Send a chat completion request and return the response.
|
||||
async fn chat(&self, context: ConversationContext) -> ProviderResult<ProviderResponse>;
|
||||
|
||||
/// Send a chat completion request with streaming response.
|
||||
async fn chat_stream(
|
||||
&self,
|
||||
context: ConversationContext,
|
||||
) -> ProviderResult<Box<dyn tokio_stream::Stream<Item = ProviderResult<String>> + Send + Unpin>>;
|
||||
}
|
||||
Reference in New Issue
Block a user