Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

OpenInterpreter fails on using tools with codegate #812

Description

@yrobla

When asking it to use a tool:


                                                                                                                                                  
  import requests                                                                                                                                 
  from bs4 import BeautifulSoup                                                                                                                   
                                                                                                                                                  
  # Function to get the latest 10 BBC headers                                                                                                     
  def get_bbc_headers():                                                                                                                          
      url = 'https://www.bbc.co.uk/'                                                                                                              
      response = requests.get(url)                                                                                                                
      soup = BeautifulSoup(response.content, 'html.parser')                                                                                       
      headers = soup.find_all(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], limit=10)                                                                     
      return [header.get_text(strip=True) for header in headers]                                                                                  
                                                                                                                                                  
  # Get the latest 10 BBC headers                                                                                                                 
  get_bbc_headers()                                                                                                                               
                                                                                                                                                  

  Would you like to run this code? (y/n)

  y

it fails with:

2025-01-29T10:20:53.713351Z [error    ] Error in OpenAIProvider completion error='litellm.BadRequestError: OpenAIException - Error code: 400 - {\'error\': {\'message\': "Invalid parameter: messages with role \'tool\' must be a response to a preceeding message with \'tool_calls\'.", \'type\': \'invalid_request_error\', \'param\': \'messages.[3].role\', \'code\': None}}' lineno=82 module=provider pathname=/Users/yolanda/development/codegate-upstream/src/codegate/providers/openai/provider.py
2025-01-29T10:20:53.713935Z [info     ] ::1:58328 - "POST /openai/chat/completions HTTP/1.1" 400 lineno=473 module=h11_impl pathname=/Users/yolanda/Library/Caches/pypoetry/virtualenvs/codegate-Xtb3B9Ks-py3.12/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py

Activity

  1. self-assigned this
    on Jan 29, 2025
  2. added a commit that references this issue on Jan 29, 2025
    e4b59a5
  3. added a commit that references this issue on Jan 29, 2025
    6c07434
  4. added a commit that references this issue on Jan 31, 2025
    2187f36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions