API Reference - Pipecat#
src
#
intentional_pipecat
#
Intentional plugin for Pipecat
__about__
#
Package descriptors for intentional-pipecat.
bot_structure
#
Pipecat bot structure implementation.
PipecatBotStructure
#
Bases: BotStructure
Bot structure that uses Pipecat to make text-only models able to handle spoken input.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
__init__(config, intent_router)
#
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
Dict[str, Any]
|
The configuration dictionary for the bot structure.
It includes only the LLM definition under the |
required |
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
connect()
async
#
Initializes the model and connects to it as/if necessary.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
disconnect()
async
#
Disconnects from the LLM and unloads/closes it as/if necessary.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
165 166 167 168 169 |
|
handle_interruption(lenght_to_interruption)
async
#
Handle an interruption in the streaming.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lenght_to_interruption
|
int
|
The length of the data that was produced to the user before the interruption. This value could be number of characters, number of words, milliseconds, number of audio frames, etc. depending on the bot structure that implements it. |
required |
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
189 190 191 192 193 194 195 196 197 198 |
|
handle_llm_starts_generating_response(_)
async
#
Warns the Pipecat pipeline of the start of a response from the LLM by sending an LLMFullResponseStartFrame()
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
150 151 152 153 154 |
|
handle_llm_stops_generating_response(_)
async
#
Warns the Pipecat pipeline of the end of a response from the LLM by sending an LLMFullResponseEndFrame()
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
156 157 158 159 160 161 162 163 |
|
handle_llm_text_messages(event)
async
#
Sends the text message to the Pipecat pipeline to be converted into audio.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
142 143 144 145 146 147 148 |
|
run()
async
#
Main loop for the bot.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
171 172 173 174 175 |
|
send(data)
async
#
Sends a message to the LLM and forward the response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Dict[str, Any]
|
The message to send to the model in OpenAI format, like {"role": "user", "content": "Hello!"} |
required |
Source code in plugins/intentional-pipecat/src/intentional_pipecat/bot_structure.py
177 178 179 180 181 182 183 184 185 186 187 |
|
frame_processor
#
Pipecat frame processor implementation
LLMToUserFrameProcessor
#
Bases: FrameProcessor
FrameProcessor that takes the LLM output and sends it to the user.
Note: this processor itself is doing nothing else than changing the default behavior of process_frame()
to not
swallow frames when they reach it. The processor is actually used by PipecatBotStructure
to generate frames when
a reply from the LLM is received.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/frame_processor.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
process_frame(frame, direction)
async
#
Simply forwards all framews ahead. The default behavior of FrameProcessor is to block them instead.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/frame_processor.py
63 64 65 66 67 68 |
|
UserToLLMFrameProcessor
#
Bases: FrameProcessor
FrameProcessor that takes the user input and sends it to the LLM.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/frame_processor.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
process_frame(frame, direction)
async
#
Processes the incoming frames if relevant.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/frame_processor.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
transport
#
Pipecat transport class implementation that is compatible with Intentional.
AudioInputTransport
#
Bases: BaseInputTransport
Pipecat input transport class implementation that is compatible with Intentional (supports audio only).
This class' task is to take the user's input and convert it into frames that Pipecat can process.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
cleanup()
async
#
Cleans up the transport's resources.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
54 55 56 57 58 |
|
send_audio_frame(audio)
async
#
Public method used by the Intentional bot structure to publish audio of user's speech to the Pipecat pipeline.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
start(frame)
async
#
Starts the transport's resources.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
46 47 48 49 50 51 52 |
|
AudioOutputTransport
#
Bases: BaseOutputTransport
Pipecat output transport class implementation that is compatible with Intentional (supports audio only).
This class' task is to take the audio frames generated by the TTS and publish them through events that Intentional can understand.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
cleanup()
async
#
Cleans up the transport's resources.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
79 80 81 82 83 |
|
process_frame(frame, direction)
async
#
When it receives a TTSAudioRawFrame, makes the llm emit a on_audio_message_from_llm
event with the content
of the frame.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
85 86 87 88 89 90 91 |
|
start(frame)
async
#
Starts the transport's resources.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
73 74 75 76 77 |
|
AudioTransport
#
Bases: BaseTransport
Pipecat transport class implementation that is compatible with Intentional (supports audio only).
This class is a simple wrapper around AudioInputTransport and AudioOutputTransport, that makes sure both classes receive the same parameters at initialization.
Source code in plugins/intentional-pipecat/src/intentional_pipecat/transport.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|