fix: tolerate partial LiteLLM citations#3655
Conversation
|
This PR is stale because it has been open for 10 days with no activity. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a3942c739
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| results.append( | ||
| Annotation( |
There was a problem hiding this comment.
Propagate converted annotations to run output
When LiteLLM returns a valid message.annotations list, this helper now builds Annotation objects, but the non-streaming LitellmModel.get_response path immediately passes the message into Converter.message_to_output_items, which still creates ResponseOutputText(..., annotations=[]) in src/agents/models/chatcmpl_converter.py. As a result, users of Runner.run still receive empty annotations even though this converter accepted the citation, and the new tests miss that end-to-end path.
Useful? React with 👍 / 👎.
Summary
Fix LiteLLM citation annotation conversion so provider-shaped partial URL citations do not raise
KeyErroror produce unusable empty citations. The converter now preserves valid citation data, defaults missing title and index fields safely, skips entries without citation URLs, and returnsNonewhen no usable citations remain.Test plan
uv run pytest tests/models/test_litellm_annotations.pyPATH="/usr/bin:/bin:/usr/sbin:/sbin:/Users/ldy/.local/bin:/Users/ldy/miniforge3/bin:/opt/homebrew/bin" bash .agents/skills/code-change-verification/scripts/run.shIssue number
N/A
Checks
make lintandmake format