diff options
| author | sigoden <sigoden@gmail.com> | 2024-06-22 14:07:58 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-22 14:07:58 +0800 |
| commit | 0ec370b48c951a69459f9232b56df882765ccb52 (patch) | |
| tree | c12bab3bd72acc97adcd835b8d5aea82d1b96cd3 /src/client/vertexai.rs | |
| parent | 250e0eb7fee0d180b08b7d38d10c530e9a6a120d (diff) | |
| download | aichat-0ec370b48c951a69459f9232b56df882765ccb52.tar.gz | |
refactor: improve clients (#632)
Diffstat (limited to 'src/client/vertexai.rs')
| -rw-r--r-- | src/client/vertexai.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/vertexai.rs b/src/client/vertexai.rs index 69d1bc4..16910b6 100644 --- a/src/client/vertexai.rs +++ b/src/client/vertexai.rs @@ -295,29 +295,29 @@ pub fn gemini_build_chat_completions_body( .collect(); vec![json!({ "role": role, "parts": parts })] }, - MessageContent::ToolResults((tool_call_results, _)) => { - let function_call_parts: Vec<Value> = tool_call_results.iter().map(|tool_call_result| { + MessageContent::ToolResults((tool_results, _)) => { + let model_parts: Vec<Value> = tool_results.iter().map(|tool_result| { json!({ "functionCall": { - "name": tool_call_result.call.name, - "args": tool_call_result.call.arguments, + "name": tool_result.call.name, + "args": tool_result.call.arguments, } }) }).collect(); - let function_response_parts: Vec<Value> = tool_call_results.into_iter().map(|tool_call_result| { + let function_parts: Vec<Value> = tool_results.into_iter().map(|tool_result| { json!({ "functionResponse": { - "name": tool_call_result.call.name, + "name": tool_result.call.name, "response": { - "name": tool_call_result.call.name, - "content": tool_call_result.output, + "name": tool_result.call.name, + "content": tool_result.output, } } }) }).collect(); vec![ - json!({ "role": "model", "parts": function_call_parts }), - json!({ "role": "function", "parts": function_response_parts }), + json!({ "role": "model", "parts": model_parts }), + json!({ "role": "function", "parts": function_parts }), ] } } |
