feat: Fix o3-pro response parsing and implement HTTP transport recorder

- Fix o3-pro response parsing to use output_text convenience field
- Replace respx with custom httpx transport solution for better reliability
- Implement comprehensive PII sanitization to prevent secret exposure
- Add HTTP request/response recording with cassette format for testing
- Sanitize all existing cassettes to remove exposed API keys
- Update documentation to reflect new HTTP transport recorder
- Add test suite for PII sanitization and HTTP recording

This change:
1. Fixes timeout issues with o3-pro API calls (was 2+ minutes, now ~15-22 seconds)
2. Properly captures response content without httpx.ResponseNotRead exceptions
3. Preserves original HTTP response format including gzip compression
4. Prevents future secret exposure with automatic PII sanitization
5. Enables reliable replay testing for o3-pro interactions

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Josh Vera
2025-07-12 18:47:17 -06:00
parent ad6b216265
commit 7f92085c70
15 changed files with 2148 additions and 25 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
{
"interactions": [
{
"request": {
"content": {
"input": [
{
"content": [
{
"text": "What is 2 + 2?",
"type": "input_text"
}
],
"role": "user"
}
],
"model": "o3-pro-2025-06-10",
"reasoning": {
"effort": "medium"
},
"store": true
},
"method": "POST",
"path": "/v1/responses",
"url": "https://api.openai.com/v1/responses"
},
"response": {
"content": {
"created_at": 0,
"id": "resp_SANITIZED",
"model": "o3-pro-2025-06-10",
"object": "response",
"output": [
{
"text": "The answer to 2 + 2 is 4. This is a basic arithmetic operation where we add two whole numbers together.",
"type": "output_text"
}
],
"system_fingerprint": "fp_SANITIZED",
"usage": {
"input_tokens": 50,
"output_tokens": 20,
"total_tokens": 70
}
},
"headers": {
"content-type": "application/json"
},
"status_code": 200
}
}
]
}