Update discriminator to have the correct mapping (#881)

See
https://swagger.io/docs/specification/v3_0/data-models/inheritance-and-polymorphism/#discriminator

When specifying discriminators, mapping must be specified unless the
value of the discriminator is the subtype itself (which in our case is
not.)

The changes in the YAML are self-explanatory.
This commit is contained in:
Ashwin Bharambe 2025-01-27 09:18:13 -08:00 committed by GitHub
parent a6d20e0f53
commit e5936a8df8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 642 additions and 420 deletions

View file

@ -157,11 +157,13 @@ class ChatCompletionResponseEvent(BaseModel):
stop_reason: Optional[StopReason] = None
@json_schema_type
class ResponseFormatType(Enum):
json_schema = "json_schema"
grammar = "grammar"
@json_schema_type
class JsonSchemaResponseFormat(BaseModel):
type: Literal[ResponseFormatType.json_schema.value] = (
ResponseFormatType.json_schema.value
@ -169,6 +171,7 @@ class JsonSchemaResponseFormat(BaseModel):
json_schema: Dict[str, Any]
@json_schema_type
class GrammarResponseFormat(BaseModel):
type: Literal[ResponseFormatType.grammar.value] = ResponseFormatType.grammar.value
bnf: Dict[str, Any]