- 1
//! vak-llm: unified multi-provider LLM vocabulary and streaming. - 2
//! - 3
//! Design invariants (see docs/design/01-llm.md): - 4
//! - every streaming event carries a delta AND the accumulated snapshot - 5
//! - errors are values; streams never panic into consumers - 6
//! - abort is first-class and preserves partial output - 7
- 8
pub mod anthropic; - 9
pub mod error; - 10
pub mod gate; - 11
pub mod google; - 12
pub mod google_live; - 13
pub mod models; - 14
pub mod ollama; - 15
pub mod openai; - 16
pub mod openai_realtime; - 17
pub mod openai_responses; - 18
pub mod provider_status; - 19
pub mod registry; - 20
pub mod route; - 21
pub mod sse; - 22
pub mod stream; - 23
pub mod turn; - 24
pub mod types; - 25
pub mod work; - 26
- 27
pub use error::LlmError; - 28
pub use gate::credential_id; - 29
pub use registry::{ProviderAuth, ProviderRegistry}; - 30
pub use route::{ - 31
BELIEF_FLOOR, BeliefMap, Demand, DemandBand, DemandInput, EndpointDialect, EvidenceSnapshot, - 32
ModelEvidence, QualityObjective, RouteLeg, order_ladder_v1, order_ladder_v2, score_demand, - 33
}; - 34
pub use stream::{EventSink, EventStream, StreamEvent}; - 35
pub use turn::current_turn_boundary; - 36
pub use types::{ - 37
AssistantMessage, CacheBreakpoint, CacheHints, ChatRequest, ContentBlock, Effort, Message, - 38
Role, StopReason, ToolDefinition, Usage, - 39
}; - 40
pub use work::{ - 41
AttemptReason, DispatchAttempt, DispatchBudget, DispatchCeiling, FailureDomain, Settlement, - 42
StepLedger, WorkPurpose, WorkReceipt, - 43
}; - 44
- 45
use tokio_util::sync::CancellationToken; - 46
- 47
#[async_trait::async_trait] - 48
pub trait Provider: Send + Sync { - 49
fn name(&self) -> &str; - 50
- 51
/// Stable in-process health identity. Implementations with independent - 52
/// credentials must include that credential's fingerprint so one bad key - 53
/// cannot open the circuit for another key. - 54
fn circuit_key(&self) -> String { - 55
self.name().to_string() - 56
} - 57
- 58
async fn stream( - 59
&self, - 60
request: ChatRequest, - 61
cancel: CancellationToken, - 62
) -> Result<EventStream, LlmError>; - 63
} - 64
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.