Skip to content

fix: move reasoning wrapper types to llama-stack-api and fix mypy errors - #5407

Merged
cdoern merged 3 commits into
ogx-ai:mainfrom
cdoern:fix-reasoning
Apr 1, 2026
Merged

fix: move reasoning wrapper types to llama-stack-api and fix mypy errors#5407
cdoern merged 3 commits into
ogx-ai:mainfrom
cdoern:fix-reasoning

Conversation

@cdoern

@cdoern cdoern commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

PR #5206 merged with openai_chat_completions_with_reasoning returning -> object which hid type errors. The wrapper types OpenAIChatCompletionWithReasoning and OpenAIChatCompletionChunkWithReasoning were incorrectly placed in providers/inline/responses/builtin/responses/types.py instead of being in llama-stack-api where API types belong.

This change:

  • Moves the wrapper types to src/llama_stack_api/inference/models.py
  • Converts them from @DataClass to BaseModel with Field() descriptors to match the rest of the API model definitions
  • Updates all imports across providers (bedrock, ollama, vllm) and routers
  • Adds explicit type annotation for completion_result variable that can hold either regular or reasoning-aware completion types
  • Fixes mypy errors that were previously hidden by the -> object return type

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 1, 2026
@github-actions

github-actions Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

✱ Stainless preview builds

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

fix: move reasoning wrapper types to llama-stack-api and fix mypy errors

Edit this comment to update it. It will appear in the SDK's changelogs.

llama-stack-client-openapi studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️

llama-stack-client-go studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.

llama-stack-client-python studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.

llama-stack-client-node studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.


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-01 18:22:30 UTC

@cdoern
cdoern force-pushed the fix-reasoning branch 2 times, most recently from 5564754 to b429f65 Compare April 1, 2026 18:04

@skamenan7 skamenan7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, apart couple of comments.

Comment thread src/llama_stack_api/inference/models.py Outdated
Comment thread src/llama_stack_api/inference/api.py
cdoern added 2 commits April 1, 2026 15:13
PR ogx-ai#5206 merged with `openai_chat_completions_with_reasoning` returning
`-> object` which hid type errors. The wrapper types
OpenAIChatCompletionWithReasoning and OpenAIChatCompletionChunkWithReasoning
were incorrectly placed in providers/inline/responses/builtin/responses/types.py
instead of being in llama-stack-api where API types belong.

This change:
- Moves the wrapper types to src/llama_stack_api/inference/models.py
- Converts them from @DataClass to BaseModel with Field() descriptors to
  match the rest of the API model definitions
- Updates all imports across providers (bedrock, ollama, vllm) and routers
- Adds explicit type annotation for completion_result variable that can
  hold either regular or reasoning-aware completion types
- Fixes mypy errors that were previously hidden by the `-> object` return type

Signed-off-by: Charlie Doern <cdoern@redhat.com>
remove json_schema_type to remove this from the spec

Signed-off-by: Charlie Doern <cdoern@redhat.com>
Signed-off-by: Charlie Doern <cdoern@redhat.com>
@cdoern
cdoern enabled auto-merge April 1, 2026 19:17
@cdoern
cdoern added this pull request to the merge queue Apr 1, 2026
Merged via the queue into ogx-ai:main with commit 3b46581 Apr 1, 2026
63 checks passed
@cdoern
cdoern deleted the fix-reasoning branch April 1, 2026 19:29
@robinnarsinghranabhat

Copy link
Copy Markdown
Contributor

Just reassuring to know that BFCL eval results remain consistent with #5206

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.

6 participants