feat: add tool call support to chat completions endpoint
- Accept tools and tool_choice fields in CompletionRequest - Convert OpenAI tools to Gemini format and store in MitmStore - Detect MITM-captured function calls in streaming poll loop - Emit tool_calls delta chunks in OpenAI streaming format - Finish with 'tool_calls' reason instead of 'stop' when tools used - Only clear tools when request has none (prevents stale state leak)
This commit is contained in:
@@ -49,6 +49,10 @@ pub(crate) struct CompletionRequest {
|
||||
pub stream: bool,
|
||||
#[serde(default = "default_timeout")]
|
||||
pub timeout: u64,
|
||||
/// OpenAI-format tool definitions
|
||||
pub tools: Option<Vec<serde_json::Value>>,
|
||||
/// Tool choice: "auto", "none", "required", or {"type":"function","function":{"name":"..."}}
|
||||
pub tool_choice: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user