Prompt stack
PromptStack
Source code in griptape/griptape/utils/prompt_stack.py
ASSISTANT_ROLE = 'assistant'
class-attribute
instance-attribute
GENERIC_ROLE = 'generic'
class-attribute
instance-attribute
SYSTEM_ROLE = 'system'
class-attribute
instance-attribute
USER_ROLE = 'user'
class-attribute
instance-attribute
inputs: list[Input] = field(factory=list, kw_only=True)
class-attribute
instance-attribute
Input
dataclass
Source code in griptape/griptape/utils/prompt_stack.py
content: str | list[dict]
instance-attribute
role: str
instance-attribute
is_assistant()
is_generic()
is_system()
add_assistant_input(content)
add_conversation_memory(memory, index=None)
Add the Conversation Memory runs to the Prompt Stack.
If autoprune is enabled, this will fit as many Conversation Memory runs into the Prompt Stack as possible without exceeding the token limit.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
memory |
ConversationMemory
|
The Conversation Memory to add the Prompt Stack to. |
required |
index |
Optional[int]
|
Optional index to insert the Conversation Memory runs at. Defaults to appending to the end of the Prompt Stack. |
None
|