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

 
Modules
       
json
typing

 
Classes
       
builtins.object
FunctionCall
MessageToolCall
builtins.str(builtins.object)
Role(builtins.str, enum.Enum)
enum.Enum(builtins.object)
Role(builtins.str, enum.Enum)
gen_ai_hub.orchestration.models.base.JSONSerializable(abc.ABC)
Message
AssistantMessage
SystemMessage
ToolMessage
UserMessage

 
class AssistantMessage(Message)
    AssistantMessage(content: str, refusal: Optional[str] = None, tool_calls: Optional[List[gen_ai_hub.orchestration.models.message.MessageToolCall]] = None)
 
Represents an assistant message in a prompt or conversation template.
 
Assistant messages typically contain responses or outputs from the AI model.
 
Args:
    content: The text content of the assistant message.
    refusal: A string indicating refusal reason.
    tool_calls: A list of tool call objects.
 
 
Method resolution order:
AssistantMessage
Message
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, content: str, refusal: Optional[str] = None, tool_calls: Optional[List[gen_ai_hub.orchestration.models.message.MessageToolCall]] = None)
Initialize self.  See help(type(self)) for accurate signature.

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

Methods inherited from Message:
__eq__(self, other)
Return self==value.
__repr__(self)
Return repr(self).
to_dict(self)
Convert the object to a JSON-serializable dictionary.

Data and other attributes inherited from Message:
__dataclass_fields__ = {'content': Field(name='content',type=typing.Union[str, typi...appingproxy({}),kw_only=False,_field_type=_FIELD), 'refusal': Field(name='refusal',type=typing.Optional[str],d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'role': Field(name='role',type=typing.Union[gen_ai_hub.o...appingproxy({}),kw_only=False,_field_type=_FIELD), 'tool_calls': Field(name='tool_calls',type=typing.Optional[typ...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('role', 'content', 'refusal', 'tool_calls')
refusal = None
tool_calls = None

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 FunctionCall(builtins.object)
    FunctionCall(name: Optional[str] = None, arguments: Optional[str] = None) -> None
 
The function that the model called.
 
  Methods defined here:
__eq__(self, other)
Return self==value.
__init__(self, name: Optional[str] = None, arguments: Optional[str] = None) -> None
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
parse_arguments(self) -> dict
Attempts to parse the arguments string as JSON.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__annotations__ = {'arguments': typing.Optional[str], 'name': typing.Optional[str]}
__dataclass_fields__ = {'arguments': Field(name='arguments',type=typing.Optional[str]...ur function.'}),kw_only=False,_field_type=_FIELD), 'name': Field(name='name',type=typing.Optional[str],defa...ion to call.'}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('name', 'arguments')
arguments = None
name = None

 
class Message(gen_ai_hub.orchestration.models.base.JSONSerializable)
    Message(role: Union[gen_ai_hub.orchestration.models.message.Rolestr], content: Union[str, List[Union[gen_ai_hub.orchestration.models.multimodal_items.TextPart, gen_ai_hub.orchestration.models.multimodal_items.ImagePart]]], refusal: Optional[str] = None, tool_calls: Optional[List[gen_ai_hub.orchestration.models.message.MessageToolCall]] = None) -> None
 
Represents a single message in a prompt or conversation template.
 
This base class defines the structure for all types of messages in a prompt,
including content and role.
 
Args:
    role: The role of the entity sending the message.
    content: The message content, which may be plain text or a sequence of text and images.
 
 
Method resolution order:
Message
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__eq__(self, other)
Return self==value.
__init__(self, role: Union[gen_ai_hub.orchestration.models.message.Role, str], content: Union[str, List[Union[gen_ai_hub.orchestration.models.multimodal_items.TextPart, gen_ai_hub.orchestration.models.multimodal_items.ImagePart]]], refusal: Optional[str] = None, tool_calls: Optional[List[gen_ai_hub.orchestration.models.message.MessageToolCall]] = None) -> None
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
to_dict(self)
Convert the object to a JSON-serializable dictionary.

Data and other attributes defined here:
__abstractmethods__ = frozenset()
__annotations__ = {'content': typing.Union[str, typing.List[typing.Union[gen_a...rchestration.models.multimodal_items.ImagePart]]], 'refusal': typing.Optional[str], 'role': typing.Union[gen_ai_hub.orchestration.models.message.Role, str], 'tool_calls': typing.Optional[typing.List[gen_ai_hub.orchestration.models.message.MessageToolCall]]}
__dataclass_fields__ = {'content': Field(name='content',type=typing.Union[str, typi...appingproxy({}),kw_only=False,_field_type=_FIELD), 'refusal': Field(name='refusal',type=typing.Optional[str],d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'role': Field(name='role',type=typing.Union[gen_ai_hub.o...appingproxy({}),kw_only=False,_field_type=_FIELD), 'tool_calls': Field(name='tool_calls',type=typing.Optional[typ...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('role', 'content', 'refusal', 'tool_calls')
refusal = None
tool_calls = None

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 MessageToolCall(builtins.object)
    MessageToolCall(id: str, type: Literal['function'], function: gen_ai_hub.orchestration.models.message.FunctionCall) -> None
 
Represents a tool call within a message, specifically a function call.
 
  Methods defined here:
__eq__(self, other)
Return self==value.
__init__(self, id: str, type: Literal['function'], function: gen_ai_hub.orchestration.models.message.FunctionCall) -> None
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self)
Return repr(self).
to_dict(self)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__annotations__ = {'function': <class 'gen_ai_hub.orchestration.models.message.FunctionCall'>, 'id': <class 'str'>, 'type': typing.Literal['function']}
__dataclass_fields__ = {'function': Field(name='function',type=<class 'gen_ai_hub.or...odel called.'}),kw_only=False,_field_type=_FIELD), 'id': Field(name='id',type=<class 'str'>,default=<data...e tool call.'}),kw_only=False,_field_type=_FIELD), 'type': Field(name='type',type=typing.Literal['function'...s supported.'}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('id', 'type', 'function')

 
class Role(builtins.str, enum.Enum)
    Role(value, names=None, *, module=None, qualname=None, type=None, start=1)
 
Enumerates supported roles in LLM-based conversations.
 
This enum defines the standard roles used in interactions with Large Language Models (LLMs).
These roles are generally used to structure the input and distinguish between different parts of the conversation.
 
Values:
    USER: Represents the human user's input in the conversation.
    SYSTEM: Represents system-level instructions or context setting for the LLM.
    ASSISTANT: Represents the LLM's responses in the conversation.
    TOOL: Represents a tool or function that the LLM can call.
    DEVELOPER: Represents the developer's input or instructions in the conversation.
 
 
Method resolution order:
Role
builtins.str
enum.Enum
builtins.object

Data and other attributes defined here:
ASSISTANT = <Role.ASSISTANT: 'assistant'>
DEVELOPER = <Role.DEVELOPER: 'developer'>
SYSTEM = <Role.SYSTEM: 'system'>
TOOL = <Role.TOOL: 'tool'>
USER = <Role.USER: 'user'>

Data descriptors inherited from enum.Enum:
name
The name of the Enum member.
value
The value of the Enum member.

Readonly properties inherited from enum.EnumMeta:
__members__
Returns a mapping of member name->value.
 
This mapping lists all enum members, including aliases. Note that this
is a read-only view of the internal mapping.

 
class SystemMessage(Message)
    SystemMessage(content: str)
 
Represents a system message in a prompt or conversation template.
 
System messages typically provide context or instructions to the AI model.
 
Args:
    content: The text content of the system message.
 
 
Method resolution order:
SystemMessage
Message
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, content: str)
Initialize self.  See help(type(self)) for accurate signature.

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

Methods inherited from Message:
__eq__(self, other)
Return self==value.
__repr__(self)
Return repr(self).
to_dict(self)
Convert the object to a JSON-serializable dictionary.

Data and other attributes inherited from Message:
__dataclass_fields__ = {'content': Field(name='content',type=typing.Union[str, typi...appingproxy({}),kw_only=False,_field_type=_FIELD), 'refusal': Field(name='refusal',type=typing.Optional[str],d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'role': Field(name='role',type=typing.Union[gen_ai_hub.o...appingproxy({}),kw_only=False,_field_type=_FIELD), 'tool_calls': Field(name='tool_calls',type=typing.Optional[typ...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('role', 'content', 'refusal', 'tool_calls')
refusal = None
tool_calls = None

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 ToolMessage(Message)
    ToolMessage(content: str, tool_call_id: str)
 

 
 
Method resolution order:
ToolMessage
Message
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, content: str, tool_call_id: str)
Initialize self.  See help(type(self)) for accurate signature.
to_dict(self)
Convert the object to a JSON-serializable dictionary.

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

Methods inherited from Message:
__eq__(self, other)
Return self==value.
__repr__(self)
Return repr(self).

Data and other attributes inherited from Message:
__dataclass_fields__ = {'content': Field(name='content',type=typing.Union[str, typi...appingproxy({}),kw_only=False,_field_type=_FIELD), 'refusal': Field(name='refusal',type=typing.Optional[str],d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'role': Field(name='role',type=typing.Union[gen_ai_hub.o...appingproxy({}),kw_only=False,_field_type=_FIELD), 'tool_calls': Field(name='tool_calls',type=typing.Optional[typ...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('role', 'content', 'refusal', 'tool_calls')
refusal = None
tool_calls = None

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 UserMessage(Message)
    UserMessage(content: Union[str, List[Union[str, gen_ai_hub.orchestration.models.multimodal_items.ImageItem]]])
 
Represents a user message in a prompt or conversation template.
 
User messages typically contain queries or inputs from the user.
 
Args:
    content: The message content, which may be plain text or a sequence of text and images.
 
 
Method resolution order:
UserMessage
Message
gen_ai_hub.orchestration.models.base.JSONSerializable
abc.ABC
builtins.object

Methods defined here:
__init__(self, content: Union[str, List[Union[str, gen_ai_hub.orchestration.models.multimodal_items.ImageItem]]])
Initialize self.  See help(type(self)) for accurate signature.

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

Methods inherited from Message:
__eq__(self, other)
Return self==value.
__repr__(self)
Return repr(self).
to_dict(self)
Convert the object to a JSON-serializable dictionary.

Data and other attributes inherited from Message:
__dataclass_fields__ = {'content': Field(name='content',type=typing.Union[str, typi...appingproxy({}),kw_only=False,_field_type=_FIELD), 'refusal': Field(name='refusal',type=typing.Optional[str],d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'role': Field(name='role',type=typing.Union[gen_ai_hub.o...appingproxy({}),kw_only=False,_field_type=_FIELD), 'tool_calls': Field(name='tool_calls',type=typing.Optional[typ...appingproxy({}),kw_only=False,_field_type=_FIELD)}
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
__hash__ = None
__match_args__ = ('role', 'content', 'refusal', 'tool_calls')
refusal = None
tool_calls = None

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)

 
Data
        ContentPart = typing.Union[gen_ai_hub.orchestration.models.mul....orchestration.models.multimodal_items.ImagePart]
List = typing.List
Optional = typing.Optional
Union = typing.Union