diff --git a/api-reference/pipecat-flows/types.mdx b/api-reference/pipecat-flows/types.mdx index 045ad3d3..f93b12f6 100644 --- a/api-reference/pipecat-flows/types.mdx +++ b/api-reference/pipecat-flows/types.mdx @@ -186,8 +186,13 @@ TypedDict for configuring actions that execute during node transitions. - Text content used by `tts_say` and optionally by `end_conversation` (as a - goodbye message). + Text to speak for the `tts_say` action, or the optional goodbye message for + the `end_conversation` action. + + + + For the built-in TTS actions (`tts_say` and `end_conversation`), whether the + spoken text is appended to the LLM context. Defaults to `True`. @@ -199,8 +204,8 @@ TypedDict for configuring actions that execute during node transitions. | Type | Description | Required Fields | | ------------------ | ----------------------------------------------------------- | ----------------- | -| `tts_say` | Speak text using the pipeline's TTS service | `text` | -| `end_conversation` | End the conversation, optionally speaking a goodbye message | `text` (optional) | +| `tts_say` | Speak text using the pipeline's TTS service. The spoken text is appended to the LLM context by default; set `append_text_to_context=False` to opt out. | `text` | +| `end_conversation` | End the conversation, optionally speaking a goodbye message. If `text` is provided, it is appended to the LLM context by default; set `append_text_to_context=False` to opt out. | `text` (optional) | | `function` | Execute a function inline in the pipeline | `handler` | ### Example diff --git a/pipecat-flows/guides/actions.mdx b/pipecat-flows/guides/actions.mdx index 789d5a60..cf7dd3ed 100644 --- a/pipecat-flows/guides/actions.mdx +++ b/pipecat-flows/guides/actions.mdx @@ -27,6 +27,18 @@ Speak a phrase immediately (useful for "please wait" messages): ] ``` +The spoken text is appended to the LLM context by default. To prevent the text from being added to the context, set `append_text_to_context=False`: + +```python +"pre_actions": [ + { + "type": "tts_say", + "text": "Processing...", + "append_text_to_context": False + } +] +``` + ### end_conversation Gracefully terminate the conversation: @@ -40,6 +52,18 @@ Gracefully terminate the conversation: ] ``` +The goodbye text is appended to the LLM context by default. To prevent the text from being added to the context, set `append_text_to_context=False`: + +```python +"post_actions": [ + { + "type": "end_conversation", + "text": "Goodbye!", + "append_text_to_context": False + } +] +``` + ### function Execute a custom function at the specified timing: diff --git a/pipecat-flows/guides/context-strategies.mdx b/pipecat-flows/guides/context-strategies.mdx index 9eb3bbda..71f70a2a 100644 --- a/pipecat-flows/guides/context-strategies.mdx +++ b/pipecat-flows/guides/context-strategies.mdx @@ -20,6 +20,13 @@ Flows provides three built-in ways to manage conversation context as you move be pre-action. + + **Initial node behavior:** The initial flow node follows its context strategy (default `APPEND`) + instead of always replacing the context. With the default strategy, context written before the + node's first inference — for example by a `tts_say` pre-action — is now preserved rather than + discarded. Set `context_strategy=RESET` on the initial node for the previous clean-slate behavior. + + ## When to Use Each Strategy - Use **APPEND** when full conversation history is important for context