gen_ai_hub.orchestration.models.template
index
/home/jenkins/agent/workspace/ation_generative-ai-hub-sdk_main/gen_ai_hub/orchestration/models/template.py

 
Classes
       
builtins.tuple(builtins.object)
TemplateValue
gen_ai_hub.orchestration.models.base.JSONSerializable(abc.ABC)
Template

 
class Template(gen_ai_hub.orchestration.models.base.JSONSerializable)
    Template(messages: List[gen_ai_hub.orchestration.models.message.Message], defaults: Optional[List[gen_ai_hub.orchestration.models.template.TemplateValue]] = None, tools: Optional[List[Union[dict, gen_ai_hub.orchestration.models.tools.ChatCompletionTool]]] = None, response_format: Union[ForwardRef(<ResponseFormatType.TEXT: 'text'>), ForwardRef(<ResponseFormatType.JSON_OBJECT: 'json_object'>), gen_ai_hub.orchestration.models.response_format.ResponseFormatJsonSchema, NoneType] = None)
 
Represents a configurable template for generating prompts or conversations.
 
Args:
    messages: A list of prompt messages that form the template.
    defaults: A list of default values for template variables.
    tools: A list of tool definitions.
    response_format: A response format that the model output should adhere to.
 
 
Method resolution order:
Template
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, messages: List[gen_ai_hub.orchestration.models.message.Message], defaults: Optional[List[gen_ai_hub.orchestration.models.template.TemplateValue]] = None, tools: Optional[List[Union[dict, gen_ai_hub.orchestration.models.tools.ChatCompletionTool]]] = None, response_format: Union[ForwardRef(<ResponseFormatType.TEXT: 'text'>), ForwardRef(<ResponseFormatType.JSON_OBJECT: 'json_object'>), gen_ai_hub.orchestration.models.response_format.ResponseFormatJsonSchema, NoneType] = None)
Initialize self.  See help(type(self)) for accurate signature.
to_dict(self) -> Dict[str, Any]
Serializes the template to a dictionary, converting tools as needed.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {}

Data descriptors inherited from gen_ai_hub.orchestration.models.base.JSONSerializable:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class TemplateValue(builtins.tuple)
    TemplateValue(name: str, value: Union[str, int, float])
 
Represents a named value for use in template substitution.
 
This class pairs a name with a corresponding value, which can be a string,
integer, or float. It's designed to be used in template rendering processes
where named placeholders are replaced with specific values.
 
Args:
    name: The identifier for this template value.
    value: The actual value to be used in substitution.
 
 
Method resolution order:
TemplateValue
builtins.tuple
builtins.object

Methods defined here:
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__repr__(self)
Return a nicely formatted representation string
_asdict(self)
Return a new dict which maps field names to their values.
_replace(self, /, **kwds)
Return a new TemplateValue object replacing specified fields with new values

Class methods defined here:
_make(iterable) from builtins.type
Make a new TemplateValue object from a sequence or iterable

Static methods defined here:
__new__(_cls, name: str, value: Union[str, int, float])
Create new instance of TemplateValue(name, value)

Data descriptors defined here:
name
Alias for field number 0
value
Alias for field number 1

Data and other attributes defined here:
__annotations__ = {'name': <class 'str'>, 'value': typing.Union[str, int, float]}
__match_args__ = ('name', 'value')
__orig_bases__ = (<function NamedTuple>,)
_field_defaults = {}
_fields = ('name', 'value')

Methods inherited from builtins.tuple:
__add__(self, value, /)
Return self+value.
__contains__(self, key, /)
Return key in self.
__eq__(self, value, /)
Return self==value.
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__getitem__(self, key, /)
Return self[key].
__gt__(self, value, /)
Return self>value.
__hash__(self, /)
Return hash(self).
__iter__(self, /)
Implement iter(self).
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__mul__(self, value, /)
Return self*value.
__ne__(self, value, /)
Return self!=value.
__rmul__(self, value, /)
Return value*self.
count(self, value, /)
Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
 
Raises ValueError if the value is not present.

Class methods inherited from builtins.tuple:
__class_getitem__(...) from builtins.type
See PEP 585

 
Data
        Any = typing.Any
Dict = typing.Dict
List = typing.List
Optional = typing.Optional
Union = typing.Union