I'm trying to make that Llama 3 can do through Google however I keep getting different errors:
One is the Bad request 400:
BadRequestError: 400 {"error":{"message":"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.","type":"invalid_request_error","code":"tool_use_failed","failed_generation":"<tool-use>\n{\n \"tool_calls\": [\n {\n \"id\": \"pending\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_info\"\n },\n \"parameters\": {\n \"query\": \"current president of the US\"\n }\n }\n ]\n}\n</tool-use>"}}
And it looks like it works I get another type of error, the tool is being called with no parameters.
My tool and it's definition:
async function searchOnWeb(search) {
console.log(search);
const response = await axios.get(
"https://www.googleapis.com/customsearch/v1?key=<key>&cx=<cx>" +
search
);
const responseModel = {
title: response.data["items"][0].title,
description:
response.data["items"][0]["pagemap"]["metatags"][
"og:description"
] ?? response.data["items"][0]["snippet"],
url: response.data["items"][0].link,
};
console.log(response.data["items"][0]);
console.log(responseModel);
return JSON.stringify(responseModel);
}
const tools = [
{
type: "function",
function: {
name: "searchOnWeb",
description:
"Returns title, url and a description of the first website on web search",
parameters: {
type: "object",
properties: {
search: {
type: "string",
description: "String to search on the web",
},
},
required: ["search"],
},
},
},
];
I'm trying to make that Llama 3 can do through Google however I keep getting different errors: One is the Bad request 400:
BadRequestError: 400 {"error":{"message":"Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.","type":"invalid_request_error","code":"tool_use_failed","failed_generation":"<tool-use>\n{\n \"tool_calls\": [\n {\n \"id\": \"pending\",\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_info\"\n },\n \"parameters\": {\n \"query\": \"current president of the US\"\n }\n }\n ]\n}\n</tool-use>"}}
And it looks like it works I get another type of error, the tool is being called with no parameters.My tool and it's definition:
My code for chat completion:
What's causing this errors?