chilly-soccer-432
05/12/2025, 5:02 PMtall-airline-16756
05/12/2025, 5:03 PMtall-airline-16756
05/12/2025, 5:03 PMModelSettings
from the livekit.agents.voice
module. The import statement would look like this:
from livekit.agents.voice import ModelSettings
If you have any further questions, feel free to ask!
Sources: Tree View: | dse-workbenchchilly-soccer-432
05/12/2025, 5:04 PMtall-airline-16756
05/12/2025, 5:04 PMWorkerType
from the livekit.agents
module. The import statement would look like this:
from livekit.agents import WorkerType
If you have any further questions, feel free to ask!
Sources: Tree View: | dse-workbenchchilly-soccer-432
05/12/2025, 5:09 PMtall-airline-16756
05/12/2025, 5:09 PMWorkerPermissions
class is part of the agents module. However, the exact import statement is not explicitly mentioned in the available documentation. It is likely to be:
from livekit.agents import WorkerPermissions
If this does not work or you need further assistance, please let me know!
Sources: WorkerPermissions | LiveKit Agentschilly-soccer-432
05/12/2025, 6:31 PMtall-airline-16756
05/12/2025, 6:31 PMRemoteParticipant
object in LiveKit does not have an attribute or function named published_tracks
. This might be causing the error you are encountering. You may want to check the LiveKit documentation or the implementation of RemoteParticipant
to confirm the available attributes and methods.
If you need further assistance, feel free to ask!chilly-soccer-432
05/12/2025, 7:48 PMawait session.agent.send_initial_greeting(session)
What is the correct way?tall-airline-16756
05/12/2025, 7:48 PMAgentSession
object does not have an agent
attribute, which is why you are encountering this error. Instead, the agent is passed as a parameter to the start()
method of the AgentSession
object. Here's an example of the correct usage:
session = AgentSession(
stt=deepgram.STT(),
llm=openai.LLM(),
tts=cartesia.TTS(),
vad=silero.VAD.load(),
turn_detection=turn_detector.MultilingualModel(),
)
await session.start(
room=ctx.room,
agent=Agent(instructions="You are a helpful voice AI assistant."),
room_input_options=RoomInputOptions(
noise_cancellation=noise_cancellation.BVC(),
),
)
In this example, the agent is passed to the start()
method rather than being accessed as an attribute of the session. Let me know if you need further clarification!
Sources: Building voice agents | LiveKit Docschilly-soccer-432
05/14/2025, 3:24 PMtall-airline-16756
05/14/2025, 3:25 PMRemoteParticipant
object does not have an attribute named published_tracks
. Instead, you should use the track_publications
attribute to access a remote participant's tracks. Here's an example:
tracks = [t for t in p.track_publications.values() if t.kind == "audio"]
The track_publications
attribute is a dictionary mapping track SIDs to track publications. Let me know if you need further assistance!
Sources: livekit.rtc API documentation | RemoteParticipant | LiveKit JS Client SDK - v2.8.1 | RemoteParticipant class - livekit_client library - Dart APIchilly-soccer-432
05/15/2025, 2:22 AMtall-airline-16756
05/15/2025, 2:22 AMchilly-soccer-432
05/15/2025, 2:22 AMtall-airline-16756
05/15/2025, 2:23 AMasync def _forward_transcription(stt_stream: stt.SpeechStream, stt_forwarder: transcription.STTSegmentsForwarder):
"""Forward the transcription to the client and log the transcript in the console"""
async for ev in stt_stream:
if ev.type == stt.SpeechEventType.FINAL_TRANSCRIPT:
print(" -> ", ev.alternatives[0].text)
# ...
stt_forwarder.update(ev)
1. Saving conversation history to a JSON file:
async def write_transcript():
current_date = datetime.now().strftime("%Y%m%d_%H%M%S")
filename = f"/tmp/transcript_{ctx.room.name}_{current_date}.json"
with open(filename, 'w') as f:
json.dump(session.history.to_dict(), f, indent=2)
print(f"Transcript for {ctx.room.name} saved to {filename}")
ctx.add_shutdown_callback(write_transcript)
1. Using the transcription protocol with TTSSegmentsForwarder:
tts_forwarder = transcription.TTSSegmentsForwarder(
room=ctx.room, participant=ctx.room.local_participant
)
# For single segment
text = "Hello world, this is a single segment"
tts_forwarder.push_text(text)
tts_forwarder.mark_text_segment_end()
# For streamed text
for chunk in _text_to_chunks(streamed_text):
tts_forwarder.push_text(chunk)
tts_forwarder.mark_text_segment_end()
Let me know if you need further clarification or assistance!
Sources: Tree View: | dse-workbench | Session recording and transcripts | LiveKit Docs | Tree View: | dse-workbenchchilly-soccer-432
05/17/2025, 3:12 PMtall-airline-16756
05/17/2025, 3:13 PM