LLM Provider Shared Utilities (shared/mod.rs)

vtcode · crates/codegen/vtcode-llm/src/providers/shared/mod.rs · rust · Apache-2.0
ai, realtime, lang:rust

Contains shared logic for LLM streaming, SSE handling, and tool output processing. Use this when building modular LLM provider integrations in Rust.

// Source: https://github.com/vinhnx/vtcode | License: Apache-2.0 | Copyright 2025 Vinh Nguyen
// Provided via justclaw.it.com; keep this notice with the code.
//! Shared provider wire helpers with stable facade imports.

mod prompt_cache;
mod responses_adapter;
mod responses_stream;
mod sse;
mod stream;
mod tag_sanitizer;
mod tool_call_indexes;
mod tool_output;
mod usage;
mod utf8;

pub use crate::providers::ReasoningBuffer;
pub(crate) use prompt_cache::{session_lineage_from_prompt_cache_key, split_dynamic_prompt_suffix};
pub(crate) use responses_stream::{
    RESPONSES_COMPLETION_TOKEN_KEYS, RESPONSES_PROMPT_TOKEN_KEYS, ResponsesStreamEventPolicy,
    response_stream_event_policy,
};
pub(crate) use responses_stream::{
    ResponsesNormalizedStreamOptions, ResponsesNormalizedStreamProcess

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key