fix: gemini ReAct (#2132)
This commit is contained in:
@@ -1424,6 +1424,16 @@ function M.get_tool_use_message(message, messages)
|
||||
return nil
|
||||
end
|
||||
|
||||
---@param tool_use AvanteLLMToolUse
|
||||
function M.tool_use_to_xml(tool_use)
|
||||
local xml = string.format("<%s>\n", tool_use.name)
|
||||
for k, v in pairs(tool_use.input or {}) do
|
||||
xml = xml .. string.format("<%s>%s</%s>\n", k, tostring(v), k)
|
||||
end
|
||||
xml = xml .. "</" .. tool_use.name .. ">"
|
||||
return xml
|
||||
end
|
||||
|
||||
---@param tool_use AvanteLLMToolUse
|
||||
function M.is_replace_func_call_tool_use(tool_use)
|
||||
local is_replace_func_call = false
|
||||
|
||||
@@ -26,11 +26,13 @@ Tool use is formatted using XML-style tags. The tool name is enclosed in opening
|
||||
|
||||
For example:
|
||||
|
||||
<view>
|
||||
<path>src/main.js</path>
|
||||
</view>
|
||||
<attempt_completion>
|
||||
<result>
|
||||
I have completed the task...
|
||||
</result>
|
||||
</attempt_completion>
|
||||
|
||||
Always adhere to this format for the tool use to ensure proper parsing and execution.
|
||||
ALWAYS ADHERE TO this format for the tool use to ensure proper parsing and execution.
|
||||
|
||||
# Tools
|
||||
|
||||
@@ -107,22 +109,22 @@ Parameters:
|
||||
<replace_in_file>
|
||||
<path>src/components/App.tsx</path>
|
||||
<diff>
|
||||
<<<<<<< SEARCH
|
||||
------- SEARCH
|
||||
import React from 'react';
|
||||
=======
|
||||
import React, { useState } from 'react';
|
||||
>>>>>>> REPLACE
|
||||
+++++++ REPLACE
|
||||
|
||||
<<<<<<< SEARCH
|
||||
------- SEARCH
|
||||
function handleSubmit() {
|
||||
saveData();
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> REPLACE
|
||||
+++++++ REPLACE
|
||||
|
||||
<<<<<<< SEARCH
|
||||
------- SEARCH
|
||||
return (
|
||||
<div>
|
||||
=======
|
||||
@@ -133,7 +135,7 @@ function handleSubmit() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
>>>>>>> REPLACE
|
||||
+++++++ REPLACE
|
||||
</diff>
|
||||
</replace_in_file>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user