Skip to content

invalid_request_error when using models from Fireworks AI #778

Description

@HareeshBahuleyan

Not sure if this is an any-agent or any-llm issue, but feel free to close the ticket if its not relevant. Minimal example:

import os
import dotenv

dotenv.load_dotenv()

from tavily.tavily import TavilyClient

def search_tavily(query: str, include_images: bool = False) -> str:
    api_key = os.getenv("TAVILY_API_KEY")
    if not api_key:
        return "TAVILY_API_KEY environment variable not set."
    try:
        client = TavilyClient(api_key)
        response = client.search(query, include_images=include_images)
        results = response.get("results", [])
        output = []
        for result in results:
            output.append(f"[{result.get('title', 'No Title')}]({result.get('url', '#')})\n{result.get('content', '')}")
        if include_images and "images" in response:
            output.append("\nImages:")
            for image in response["images"]:
                output.append(image)
        return "\n\n".join(output) if output else "No results found."
    except Exception as e:
        return f"Error performing Tavily search: {e!s}"

agent = AnyAgent.create(
    "tinyagent",
    AgentConfig(model_id="fireworks:accounts/fireworks/models/gpt-oss-120b",
    instructions="You are a helpful assistant. Answer the question with available tools.",
    tools=[search_tavily])
)

agent.run("Which agent framework is the best?")

After running a few steps, it throws:

any_agent.frameworks.any_agent.AgentRunError: Error code: 400 - {'error': {'object': 'error', 'type': 'invalid_request_error', 'code': 
'invalid_request_error', 'message': "5 request validation errors: Extra inputs are not permitted, field: 'messages[2].refusal', 
value: None; Extra inputs are not permitted, field: 'messages[2].annotations', value: None; 
Extra inputs are not permitted, field: 'messages[2].audio', value: None; 
Extra inputs are not permitted, field: 'messages[2].function_call', value: None; Extra inputs are not permitted, field: 'messages[2].reasoning'"}}

When using it simply querying the completion endpoint, it works alright:

response = completion(
  model="fireworks:accounts/fireworks/models/gpt-oss-120b",
  messages=[{"role": "user", "content": "Hello!"}]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions