Skip to content

fix(conformance): improve OpenAI API conformance score from 89.1% to 91.2%#5490

Merged
leseb merged 2 commits intollamastack:mainfrom
franciscojavierarceo:fix/conformance-type-object
Apr 9, 2026
Merged

fix(conformance): improve OpenAI API conformance score from 89.1% to 91.2%#5490
leseb merged 2 commits intollamastack:mainfrom
franciscojavierarceo:fix/conformance-type-object

Conversation

@franciscojavierarceo
Copy link
Copy Markdown
Collaborator

@franciscojavierarceo franciscojavierarceo commented Apr 8, 2026

Summary

Two targeted fixes to the OpenAPI schema generation transforms that improve overall OpenAI API conformance from 89.1% to 91.2% (+2.1%) and reduce total issues from 374 to 303 (-71).

1. Keep type: object on schemas that include it in the OpenAI spec

Previously, _remove_type_object_from_openai_schemas stripped type: object from all schemas with properties. But 766 of 772 OpenAI schemas include type: object — only 6 omit it. Changed to a targeted exemption list so only those 6 schemas have type: object removed.

2. Restore default on single-value enum fields where OpenAI expects them

_convert_standalone_const_to_enum strips all defaults from single-value enums. A handful of OpenAI schemas (CompactResource, ConversationResource, Response, ChatCompletionList) include explicit defaults on their object fields. Added _restore_const_enum_defaults to selectively re-add them for the 5 affected schemas.

Conformance delta (main vs this PR)

Category main This PR Delta
Overall 89.1% 91.2% +2.1%
Moderations 15.1% 17.0% +1.9%
Batch 39.3% 39.9% +0.6%
Completions 56.5% 58.7% +2.2%
Embeddings 64.3% 78.6% +14.3%
Files 66.7% 66.7% --
Models 66.7% 66.7% --
Vector stores 77.7% 81.9% +4.2%
Responses 84.0% 85.8% +1.8%
Chat 87.1% 98.5% +11.4%
Conversations 98.8% 98.9% +0.1%
Metric main This PR Delta
Schema/Type Issues 246 193 -53
Missing Properties 128 110 -18
Total Issues 374 303 -71

Compact endpoint (/responses/compact)

Metric main This PR
Issues 7 3
object default missing restored
type: object on usage stripped kept

Test plan

  • uv run pre-commit run --all-files -- all hooks pass
  • ./scripts/unit-tests.sh -- all tests pass
  • No regressions in any conformance category
  • OpenAPI specs regenerated and validated

The OpenAI spec includes type: object on 766 of 772 schemas that have
properties defined. Previously we stripped it from all schemas, which
hurt conformance across Chat, Embeddings, Vector stores, and other
categories. This change narrows the strip to only the 6 schemas that
actually omit it in the OpenAI spec.

Overall conformance: 89.3% -> 91.0%

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

fix(conformance): keep type: object on schemas to match OpenAI spec
⚠️ llama-stack-client-go studio · conflict

Your SDK build had at least one warning diagnostic.

⚠️ llama-stack-client-node studio · conflict

Your SDK build had at least one warning diagnostic.

⚠️ llama-stack-client-openapi studio · code

Your SDK build had at least one "warning" diagnostic.
generate ⚠️

⚠️ llama-stack-client-python studio · conflict

Your SDK build had at least one warning diagnostic.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-04-09 11:24:28 UTC

…spec

The _convert_standalone_const_to_enum transform strips all defaults from
single-value enums, but a handful of OpenAI schemas (Conversations,
Responses, Compact, Chat list) include explicit defaults on their object
fields. Add _restore_const_enum_defaults to selectively re-add defaults
on the 5 schemas that need them, fixing 6 conformance issues across
Responses (+0.9%), Chat (+0.2%), Conversations (+0.1%), and Embeddings
categories. Overall conformance improves from 91.0% to 91.2%.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
@franciscojavierarceo franciscojavierarceo changed the title fix(conformance): keep type: object on schemas to match OpenAI spec fix(conformance): improve OpenAI API conformance score from 89.1% to 91.2% Apr 9, 2026
@franciscojavierarceo
Copy link
Copy Markdown
Collaborator Author

@cdoern the reason the conformance went down in the compaction PR is because it's a api under /responses so the errors only increased the amount of issues and one of the larger ones was this default value.

I have another PR incoming that will do a broader change to handle some of the other type issues observed by the entire /responses API.

@franciscojavierarceo
Copy link
Copy Markdown
Collaborator Author

@cdoern other PR is ready here: #5494

Includes the first two commits here as that one can be merged after.

@leseb leseb added this pull request to the merge queue Apr 9, 2026
Merged via the queue into llamastack:main with commit eb04239 Apr 9, 2026
25 checks passed
leseb added a commit to leseb/llama-stack that referenced this pull request Apr 9, 2026
Resolve conflicts in generated spec files by regenerating them with
our changes (type: object retention and files_batch enum fix) applied
on top of the merged conformance improvements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
github-merge-queue Bot pushed a commit that referenced this pull request Apr 9, 2026
…AI spec (#5494)

## Summary

- Remove `null` from `anyOf` JSON schemas for 8 response body fields
(`frequency_penalty`, `parallel_tool_calls`, `presence_penalty`,
`temperature`, `top_p`, `top_logprobs`, `tools`, `service_tier`) and 3
request body fields (`store`, `stream`, `include`) to match OpenAI's
non-nullable spec
- Python types remain `T | None` for runtime compatibility — only the
generated JSON schema output changes
- Responses conformance score improves from 85.8% → 88.9% (7 schema
issues resolved), overall 91.2% → 91.4%

Builds on #5490, which improved overall conformance from 89.1% to 91.2%.

## BREAKING CHANGE

Request properties `store`, `stream`, and `include` on `POST
/v1/responses` no longer accept explicit `null` in the JSON schema.
Clients should omit these fields instead of sending `null`. This aligns
with the OpenAI spec behavior.

## Test plan

- [x] `uv run pytest tests/unit/ -k "response"
--ignore=tests/unit/providers/vector_io/` — 360 passed
- [x] `uv run pytest tests/unit/ -k "openai or schema or spec"` — 431
passed
- [x] `uv run pre-commit run --all-files` — all hooks pass
- [x] `uv run python scripts/openai_coverage.py --update` — conformance
score verified

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

---------

Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants