AsyncChatFlowStep
This file contains the AsyncChatFlowStep class, which represents a step in an AsyncFlow that is using a chat LLM. The async implementation allows async flowsteps to be run in parallel if multiple flowsteps have all the required inputs available.
AsyncChatFlowStep
Bases: AsyncBaseFlowStep
Represents an async step in a Flow that is utilizing a chat LLM.
An AsyncChatFlowStep calls a language model using two prompt templates, namely a system prompt and a message prompt, records the run time, and optionally invokes callback functions on the results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the flow step. |
required |
llm |
OpenAIChat
|
The language model to be used in the flow step. |
required |
output_key |
str
|
The key for the output of the flow step. |
required |
message_history |
Union[MessageHistory, None]
|
predefined conversation history |
None
|
message_key |
str
|
Key used to extract message from inputs. |
required |
message_prompt_template |
PromptTemplate
|
Prompt template for the message used with the language model. |
None
|
callbacks |
Union[list[AsyncBaseCallback], None]
|
Callbacks to be invoked within the flowstep |
None
|
Attributes:
Name | Type | Description |
---|---|---|
llm |
BaseLLM
|
The language model to be used in the flow step. |
message_key |
str
|
Key used to extract message from inputs. |
system_prompt_template |
PromptTemplate
|
Prompt tempalte for the system prompt to be used with the language model. |
message_prompt_template |
PromptTemplate
|
Prompt template for the message used with the language model. |
required_keys |
set[str]
|
The keys required for the flow step to run. |