Skip to main content

llm_kernel/
prelude.rs

1//! Re-exports of the most commonly used types.
2//!
3//! ```no_run
4//! use llm_kernel::prelude::*;
5//! ```
6
7pub use crate::error::{KernelError, Result};
8
9// --- Provider ---
10
11#[cfg(feature = "provider")]
12pub use crate::provider::{
13    AuthStrategy, ModelCapabilities, ModelCost, ModelDescriptor, ModelLimit, ModelModalities,
14    ProviderIndex, ServiceDescriptor,
15};
16
17// --- Client-async ---
18
19#[cfg(feature = "client-async")]
20pub use crate::llm::{
21    AnthropicClient, ChatMessage, LLMClient, LLMRequest, LLMResponse, LLMStream, ModelConfig,
22    OpenAIClient, StreamEvent, TokenUsage,
23    json_extract::{JsonExtractor, extract_json, parse_json},
24    prompt::render_prompt,
25};
26
27// --- Secrets ---
28
29#[cfg(feature = "secrets")]
30pub use crate::secrets::{SecretVault, redact_credential};
31
32// --- Graph ---
33
34#[cfg(feature = "graph")]
35pub use crate::graph::{
36    Graph, GraphEdge, GraphNode, GraphNodeSummary, GraphStats, ScoredNode, append_edge,
37    build_graph, compute_stats, decay_importance, delete_node, graph_neighbors, init_graph_schema,
38    query_nodes, read_node, related_nodes, search_nodes, smart_recall, tag_stale_nodes,
39    upsert_node,
40};
41
42// --- MCP ---
43
44#[cfg(feature = "mcp")]
45pub use crate::mcp::{
46    BearerAuth, Handler, JsonRpcDispatcher, McpServer, ResourceDescription, ToolDescription,
47};
48
49// --- Tokens ---
50
51#[cfg(feature = "tokens")]
52pub use crate::tokens::estimate_tokens;
53
54// --- Search ---
55
56#[cfg(feature = "search")]
57pub use crate::search::{SearchResult, rrf_fuse};
58
59// --- Embedding ---
60
61#[cfg(feature = "embedding")]
62pub use crate::embedding::{EmbeddingProvider, EmbeddingResult, cosine_similarity};
63
64// --- Telemetry ---
65
66#[cfg(feature = "telemetry")]
67pub use crate::telemetry::{
68    ConsoleSink, FailureClass, FeatureName, NoopSink, ProviderCategory, TelemetryEvent,
69    TelemetrySink, ToolName,
70};
71
72// --- Safety ---
73
74#[cfg(feature = "safety")]
75pub use crate::safety::{
76    FailureCategory, classify_failure, mask_secrets, sanitize_output, strip_ansi,
77};
78
79// --- Discovery ---
80
81#[cfg(feature = "discovery")]
82pub use crate::discovery::{
83    ModelEntry, ModelLimits, ModelsDevPayload, fetch_and_cache, fetch_ollama_models,
84    fetch_openai_compatible_models, load_cache,
85};
86
87// --- Store ---
88
89#[cfg(feature = "store")]
90pub use crate::store::{
91    MigrationFn, SchemaVersion, init_in_memory, init_schema, init_schema_with_migrations,
92};
93
94// --- Config ---
95
96#[cfg(feature = "config")]
97pub use crate::config::{default_config_template, load_toml_config};
98
99// --- Install ---
100
101#[cfg(feature = "install")]
102pub use crate::install::{AgentKind, McpConfig, generate_mcp_config};