use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum TransportKind {
Completion,
Responses,
Messages,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ToolCallDelta {
#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub index: Option<Value>,
#[serde(skip_serializing_if = "Option::is_none")]
pub call_type: Option<String>,
pub name: String,
pub arguments: String,
pub arguments_complete: bool,
}
pub trait BaseTransportParser: Send + Sync {
fn is_non_stream_response(&self, response: &Value) -> bool;
fn extract_chunk_tool_call_deltas(&self, chunk: &Value) -> Vec<ToolCallDelta>;
fn extract_chunk_text(&self, chunk: &Value) -> String;
fn extract_text(&self, response: &Value) -> String;
fn extract_tool_calls(&self, response: &Value) -> Vec<Value>;
fn extract_usage(&self, response: &Value) -> Option<Value>;
}