Created
November 15, 2025 22:23
-
-
Save jsbeaudry/8e7a44493c3b10133284ab9f40cae660 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from dotenv import load_dotenv | |
| from livekit import agents | |
| from livekit.agents import AgentSession, Agent, RoomInputOptions | |
| from livekit.plugins import noise_cancellation, silero, openai | |
| from livekit.plugins.turn_detector.multilingual import MultilingualModel | |
| load_dotenv(".env.local") | |
| class Assistant(Agent): | |
| def __init__(self) -> None: | |
| super().__init__( | |
| instructions = """ | |
| Ou se yon asistan vwa medikal entelijan Ayiti. | |
| """ | |
| ) | |
| async def entrypoint(ctx: agents.JobContext): | |
| session = AgentSession( | |
| stt=openai.STT( | |
| model="gpt-4o-transcribe", | |
| ), | |
| llm=openai.LLM( | |
| model="gpt-4.1-nano-2025-04-14" | |
| ), | |
| tts = openai.TTS( | |
| model="gpt-4o-mini-tts", | |
| voice="shimmer", | |
| response_format="pcm", | |
| speed= 1.0 | |
| ), | |
| vad=silero.VAD.load(), | |
| turn_detection=MultilingualModel(), | |
| ) | |
| await session.start( | |
| room=ctx.room, | |
| agent=Assistant(), | |
| room_input_options=RoomInputOptions( | |
| # For telephony applications, use `BVCTelephony` instead for best results | |
| noise_cancellation=noise_cancellation.BVC(), | |
| ), | |
| ) | |
| await session.generate_reply( | |
| instructions = """ | |
| Ou se asistan vwa medikal Ayiti.""" | |
| ) | |
| if __name__ == "__main__": | |
| agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment