instructions

The instruction that teaches an LLM to take part in expressive conversation.

Part of expressive conversation (alpha). The readings and tags it teaches are written in RCS, the Real-time Context Standard. The instruction has three parts: how to read what was perceived of how the user spoke, built from a perception producer’s PerceptionCapabilities; the tags the active TTS service can perform, by their universal names, built from its ExpressionCapabilities; and the developer’s guidance on how to answer, from an ExpressionPolicy.

Alpha. The tag syntax and these types are likely to change between releases.

pipecat.expressive.instructions.expression_instructions(capabilities: ExpressionCapabilities | None, policy: ExpressionPolicy | None = None, *, perception: PerceptionCapabilities | None = None) → str | None[source]

Build the instruction for an LLM in an expressive conversation.

Parameters:
  • capabilities – What the TTS service that speaks the LLM’s replies can perform, or None for nothing.

  • policy – Which tags to offer, and guidance on how to answer.

  • perception – The signals perceived of how the user spoke, or None when nothing is perceived.

Returns:

The instruction, or None when nothing is perceived and the TTS service can perform none of the tags offered.

pipecat.expressive.instructions.perception_turn_completion_instructions(complete: str, short: str, long: str) → str[source]

Tell an LLM that decides when the user’s turn is complete that a reading doesn’t decide it.

It goes after the turn completion instructions. Without it, a reading can change the marker: a hesitant user’s cut-off words get the long wait, and words that haven’t answered the LLM get an answer.

Parameters:
  • complete – The marker for a complete turn.

  • short – The marker for a turn cut off mid-sentence.

  • long – The marker for a user who needs time to think.

Returns:

The instruction.

pipecat.expressive.instructions.expression_policy_warning(capabilities: ExpressionCapabilities | None, policy: ExpressionPolicy | None) → str | None[source]

Tell what an expression policy asks for that a TTS service can’t perform.

Parameters:
  • capabilities – What the TTS service can perform, or None for nothing.

  • policy – Which tags to offer, and guidance on how to answer.

Returns:

The warning, or None when there’s no policy or the service can perform every tag it offers.