#How to I return a tool / function call message in CURL?

1 messages · Page 1 of 1 (latest)

dreamy lark
#

So, i need receive a response for GPT to call a function:

"tool_calls": [
  {
   "id": "AABB",
   "type": "function",
   "function": {
   "name": "pegarValoresPorBanco",
   "arguments": "{}"
  }
}]

So When I sent a CURL the response was:

{
  "error": {
    "message": "Missing required parameter: 'messages[5].content[0].type'.",
    "type": "invalid_request_error",
    "param": "messages[5].content[0].type",
    "code": "missing_required_parameter"
  }
}

This is the message[5] a message about a tool call:

{
  "tool_call_id": "AABB",
  "role": "tool",
  "name": "pegarValoresPorBanco",
  "content": [
    {
      "Nome Banco": "Inter",
      "Ultimo Saldo registrado": -402050,
      "Tipo": "Conta Corrente",
      "Nome Planilha": "✦Extrato Inter"
    },
    {
      "Nome Banco": "Inter",
      "Ultimo Saldo registrado": -450,
      "Tipo": "Cartão de Credito",
      "Nome Planilha": "★Cartão Inter"
    },
    {
      "Nome Banco": "Inter PJ",
      "Ultimo Saldo registrado": 5000,
      "Tipo": "Conta Corrente",
      "Nome Planilha": "✦Extrato Inter PJ"
    },
    {
      "Nome Banco": "Inter PJ",
      "Ultimo Saldo registrado": 5000,
      "Tipo": "Cartão de Credito",
      "Nome Planilha": "★Cartão Inter PJ"
    },
    {
      "Nome Banco": "XP",
      "Ultimo Saldo registrado": 5000,
      "Tipo": "Conta Investimento",
      "Nome Planilha": "▣Conta Investimento"
    }
  ]
}

My tool is define in this way:

{
  "tools": [{
    "type": "function",
    "function": {
    "name": "pegarValoresPorBanco",
    "description": "Obtem valores referentes a bancos.",
    "parameters": {
        "type": "object",
        "properties": {},
        "required": []
        }
    }
}]

So, what is the right way to return a tool call in curl (I have found ways in python, node with modules).
I understand the error, is missing the type on each return of content, but, what I have to put in type?

#

How to I return a tool / function call message in CURL?