Guava.Testing.Session (Guava v0.34.0)

Copy Markdown View Source

Drives an agent under test against Guava's v1/test-agent endpoint.

Inject caller utterances with say/2, wait for the agent's turn with wait_for_turn/1, read the running get_transcript/1, and assert outcomes with evaluate/2. Created for you by Guava.Testing.session/3 and Guava.Testing.roleplay/3.

Summary

Functions

Returns a specification to start this module under a supervisor.

Evaluate the transcript against pass/fail criteria using the LLM endpoint. Raises if any pass criterion is unmet or any fail criterion is triggered.

The conversation transcript so far.

Receive the next server event (a BotTTS or TurnStarted), or :closed.

Inject a caller utterance.

The session id assigned by the server.

Stop the session.

Block until the agent yields the turn back to the caller.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

evaluate(pid, pass_criteria \\ [], fail_criteria \\ [])

@spec evaluate(pid(), [String.t()], [String.t()]) :: :ok

Evaluate the transcript against pass/fail criteria using the LLM endpoint. Raises if any pass criterion is unmet or any fail criterion is triggered.

get_transcript(pid)

@spec get_transcript(pid()) :: String.t()

The conversation transcript so far.

recv(pid, timeout \\ 30000)

@spec recv(pid(), timeout()) :: struct() | :closed

Receive the next server event (a BotTTS or TurnStarted), or :closed.

say(pid, utterance)

@spec say(pid(), String.t()) :: :ok

Inject a caller utterance.

session_id(pid)

@spec session_id(pid()) :: String.t()

The session id assigned by the server.

stop(pid)

@spec stop(pid()) :: :ok

Stop the session.

wait_for_turn(pid)

@spec wait_for_turn(pid()) :: :ok

Block until the agent yields the turn back to the caller.