gen_ai_hub.prompt_registry.models.prompt_template module

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplate(*, role: str, content: str | List[str | TextPart | ImagePart | ImageItem])

Bases: BaseModel

Represents a prompt template.

Parameters:
  • role – The role of the prompt template.

  • content – The content of the prompt template.

role: str

The role of the prompt template.

content: str | List[str | TextPart | ImagePart | ImageItem]

The content of the prompt template.

classmethod content_validation(content)

Validates and maps the content field to the appropriate types.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateSpec(*, template: ~typing.List[~gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplate], defaults: dict | None = None, response_format: ~gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatText | ~gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatJsonObject | ~gen_ai_hub.orchestration_v2.models.response_format.ResponseFormatJsonSchema | None = None, tools: ~typing.List[dict | ~gen_ai_hub.orchestration_v2.models.tools.FunctionTool] | None = None, additional_fields: ~typing.Dict[~typing.Any, ~typing.Any] | None = <factory>)

Bases: BaseModel

Represents a prompt template specification.

Parameters:
  • Args

  • template – A list of prompt messages that form the template.

  • defaults – A dict of default values for template variables.

  • tools – A list of tool definitions.

  • response_format – A response format that the model output should adhere to.

  • additional_fields – Additional fields for the prompt template.

template: List[PromptTemplate]
defaults: dict | None
response_format: ResponseFormatText | ResponseFormatJsonObject | ResponseFormatJsonSchema | None
tools: List[dict | FunctionTool] | None
additional_fields: Dict[Any, Any] | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplatePostRequest(*, name: str, version: str, scenario: str, spec: PromptTemplateSpec)

Bases: BaseModel

Represents a request to create a prompt template.

Parameters:
  • name – The name of the prompt template.

  • version – The version of the prompt template.

  • scenario – The scenario of the prompt template.

  • spec – The specification of the prompt template.

name: str

The name of the prompt template.

version: str

The version of the prompt template.

scenario: str

The scenario of the prompt template.

spec: PromptTemplateSpec

The specification of the prompt template.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplatePostResponse(*, message: str, id: str, scenario: str, name: str, version: str)

Bases: BaseModel

Represents a response to a request to create a prompt template.

Parameters:
  • message – The message of the response.

  • id – The ID of the prompt template.

  • scenario – The scenario of the prompt template.

  • name – The name of the prompt template.

  • version – The version of the prompt template.

message: str

The message of the response.

id: str

The ID of the prompt template.

scenario: str

The scenario of the prompt template.

name: str

The name of the prompt template.

version: str

The version of the prompt template.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateGetResponse(*, id: str, name: str, version: str, scenario: str, creation_timestamp: str | None = None, managed_by: str | None = None, is_version_head: bool | None = None, spec: PromptTemplateSpec | None = None)

Bases: BaseModel

Represents a response to a request to get a prompt template.

Parameters:
  • id – The ID of the prompt template.

  • name – The name of the prompt template.

  • version – The version of the prompt template.

  • scenario – The scenario of the prompt template.

  • creation_timestamp – The creation timestamp of the prompt template.

  • managed_by – The manager of the prompt template.

  • is_version_head – Whether the version is the head version.

  • spec – The specification of the prompt template.

id: str

The ID of the prompt template.

name: str

The name of the prompt template.

version: str

The version of the prompt template.

scenario: str

The scenario of the prompt template.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

creation_timestamp: str | None

The creation timestamp of the prompt template.

managed_by: str | None

The manager of the prompt template.

is_version_head: bool | None

Whether the version is the head version.

spec: PromptTemplateSpec | None

The specification of the prompt template.

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateListResponse(*, count: int, resources: List[PromptTemplateGetResponse])

Bases: BaseModel

Represents a response to a request to list prompt templates.

Parameters:
  • count – The number of prompt templates.

  • resources – The list of PromptGetResponse objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

count: int

The number of prompt templates.

resources: List[PromptTemplateGetResponse]

The list of PromptGetResponse objects.

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateDeleteResponse(*, message: str)

Bases: BaseModel

Represents a response to a request to delete a prompt template.

Parameters:

message – The message of the response.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

message: str

The message of the response.

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateSubstitutionRequest(*, inputParams: ~typing.Dict[~typing.Any, ~typing.Any] | None = <factory>)

Bases: BaseModel

Represents a request to substitute a prompt template.

Parameters:

input_params – User provided values to replace the placeholders of the prompt template.

model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}

Pydantic configuration to allow population by field name.

input_params: Dict[Any, Any] | None

User provided values to replace the placeholders of the prompt template.

class gen_ai_hub.prompt_registry.models.prompt_template.PromptTemplateSubstitutionResponse(*, parsed_prompt: List[PromptTemplate], resource: PromptTemplateGetResponse | None = None)

Bases: BaseModel

Represents a response to a request to substitute a prompt template.

Parameters:
  • parsed_prompt – The parsed prompt.

  • resource – List of TemplateGetResponse objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

parsed_prompt: List[PromptTemplate]

The parsed prompt.

resource: PromptTemplateGetResponse | None

List of TemplateGetResponse objects.