persona

The simulated caller: who they are, what they want, and how they end the call.

An EvalPersona is the instruction the persona LLM runs under, the LLM service itself, which rides in the eval pipeline, and the context it runs on, where the bot’s turns are the user messages and its own the assistant ones. The context offers one tool, end_call, which the persona calls once its goal is achieved or clearly out of reach; its success claim is its own view, and the judge decides the outcome.

class pipecat.evals.persona.EvalPersona(description: str, goal: str, llm: LLMService)[source]

Bases: object

The simulated caller: its instruction, its LLM, and the context it runs on.

__init__(description: str, goal: str, llm: LLMService)[source]

Initialize the persona.

Parameters:
  • description – Who the caller is, as free text.

  • goal – What the caller wants from the call.

  • llm – The LLM service that plays the caller, run inside the eval pipeline.

property instruction: str

The system instruction the persona LLM runs under.

property llm: LLMService

The LLM service that plays the caller, a processor in the eval pipeline.

property context: LLMContext

The context the persona runs on, with the end_call tool; empty until the call starts.

property hung_up: bool

Whether the persona has ended its part of the call.

hang_up() → None[source]

End the persona’s part of the call: it answers nothing more.

hear(event: dict) → LLMContextFrame | None[source]

Take in one of the bot’s events; the frame that has the persona answer, once the bot’s turn is done.

A response the bot gives while one of its function calls is still running is held and joined with the response after the call, so the persona answers the bot’s whole turn rather than its “let me check”. In audio mode the aggregator does this instead.

Parameters:

event – An event from the stream.

Returns:

The context frame to push to the persona LLM, or None.

on_end_call(handler: Callable[[FunctionCallParams], Awaitable[None]]) → None[source]

Register what happens when the persona calls end_call.

Parameters:

handler – Awaited with the call’s params; its success and reason arguments are the persona’s own claim.