Commit graph

2 commits

Author SHA1 Message Date
Ashwin Bharambe
674140fe89 feat(responses): implement usage tracking in streaming responses
Implementation changes:
- Add usage accumulation to StreamingResponseOrchestrator
- Enable stream_options to receive usage in streaming chunks
- Track usage across multi-turn responses with tool execution
- Convert between chat completion and response usage formats
- Extract usage accumulation into helper method for clarity

Test changes:
- Add usage assertions to streaming and non-streaming tests
- Update test recordings with actual usage data from OpenAI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-09 21:12:50 -07:00
Ashwin Bharambe
f50ce11a3b
feat(tests): make inference_recorder into api_recorder (include tool_invoke) (#3403)
Renames `inference_recorder.py` to `api_recorder.py` and extends it to
support recording/replaying tool invocations in addition to inference
calls.

This allows us to record web-search, etc. tool calls and thereafter
apply recordings for `tests/integration/responses`

## Test Plan

```
export OPENAI_API_KEY=...
export TAVILY_SEARCH_API_KEY=...

./scripts/integration-tests.sh --stack-config ci-tests \
   --suite responses --inference-mode record-if-missing
```
2025-10-09 14:27:51 -07:00