Expand description
Brain module — LLM provider abstraction and interaction.
Defines the LlmProvider trait for model-agnostic LLM interactions,
and provides an OpenAI-compatible implementation with streaming support.
Structs§
- Brain
- The Brain wraps an LLM provider and adds higher-level logic: prompt construction, cost tracking, and model selection.
- Mock
LlmProvider - A mock LLM provider for testing and development.
- Token
Budget Manager - Tracks token usage against configurable budgets and predicts costs before execution. Can warn or halt when budgets are exceeded.
- Token
Counter - Token counter using tiktoken-rs for accurate BPE tokenization.
Enums§
- Budget
Check Result - The result of a pre-call budget check.
Constants§
- DEFAULT_
SYSTEM_ PROMPT - The system prompt used by default for the Rustant agent.
Traits§
- LlmProvider
- Trait for LLM providers, supporting both full and streaming completions.
Functions§
- sanitize_
tool_ sequence - Sanitize tool_call → tool_result ordering in a message sequence.