llm-kernel 0.4.0

Foundation library for Rust AI-native apps — provider catalog, LLM client, MCP server, search, telemetry, and safety
Documentation
//! Async LLM client with OpenAI and Anthropic backends.
//!
//! The [`LLMClient`] trait provides a unified interface for chat completion
//! and SSE streaming. Implementations: [`OpenAIClient`], [`AnthropicClient`].
//!
//! The [`json_extract`] module handles extracting structured JSON from
//! raw LLM text output (code fences, raw JSON, etc.).
//!
//! Requires the `client-async` feature.

/// Async LLM client implementations (OpenAI, Anthropic).
#[cfg(feature = "client-async")]
pub mod client;
/// JSON extraction from raw LLM text output.
pub mod json_extract;
/// Prompt template rendering.
pub mod prompt;
/// Tool/function calling types.
pub mod tool;
/// Core LLM request/response types.
pub mod types;

#[cfg(feature = "client-async")]
pub use client::{AnthropicClient, LLMClient, OpenAIClient};
pub use json_extract::{JsonExtractor, extract_json, parse_json};
pub use prompt::render_prompt;
pub use tool::{ToolCall, ToolDefinition, ToolResult};
#[cfg(feature = "client-async")]
pub use types::LLMStream;
pub use types::{
    ChatMessage, ContentPart, LLMRequest, LLMRequestBuilder, LLMResponse, MessageRole, ModelConfig,
    ResponseFormat, StreamEvent, TokenUsage,
};