mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-24 22:09:56 +00:00
* refactor(cache): organize v2 cache as a package * docs: clarify experimental v2 guidance * fix(cache): verify cache-hit accounting and preserve logging metadata * refactor(cache): separate execution facts from host accounting * refactor(rust): build messages routes with named dependencies * wip * fix(cache): preserve facade policy and preflight fallback * refactor(cache): defer shared Python logging changes * test(gateway-inference): allow dead code in shared test helpers Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(cache): key prepared requests and honor facade controls * feat(cache): use Python caches from Rust Messages inference * refactor(cache): separate native and Python cache adapters * refactor(cache): enforce shared composition and adapter boundaries * fix(cache): let Python key delegated Rust Messages entries --------- Co-authored-by: Yujong Lee <yujong@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
41 lines
1 KiB
Rust
41 lines
1 KiB
Rust
use std::ops::ControlFlow;
|
|
|
|
pub use litellm_coroutine::{Abandoned, Answer, Reply, reply};
|
|
|
|
use crate::interceptors::{RawResponse, RequestContext, WireRequest};
|
|
|
|
pub trait Protocol: Send + Sync + 'static {
|
|
type Request: Send + 'static;
|
|
type Response: Send + 'static;
|
|
type Error: Clone + Send + Sync + 'static;
|
|
type HostCall: Send + 'static;
|
|
type Chunk: Send + 'static;
|
|
type StreamHead: Send + 'static;
|
|
}
|
|
|
|
pub enum HostRequest<P: Protocol> {
|
|
HostCall(P::HostCall),
|
|
Intercept(InterceptRequest),
|
|
Stream(StreamDelivery<P>),
|
|
}
|
|
|
|
pub enum InterceptRequest {
|
|
ResultReady {
|
|
facts: crate::interceptors::ExecutionFacts,
|
|
reply: Reply<()>,
|
|
},
|
|
BeforeProviderRequest {
|
|
wire: Box<WireRequest>,
|
|
context: Box<RequestContext>,
|
|
reply: Reply<WireRequest>,
|
|
},
|
|
AfterProviderResponse {
|
|
raw: RawResponse,
|
|
reply: Reply<()>,
|
|
},
|
|
}
|
|
|
|
pub enum StreamDelivery<P: Protocol> {
|
|
Open(P::StreamHead, Reply<ControlFlow<()>>),
|
|
Chunk(P::Chunk, Reply<ControlFlow<()>>),
|
|
}
|