common
__all__ = ['BaseMessage', 'BaseDeltaMessageContent', 'BaseMessageContent', 'DeltaMessage', 'Message', 'TextDeltaMessageContent', 'TextMessageContent', 'ImageMessageContent', 'GenericMessageContent', 'ActionCallDeltaMessageContent', 'ActionCallMessageContent', 'ActionResultMessageContent', 'PromptStack', 'Reference', 'BaseAction', 'ToolAction', 'observable', 'Observable']
module-attribute
ActionCallDeltaMessageContent
Bases: BaseDeltaMessageContent
Source code in griptape/common/prompt_stack/contents/action_call_delta_message_content.py
name: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
partial_input: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
path: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
tag: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
__str__()
Source code in griptape/common/prompt_stack/contents/action_call_delta_message_content.py
ActionCallMessageContent
Bases: BaseMessageContent
Source code in griptape/common/prompt_stack/contents/action_call_message_content.py
artifact: ActionArtifact = field(metadata={'serializable': True})
class-attribute
instance-attribute
from_deltas(deltas)
classmethod
Source code in griptape/common/prompt_stack/contents/action_call_message_content.py
ActionResultMessageContent
Bases: BaseMessageContent
Source code in griptape/common/prompt_stack/contents/action_result_message_content.py
action: ToolAction = field(metadata={'serializable': True})
class-attribute
instance-attribute
artifact: BaseArtifact = field(metadata={'serializable': True})
class-attribute
instance-attribute
BaseAction
BaseDeltaMessageContent
Bases: ABC
, SerializableMixin
Source code in griptape/common/prompt_stack/contents/base_delta_message_content.py
index: int = field(kw_only=True, default=0, metadata={'serializable': True})
class-attribute
instance-attribute
BaseMessage
Bases: ABC
, SerializableMixin
Source code in griptape/common/prompt_stack/messages/base_message.py
ASSISTANT_ROLE = 'assistant'
class-attribute
instance-attribute
SYSTEM_ROLE = 'system'
class-attribute
instance-attribute
USER_ROLE = 'user'
class-attribute
instance-attribute
content: list[Union[BaseMessageContent, BaseDeltaMessageContent]] = field(metadata={'serializable': True})
class-attribute
instance-attribute
role: str = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
usage: Usage = field(kw_only=True, default=Factory(lambda: BaseMessage.Usage()), metadata={'serializable': True})
class-attribute
instance-attribute
Usage
Bases: SerializableMixin
Source code in griptape/common/prompt_stack/messages/base_message.py
input_tokens: Optional[float] = field(kw_only=True, default=None, metadata={'serializable': True})
class-attribute
instance-attribute
output_tokens: Optional[float] = field(kw_only=True, default=None, metadata={'serializable': True})
class-attribute
instance-attribute
total_tokens: float
property
__add__(other)
Source code in griptape/common/prompt_stack/messages/base_message.py
is_assistant()
is_system()
BaseMessageContent
Bases: ABC
, SerializableMixin
Source code in griptape/common/prompt_stack/contents/base_message_content.py
artifact: BaseArtifact = field(metadata={'serializable': True})
class-attribute
instance-attribute
__bool__()
__len__()
__str__()
from_deltas(deltas)
abstractmethod
classmethod
DeltaMessage
Bases: BaseMessage
Source code in griptape/common/prompt_stack/messages/delta_message.py
content: Optional[BaseDeltaMessageContent] = field(kw_only=True, default=None, metadata={'serializable': True})
class-attribute
instance-attribute
role: Optional[str] = field(kw_only=True, default=None, metadata={'serializable': True})
class-attribute
instance-attribute
GenericMessageContent
Bases: BaseMessageContent
Source code in griptape/common/prompt_stack/contents/generic_message_content.py
artifact: GenericArtifact = field(metadata={'serializable': True})
class-attribute
instance-attribute
ImageMessageContent
Bases: BaseMessageContent
Source code in griptape/common/prompt_stack/contents/image_message_content.py
artifact: ImageArtifact = field(metadata={'serializable': True})
class-attribute
instance-attribute
Message
Bases: BaseMessage
Source code in griptape/common/prompt_stack/messages/message.py
content: list[BaseMessageContent] = field(metadata={'serializable': True})
class-attribute
instance-attribute
value: Any
property
__init__(content, **kwargs)
Source code in griptape/common/prompt_stack/messages/message.py
__str__()
get_content_type(content_type)
has_all_content_type(content_type)
has_any_content_type(content_type)
is_text()
to_artifact()
Observable
Source code in griptape/common/observable.py
decorator_args = ()
instance-attribute
decorator_kwargs = {}
instance-attribute
Call
Source code in griptape/common/observable.py
args: tuple[Any, ...] = field(default=Factory(tuple), kw_only=True)
class-attribute
instance-attribute
decorator_args: tuple[Any, ...] = field(default=Factory(tuple), kw_only=True)
class-attribute
instance-attribute
decorator_kwargs: dict[str, Any] = field(default=Factory(dict), kw_only=True)
class-attribute
instance-attribute
func: Callable = field(kw_only=True)
class-attribute
instance-attribute
instance: Optional[Any] = field(default=None, kw_only=True)
class-attribute
instance-attribute
kwargs: dict[str, Any] = field(default=Factory(dict), kw_only=True)
class-attribute
instance-attribute
tags: Optional[list[str]]
property
__call__()
Source code in griptape/common/observable.py
__call__(*args, **kwargs)
Source code in griptape/common/observable.py
__get__(obj, objtype=None)
__init__(*args, **kwargs)
Source code in griptape/common/observable.py
PromptStack
Bases: SerializableMixin
Source code in griptape/common/prompt_stack/prompt_stack.py
assistant_messages: list[Message]
property
messages: list[Message] = field(factory=list, kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
system_messages: list[Message]
property
tools: list[BaseTool] = field(factory=list, kw_only=True)
class-attribute
instance-attribute
user_messages: list[Message]
property
__to_message_content(artifact)
Source code in griptape/common/prompt_stack/prompt_stack.py
add_assistant_message(artifact)
add_message(artifact, role)
add_system_message(artifact)
Reference
Bases: SerializableMixin
Source code in griptape/common/reference.py
authors: list[str] = field(factory=list, metadata={'serializable': True})
class-attribute
instance-attribute
id: str = field(default=Factory(lambda: uuid.uuid4().hex), metadata={'serializable': True})
class-attribute
instance-attribute
source: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
title: str = field(metadata={'serializable': True})
class-attribute
instance-attribute
url: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
year: Optional[str] = field(default=None, metadata={'serializable': True})
class-attribute
instance-attribute
TextDeltaMessageContent
Bases: BaseDeltaMessageContent
Source code in griptape/common/prompt_stack/contents/text_delta_message_content.py
text: str = field(metadata={'serializable': True})
class-attribute
instance-attribute
TextMessageContent
Bases: BaseMessageContent
Source code in griptape/common/prompt_stack/contents/text_message_content.py
artifact: TextArtifact = field(metadata={'serializable': True})
class-attribute
instance-attribute
from_deltas(deltas)
classmethod
Source code in griptape/common/prompt_stack/contents/text_message_content.py
ToolAction
Bases: BaseAction
Represents an instance of an LLM using a Tool.
Attributes:
Name | Type | Description |
---|---|---|
tag |
str
|
The tag (unique identifier) of the action. |
name |
str
|
The name (Tool name) of the action. |
path |
Optional[str]
|
The path (Tool activity name) of the action. |
input |
dict
|
The input (Tool params) of the action. |
tool |
Optional[BaseTool]
|
The matched Tool of the action. |
output |
Optional[BaseArtifact]
|
The output (Tool result) of the action. |