{"id":20645965,"url":"https://github.com/jakecyr/llm-voice","last_synced_at":"2026-04-21T02:05:12.405Z","repository":{"id":243394031,"uuid":"812135279","full_name":"jakecyr/llm-voice","owner":"jakecyr","description":"Library to reduce latency in voice generations from LLM chat completion streams.","archived":false,"fork":false,"pushed_at":"2024-06-08T18:07:28.000Z","size":66,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T09:35:41.744Z","etag":null,"topics":["assistant","chatbot","llm","openai","tts"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakecyr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-08T03:54:42.000Z","updated_at":"2024-11-18T07:30:38.000Z","dependencies_parsed_at":"2024-06-08T15:42:46.705Z","dependency_job_id":"dafe2627-fcfc-4aeb-a72d-a31b0ec2ca8d","html_url":"https://github.com/jakecyr/llm-voice","commit_stats":null,"previous_names":["jakecyr/llm-voice"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecyr%2Fllm-voice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecyr%2Fllm-voice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecyr%2Fllm-voice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakecyr%2Fllm-voice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakecyr","download_url":"https://codeload.github.com/jakecyr/llm-voice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242714050,"owners_count":20173581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assistant","chatbot","llm","openai","tts"],"created_at":"2024-11-16T16:22:49.737Z","updated_at":"2026-04-21T02:05:12.349Z","avatar_url":"https://github.com/jakecyr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM Voice\n\nLibrary to reduce latency in voice generations from LLM chat completion streams.\n\nThis lets you generate voices from streams of text from local LLMs, such as Ollama and local TTS clients, such as Apple Say along with external clients such as Google Text-to-Speech with the same speed as privately created assistants such as OpenAI.\n\nAs each sentence end is detected, it will run TTS on it and play it out loud while the rest of the completion is being generated in the background.\n\n## Installation and Setup\n\n1. Install the package from PyPI with:\n\n   ```bash\n   pip install llm-voice\n   ```\n\n2. Copy the .env.example file to .env and fill in your OpenAI API key if you want to use OpenAI along with the model name for the Ollama/OpenAI model you want to use.\n3. Take a look at one of the examples to start generating voice responses in realtime.\n\n## Example Usage\n\nThe example below can be found in the [examples](./examples/README.md) directory.\n\n```python\n# Setup output device, TTS client and LLM client.\ndevices: list[AudioDevice] = AudioDevices.get_list_of_devices(\n   device_type=AudioDeviceType.OUTPUT\n)\n\n# Pick the first output device (usually computer builtin speakers if nothing else if connected).\noutput_device: AudioDevice = devices[0]\n\n# Change to another TTS client depending on your needs and desires.\ntts_client: TextToSpeechClient = OpenAITextToSpeechClient()\n\n# Change to another LLM client depending on your needs and desires.\nllm_client: LLMClient = OllamaClient(\n   model_name=MODEL_NAME,\n)\n\n# Define messages to send to the LLM.\nmessages: list[ChatMessage] = [\n   ChatMessage(\n      role=MessageRole.SYSTEM,\n      content=\"You are a helpful assistant named Alfred.\",\n   ),\n   ChatMessage(role=MessageRole.USER, content=\"Hey there what is your name?\"),\n]\n\n# Use the LLM to generate a response.\nchat_stream: Iterator[str] = llm_client.generate_chat_completion_stream(\n   messages=messages,\n)\n\n# Create the voice responder and speak the response.\nvoice_responder_fast = VoiceResponderFast(\n   text_to_speech_client=tts_client,\n   output_device=output_device,\n)\n\n# Will speak each sentence back to back as it is available.\nvoice_responder_fast.respond(chat_stream)\n```\n\n## Install From Source\n\n```bash\npip install poetry\npoetry install\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakecyr%2Fllm-voice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakecyr%2Fllm-voice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakecyr%2Fllm-voice/lists"}