Crate ferrous_llm

Source

Modules§

config
Configuration system for LLM providers.
error
Error handling for LLM providers.
traits
Core traits for LLM providers.
types
Core types for LLM requests and responses.

Structs§

ChatRequest
A chat request containing messages and parameters.
ChatRequestBuilder
Builder for ChatRequest
CompletionRequest
A completion request for non-chat text generation.
DateTime
ISO 8601 combined date and time with time zone.
Duration
A Duration type to represent a span of time, typically used for system timeouts.
Embedding
An embedding vector.
Function
Definition of a function that can be called.
FunctionCall
A function call within a tool call.
GeneratedImage
A generated image.
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
HttpConfig
Common HTTP client configuration options.
ImageRequest
Request for image generation.
Message
A message in a conversation.
Metadata
Metadata for requests, including provider-specific extensions.
Parameters
Common parameters used across providers.
PoolConfig
Connection pool configuration.
RateLimitConfig
Rate limiting configuration.
RetryConfig
Retry configuration for failed requests.
SecretString
A secure string type for sensitive configuration values like API keys.
SpeechToTextRequest
Request for speech-to-text conversion.
TextToSpeechRequest
Request for text-to-speech conversion.
Tool
Definition of a tool/function that can be called.
ToolCall
A tool/function call made by the AI.
ToolContent
Tool-related message content.
Usage
Usage statistics for a request.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).

Enums§

ConfigError
Common configuration errors.
ContentPart
A part of multimodal message content.
FinishReason
Reason why the model stopped generating.
ImageSource
LlmError
A generic error type that can wrap any provider error.
MessageContent
Content of a message, which can be text or multimodal.
NetworkError
Common network errors.
RequestError
Common request errors.
ResponseError
Common response errors.
Role
The role of a message sender.
Value
Represents any valid JSON value.

Traits§

ChatProvider
Base trait for chat-based LLM providers.
ChatResponse
Trait for chat response types.
CompletionProvider
Trait for providers that support text completion (non-chat).
CompletionResponse
Trait for completion response types.
ConfigBuilder
Builder pattern helper for configuration types.
Deserialize
A data structure that can be deserialized from any data format supported by Serde.
EmbeddingProvider
Trait for providers that support text embeddings.
Error
Error is a trait representing the basic expectations for error values, i.e., values of type E in Result<T, E>.
ImageProvider
Optional trait for providers that support image generation.
ImageResponse
Trait for image generation response types.
ProviderConfig
Trait for provider configuration types.
ProviderError
Common trait for all provider errors.
Serialize
A data structure that can be serialized into any data format supported by Serde.
SpeechToTextProvider
Optional trait for providers that support speech-to-text.
SpeechToTextResponse
Trait for speech-to-text response types.
Stream
A stream of values produced asynchronously.
StreamingProvider
Optional trait for providers that support streaming responses.
TextToSpeechProvider
Optional trait for providers that support text-to-speech.
TextToSpeechResponse
Trait for text-to-speech response types.
ToolProvider
Optional trait for providers that support tool/function calling.

Type Aliases§

LlmResult
Result type alias for LLM operations with generic error.
ProviderResult
Result type alias for provider operations.

Attribute Macros§

async_trait

Derive Macros§

Deserialize
Serialize