feat(openai): implement Responses API streaming and proactive routing
This commit adds support for the OpenAI Responses API in both streaming and non-streaming modes. It also implements proactive routing for gpt-5 and codex models and cleans up unused 'session' variable warnings across the dashboard source files.
This commit is contained in:
@@ -42,6 +42,16 @@ pub trait Provider: Send + Sync {
|
||||
request: UnifiedRequest,
|
||||
) -> Result<BoxStream<'static, Result<ProviderStreamChunk, AppError>>, AppError>;
|
||||
|
||||
/// Process a streaming chat request using provider-specific "responses" style endpoint
|
||||
/// Default implementation falls back to `chat_completion_stream` for providers
|
||||
/// that do not implement a dedicated responses endpoint.
|
||||
async fn chat_responses_stream(
|
||||
&self,
|
||||
request: UnifiedRequest,
|
||||
) -> Result<BoxStream<'static, Result<ProviderStreamChunk, AppError>>, AppError> {
|
||||
self.chat_completion_stream(request).await
|
||||
}
|
||||
|
||||
/// Estimate token count for a request (for cost calculation)
|
||||
fn estimate_tokens(&self, request: &UnifiedRequest) -> Result<u32>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user