Repository navigation
test: expect flattened metadata keys for v5 #2001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -999,17 +999,13 @@ def test_structured_output_response_format_kwarg(openai): | |
|
|
||
| langfuse.flush() | ||
|
|
||
| generation = wait_for_observations( | ||
| name=generation_name, type="GENERATION", expand_metadata="response_format" | ||
| ) | ||
| generation = wait_for_observations(name=generation_name, type="GENERATION") | ||
|
|
||
| assert len(generation) != 0 | ||
| assert generation[0].name == generation_name | ||
| assert generation[0].metadata["someKey"] == "someResponse" | ||
| assert generation[0].metadata["response_format"] == { | ||
| "type": "json_schema", | ||
| "json_schema": json_schema, | ||
| } | ||
| assert generation[0].metadata["response_format.type"] == "json_schema" | ||
| assert generation[0].metadata["response_format.json_schema.name"] == "math_response" | ||
|
Comment on lines
+1007
to
+1008
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 nit (optional): Maintainers lose coverage of the recorded json_schema body. The new assertions would still pass if the SDK dropped or mangled Why this was flaggedOn the base branch, tests/live_provider/test_openai.py compared Verification: The base test asserted
Comment on lines
+1007
to
+1008
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replacing the full Prompt To Fix With AIThis is a comment left during a code review.
Path: tests/live_provider/test_openai.py
Line: 1007-1008
Comment:
**Actual schema goes unchecked**
Replacing the full `response_format` comparison with only `type` and `name` lets this test pass if the captured metadata drops `json_schema.schema` entirely. Keep assertions for short string-valued leaves such as `response_format.json_schema.schema.type` and `response_format.json_schema.schema.properties.final_answer.type`. These do not need array or boolean decoding.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||
|
|
||
| assert generation[0].input == [ | ||
| {"role": "system", "content": "You are a helpful math tutor."}, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assert the flattened equivalent of the complete
response_format, not only its type and name. If the OpenAI instrumentation drops or corruptsstrict, the schema properties, required fields, oradditionalProperties, this test now passes despite previously verifying the entire object; checking all expected flattened leaf paths and serialized values would retain that regression coverage.AGENTS.md reference: AGENTS.md:L32-L34
Useful? React with 👍 / 👎.