Skip to content

Commit

Permalink
Add events for final transcript
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-purplefish committed Dec 26, 2024
1 parent f1acafd commit 34c1aad
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions livekit-agents/livekit/agents/pipeline/pipeline_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
EventTypes = Literal[
"user_started_speaking",
"user_interim_transcript",
"user_final_transcript",
"user_stopped_speaking",
"agent_started_speaking",
"agent_stopped_speaking",
Expand Down Expand Up @@ -417,6 +418,7 @@ def on(self, event: EventTypes, callback: Callable[[Any], None] | None = None):
event: the event to listen to (see EventTypes)
- user_started_speaking: the user started speaking
- user_interim_transcript: the user transcript was updated
- user_final_transcript: the user transcript was committed
- user_stopped_speaking: the user stopped speaking
- agent_started_speaking: the agent started speaking
- agent_stopped_speaking: the agent stopped speaking
Expand Down Expand Up @@ -592,6 +594,7 @@ def _on_final_transcript(ev: stt.SpeechEvent) -> None:
"received user transcript",
extra={"user_transcript": new_transcript},
)
self.emit("user_final_transcript", new_transcript)

self._last_final_transcript_time = time.perf_counter()

Expand Down

0 comments on commit 34c1aad

Please sign in to comment.