Effect CommunityEC
Effect Community•8mo ago•
12 replies
danielo515

Error with OpenAI Completions: Missing Tool Call Responses

I've tried to manually provide a tool call part as an input, but I'm getting the following error:
AiError: OpenAiCompletions.create: An error occurred
    at new Base (unknown:1:28)
    at new klass (/Users/danielo/GIT/whatsapp-family/node_modules/effect/dist/esm/Schema.js:4878:7)
    at new TaggedErrorClass (unknown:1:28)
    at new AiError (unknown:1:28)
    at <anonymous> (/Users/danielo/GIT/whatsapp-family/node_modules/@effect/ai-openai/dist/esm/OpenAiCompletions.js:105:402)
    at AiChat.toolkit
    at AIToolsService.processQuestion (/Users/danielo/GIT/whatsapp-family/src/ai/tools.ts:248:10)
    at AIToolsService.processQuestion (/Users/danielo/GIT/whatsapp-family/src/scratch.ts:32:35) {
  [cause]: ResponseError: StatusCode: {
    "error": {
      "message": "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: getContactDetails",
      "type": "invalid_request_error",
      "param": "messages",
      "code": null
    }
  } (400 POST /chat/completions)

It seems that providing context as a tool call is not the best idea. For reference my code is in the thread 🧵
Was this page helpful?