mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-11 13:44:38 +00:00
fix(responses): type aliasing not supported for pydantic code generation and discrimintated unions
This commit is contained in:
parent
8fb17ba18e
commit
80b82c070c
5 changed files with 287 additions and 73 deletions
139
docs/_static/llama-stack-spec.yaml
vendored
139
docs/_static/llama-stack-spec.yaml
vendored
|
@ -6589,39 +6589,118 @@ components:
|
|||
additionalProperties: false
|
||||
title: OpenAIResponsesTool
|
||||
OpenAIResponsesToolChoice:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ToolChoiceOptions'
|
||||
- $ref: '#/components/schemas/ToolChoiceTypes'
|
||||
- oneOf:
|
||||
- $ref: '#/components/schemas/ToolChoiceAllowed'
|
||||
- $ref: '#/components/schemas/ToolChoiceFunction'
|
||||
- $ref: '#/components/schemas/ToolChoiceMcp'
|
||||
- $ref: '#/components/schemas/ToolChoiceCustom'
|
||||
discriminator:
|
||||
propertyName: type
|
||||
mapping:
|
||||
allowed_tools: '#/components/schemas/ToolChoiceAllowed'
|
||||
function: '#/components/schemas/ToolChoiceFunction'
|
||||
mcp: '#/components/schemas/ToolChoiceMcp'
|
||||
custom: '#/components/schemas/ToolChoiceCustom'
|
||||
ToolChoiceAllowed:
|
||||
type: object
|
||||
title: OpenAIResponsesToolChoice
|
||||
description: >-
|
||||
Type alias.
|
||||
properties:
|
||||
mode:
|
||||
type: string
|
||||
enum:
|
||||
- auto
|
||||
- required
|
||||
tools:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: object
|
||||
title: object
|
||||
description: >-
|
||||
The base class of the class hierarchy.
|
||||
|
||||
Type aliases are created through the type statement::
|
||||
When called, it accepts no arguments and returns a new featureless
|
||||
|
||||
type Alias = int
|
||||
|
||||
In this example, Alias and int will be treated equivalently by static
|
||||
|
||||
type checkers.
|
||||
|
||||
|
||||
At runtime, Alias is an instance of TypeAliasType. The __name__
|
||||
|
||||
attribute holds the name of the type alias. The value of the type alias
|
||||
|
||||
is stored in the __value__ attribute. It is evaluated lazily, so the
|
||||
|
||||
value is computed only if the attribute is accessed.
|
||||
|
||||
|
||||
Type aliases can also be generic::
|
||||
|
||||
type ListOrSet[T] = list[T] | set[T]
|
||||
|
||||
In this case, the type parameters of the alias are stored in the
|
||||
|
||||
__type_params__ attribute.
|
||||
|
||||
|
||||
See PEP 695 for more information.
|
||||
instance that has no instance attributes and cannot be given any.
|
||||
type:
|
||||
type: string
|
||||
const: allowed_tools
|
||||
default: allowed_tools
|
||||
additionalProperties: false
|
||||
required:
|
||||
- mode
|
||||
- tools
|
||||
- type
|
||||
title: ToolChoiceAllowed
|
||||
ToolChoiceCustom:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
const: custom
|
||||
default: custom
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
- type
|
||||
title: ToolChoiceCustom
|
||||
ToolChoiceFunction:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
const: function
|
||||
default: function
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
- type
|
||||
title: ToolChoiceFunction
|
||||
ToolChoiceMcp:
|
||||
type: object
|
||||
properties:
|
||||
server_label:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
const: mcp
|
||||
default: mcp
|
||||
name:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
required:
|
||||
- server_label
|
||||
- type
|
||||
title: ToolChoiceMcp
|
||||
ToolChoiceOptions:
|
||||
type: string
|
||||
enum:
|
||||
- none
|
||||
- auto
|
||||
- required
|
||||
ToolChoiceTypes:
|
||||
type: object
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- file_search
|
||||
- web_search_preview
|
||||
- computer_use_preview
|
||||
- web_search_preview_2025_03_11
|
||||
- image_generation
|
||||
- code_interpreter
|
||||
additionalProperties: false
|
||||
required:
|
||||
- type
|
||||
title: ToolChoiceTypes
|
||||
OpenAIResponseContentPart:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/OpenAIResponseContentPartOutputText'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue