gen_ai_hub.orchestration_v2.models.response_format module¶
Response format models for model output specification.
- class gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatType(*values)¶
Bases:
str,EnumEnumerates the supported response format.
Response format that the model output should adhere to. This is the same as the OpenAI definition.
- Values:
TEXT: Response format as text
JSON_OBJECT: Response format as json object
JSON_SCHEMA: Response format as defined json schema
- TEXT = 'text'¶
- JSON_OBJECT = 'json_object'¶
- JSON_SCHEMA = 'json_schema'¶
- class gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatText(*, type: ResponseFormatType = ResponseFormatType.TEXT)¶
Bases:
ABCBaseModelResponse format that the model output should adhere to.
- type_: ResponseFormatType¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatJsonObject(*, type: ResponseFormatType = ResponseFormatType.JSON_OBJECT)¶
Bases:
ABCBaseModelResponse format JSON Object that the model output should adhere to.
- type_: ResponseFormatType¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatJsonSchema(*, type: ResponseFormatType = ResponseFormatType.JSON_SCHEMA, json_schema: JSONResponseSchema)¶
Bases:
ABCBaseModel- type_: ResponseFormatType¶
- json_schema: JSONResponseSchema¶
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gen_ai_hub.orchestration_v2.models.response_format.JSONResponseSchema(*, name: str, description: str | None = None, schema: dict = <factory>, strict: bool = False)¶
Bases:
ABCBaseModelResponse format JSON Schema that the model output should adhere to.
- Parameters:
name – The name of the response format.
description – A description of what the response format is for.
schema – A schema for the response format described as a JSON Schema object.
strict – Whether to enable strict schema adherence when generating the output.
- name: str¶
- description: str | None¶
- schema_: dict¶
- strict: bool¶
- classmethod validate_name(name)¶
validates the name of the response format.
- Parameters:
name (str) – the name to validate
- Raises:
ValueError – if the name does not match the required pattern or exceeds the maximum length
- Returns:
the validated name
- Return type:
str
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': False}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].