gen_ai_hub.orchestration.models.template_ref module

class gen_ai_hub.orchestration.models.template_ref.TemplateRef(**kwargs)

Bases: JSONSerializable

Represents a prompt template reference for generating prompts or conversations.

This is a factory class for creating a reference to a prompt template. It is used to reference a template by id, or the tuple: scenario, name, version

__init__(**kwargs)

Initializes a TemplateRef instance with dynamic attributes.

classmethod from_id(prompt_template_id: str)

Creates a TemplateRef instance from a prompt template ID.

Parameters:

prompt_template_id (str) – The ID of the prompt template.

Returns:

A TemplateRef instance with the specified ID.

Return type:

TemplateRef

classmethod from_tuple(scenario: str, name: str, version: str)

Creates a TemplateRef instance from a scenario, name, and version.

Parameters:
  • scenario (str) – The scenario of the prompt template.

  • name (str) – The name of the prompt template.

  • version (str) – The version of the prompt template.

Returns:

A TemplateRef instance with the specified scenario, name, and version.

Return type:

TemplateRef

to_dict()

Converts the TemplateRef instance to a dictionary representation.

Returns:

A dictionary representation of the TemplateRef instance.

Return type:

dict