fix(assertions): recognize Responses calls in tool-call-f1 by JuSe123456 · Pull Request #10650 · promptfoo/promptfoo · GitHub
Skip to content

fix(assertions): recognize Responses calls in tool-call-f1 - #10650

Open
JuSe123456 wants to merge 2 commits into
promptfoo:mainfrom
JuSe123456:fix/tool-call-f1-responses
Open

fix(assertions): recognize Responses calls in tool-call-f1#10650
JuSe123456 wants to merge 2 commits into
promptfoo:mainfrom
JuSe123456:fix/tool-call-f1-responses

Conversation

@JuSe123456

Copy link
Copy Markdown

Problem

tool-call-f1 scores a correct Responses function_call as 0 when it arrives as a JSON string, while the same call in an array scores 1. The shared Responses processor emits exactly this string form when no tool callback is configured, so correct tool selection can fail an agent eval.

Fixes #10649.

Fix

Recognize single function_call blocks alongside Anthropic tool_use blocks, retaining the string-name check. Add regression coverage for objects, JSON, mixed text, malformed/non-tool objects, and the real Responses processor/callback-handler path. Clarify the supported format in the assertion docs.

Validation

  • Reproduced before the fix: six failing cases, including the real Responses processor configured for OpenAI, Azure, and xAI; the existing 33 F1 tests passed.
  • Focused regression and integration checks: 167 tests passed across toolCallF1, toolCallF1.responses, responses/processor, assertionsResult, runAssertions, trace, and evaluator/assertions.
  • Local CLI, echo provider, --no-cache, exported JSON inspected: the failing Responses sample changes from score 0 to 1; all three samples pass. The two-case configuration in the issue also passes. No model API calls.
  • TypeScript check and git diff --check passed. npm run l / npm run f passed with a non-blocking cognitive-complexity warning on the existing extraction function.
  • Full suite attempted with --maxWorkers=2 --bail=1 --sequence.shuffle=false: 5754 passed before an unrelated Windows EPERM at fs.symlinkSync in test/providers/openinterpreter.test.ts:356. That provider and test are unchanged; the complete suite is not claimed green.

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

@promptfoo-scanner promptfoo-scanner Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 All Clear

I reviewed the PR’s changes to the tool-call-f1 assertion and related docs/tests. The update expands recognition of OpenAI Responses function_call outputs for evaluation only, without introducing new LLM calls, tools, or privileged actions. No LLM security-impacting behaviors (prompting, tool execution, or data movement) are added.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59d638f02a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +87 to 89

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve function-call names when callbacks run

When a Responses provider has functionToolCallbacks configured, ResponsesProcessor.processFunctionCall replaces the function_call block with the callback's return value—for example, the existing callback test produces result.output === '11'. Consequently, handleToolCallF1 never receives an object matching this new branch and still scores a valid call as zero. Preserve the original call names in provider metadata/raw output or inspect providerResponse.raw, and cover the callback-enabled path rather than testing only an empty request config.

AGENTS.md reference: AGENTS.md:L380-L380

Useful? React with 👍 / 👎.

@promptfoo-scanner promptfoo-scanner Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 All Clear

Reviewed updates to the tool-call-f1 assertion and associated tests/documentation adding support for OpenAI Responses function_call parsing. Traced data flows from simulated LLM outputs through parsing to scoring, with no execution or privileged actions. No LLM-security relevant sinks or capability changes were introduced by this PR.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tool-call-f1 misses OpenAI Responses function_call outputs

1 participant