Skip to content

Fix gpt-oss tool call#23518

Closed
sa411022 wants to merge 4 commits intovllm-project:mainfrom
sa411022:fix-gpt-oss
Closed

Fix gpt-oss tool call#23518
sa411022 wants to merge 4 commits intovllm-project:mainfrom
sa411022:fix-gpt-oss

Conversation

@sa411022
Copy link

@sa411022 sa411022 commented Aug 25, 2025

Purpose

Fix gpt-oss tool call when Pydantic validates the function call message as dict

Test Plan

Test Result

(Optional) Documentation Update

Signed-off-by: sa411022 <sa411022@gmail.com>
@sa411022 sa411022 requested a review from aarnphm as a code owner August 25, 2025 03:19
@mergify mergify bot added the frontend label Aug 25, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a bug where a tool call from gpt-oss is validated as a dictionary instead of a ResponseFunctionToolCall object. The fix involves adding an elif block to check if the message is a dictionary representing a function call and, if so, converting it into the proper ResponseFunctionToolCall object. This change is crucial for the subsequent logic that needs to find this specific object type to correctly process tool call outputs. The implementation is direct, correct, and safely resolves the issue described in the pull request description.

@sa411022 sa411022 changed the title Update serving_responses.py Fix gpt-oss tool call Aug 25, 2025
@mergify mergify bot added the gpt-oss Related to GPT-OSS models label Aug 25, 2025
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

Copy link
Collaborator

@heheda12345 heheda12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sa411022 sa411022 closed this Aug 25, 2025
@sa411022
Copy link
Author

@heheda12345

I found the root cause is that some clients (such as LangChain) do not include the status field in the input function_call message.
If status field exists (even if its value is null), the message will be validated as ResponseFunctionToolCall correctly.
On the other hand, if status field does not exists, the message will be validated as dict and thus it will not be appended to the prev_outputs, which cause the "No call message found for call_xxx" error.

However, I am not sure if this should be fixed on the server side (vLLM) or the client side (such as LangChain)?

@sa411022
Copy link
Author

#22578 (comment)

@heheda12345
Copy link
Collaborator

Would be great if you can parse it correctly in vLLM. My suspicion is ResponseFunctionToolCall is not a standard ResponseInputItemParam so the below hack may have some problem.

ResponseInputOutputItem: TypeAlias = Union[ResponseInputItemParam,
                                           ResponseReasoningItem,
                                           ResponseFunctionToolCall]
class ResponsesRequest(OpenAIBaseModel):
    ....
    input: Union[str, list[ResponseInputOutputItem]]

@heheda12345
Copy link
Collaborator

FYI #24158 has a fix.

@github-actions
Copy link

github-actions bot commented Dec 6, 2025

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale Over 90 days of inactivity label Dec 6, 2025
@mergify
Copy link

mergify bot commented Dec 6, 2025

Hi @sa411022, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

@github-actions github-actions bot added unstale Recieved activity after being labelled stale and removed stale Over 90 days of inactivity labels Dec 8, 2025
@hmellor
Copy link
Member

hmellor commented Mar 6, 2026

Thanks for investigating this bug! As noted by @heheda12345 in the review, #24158 contains the proper fix for this issue. Closing as superseded.

@hmellor hmellor closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend gpt-oss Related to GPT-OSS models unstale Recieved activity after being labelled stale

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants