You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
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
When asking it to use a tool:
it fails with: