I am using the OpenAI sdk to enable usage of new models/providers but using existing code. Here is a sample JSON object submitted to
openai.chat.completions.create(obj)
. The code works against OpenAI but I am getting format errors from Google. First I had to remove the
$schema
key from each tool
function.parameters.$schema
I was under the impression that Portkey was suppose to translate the payload formats? Am I doing something wrong?
Current error:
BadRequestError: 400 google error: * GenerateContentRequest.contents: contents is not specified
obj = {
"messages": [
{
"role": "developer",
"content": "I want to buy a hoodie with a fur lined hood. It needs a full zipper. Near Times Square in NYC. Where can I buy one today at lunch time?"
}
],
"model": "gemini-2.0-flash-001",
"tool_choice": "auto",
"tools": [
{
"type": "function",
"function": {
"name": "searchGoogle",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query to send to google."
}
},
"required": [
"query"
],
"additionalProperties": false
},
"strict": true,
"description": "Run a search query against google for information from the web."
}
}
],
"store": false
}