Skip to main content

Crate aimux_core

Crate aimux_core 

Source
Expand description

§aimux-core

Core abstractions for the aimux toolkit.

Architecture (aligned with Vercel AI SDK V4):

  User-facing API          Provider-facing trait
  ──────────────           ─────────────────────
  generate_text()  ──►     LanguageModel::do_generate()
  stream_text()    ──►     LanguageModel::do_stream()

The user calls generate_text / stream_text (free functions). These convert user messages into LanguageModelPrompt, build CallOptions, and call LanguageModel::do_generate / do_stream on the provider implementation.

Re-exports§

pub use embedding_model::EmbeddingModel;
pub use error::AiMuxError;
pub use error::ApiCallError;
pub use files_model::Files;
pub use image_model::ImageModel;
pub use language_model::LanguageModel;
pub use provider::Provider;
pub use reranking_model::RerankingModel;
pub use search_model::SearchModel;
pub use speech_model::SpeechModel;
pub use transcription_model::TranscriptionModel;
pub use video_model::VideoModel;

Modules§

composite
Composite-model shared infrastructure (RFC-0021 / RFC-0022).
content
Content parts shared between user-facing and provider-facing messages.
embedding_model
The EmbeddingModel trait — the provider-facing interface for text embeddings.
error
Error types for aimux-core.
files_model
The Files trait — the provider-facing interface for file management.
generate
User-facing API: generate_text and stream_text.
image_model
The ImageModel trait — the provider-facing interface for image generation.
json_repair
JSON repair and partial-JSON parsing helpers.
language_model
The LanguageModel trait — the provider-facing interface.
language_model_message
Provider-facing message types.
math
Math helpers ported from the Vercel AI SDK TypeScript util package.
message
User-facing message types.
moa
MoaModel — Mixture-of-Agents single-fanout aggregation (RFC-0022).
model_catalogue
Model catalogue types (RFC-0027).
model_id
Model identifier helpers.
openai_output
OpenAI Chat Completions output format.
options
CallOptions — the provider-facing options passed to do_generate / do_stream.
prelude
Convenience re-exports.
provider
The Provider trait — a factory that creates LanguageModel instances.
recording
RFC-0023: 调用上下文录制(P1 — 数据模型 + Recorder trait + 门控 + JsonlRecorder)。
replay
RFC-0023 回放(P3 — mock 响应回放;P4 — 请求回放)。
reranking_model
The RerankingModel trait — the provider-facing interface for reranking.
result
Result types for do_generate and do_stream.
router
RouterModel — a composite model that routes each call to one child and optionally falls back (RFC-0021).
search_model
The SearchModel trait — the provider-facing interface for web search.
session
Session aggregation (RFC-0024): session_id 归组基础设施.
shared
Shared V4 value types used across all non-chat model traits.
speech_model
The SpeechModel trait — the provider-facing interface for text-to-speech.
stream_part
StreamPart — the individual chunk types emitted by do_stream.
tool
Tool / function-calling types.
trace
Cache-hit probing infrastructure (RFC-0015) — layer ① of the three-layer split: probe itself. Collects fingerprints, judges verdicts, stores hashes, and exposes query APIs. Business logic (alerts / CLI / reports) lives outside this module.
transcription_model
The TranscriptionModel trait — the provider-facing interface for speech-to-text.
types
Shared value types: FinishReason, Usage, Warning, ResponseMetadata.
util
Utility functions ported from the Vercel AI SDK TypeScript util package.
video_model
The VideoModel trait — the provider-facing interface for video generation.