melodic-arm-17634
09/04/2025, 3:44 PMmelodic-arm-17634
09/04/2025, 3:45 PMasync def entrypoint(ctx: JobContext):
await ctx.connect(auto_subscribe=AutoSubscribe.SUBSCRIBE_ALL)
############## Room Metadata ##############
if not ctx.job.room.metadata and os.getenv("REPLAY_BASE_URL") == "http://localhost:3000":
# Default metadata for local development
metadata = RoomMetadata.get_default().to_dict()
else:
metadata = json.loads(ctx.job.room.metadata)
room_metadata = RoomMetadata.from_dict(metadata) # Extract room metadata
usage_collector = metrics.UsageCollector() # Begin collecting usage metrics
state.initialize(room_metadata=room_metadata, room=ctx.room) # Core state
############## Agent Session ##############
session: AgentSession = None
if room_metadata.realtime_provider:
# Realtime Voice Pipeline (OpenAI)
if room_metadata.realtime_provider == RealtimeProvider.OPENAI:
session = AgentSession(
llm=openai.realtime.RealtimeModel(
voice=room_metadata.voice.id,
),
)
# Realtime Voice Pipeline (Gemini)
elif room_metadata.realtime_provider == RealtimeProvider.GEMINI:
session = AgentSession(
llm=google.beta.realtime.RealtimeModel(
voice=room_metadata.voice.id,
vertexai=True,
location="us-central1",
project="xxxxxx",
),
)melodic-arm-17634
09/04/2025, 3:45 PMglamorous-architect-23034
09/04/2025, 7:27 PMfast-dentist-39499
09/13/2025, 12:51 PMglamorous-architect-23034
09/15/2025, 7:04 PMmelodic-arm-17634
09/15/2025, 7:14 PM