这是indexloc提供的服务,不要输入任何密码
Skip to content

[BUG]: GPT-5 models cannot use tools #4385

@Bender250

Description

@Bender250

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

GPT-5 family models does not support message.role = "function". AnythingLLM uses it and the request to OpenAI crashes with 400 Unsupported value.

Image

Here are logs:

[backend] info: [AgentHandler] [debug]: @agent is attempting to call `web-scraping` tool
[backend] info: [EncryptionManager] Loaded existing key & salt for encrypting arbitrary data.
[collector] info: -- Working URL https://docs.anythingllm.com/installation-desktop/debug => (text) --
[Electron:Collector] Page Content loaded - cleaning up timers
[Electron:Collector] Scraping page content as  text
[collector] info: Cleaning up request handler for request ID.
[backend] info: [TokenManager] Initialized new TokenManager instance for model: gpt-5-mini
[backend] error:    error: 400 Unsupported value: 'messages[2].role' does not support 'function' with this model. Error: 400 Unsupported value: 'messages[2].role' does not support 'function' with this model.
    at r.complete (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:8244)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Dl.handleExecution (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:406)
    at async Dl.handleExecution (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:1345)
    at async Dl.reply (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:274)
    at async Dl.chat (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:46286)
    at async Dl.start (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:45720)
    at async aK (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:369:2717)
    at async /Applications/AnythingLLM.app/Contents/Resources/backend/server.js:369:2243
[backend] info: [AgentHandler] End 4292d7b4-6a9e-477e-af0b-6362b6fa756a::openai:gpt-5-mini

This discussion suggests that GPT-5 family models changed the API and are now using "tool" as message type for tool calls, not "function".

Are there known steps to reproduce?

  1. Set GPT-5 / GPT-5-mini (I guess even GPT-5-nano) as model
  2. Send this message: @agent Collect the text of this page: https://docs.anythingllm.com/installation-desktop/debug (or any other tool call)

(Older models like GPT-4.1 work fine.)

Metadata

Metadata

Assignees

Labels

investigatingCore team or maintainer will or is currently looking into this issuepossible bugBug was reported but is not confirmed or is unable to be replicated.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions