diff --git a/docs/ref/voice/events.md b/docs/ref/voice/events.md new file mode 100644 index 000000000..71e88e3ed --- /dev/null +++ b/docs/ref/voice/events.md @@ -0,0 +1,3 @@ +# `Events` + +::: agents.voice.events diff --git a/docs/ref/voice/exceptions.md b/docs/ref/voice/exceptions.md new file mode 100644 index 000000000..61f6ca891 --- /dev/null +++ b/docs/ref/voice/exceptions.md @@ -0,0 +1,3 @@ +# `Exceptions` + +::: agents.voice.exceptions diff --git a/docs/ref/voice/input.md b/docs/ref/voice/input.md new file mode 100644 index 000000000..b61d2f5bc --- /dev/null +++ b/docs/ref/voice/input.md @@ -0,0 +1,3 @@ +# `Input` + +::: agents.voice.input diff --git a/docs/ref/voice/model.md b/docs/ref/voice/model.md new file mode 100644 index 000000000..212d3ded9 --- /dev/null +++ b/docs/ref/voice/model.md @@ -0,0 +1,3 @@ +# `Model` + +::: agents.voice.model diff --git a/docs/ref/voice/models/openai_provider.md b/docs/ref/voice/models/openai_provider.md new file mode 100644 index 000000000..f8a40889e --- /dev/null +++ b/docs/ref/voice/models/openai_provider.md @@ -0,0 +1,3 @@ +# `OpenAIVoiceModelProvider` + +::: agents.voice.models.openai_model_provider diff --git a/docs/ref/voice/models/openai_stt.md b/docs/ref/voice/models/openai_stt.md new file mode 100644 index 000000000..eeeb64113 --- /dev/null +++ b/docs/ref/voice/models/openai_stt.md @@ -0,0 +1,3 @@ +# `OpenAI STT` + +::: agents.voice.models.openai_stt diff --git a/docs/ref/voice/models/openai_tts.md b/docs/ref/voice/models/openai_tts.md new file mode 100644 index 000000000..920c3242e --- /dev/null +++ b/docs/ref/voice/models/openai_tts.md @@ -0,0 +1,3 @@ +# `OpenAI TTS` + +::: agents.voice.models.openai_tts diff --git a/docs/ref/voice/pipeline.md b/docs/ref/voice/pipeline.md new file mode 100644 index 000000000..7a1ec69cb --- /dev/null +++ b/docs/ref/voice/pipeline.md @@ -0,0 +1,3 @@ +# `Pipeline` + +::: agents.voice.pipeline diff --git a/docs/ref/voice/pipeline_config.md b/docs/ref/voice/pipeline_config.md new file mode 100644 index 000000000..0bc0467cb --- /dev/null +++ b/docs/ref/voice/pipeline_config.md @@ -0,0 +1,3 @@ +# `Pipeline Config` + +::: agents.voice.pipeline_config diff --git a/docs/ref/voice/result.md b/docs/ref/voice/result.md new file mode 100644 index 000000000..60d985a19 --- /dev/null +++ b/docs/ref/voice/result.md @@ -0,0 +1,3 @@ +# `Result` + +::: agents.voice.result diff --git a/docs/ref/voice/utils.md b/docs/ref/voice/utils.md new file mode 100644 index 000000000..c13efc6a3 --- /dev/null +++ b/docs/ref/voice/utils.md @@ -0,0 +1,3 @@ +# `Utils` + +::: agents.voice.utils diff --git a/docs/ref/voice/workflow.md b/docs/ref/voice/workflow.md new file mode 100644 index 000000000..a5ae128e0 --- /dev/null +++ b/docs/ref/voice/workflow.md @@ -0,0 +1,3 @@ +# `Workflow` + +::: agents.voice.workflow diff --git a/docs/voice/pipeline.md b/docs/voice/pipeline.md new file mode 100644 index 000000000..8cf5dafeb --- /dev/null +++ b/docs/voice/pipeline.md @@ -0,0 +1,75 @@ +# Pipelines and workflows + +[`VoicePipeline`][agents.voice.pipeline.VoicePipeline] is a class that makes it easy to turn your agentic workflows into a voice app. You pass in a workflow to run, and the pipeline takes care of transcribing input audio, detecting when the audio ends, calling your workflow at the right time, and turning the workflow output back into audio. + +```mermaid +graph LR + %% Input + A["🎤 Audio Input"] + + %% Voice Pipeline + subgraph Voice_Pipeline [Voice Pipeline] + direction TB + B["Transcribe (speech-to-text)"] + C["Your Code"]:::highlight + D["Text-to-speech"] + B --> C --> D + end + + %% Output + E["🎧 Audio Output"] + + %% Flow + A --> Voice_Pipeline + Voice_Pipeline --> E + + %% Custom styling + classDef highlight fill:#ffcc66,stroke:#333,stroke-width:1px,font-weight:700; + +``` + +## Configuring a pipeline + +When you create a pipeline, you can set a few things: + +1. The [`workflow`][agents.voice.workflow.VoiceWorkflowBase], which is the code that runs each time new audio is transcribed. +2. The [`speech-to-text`][agents.voice.model.STTModel] and [`text-to-speech`][agents.voice.model.TTSModel] models used +3. The [`config`][agents.voice.pipeline_config.VoicePipelineConfig], which lets you configure things like: + - A model provider, which can map model names to models + - Tracing, including whether to disable tracing, whether audio files are uploaded, the workflow name, trace IDs etc. + - Settings on the TTS and STT models, like the prompt, language and data types used. + +## Running a pipeline + +You can run a pipeline via the [`run()`][agents.voice.pipeline.VoicePipeline.run] method, which lets you pass in audio input in two forms: + +1. [`AudioInput`][agents.voice.input.AudioInput] is used when you have a full audio transcript, and just want to produce a result for it. This is useful in cases where you don't need to detect when a speaker is done speaking; for example, when you have pre-recorded audio or in push-to-talk apps where it's clear when the user is done speaking. +2. [`StreamedAudioInput`][agents.voice.input.StreamedAudioInput] is used when you might need to detect when a user is done speaking. It allows you to push audio chunks as they are detected, and the voice pipeline will automatically run the agent workflow at the right time, via a process called "activity detection". + +## Results + +The result of a voice pipeline run is a [`StreamedAudioResult`][agents.voice.result.StreamedAudioResult]. This is an object that lets you stream events as they occur. There are a few kinds of [`VoiceStreamEvent`][agents.voice.events.VoiceStreamEvent], including: + +1. [`VoiceStreamEventAudio`][agents.voice.events.VoiceStreamEventAudio], which contains a chunk of audio. +2. [`VoiceStreamEventLifecycle`][agents.voice.events.VoiceStreamEventLifecycle], which informs you of lifecycle events like a turn starting or ending. +3. [`VoiceStreamEventError`][agents.voice.events.VoiceStreamEventError], is an error event. + +```python + +result = await pipeline.run(input) + +async for event in result.stream(): + if event.type == "voice_stream_event_audio": + # play audio + elif event.type == "voice_stream_event_lifecycle": + # lifecycle + elif event.type == "voice_stream_event_error" + # error + ... +``` + +## Best practices + +### Interruptions + +The Agents SDK currently does not support any built-in interruptions support for [`StreamedAudioInput`][agents.voice.input.StreamedAudioInput]. Instead for every detected turn it will trigger a separate run of your workflow. If you want to handle interruptions inside your application you can listen to the [`VoiceStreamEventLifecycle`][agents.voice.events.VoiceStreamEventLifecycle] events. `turn_started` will indicate that a new turn was transcribed and processing is beginning. `turn_ended` will trigger after all the audio was dispatched for a respective turn. You could use these events to mute the microphone of the speaker when the model starts a turn and unmute it after you flushed all the related audio for a turn. diff --git a/docs/voice/quickstart.md b/docs/voice/quickstart.md new file mode 100644 index 000000000..144b748ab --- /dev/null +++ b/docs/voice/quickstart.md @@ -0,0 +1,189 @@ +# Quickstart + +## Prerequisites + +Make sure you've followed the base [quickstart instructions](../quickstart.md) for the Agents SDK, and set up a virtual environment. Then, install the optional voice dependencies from the SDK: + +```bash +pip install openai-agents[voice] +``` + +## Concepts + +The main concept to know about is a [`VoicePipeline`][agents.voice.pipeline.VoicePipeline], which is a 3 step process: + +1. Run a speech-to-text model to turn audio into text. +2. Run your code, which is usually an agentic workflow, to produce a result. +3. Run a text-to-speech model to turn the result text back into audio. + +```mermaid +graph LR + %% Input + A["🎤 Audio Input"] + + %% Voice Pipeline + subgraph Voice_Pipeline [Voice Pipeline] + direction TB + B["Transcribe (speech-to-text)"] + C["Your Code"]:::highlight + D["Text-to-speech"] + B --> C --> D + end + + %% Output + E["🎧 Audio Output"] + + %% Flow + A --> Voice_Pipeline + Voice_Pipeline --> E + + %% Custom styling + classDef highlight fill:#ffcc66,stroke:#333,stroke-width:1px,font-weight:700; + +``` + +## Agents + +First, let's set up some Agents. This should feel familiar to you if you've built any agents with this SDK. We'll have a couple of Agents, a handoff, and a tool. + +```python +import asyncio +import random + +from agents import ( + Agent, + function_tool, +) +from agents.extensions.handoff_prompt import prompt_with_handoff_instructions + + + +@function_tool +def get_weather(city: str) -> str: + """Get the weather for a given city.""" + print(f"[debug] get_weather called with city: {city}") + choices = ["sunny", "cloudy", "rainy", "snowy"] + return f"The weather in {city} is {random.choice(choices)}." + + +spanish_agent = Agent( + name="Spanish", + handoff_description="A spanish speaking agent.", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. Speak in Spanish.", + ), + model="gpt-4o-mini", +) + +agent = Agent( + name="Assistant", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. If the user speaks in Spanish, handoff to the spanish agent.", + ), + model="gpt-4o-mini", + handoffs=[spanish_agent], + tools=[get_weather], +) +``` + +## Voice pipeline + +We'll set up a simple voice pipeline, using [`SingleAgentVoiceWorkflow`][agents.voice.workflow.SingleAgentVoiceWorkflow] as the workflow. + +```python +from agents import SingleAgentVoiceWorkflow, VoicePipeline, +pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent)) +``` + +## Run the pipeline + +```python +import numpy as np +import sounddevice as sd + +# For simplicity, we'll just create 3 seconds of silence +# In reality, you'd get microphone data +audio = np.zeros(24000 * 3, dtype=np.int16) +result = await pipeline.run(audio_input) + +# Create an audio player using `sounddevice` +player = sd.OutputStream(samplerate=24000, channels=1, dtype=np.int16) +player.start() + +# Play the audio stream as it comes in +async for event in result.stream(): + if event.type == "voice_stream_event_audio": + player.write(event.data) + +``` + +## Put it all together + +```python +import asyncio +import random + +import numpy as np +import sounddevice as sd + +from agents import ( + Agent, + AudioInput, + SingleAgentVoiceWorkflow, + VoicePipeline, + function_tool, + set_tracing_disabled, +) +from agents.extensions.handoff_prompt import prompt_with_handoff_instructions + + +@function_tool +def get_weather(city: str) -> str: + """Get the weather for a given city.""" + print(f"[debug] get_weather called with city: {city}") + choices = ["sunny", "cloudy", "rainy", "snowy"] + return f"The weather in {city} is {random.choice(choices)}." + + +spanish_agent = Agent( + name="Spanish", + handoff_description="A spanish speaking agent.", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. Speak in Spanish.", + ), + model="gpt-4o-mini", +) + +agent = Agent( + name="Assistant", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. If the user speaks in Spanish, handoff to the spanish agent.", + ), + model="gpt-4o-mini", + handoffs=[spanish_agent], + tools=[get_weather], +) + + +async def main(): + pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent)) + buffer = np.zeros(24000 * 3, dtype=np.int16) + audio_input = AudioInput(buffer=buffer) + + result = await pipeline.run(audio_input) + + # Create an audio player using `sounddevice` + player = sd.OutputStream(samplerate=24000, channels=1, dtype=np.int16) + player.start() + + # Play the audio stream as it comes in + async for event in result.stream(): + if event.type == "voice_stream_event_audio": + player.write(event.data) + + +if __name__ == "__main__": + asyncio.run(main()) +``` + +If you run this example, the agent will speak to you! Check out the example in [examples/voice/static](https://github.com/openai/openai-agents-python/tree/main/examples/voice/static) to see a demo where you can speak to the agent yourself. diff --git a/docs/voice/tracing.md b/docs/voice/tracing.md new file mode 100644 index 000000000..311a9ba80 --- /dev/null +++ b/docs/voice/tracing.md @@ -0,0 +1,14 @@ +# Tracing + +Just like the way [agents are traced](../tracing.md), voice pipelines are also automatically traced. + +You can read the tracing doc above for basic tracing information, but you can additionally configure tracing of a pipeline via [`VoicePipelineConfig`][agents.voice.pipeline_config.VoicePipelineConfig]. + +Key tracing related fields are: + +- [`tracing_disabled`][agents.voice.pipeline_config.VoicePipelineConfig.tracing_disabled]: controls whether tracing is disabled. By default, tracing is enabled. +- [`trace_include_sensitive_data`][agents.voice.pipeline_config.VoicePipelineConfig.trace_include_sensitive_data]: controls whether traces include potentially sensitive data, like audio transcripts. This is specifically for the voice pipeline, and not for anything that goes on inside your Workflow. +- [`trace_include_sensitive_audio_data`][agents.voice.pipeline_config.VoicePipelineConfig.trace_include_sensitive_audio_data]: controls whether traces include audio data. +- [`workflow_name`][agents.voice.pipeline_config.VoicePipelineConfig.workflow_name]: The name of the trace workflow. +- [`group_id`][agents.voice.pipeline_config.VoicePipelineConfig.group_id]: The `group_id` of the trace, which lets you link multiple traces. +- [`trace_metadata`][agents.voice.pipeline_config.VoicePipelineConfig.tracing_disabled]: Additional metadata to include with the trace. diff --git a/examples/financial_research_agent/manager.py b/examples/financial_research_agent/manager.py index 9a7722ad4..a996296db 100644 --- a/examples/financial_research_agent/manager.py +++ b/examples/financial_research_agent/manager.py @@ -42,16 +42,14 @@ async def run(self, query: str) -> None: is_done=True, hide_checkmark=True, ) - self.printer.update_item( - "start", "Starting financial research...", is_done=True) + self.printer.update_item("start", "Starting financial research...", is_done=True) search_plan = await self._plan_searches(query) search_results = await self._perform_searches(search_plan) report = await self._write_report(query, search_results) verification = await self._verify_report(report) final_report = f"Report summary\n\n{report.short_summary}" - self.printer.update_item( - "final_report", final_report, is_done=True) + self.printer.update_item("final_report", final_report, is_done=True) self.printer.end() @@ -76,8 +74,7 @@ async def _plan_searches(self, query: str) -> FinancialSearchPlan: async def _perform_searches(self, search_plan: FinancialSearchPlan) -> Sequence[str]: with custom_span("Search the web"): self.printer.update_item("searching", "Searching...") - tasks = [asyncio.create_task(self._search(item)) - for item in search_plan.searches] + tasks = [asyncio.create_task(self._search(item)) for item in search_plan.searches] results: list[str] = [] num_completed = 0 for task in asyncio.as_completed(tasks): @@ -112,8 +109,7 @@ async def _write_report(self, query: str, search_results: Sequence[str]) -> Fina tool_description="Use to get a short write‑up of potential red flags", custom_output_extractor=_summary_extractor, ) - writer_with_tools = writer_agent.clone( - tools=[fundamentals_tool, risk_tool]) + writer_with_tools = writer_agent.clone(tools=[fundamentals_tool, risk_tool]) self.printer.update_item("writing", "Thinking about report...") input_data = f"Original query: {query}\nSummarized search results: {search_results}" result = Runner.run_streamed(writer_with_tools, input_data) @@ -126,8 +122,7 @@ async def _write_report(self, query: str, search_results: Sequence[str]) -> Fina next_message = 0 async for _ in result.stream_events(): if time.time() - last_update > 5 and next_message < len(update_messages): - self.printer.update_item( - "writing", update_messages[next_message]) + self.printer.update_item("writing", update_messages[next_message]) next_message += 1 last_update = time.time() self.printer.mark_item_done("writing") diff --git a/examples/financial_research_agent/printer.py b/examples/financial_research_agent/printer.py index 16e04d2e2..4c1a4944d 100644 --- a/examples/financial_research_agent/printer.py +++ b/examples/financial_research_agent/printer.py @@ -10,6 +10,7 @@ class Printer: Simple wrapper to stream status updates. Used by the financial bot manager as it orchestrates planning, search and writing. """ + def __init__(self, console: Console) -> None: self.live = Live(console=console) self.items: dict[str, tuple[str, bool]] = {} diff --git a/examples/voice/__init__.py b/examples/voice/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/voice/static/README.md b/examples/voice/static/README.md new file mode 100644 index 000000000..74dc114ba --- /dev/null +++ b/examples/voice/static/README.md @@ -0,0 +1,26 @@ +# Static voice demo + +This demo operates by capturing a recording, then running a voice pipeline on it. + +Run via: + +``` +python -m examples.voice.static.main +``` + +## How it works + +1. We create a `VoicePipeline`, setup with a custom workflow. The workflow runs an Agent, but it also has some custom responses if you say the secret word. +2. When you speak, audio is forwarded to the voice pipeline. When you stop speaking, the agent runs. +3. The pipeline is run with the audio, which causes it to: + 1. Transcribe the audio + 2. Feed the transcription to the workflow, which runs the agent. + 3. Stream the output of the agent to a text-to-speech model. +4. Play the audio. + +Some suggested examples to try: + +- Tell me a joke (_the assistant tells you a joke_) +- What's the weather in Tokyo? (_will call the `get_weather` tool and then speak_) +- Hola, como estas? (_will handoff to the spanish agent_) +- Tell me about dogs. (_will respond with the hardcoded "you guessed the secret word" message_) diff --git a/examples/voice/static/__init__.py b/examples/voice/static/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/voice/static/main.py b/examples/voice/static/main.py new file mode 100644 index 000000000..5f512db75 --- /dev/null +++ b/examples/voice/static/main.py @@ -0,0 +1,84 @@ +import asyncio +import random + +from agents import ( + Agent, + AudioInput, + SingleAgentVoiceWorkflow, + SingleAgentWorkflowCallbacks, + VoicePipeline, + function_tool, +) +from agents.extensions.handoff_prompt import prompt_with_handoff_instructions + +from .util import AudioPlayer, record_audio + +""" +This is a simple example that uses a recorded audio buffer. Run it via: +`python -m examples.voice.static.main` + +1. You can record an audio clip in the terminal. +2. The pipeline automatically transcribes the audio. +3. The agent workflow is a simple one that starts at the Assistant agent. +4. The output of the agent is streamed to the audio player. + +Try examples like: +- Tell me a joke (will respond with a joke) +- What's the weather in Tokyo? (will call the `get_weather` tool and then speak) +- Hola, como estas? (will handoff to the spanish agent) +""" + + +@function_tool +def get_weather(city: str) -> str: + """Get the weather for a given city.""" + print(f"[debug] get_weather called with city: {city}") + choices = ["sunny", "cloudy", "rainy", "snowy"] + return f"The weather in {city} is {random.choice(choices)}." + + +spanish_agent = Agent( + name="Spanish", + handoff_description="A spanish speaking agent.", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. Speak in Spanish.", + ), + model="gpt-4o-mini", +) + +agent = Agent( + name="Assistant", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. If the user speaks in Spanish, handoff to the spanish agent.", + ), + model="gpt-4o-mini", + handoffs=[spanish_agent], + tools=[get_weather], +) + + +class WorkflowCallbacks(SingleAgentWorkflowCallbacks): + def on_run(self, workflow: SingleAgentVoiceWorkflow, transcription: str) -> None: + print(f"[debug] on_run called with transcription: {transcription}") + + +async def main(): + pipeline = VoicePipeline( + workflow=SingleAgentVoiceWorkflow(agent, callbacks=WorkflowCallbacks()) + ) + + audio_input = AudioInput(buffer=record_audio()) + + result = await pipeline.run(audio_input) + + with AudioPlayer() as player: + async for event in result.stream(): + if event.type == "voice_stream_event_audio": + player.add_audio(event.data) + print("Received audio") + elif event.type == "voice_stream_event_lifecycle": + print(f"Received lifecycle event: {event.event}") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/examples/voice/static/util.py b/examples/voice/static/util.py new file mode 100644 index 000000000..455bafee0 --- /dev/null +++ b/examples/voice/static/util.py @@ -0,0 +1,68 @@ +import curses +import time + +import numpy as np +import numpy.typing as npt +import sounddevice as sd + + +def _record_audio(screen: curses.window) -> npt.NDArray[np.float32]: + screen.nodelay(True) # Non-blocking input + screen.clear() + screen.addstr( + "Press to start recording. Press again to stop recording.\n" + ) + screen.refresh() + + recording = False + audio_buffer: list[npt.NDArray[np.float32]] = [] + + def _audio_callback(indata, frames, time_info, status): + if status: + screen.addstr(f"Status: {status}\n") + screen.refresh() + if recording: + audio_buffer.append(indata.copy()) + + # Open the audio stream with the callback. + with sd.InputStream(samplerate=24000, channels=1, dtype=np.float32, callback=_audio_callback): + while True: + key = screen.getch() + if key == ord(" "): + recording = not recording + if recording: + screen.addstr("Recording started...\n") + else: + screen.addstr("Recording stopped.\n") + break + screen.refresh() + time.sleep(0.01) + + # Combine recorded audio chunks. + if audio_buffer: + audio_data = np.concatenate(audio_buffer, axis=0) + else: + audio_data = np.empty((0,), dtype=np.float32) + + return audio_data + + +def record_audio(): + # Using curses to record audio in a way that: + # - doesn't require accessibility permissions on macos + # - doesn't block the terminal + audio_data = curses.wrapper(_record_audio) + return audio_data + + +class AudioPlayer: + def __enter__(self): + self.stream = sd.OutputStream(samplerate=24000, channels=1, dtype=np.int16) + self.stream.start() + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.stream.close() + + def add_audio(self, audio_data: npt.NDArray[np.int16]): + self.stream.write(audio_data) diff --git a/examples/voice/streamed/README.md b/examples/voice/streamed/README.md new file mode 100644 index 000000000..ab0ffedb6 --- /dev/null +++ b/examples/voice/streamed/README.md @@ -0,0 +1,25 @@ +# Streamed voice demo + +This is an interactive demo, where you can talk to an Agent conversationally. It uses the voice pipeline's built in turn detection feature, so if you stop speaking the Agent responds. + +Run via: + +``` +python -m examples.voice.streamed.main +``` + +## How it works + +1. We create a `VoicePipeline`, setup with a `SingleAgentVoiceWorkflow`. This is a workflow that starts at an Assistant agent, has tools and handoffs. +2. Audio input is captured from the terminal. +3. The pipeline is run with the recorded audio, which causes it to: + 1. Transcribe the audio + 2. Feed the transcription to the workflow, which runs the agent. + 3. Stream the output of the agent to a text-to-speech model. +4. Play the audio. + +Some suggested examples to try: + +- Tell me a joke (_the assistant tells you a joke_) +- What's the weather in Tokyo? (_will call the `get_weather` tool and then speak_) +- Hola, como estas? (_will handoff to the spanish agent_) diff --git a/examples/voice/streamed/__init__.py b/examples/voice/streamed/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/examples/voice/streamed/agents.py b/examples/voice/streamed/agents.py new file mode 100644 index 000000000..dcf312d76 --- /dev/null +++ b/examples/voice/streamed/agents.py @@ -0,0 +1,87 @@ +import random +from collections.abc import AsyncIterator +from typing import Callable + +from agents import ( + Agent, + Runner, + TResponseInputItem, + VoiceWorkflowBase, + VoiceWorkflowHelper, + function_tool, +) +from agents.extensions.handoff_prompt import prompt_with_handoff_instructions + + +@function_tool +def get_weather(city: str) -> str: + """Get the weather for a given city.""" + print(f"[debug] get_weather called with city: {city}") + choices = ["sunny", "cloudy", "rainy", "snowy"] + return f"The weather in {city} is {random.choice(choices)}." + + +spanish_agent = Agent( + name="Spanish", + handoff_description="A spanish speaking agent.", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. Speak in Spanish.", + ), + model="gpt-4o-mini", +) + +agent = Agent( + name="Assistant", + instructions=prompt_with_handoff_instructions( + "You're speaking to a human, so be polite and concise. If the user speaks in Spanish, handoff to the spanish agent.", + ), + model="gpt-4o-mini", + handoffs=[spanish_agent], + tools=[get_weather], +) + + +class MyWorkflow(VoiceWorkflowBase): + def __init__(self, secret_word: str, on_start: Callable[[str], None]): + """ + Args: + secret_word: The secret word to guess. + on_start: A callback that is called when the workflow starts. The transcription + is passed in as an argument. + """ + self._input_history: list[TResponseInputItem] = [] + self._current_agent = agent + self._secret_word = secret_word.lower() + self._on_start = on_start + + async def run(self, transcription: str) -> AsyncIterator[str]: + self._on_start(transcription) + + # Add the transcription to the input history + self._input_history.append( + { + "role": "user", + "content": transcription, + } + ) + + # If the user guessed the secret word, do alternate logic + if self._secret_word in transcription.lower(): + yield "You guessed the secret word!" + self._input_history.append( + { + "role": "assistant", + "content": "You guessed the secret word!", + } + ) + return + + # Otherwise, run the agent + result = Runner.run_streamed(self._current_agent, self._input_history) + + async for chunk in VoiceWorkflowHelper.stream_text_from(result): + yield chunk + + # Update the input history and current agent + self._input_history = result.to_input_list() + self._current_agent = result.last_agent diff --git a/examples/voice/streamed/main.py b/examples/voice/streamed/main.py new file mode 100644 index 000000000..36894338b --- /dev/null +++ b/examples/voice/streamed/main.py @@ -0,0 +1,222 @@ +from __future__ import annotations + +import asyncio + +import numpy as np +import sounddevice as sd +from textual import events +from textual.app import App, ComposeResult +from textual.containers import Container +from textual.reactive import reactive +from textual.widgets import Button, RichLog, Static +from typing_extensions import override + +from agents import VoicePipeline +from agents.voice.input import StreamedAudioInput + +from .agents import MyWorkflow + +CHUNK_LENGTH_S = 0.05 # 100ms +SAMPLE_RATE = 24000 +FORMAT = np.int16 +CHANNELS = 1 + + +class Header(Static): + """A header widget.""" + + session_id = reactive("") + + @override + def render(self) -> str: + return "Speak to the agent. When you stop speaking, it will respond." + + +class AudioStatusIndicator(Static): + """A widget that shows the current audio recording status.""" + + is_recording = reactive(False) + + @override + def render(self) -> str: + status = ( + "🔴 Recording... (Press K to stop)" + if self.is_recording + else "⚪ Press K to start recording (Q to quit)" + ) + return status + + +class RealtimeApp(App[None]): + CSS = """ + Screen { + background: #1a1b26; /* Dark blue-grey background */ + } + + Container { + border: double rgb(91, 164, 91); + } + + Horizontal { + width: 100%; + } + + #input-container { + height: 5; /* Explicit height for input container */ + margin: 1 1; + padding: 1 2; + } + + Input { + width: 80%; + height: 3; /* Explicit height for input */ + } + + Button { + width: 20%; + height: 3; /* Explicit height for button */ + } + + #bottom-pane { + width: 100%; + height: 82%; /* Reduced to make room for session display */ + border: round rgb(205, 133, 63); + content-align: center middle; + } + + #status-indicator { + height: 3; + content-align: center middle; + background: #2a2b36; + border: solid rgb(91, 164, 91); + margin: 1 1; + } + + #session-display { + height: 3; + content-align: center middle; + background: #2a2b36; + border: solid rgb(91, 164, 91); + margin: 1 1; + } + + Static { + color: white; + } + """ + + should_send_audio: asyncio.Event + audio_player: sd.OutputStream + last_audio_item_id: str | None + connected: asyncio.Event + + def __init__(self) -> None: + super().__init__() + self.last_audio_item_id = None + self.should_send_audio = asyncio.Event() + self.connected = asyncio.Event() + self.pipeline = VoicePipeline( + workflow=MyWorkflow(secret_word="dog", on_start=self._on_transcription) + ) + self._audio_input = StreamedAudioInput() + self.audio_player = sd.OutputStream( + samplerate=SAMPLE_RATE, + channels=CHANNELS, + dtype=FORMAT, + ) + + def _on_transcription(self, transcription: str) -> None: + try: + self.query_one("#bottom-pane", RichLog).write(f"Transcription: {transcription}") + except Exception: + pass + + @override + def compose(self) -> ComposeResult: + """Create child widgets for the app.""" + with Container(): + yield Header(id="session-display") + yield AudioStatusIndicator(id="status-indicator") + yield RichLog(id="bottom-pane", wrap=True, highlight=True, markup=True) + + async def on_mount(self) -> None: + self.run_worker(self.start_voice_pipeline()) + self.run_worker(self.send_mic_audio()) + + async def start_voice_pipeline(self) -> None: + try: + self.audio_player.start() + self.result = await self.pipeline.run(self._audio_input) + + async for event in self.result.stream(): + bottom_pane = self.query_one("#bottom-pane", RichLog) + if event.type == "voice_stream_event_audio": + self.audio_player.write(event.data) + bottom_pane.write( + f"Received audio: {len(event.data) if event.data is not None else '0'} bytes" + ) + elif event.type == "voice_stream_event_lifecycle": + bottom_pane.write(f"Lifecycle event: {event.event}") + except Exception as e: + bottom_pane = self.query_one("#bottom-pane", RichLog) + bottom_pane.write(f"Error: {e}") + finally: + self.audio_player.close() + + async def send_mic_audio(self) -> None: + device_info = sd.query_devices() + print(device_info) + + read_size = int(SAMPLE_RATE * 0.02) + + stream = sd.InputStream( + channels=CHANNELS, + samplerate=SAMPLE_RATE, + dtype="int16", + ) + stream.start() + + status_indicator = self.query_one(AudioStatusIndicator) + + try: + while True: + if stream.read_available < read_size: + await asyncio.sleep(0) + continue + + await self.should_send_audio.wait() + status_indicator.is_recording = True + + data, _ = stream.read(read_size) + + await self._audio_input.add_audio(data) + await asyncio.sleep(0) + except KeyboardInterrupt: + pass + finally: + stream.stop() + stream.close() + + async def on_key(self, event: events.Key) -> None: + """Handle key press events.""" + if event.key == "enter": + self.query_one(Button).press() + return + + if event.key == "q": + self.exit() + return + + if event.key == "k": + status_indicator = self.query_one(AudioStatusIndicator) + if status_indicator.is_recording: + self.should_send_audio.clear() + status_indicator.is_recording = False + else: + self.should_send_audio.set() + status_indicator.is_recording = True + + +if __name__ == "__main__": + app = RealtimeApp() + app.run() diff --git a/mkdocs.yml b/mkdocs.yml index 6b8153160..941f29ed9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -35,6 +35,10 @@ nav: - multi_agent.md - models.md - config.md + - Voice agents: + - voice/quickstart.md + - voice/pipeline.md + - voice/tracing.md - API Reference: - Agents: - ref/index.md @@ -67,6 +71,19 @@ nav: - ref/tracing/setup.md - ref/tracing/span_data.md - ref/tracing/util.md + - Voice: + - ref/voice/pipeline.md + - ref/voice/workflow.md + - ref/voice/input.md + - ref/voice/result.md + - ref/voice/pipeline_config.md + - ref/voice/events.md + - ref/voice/exceptions.md + - ref/voice/model.md + - ref/voice/utils.md + - ref/voice/models/openai_provider.md + - ref/voice/models/openai_stt.md + - ref/voice/models/openai_tts.md - Extensions: - ref/extensions/handoff_filters.md - ref/extensions/handoff_prompt.md @@ -96,9 +113,13 @@ extra: generator: false markdown_extensions: + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format - admonition - pymdownx.details - - pymdownx.superfences - attr_list - md_in_html - pymdownx.highlight: diff --git a/pyproject.toml b/pyproject.toml index 8aecf1baa..9d0d8c552 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,9 +5,7 @@ description = "OpenAI Agents SDK" readme = "README.md" requires-python = ">=3.9" license = "MIT" -authors = [ - { name = "OpenAI", email = "support@openai.com" }, -] +authors = [{ name = "OpenAI", email = "support@openai.com" }] dependencies = [ "openai>=1.66.5", "pydantic>=2.10, <3", @@ -27,13 +25,16 @@ classifiers = [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Topic :: Software Development :: Libraries :: Python Modules", - "License :: OSI Approved :: MIT License" + "License :: OSI Approved :: MIT License", ] [project.urls] Homepage = "https://github.com/openai/openai-agents-python" Repository = "https://github.com/openai/openai-agents-python" +[project.optional-dependencies] +voice = ["numpy>=2.2.0, <3; python_version>='3.10'", "websockets>=15.0, <16"] + [dependency-groups] dev = [ "mypy", @@ -48,6 +49,11 @@ dev = [ "coverage>=7.6.12", "playwright==1.50.0", "inline-snapshot>=0.20.7", + "pynput", + "types-pynput", + "sounddevice", + "pynput", + "textual", ] [tool.uv.workspace] members = ["agents"] @@ -74,8 +80,8 @@ select = [ "F", # pyflakes "I", # isort "B", # flake8-bugbear - "C4", # flake8-comprehensions - "UP", # pyupgrade + "C4", # flake8-comprehensions + "UP", # pyupgrade ] isort = { combine-as-imports = true, known-first-party = ["agents"] } @@ -91,11 +97,12 @@ disallow_incomplete_defs = false disallow_untyped_defs = false disallow_untyped_calls = false +[[tool.mypy.overrides]] +module = "sounddevice.*" +ignore_missing_imports = true + [tool.coverage.run] -source = [ - "tests", - "src/agents", -] +source = ["tests", "src/agents"] [tool.coverage.report] show_missing = true @@ -109,7 +116,7 @@ exclude_also = [ ] [tool.pytest.ini_options] -asyncio_mode = "auto" +asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "session" filterwarnings = [ # This is a warning that is expected to happen: we have an async filter that raises an exception @@ -120,4 +127,4 @@ markers = [ ] [tool.inline-snapshot] -format-command="ruff format --stdin-filename {filename}" \ No newline at end of file +format-command = "ruff format --stdin-filename {filename}" diff --git a/src/agents/__init__.py b/src/agents/__init__.py index a7a1272cf..c0b47dc8e 100644 --- a/src/agents/__init__.py +++ b/src/agents/__init__.py @@ -73,8 +73,11 @@ Span, SpanData, SpanError, + SpeechGroupSpanData, + SpeechSpanData, Trace, TracingProcessor, + TranscriptionSpanData, add_trace_processor, agent_span, custom_span, @@ -89,9 +92,37 @@ set_trace_processors, set_tracing_disabled, set_tracing_export_api_key, + speech_group_span, + speech_span, trace, + transcription_span, ) from .usage import Usage +from .voice import ( + AudioInput, + OpenAISTTModel, + OpenAISTTTranscriptionSession, + OpenAITTSModel, + OpenAIVoiceModelProvider, + SingleAgentVoiceWorkflow, + SingleAgentWorkflowCallbacks, + StreamedAudioInput, + StreamedAudioResult, + StreamedTranscriptionSession, + STTModel, + STTModelSettings, + TTSModel, + TTSModelSettings, + VoiceModelProvider, + VoicePipeline, + VoicePipelineConfig, + VoiceStreamEvent, + VoiceStreamEventAudio, + VoiceStreamEventLifecycle, + VoiceWorkflowBase, + VoiceWorkflowHelper, + get_sentence_based_splitter, +) def set_default_openai_key(key: str, use_for_tracing: bool = True) -> None: @@ -211,6 +242,9 @@ def enable_verbose_stdout_logging(): "handoff_span", "set_trace_processors", "set_tracing_disabled", + "speech_group_span", + "transcription_span", + "speech_span", "trace", "Trace", "TracingProcessor", @@ -223,6 +257,9 @@ def enable_verbose_stdout_logging(): "GenerationSpanData", "GuardrailSpanData", "HandoffSpanData", + "SpeechGroupSpanData", + "SpeechSpanData", + "TranscriptionSpanData", "set_default_openai_key", "set_default_openai_client", "set_default_openai_api", @@ -231,4 +268,27 @@ def enable_verbose_stdout_logging(): "gen_trace_id", "gen_span_id", "default_tool_error_function", + "AudioInput", + "StreamedAudioInput", + "STTModel", + "STTModelSettings", + "TTSModel", + "TTSModelSettings", + "VoiceModelProvider", + "StreamedAudioResult", + "SingleAgentVoiceWorkflow", + "OpenAIVoiceModelProvider", + "OpenAISTTModel", + "OpenAITTSModel", + "VoiceStreamEventAudio", + "VoiceStreamEventLifecycle", + "VoiceStreamEvent", + "VoicePipeline", + "VoicePipelineConfig", + "get_sentence_based_splitter", + "VoiceWorkflowHelper", + "VoiceWorkflowBase", + "StreamedTranscriptionSession", + "OpenAISTTTranscriptionSession", + "SingleAgentWorkflowCallbacks", ] diff --git a/src/agents/models/openai_provider.py b/src/agents/models/openai_provider.py index e6a859fb2..e7e922ab4 100644 --- a/src/agents/models/openai_provider.py +++ b/src/agents/models/openai_provider.py @@ -34,6 +34,19 @@ def __init__( project: str | None = None, use_responses: bool | None = None, ) -> None: + """Create a new OpenAI provider. + + Args: + api_key: The API key to use for the OpenAI client. If not provided, we will use the + default API key. + base_url: The base URL to use for the OpenAI client. If not provided, we will use the + default base URL. + openai_client: An optional OpenAI client to use. If not provided, we will create a new + OpenAI client using the api_key and base_url. + organization: The organization to use for the OpenAI client. + project: The project to use for the OpenAI client. + use_responses: Whether to use the OpenAI responses API. + """ if openai_client is not None: assert api_key is None and base_url is None, ( "Don't provide api_key or base_url if you provide openai_client" diff --git a/src/agents/tracing/__init__.py b/src/agents/tracing/__init__.py index 8e802018f..dc7c7cfd9 100644 --- a/src/agents/tracing/__init__.py +++ b/src/agents/tracing/__init__.py @@ -10,7 +10,10 @@ guardrail_span, handoff_span, response_span, + speech_group_span, + speech_span, trace, + transcription_span, ) from .processor_interface import TracingProcessor from .processors import default_exporter, default_processor @@ -24,6 +27,9 @@ HandoffSpanData, ResponseSpanData, SpanData, + SpeechGroupSpanData, + SpeechSpanData, + TranscriptionSpanData, ) from .spans import Span, SpanError from .traces import Trace @@ -54,9 +60,15 @@ "GuardrailSpanData", "HandoffSpanData", "ResponseSpanData", + "SpeechGroupSpanData", + "SpeechSpanData", + "TranscriptionSpanData", "TracingProcessor", "gen_trace_id", "gen_span_id", + "speech_group_span", + "speech_span", + "transcription_span", ] diff --git a/src/agents/tracing/create.py b/src/agents/tracing/create.py index 78a064bc3..af2f156f7 100644 --- a/src/agents/tracing/create.py +++ b/src/agents/tracing/create.py @@ -13,6 +13,9 @@ GuardrailSpanData, HandoffSpanData, ResponseSpanData, + SpeechGroupSpanData, + SpeechSpanData, + TranscriptionSpanData, ) from .spans import Span from .traces import Trace @@ -181,7 +184,11 @@ def generation_span( """ return GLOBAL_TRACE_PROVIDER.create_span( span_data=GenerationSpanData( - input=input, output=output, model=model, model_config=model_config, usage=usage + input=input, + output=output, + model=model, + model_config=model_config, + usage=usage, ), span_id=span_id, parent=parent, @@ -304,3 +311,116 @@ def guardrail_span( parent=parent, disabled=disabled, ) + + +def transcription_span( + model: str | None = None, + input: str | None = None, + input_format: str | None = "pcm", + output: str | None = None, + model_config: Mapping[str, Any] | None = None, + span_id: str | None = None, + parent: Trace | Span[Any] | None = None, + disabled: bool = False, +) -> Span[TranscriptionSpanData]: + """Create a new transcription span. The span will not be started automatically, you should + either do `with transcription_span() ...` or call `span.start()` + `span.finish()` manually. + + Args: + model: The name of the model used for the speech-to-text. + input: The audio input of the speech-to-text transcription, as a base64 encoded string of + audio bytes. + input_format: The format of the audio input (defaults to "pcm"). + output: The output of the speech-to-text transcription. + model_config: The model configuration (hyperparameters) used. + span_id: The ID of the span. Optional. If not provided, we will generate an ID. We + recommend using `util.gen_span_id()` to generate a span ID, to guarantee that IDs are + correctly formatted. + parent: The parent span or trace. If not provided, we will automatically use the current + trace/span as the parent. + disabled: If True, we will return a Span but the Span will not be recorded. + + Returns: + The newly created speech-to-text span. + """ + return GLOBAL_TRACE_PROVIDER.create_span( + span_data=TranscriptionSpanData( + input=input, + input_format=input_format, + output=output, + model=model, + model_config=model_config, + ), + span_id=span_id, + parent=parent, + disabled=disabled, + ) + + +def speech_span( + model: str | None = None, + input: str | None = None, + output: str | None = None, + output_format: str | None = "pcm", + model_config: Mapping[str, Any] | None = None, + first_content_at: str | None = None, + span_id: str | None = None, + parent: Trace | Span[Any] | None = None, + disabled: bool = False, +) -> Span[SpeechSpanData]: + """Create a new speech span. The span will not be started automatically, you should either do + `with speech_span() ...` or call `span.start()` + `span.finish()` manually. + + Args: + model: The name of the model used for the text-to-speech. + input: The text input of the text-to-speech. + output: The audio output of the text-to-speech as base64 encoded string of PCM audio bytes. + output_format: The format of the audio output (defaults to "pcm"). + model_config: The model configuration (hyperparameters) used. + first_content_at: The time of the first byte of the audio output. + span_id: The ID of the span. Optional. If not provided, we will generate an ID. We + recommend using `util.gen_span_id()` to generate a span ID, to guarantee that IDs are + correctly formatted. + parent: The parent span or trace. If not provided, we will automatically use the current + trace/span as the parent. + disabled: If True, we will return a Span but the Span will not be recorded. + """ + return GLOBAL_TRACE_PROVIDER.create_span( + span_data=SpeechSpanData( + model=model, + input=input, + output=output, + output_format=output_format, + model_config=model_config, + first_content_at=first_content_at, + ), + span_id=span_id, + parent=parent, + disabled=disabled, + ) + + +def speech_group_span( + input: str | None = None, + span_id: str | None = None, + parent: Trace | Span[Any] | None = None, + disabled: bool = False, +) -> Span[SpeechGroupSpanData]: + """Create a new speech group span. The span will not be started automatically, you should + either do `with speech_group_span() ...` or call `span.start()` + `span.finish()` manually. + + Args: + input: The input text used for the speech request. + span_id: The ID of the span. Optional. If not provided, we will generate an ID. We + recommend using `util.gen_span_id()` to generate a span ID, to guarantee that IDs are + correctly formatted. + parent: The parent span or trace. If not provided, we will automatically use the current + trace/span as the parent. + disabled: If True, we will return a Span but the Span will not be recorded. + """ + return GLOBAL_TRACE_PROVIDER.create_span( + span_data=SpeechGroupSpanData(input=input), + span_id=span_id, + parent=parent, + disabled=disabled, + ) diff --git a/src/agents/tracing/span_data.py b/src/agents/tracing/span_data.py index 1a49d8e6f..95e7fe0f6 100644 --- a/src/agents/tracing/span_data.py +++ b/src/agents/tracing/span_data.py @@ -186,3 +186,99 @@ def export(self) -> dict[str, Any]: "name": self.name, "triggered": self.triggered, } + + +class TranscriptionSpanData(SpanData): + __slots__ = ( + "input", + "output", + "model", + "model_config", + ) + + def __init__( + self, + input: str | None = None, + input_format: str | None = "pcm", + output: str | None = None, + model: str | None = None, + model_config: Mapping[str, Any] | None = None, + ): + self.input = input + self.input_format = input_format + self.output = output + self.model = model + self.model_config = model_config + + @property + def type(self) -> str: + return "transcription" + + def export(self) -> dict[str, Any]: + return { + "type": self.type, + "input": { + "data": self.input or "", + "format": self.input_format, + }, + "output": self.output, + "model": self.model, + "model_config": self.model_config, + } + + +class SpeechSpanData(SpanData): + __slots__ = ("input", "output", "model", "model_config", "first_byte_at") + + def __init__( + self, + input: str | None = None, + output: str | None = None, + output_format: str | None = "pcm", + model: str | None = None, + model_config: Mapping[str, Any] | None = None, + first_content_at: str | None = None, + ): + self.input = input + self.output = output + self.output_format = output_format + self.model = model + self.model_config = model_config + self.first_content_at = first_content_at + + @property + def type(self) -> str: + return "speech" + + def export(self) -> dict[str, Any]: + return { + "type": self.type, + "input": self.input, + "output": { + "data": self.output or "", + "format": self.output_format, + }, + "model": self.model, + "model_config": self.model_config, + "first_content_at": self.first_content_at, + } + + +class SpeechGroupSpanData(SpanData): + __slots__ = "input" + + def __init__( + self, + input: str | None = None, + ): + self.input = input + + @property + def type(self) -> str: + return "speech-group" + + def export(self) -> dict[str, Any]: + return { + "type": self.type, + "input": self.input, + } diff --git a/src/agents/tracing/util.py b/src/agents/tracing/util.py index 3e5cad900..f546b4e50 100644 --- a/src/agents/tracing/util.py +++ b/src/agents/tracing/util.py @@ -15,3 +15,8 @@ def gen_trace_id() -> str: def gen_span_id() -> str: """Generates a new span ID.""" return f"span_{uuid.uuid4().hex[:24]}" + + +def gen_group_id() -> str: + """Generates a new group ID.""" + return f"group_{uuid.uuid4().hex[:24]}" diff --git a/src/agents/voice/__init__.py b/src/agents/voice/__init__.py new file mode 100644 index 000000000..499c064c5 --- /dev/null +++ b/src/agents/voice/__init__.py @@ -0,0 +1,51 @@ +from .events import VoiceStreamEvent, VoiceStreamEventAudio, VoiceStreamEventLifecycle +from .exceptions import STTWebsocketConnectionError +from .input import AudioInput, StreamedAudioInput +from .model import ( + StreamedTranscriptionSession, + STTModel, + STTModelSettings, + TTSModel, + TTSModelSettings, + VoiceModelProvider, +) +from .models.openai_model_provider import OpenAIVoiceModelProvider +from .models.openai_stt import OpenAISTTModel, OpenAISTTTranscriptionSession +from .models.openai_tts import OpenAITTSModel +from .pipeline import VoicePipeline +from .pipeline_config import VoicePipelineConfig +from .result import StreamedAudioResult +from .utils import get_sentence_based_splitter +from .workflow import ( + SingleAgentVoiceWorkflow, + SingleAgentWorkflowCallbacks, + VoiceWorkflowBase, + VoiceWorkflowHelper, +) + +__all__ = [ + "AudioInput", + "StreamedAudioInput", + "STTModel", + "STTModelSettings", + "TTSModel", + "TTSModelSettings", + "VoiceModelProvider", + "StreamedAudioResult", + "SingleAgentVoiceWorkflow", + "OpenAIVoiceModelProvider", + "OpenAISTTModel", + "OpenAITTSModel", + "VoiceStreamEventAudio", + "VoiceStreamEventLifecycle", + "VoiceStreamEvent", + "VoicePipeline", + "VoicePipelineConfig", + "get_sentence_based_splitter", + "VoiceWorkflowHelper", + "VoiceWorkflowBase", + "SingleAgentWorkflowCallbacks", + "StreamedTranscriptionSession", + "OpenAISTTTranscriptionSession", + "STTWebsocketConnectionError", +] diff --git a/src/agents/voice/events.py b/src/agents/voice/events.py new file mode 100644 index 000000000..bdcd08153 --- /dev/null +++ b/src/agents/voice/events.py @@ -0,0 +1,47 @@ +from __future__ import annotations + +from dataclasses import dataclass +from typing import Literal, Union + +from typing_extensions import TypeAlias + +from .imports import np, npt + + +@dataclass +class VoiceStreamEventAudio: + """Streaming event from the VoicePipeline""" + + data: npt.NDArray[np.int16 | np.float32] | None + """The audio data.""" + + type: Literal["voice_stream_event_audio"] = "voice_stream_event_audio" + """The type of event.""" + + +@dataclass +class VoiceStreamEventLifecycle: + """Streaming event from the VoicePipeline""" + + event: Literal["turn_started", "turn_ended", "session_ended"] + """The event that occurred.""" + + type: Literal["voice_stream_event_lifecycle"] = "voice_stream_event_lifecycle" + """The type of event.""" + + +@dataclass +class VoiceStreamEventError: + """Streaming event from the VoicePipeline""" + + error: Exception + """The error that occurred.""" + + type: Literal["voice_stream_event_error"] = "voice_stream_event_error" + """The type of event.""" + + +VoiceStreamEvent: TypeAlias = Union[ + VoiceStreamEventAudio, VoiceStreamEventLifecycle, VoiceStreamEventError +] +"""An event from the `VoicePipeline`, streamed via `StreamedAudioResult.stream()`.""" diff --git a/src/agents/voice/exceptions.py b/src/agents/voice/exceptions.py new file mode 100644 index 000000000..97dccac81 --- /dev/null +++ b/src/agents/voice/exceptions.py @@ -0,0 +1,8 @@ +from ..exceptions import AgentsException + + +class STTWebsocketConnectionError(AgentsException): + """Exception raised when the STT websocket connection fails.""" + + def __init__(self, message: str): + self.message = message diff --git a/src/agents/voice/imports.py b/src/agents/voice/imports.py new file mode 100644 index 000000000..37062da53 --- /dev/null +++ b/src/agents/voice/imports.py @@ -0,0 +1,11 @@ +try: + import numpy as np + import numpy.typing as npt + import websockets +except ImportError as _e: + raise ImportError( + "`numpy` + `websockets` are required to use voice. You can install them via the optional " + "dependency group: `pip install openai-agents[voice]`." + ) from _e + +__all__ = ["np", "npt", "websockets"] diff --git a/src/agents/voice/input.py b/src/agents/voice/input.py new file mode 100644 index 000000000..8613d27ac --- /dev/null +++ b/src/agents/voice/input.py @@ -0,0 +1,88 @@ +from __future__ import annotations + +import asyncio +import base64 +import io +import wave +from dataclasses import dataclass + +from ..exceptions import UserError +from .imports import np, npt + +DEFAULT_SAMPLE_RATE = 24000 + + +def _buffer_to_audio_file( + buffer: npt.NDArray[np.int16 | np.float32], + frame_rate: int = DEFAULT_SAMPLE_RATE, + sample_width: int = 2, + channels: int = 1, +) -> tuple[str, io.BytesIO, str]: + if buffer.dtype == np.float32: + # convert to int16 + buffer = np.clip(buffer, -1.0, 1.0) + buffer = (buffer * 32767).astype(np.int16) + elif buffer.dtype != np.int16: + raise UserError("Buffer must be a numpy array of int16 or float32") + + audio_file = io.BytesIO() + with wave.open(audio_file, "w") as wav_file: + wav_file.setnchannels(channels) + wav_file.setsampwidth(sample_width) + wav_file.setframerate(frame_rate) + wav_file.writeframes(buffer.tobytes()) + audio_file.seek(0) + + # (filename, bytes, content_type) + return ("audio.wav", audio_file, "audio/wav") + + +@dataclass +class AudioInput: + """Static audio to be used as input for the VoicePipeline.""" + + buffer: npt.NDArray[np.int16 | np.float32] + """ + A buffer containing the audio data for the agent. Must be a numpy array of int16 or float32. + """ + + frame_rate: int = DEFAULT_SAMPLE_RATE + """The sample rate of the audio data. Defaults to 24000.""" + + sample_width: int = 2 + """The sample width of the audio data. Defaults to 2.""" + + channels: int = 1 + """The number of channels in the audio data. Defaults to 1.""" + + def to_audio_file(self) -> tuple[str, io.BytesIO, str]: + """Returns a tuple of (filename, bytes, content_type)""" + return _buffer_to_audio_file(self.buffer, self.frame_rate, self.sample_width, self.channels) + + def to_base64(self) -> str: + """Returns the audio data as a base64 encoded string.""" + if self.buffer.dtype == np.float32: + # convert to int16 + self.buffer = np.clip(self.buffer, -1.0, 1.0) + self.buffer = (self.buffer * 32767).astype(np.int16) + elif self.buffer.dtype != np.int16: + raise UserError("Buffer must be a numpy array of int16 or float32") + + return base64.b64encode(self.buffer.tobytes()).decode("utf-8") + + +class StreamedAudioInput: + """Audio input represented as a stream of audio data. You can pass this to the `VoicePipeline` + and then push audio data into the queue using the `add_audio` method. + """ + + def __init__(self): + self.queue: asyncio.Queue[npt.NDArray[np.int16 | np.float32]] = asyncio.Queue() + + async def add_audio(self, audio: npt.NDArray[np.int16 | np.float32]): + """Adds more audio data to the stream. + + Args: + audio: The audio data to add. Must be a numpy array of int16 or float32. + """ + await self.queue.put(audio) diff --git a/src/agents/voice/model.py b/src/agents/voice/model.py new file mode 100644 index 000000000..220d4b480 --- /dev/null +++ b/src/agents/voice/model.py @@ -0,0 +1,193 @@ +from __future__ import annotations + +import abc +from collections.abc import AsyncIterator +from dataclasses import dataclass +from typing import Any, Callable, Literal + +from .imports import np, npt +from .input import AudioInput, StreamedAudioInput +from .utils import get_sentence_based_splitter + +DEFAULT_TTS_INSTRUCTIONS = ( + "You will receive partial sentences. Do not complete the sentence, just read out the text." +) +DEFAULT_TTS_BUFFER_SIZE = 120 + + +@dataclass +class TTSModelSettings: + """Settings for a TTS model.""" + + voice: ( + Literal["alloy", "ash", "coral", "echo", "fable", "onyx", "nova", "sage", "shimmer"] | None + ) = None + """ + The voice to use for the TTS model. If not provided, the default voice for the respective model + will be used. + """ + + buffer_size: int = 120 + """The minimal size of the chunks of audio data that are being streamed out.""" + + dtype: npt.DTypeLike = np.int16 + """The data type for the audio data to be returned in.""" + + transform_data: ( + Callable[[npt.NDArray[np.int16 | np.float32]], npt.NDArray[np.int16 | np.float32]] | None + ) = None + """ + A function to transform the data from the TTS model. This is useful if you want the resulting + audio stream to have the data in a specific shape already. + """ + + instructions: str = ( + "You will receive partial sentences. Do not complete the sentence just read out the text." + ) + """ + The instructions to use for the TTS model. This is useful if you want to control the tone of the + audio output. + """ + + text_splitter: Callable[[str], tuple[str, str]] = get_sentence_based_splitter() + """ + A function to split the text into chunks. This is useful if you want to split the text into + chunks before sending it to the TTS model rather than waiting for the whole text to be + processed. + """ + + speed: float | None = None + """The speed with which the TTS model will read the text. Between 0.25 and 4.0.""" + + +class TTSModel(abc.ABC): + """A text-to-speech model that can convert text into audio output.""" + + @property + @abc.abstractmethod + def model_name(self) -> str: + """The name of the TTS model.""" + pass + + @abc.abstractmethod + def run(self, text: str, settings: TTSModelSettings) -> AsyncIterator[bytes]: + """Given a text string, produces a stream of audio bytes, in PCM format. + + Args: + text: The text to convert to audio. + + Returns: + An async iterator of audio bytes, in PCM format. + """ + pass + + +class StreamedTranscriptionSession(abc.ABC): + """A streamed transcription of audio input.""" + + @abc.abstractmethod + def transcribe_turns(self) -> AsyncIterator[str]: + """Yields a stream of text transcriptions. Each transcription is a turn in the conversation. + + This method is expected to return only after `close()` is called. + """ + pass + + @abc.abstractmethod + async def close(self) -> None: + """Closes the session.""" + pass + + +@dataclass +class STTModelSettings: + """Settings for a speech-to-text model.""" + + prompt: str | None = None + """Instructions for the model to follow.""" + + language: str | None = None + """The language of the audio input.""" + + temperature: float | None = None + """The temperature of the model.""" + + turn_detection: dict[str, Any] | None = None + """The turn detection settings for the model when using streamed audio input.""" + + +class STTModel(abc.ABC): + """A speech-to-text model that can convert audio input into text.""" + + @property + @abc.abstractmethod + def model_name(self) -> str: + """The name of the STT model.""" + pass + + @abc.abstractmethod + async def transcribe( + self, + input: AudioInput, + settings: STTModelSettings, + trace_include_sensitive_data: bool, + trace_include_sensitive_audio_data: bool, + ) -> str: + """Given an audio input, produces a text transcription. + + Args: + input: The audio input to transcribe. + settings: The settings to use for the transcription. + trace_include_sensitive_data: Whether to include sensitive data in traces. + trace_include_sensitive_audio_data: Whether to include sensitive audio data in traces. + + Returns: + The text transcription of the audio input. + """ + pass + + @abc.abstractmethod + async def create_session( + self, + input: StreamedAudioInput, + settings: STTModelSettings, + trace_include_sensitive_data: bool, + trace_include_sensitive_audio_data: bool, + ) -> StreamedTranscriptionSession: + """Creates a new transcription session, which you can push audio to, and receive a stream + of text transcriptions. + + Args: + input: The audio input to transcribe. + settings: The settings to use for the transcription. + trace_include_sensitive_data: Whether to include sensitive data in traces. + trace_include_sensitive_audio_data: Whether to include sensitive audio data in traces. + + Returns: + A new transcription session. + """ + pass + + +class VoiceModelProvider(abc.ABC): + """The base interface for a voice model provider. + + A model provider is responsible for creating speech-to-text and text-to-speech models, given a + name. + """ + + @abc.abstractmethod + def get_stt_model(self, model_name: str | None) -> STTModel: + """Get a speech-to-text model by name. + + Args: + model_name: The name of the model to get. + + Returns: + The speech-to-text model. + """ + pass + + @abc.abstractmethod + def get_tts_model(self, model_name: str | None) -> TTSModel: + """Get a text-to-speech model by name.""" diff --git a/src/agents/voice/models/__init__.py b/src/agents/voice/models/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/agents/voice/models/openai_model_provider.py b/src/agents/voice/models/openai_model_provider.py new file mode 100644 index 000000000..094df4cc1 --- /dev/null +++ b/src/agents/voice/models/openai_model_provider.py @@ -0,0 +1,97 @@ +from __future__ import annotations + +import httpx +from openai import AsyncOpenAI, DefaultAsyncHttpxClient + +from ...models import _openai_shared +from ..model import STTModel, TTSModel, VoiceModelProvider +from .openai_stt import OpenAISTTModel +from .openai_tts import OpenAITTSModel + +_http_client: httpx.AsyncClient | None = None + + +# If we create a new httpx client for each request, that would mean no sharing of connection pools, +# which would mean worse latency and resource usage. So, we share the client across requests. +def shared_http_client() -> httpx.AsyncClient: + global _http_client + if _http_client is None: + _http_client = DefaultAsyncHttpxClient() + return _http_client + + +DEFAULT_STT_MODEL = "gpt-4o-transcribe" +DEFAULT_TTS_MODEL = "gpt-4o-mini-tts" + + +class OpenAIVoiceModelProvider(VoiceModelProvider): + """A voice model provider that uses OpenAI models.""" + + def __init__( + self, + *, + api_key: str | None = None, + base_url: str | None = None, + openai_client: AsyncOpenAI | None = None, + organization: str | None = None, + project: str | None = None, + ) -> None: + """Create a new OpenAI voice model provider. + + Args: + api_key: The API key to use for the OpenAI client. If not provided, we will use the + default API key. + base_url: The base URL to use for the OpenAI client. If not provided, we will use the + default base URL. + openai_client: An optional OpenAI client to use. If not provided, we will create a new + OpenAI client using the api_key and base_url. + organization: The organization to use for the OpenAI client. + project: The project to use for the OpenAI client. + """ + if openai_client is not None: + assert api_key is None and base_url is None, ( + "Don't provide api_key or base_url if you provide openai_client" + ) + self._client: AsyncOpenAI | None = openai_client + else: + self._client = None + self._stored_api_key = api_key + self._stored_base_url = base_url + self._stored_organization = organization + self._stored_project = project + + # We lazy load the client in case you never actually use OpenAIProvider(). Otherwise + # AsyncOpenAI() raises an error if you don't have an API key set. + def _get_client(self) -> AsyncOpenAI: + if self._client is None: + self._client = _openai_shared.get_default_openai_client() or AsyncOpenAI( + api_key=self._stored_api_key or _openai_shared.get_default_openai_key(), + base_url=self._stored_base_url, + organization=self._stored_organization, + project=self._stored_project, + http_client=shared_http_client(), + ) + + return self._client + + def get_stt_model(self, model_name: str | None) -> STTModel: + """Get a speech-to-text model by name. + + Args: + model_name: The name of the model to get. + + Returns: + The speech-to-text model. + """ + return OpenAISTTModel(model_name or DEFAULT_STT_MODEL, self._get_client()) + + def get_tts_model(self, model_name: str | None) -> TTSModel: + """Get a text-to-speech model by name. + + Args: + model_name: The name of the model to get. + + Returns: + The text-to-speech model. + """ + return OpenAITTSModel(model_name or DEFAULT_TTS_MODEL, self._get_client()) diff --git a/src/agents/voice/models/openai_stt.py b/src/agents/voice/models/openai_stt.py new file mode 100644 index 000000000..a5cf8acd3 --- /dev/null +++ b/src/agents/voice/models/openai_stt.py @@ -0,0 +1,457 @@ +from __future__ import annotations + +import asyncio +import base64 +import json +import time +from collections.abc import AsyncIterator +from dataclasses import dataclass +from typing import Any, cast + +from openai import AsyncOpenAI + +from agents.exceptions import AgentsException + +from ... import _debug +from ...logger import logger +from ...tracing import Span, SpanError, TranscriptionSpanData, transcription_span +from ..exceptions import STTWebsocketConnectionError +from ..imports import np, npt, websockets +from ..input import AudioInput, StreamedAudioInput +from ..model import StreamedTranscriptionSession, STTModel, STTModelSettings + +EVENT_INACTIVITY_TIMEOUT = 1000 # Timeout for inactivity in event processing +SESSION_CREATION_TIMEOUT = 10 # Timeout waiting for session.created event +SESSION_UPDATE_TIMEOUT = 10 # Timeout waiting for session.updated event + +DEFAULT_TURN_DETECTION = {"type": "semantic_vad"} + + +@dataclass +class ErrorSentinel: + error: Exception + + +class SessionCompleteSentinel: + pass + + +class WebsocketDoneSentinel: + pass + + +def _audio_to_base64(audio_data: list[npt.NDArray[np.int16 | np.float32]]) -> str: + concatenated_audio = np.concatenate(audio_data) + if concatenated_audio.dtype == np.float32: + # convert to int16 + concatenated_audio = np.clip(concatenated_audio, -1.0, 1.0) + concatenated_audio = (concatenated_audio * 32767).astype(np.int16) + audio_bytes = concatenated_audio.tobytes() + return base64.b64encode(audio_bytes).decode("utf-8") + + +async def _wait_for_event( + event_queue: asyncio.Queue[dict[str, Any]], expected_types: list[str], timeout: float +): + """ + Wait for an event from event_queue whose type is in expected_types within the specified timeout. + """ + start_time = time.time() + while True: + remaining = timeout - (time.time() - start_time) + if remaining <= 0: + raise TimeoutError(f"Timeout waiting for event(s): {expected_types}") + evt = await asyncio.wait_for(event_queue.get(), timeout=remaining) + evt_type = evt.get("type", "") + if evt_type in expected_types: + return evt + elif evt_type == "error": + raise Exception(f"Error event: {evt.get('error')}") + + +class OpenAISTTTranscriptionSession(StreamedTranscriptionSession): + """A transcription session for OpenAI's STT model.""" + + def __init__( + self, + input: StreamedAudioInput, + client: AsyncOpenAI, + model: str, + settings: STTModelSettings, + trace_include_sensitive_data: bool, + trace_include_sensitive_audio_data: bool, + ): + self.connected: bool = False + self._client = client + self._model = model + self._settings = settings + self._turn_detection = settings.turn_detection or DEFAULT_TURN_DETECTION + self._trace_include_sensitive_data = trace_include_sensitive_data + self._trace_include_sensitive_audio_data = trace_include_sensitive_audio_data + + self._input_queue: asyncio.Queue[npt.NDArray[np.int16 | np.float32]] = input.queue + self._output_queue: asyncio.Queue[str | ErrorSentinel | SessionCompleteSentinel] = ( + asyncio.Queue() + ) + self._websocket: websockets.ClientConnection | None = None + self._event_queue: asyncio.Queue[dict[str, Any] | WebsocketDoneSentinel] = asyncio.Queue() + self._state_queue: asyncio.Queue[dict[str, Any]] = asyncio.Queue() + self._turn_audio_buffer: list[npt.NDArray[np.int16 | np.float32]] = [] + self._tracing_span: Span[TranscriptionSpanData] | None = None + + # tasks + self._listener_task: asyncio.Task[Any] | None = None + self._process_events_task: asyncio.Task[Any] | None = None + self._stream_audio_task: asyncio.Task[Any] | None = None + self._connection_task: asyncio.Task[Any] | None = None + self._stored_exception: Exception | None = None + + def _start_turn(self) -> None: + self._tracing_span = transcription_span( + model=self._model, + model_config={ + "temperature": self._settings.temperature, + "language": self._settings.language, + "prompt": self._settings.prompt, + "turn_detection": self._turn_detection, + }, + ) + self._tracing_span.start() + + def _end_turn(self, _transcript: str) -> None: + if len(_transcript) < 1: + return + + if self._tracing_span: + if self._trace_include_sensitive_audio_data: + self._tracing_span.span_data.input = _audio_to_base64(self._turn_audio_buffer) + + self._tracing_span.span_data.input_format = "pcm" + + if self._trace_include_sensitive_data: + self._tracing_span.span_data.output = _transcript + + self._tracing_span.finish() + self._turn_audio_buffer = [] + self._tracing_span = None + + async def _event_listener(self) -> None: + assert self._websocket is not None, "Websocket not initialized" + + async for message in self._websocket: + try: + event = json.loads(message) + + if event.get("type") == "error": + raise STTWebsocketConnectionError(f"Error event: {event.get('error')}") + + if event.get("type") in [ + "session.updated", + "transcription_session.updated", + "session.created", + "transcription_session.created", + ]: + await self._state_queue.put(event) + + await self._event_queue.put(event) + except Exception as e: + await self._output_queue.put(ErrorSentinel(e)) + raise STTWebsocketConnectionError("Error parsing events") from e + await self._event_queue.put(WebsocketDoneSentinel()) + + async def _configure_session(self) -> None: + assert self._websocket is not None, "Websocket not initialized" + await self._websocket.send( + json.dumps( + { + "type": "transcription_session.update", + "session": { + "input_audio_format": "pcm16", + "input_audio_transcription": {"model": self._model}, + "turn_detection": self._turn_detection, + }, + } + ) + ) + + async def _setup_connection(self, ws: websockets.ClientConnection) -> None: + self._websocket = ws + self._listener_task = asyncio.create_task(self._event_listener()) + + try: + event = await _wait_for_event( + self._state_queue, + ["session.created", "transcription_session.created"], + SESSION_CREATION_TIMEOUT, + ) + except TimeoutError as e: + wrapped_err = STTWebsocketConnectionError( + "Timeout waiting for transcription_session.created event" + ) + await self._output_queue.put(ErrorSentinel(wrapped_err)) + raise wrapped_err from e + except Exception as e: + await self._output_queue.put(ErrorSentinel(e)) + raise e + + await self._configure_session() + + try: + event = await _wait_for_event( + self._state_queue, + ["session.updated", "transcription_session.updated"], + SESSION_UPDATE_TIMEOUT, + ) + if _debug.DONT_LOG_MODEL_DATA: + logger.debug("Session updated") + else: + logger.debug(f"Session updated: {event}") + except TimeoutError as e: + wrapped_err = STTWebsocketConnectionError( + "Timeout waiting for transcription_session.updated event" + ) + await self._output_queue.put(ErrorSentinel(wrapped_err)) + raise wrapped_err from e + except Exception as e: + await self._output_queue.put(ErrorSentinel(e)) + raise + + async def _handle_events(self) -> None: + while True: + try: + event = await asyncio.wait_for( + self._event_queue.get(), timeout=EVENT_INACTIVITY_TIMEOUT + ) + if isinstance(event, WebsocketDoneSentinel): + # processed all events and websocket is done + break + + event_type = event.get("type", "unknown") + if event_type == "conversation.item.input_audio_transcription.completed": + transcript = cast(str, event.get("transcript", "")) + if len(transcript) > 0: + self._end_turn(transcript) + self._start_turn() + await self._output_queue.put(transcript) + await asyncio.sleep(0) # yield control + except asyncio.TimeoutError: + # No new events for a while. Assume the session is done. + break + except Exception as e: + await self._output_queue.put(ErrorSentinel(e)) + raise e + await self._output_queue.put(SessionCompleteSentinel()) + + async def _stream_audio( + self, audio_queue: asyncio.Queue[npt.NDArray[np.int16 | np.float32]] + ) -> None: + assert self._websocket is not None, "Websocket not initialized" + self._start_turn() + while True: + buffer = await audio_queue.get() + if buffer is None: + break + + self._turn_audio_buffer.append(buffer) + try: + await self._websocket.send( + json.dumps( + { + "type": "input_audio_buffer.append", + "audio": base64.b64encode(buffer.tobytes()).decode("utf-8"), + } + ) + ) + except websockets.ConnectionClosed: + break + except Exception as e: + await self._output_queue.put(ErrorSentinel(e)) + raise e + + await asyncio.sleep(0) # yield control + + async def _process_websocket_connection(self) -> None: + try: + async with websockets.connect( + "wss://api.openai.com/v1/realtime?intent=transcription", + additional_headers={ + "Authorization": f"Bearer {self._client.api_key}", + "OpenAI-Beta": "realtime=v1", + "OpenAI-Log-Session": "1", + }, + ) as ws: + await self._setup_connection(ws) + self._process_events_task = asyncio.create_task(self._handle_events()) + self._stream_audio_task = asyncio.create_task(self._stream_audio(self._input_queue)) + self.connected = True + if self._listener_task: + await self._listener_task + else: + logger.error("Listener task not initialized") + raise AgentsException("Listener task not initialized") + except Exception as e: + await self._output_queue.put(ErrorSentinel(e)) + raise e + + def _check_errors(self) -> None: + if self._connection_task and self._connection_task.done(): + exc = self._connection_task.exception() + if exc and isinstance(exc, Exception): + self._stored_exception = exc + + if self._process_events_task and self._process_events_task.done(): + exc = self._process_events_task.exception() + if exc and isinstance(exc, Exception): + self._stored_exception = exc + + if self._stream_audio_task and self._stream_audio_task.done(): + exc = self._stream_audio_task.exception() + if exc and isinstance(exc, Exception): + self._stored_exception = exc + + if self._listener_task and self._listener_task.done(): + exc = self._listener_task.exception() + if exc and isinstance(exc, Exception): + self._stored_exception = exc + + def _cleanup_tasks(self) -> None: + if self._listener_task and not self._listener_task.done(): + self._listener_task.cancel() + + if self._process_events_task and not self._process_events_task.done(): + self._process_events_task.cancel() + + if self._stream_audio_task and not self._stream_audio_task.done(): + self._stream_audio_task.cancel() + + if self._connection_task and not self._connection_task.done(): + self._connection_task.cancel() + + async def transcribe_turns(self) -> AsyncIterator[str]: + self._connection_task = asyncio.create_task(self._process_websocket_connection()) + + while True: + try: + turn = await self._output_queue.get() + except asyncio.CancelledError: + break + + if ( + turn is None + or isinstance(turn, ErrorSentinel) + or isinstance(turn, SessionCompleteSentinel) + ): + self._output_queue.task_done() + break + yield turn + self._output_queue.task_done() + + if self._tracing_span: + self._end_turn("") + + if self._websocket: + await self._websocket.close() + + self._check_errors() + if self._stored_exception: + raise self._stored_exception + + async def close(self) -> None: + if self._websocket: + await self._websocket.close() + + self._cleanup_tasks() + + +class OpenAISTTModel(STTModel): + """A speech-to-text model for OpenAI.""" + + def __init__( + self, + model: str, + openai_client: AsyncOpenAI, + ): + """Create a new OpenAI speech-to-text model. + + Args: + model: The name of the model to use. + openai_client: The OpenAI client to use. + """ + self.model = model + self._client = openai_client + + @property + def model_name(self) -> str: + return self.model + + def _non_null_or_not_given(self, value: Any) -> Any: + return value if value is not None else None # NOT_GIVEN + + async def transcribe( + self, + input: AudioInput, + settings: STTModelSettings, + trace_include_sensitive_data: bool, + trace_include_sensitive_audio_data: bool, + ) -> str: + """Transcribe an audio input. + + Args: + input: The audio input to transcribe. + settings: The settings to use for the transcription. + + Returns: + The transcribed text. + """ + with transcription_span( + model=self.model, + input=input.to_base64() if trace_include_sensitive_audio_data else "", + input_format="pcm", + model_config={ + "temperature": self._non_null_or_not_given(settings.temperature), + "language": self._non_null_or_not_given(settings.language), + "prompt": self._non_null_or_not_given(settings.prompt), + }, + ) as span: + try: + response = await self._client.audio.transcriptions.create( + model=self.model, + file=input.to_audio_file(), + prompt=self._non_null_or_not_given(settings.prompt), + language=self._non_null_or_not_given(settings.language), + temperature=self._non_null_or_not_given(settings.temperature), + ) + if trace_include_sensitive_data: + span.span_data.output = response.text + return response.text + except Exception as e: + span.span_data.output = "" + span.set_error(SpanError(message=str(e), data={})) + raise e + + async def create_session( + self, + input: StreamedAudioInput, + settings: STTModelSettings, + trace_include_sensitive_data: bool, + trace_include_sensitive_audio_data: bool, + ) -> StreamedTranscriptionSession: + """Create a new transcription session. + + Args: + input: The audio input to transcribe. + settings: The settings to use for the transcription. + trace_include_sensitive_data: Whether to include sensitive data in traces. + trace_include_sensitive_audio_data: Whether to include sensitive audio data in traces. + + Returns: + A new transcription session. + """ + return OpenAISTTTranscriptionSession( + input, + self._client, + self.model, + settings, + trace_include_sensitive_data, + trace_include_sensitive_audio_data, + ) diff --git a/src/agents/voice/models/openai_tts.py b/src/agents/voice/models/openai_tts.py new file mode 100644 index 000000000..3b7dcf150 --- /dev/null +++ b/src/agents/voice/models/openai_tts.py @@ -0,0 +1,54 @@ +from collections.abc import AsyncIterator +from typing import Literal + +from openai import AsyncOpenAI + +from ..model import TTSModel, TTSModelSettings + +DEFAULT_VOICE: Literal["ash"] = "ash" + + +class OpenAITTSModel(TTSModel): + """A text-to-speech model for OpenAI.""" + + def __init__( + self, + model: str, + openai_client: AsyncOpenAI, + ): + """Create a new OpenAI text-to-speech model. + + Args: + model: The name of the model to use. + openai_client: The OpenAI client to use. + """ + self.model = model + self._client = openai_client + + @property + def model_name(self) -> str: + return self.model + + async def run(self, text: str, settings: TTSModelSettings) -> AsyncIterator[bytes]: + """Run the text-to-speech model. + + Args: + text: The text to convert to speech. + settings: The settings to use for the text-to-speech model. + + Returns: + An iterator of audio chunks. + """ + response = self._client.audio.speech.with_streaming_response.create( + model=self.model, + voice=settings.voice or DEFAULT_VOICE, + input=text, + response_format="pcm", + extra_body={ + "instructions": settings.instructions, + }, + ) + + async with response as stream: + async for chunk in stream.iter_bytes(chunk_size=1024): + yield chunk diff --git a/src/agents/voice/pipeline.py b/src/agents/voice/pipeline.py new file mode 100644 index 000000000..d1dac57cf --- /dev/null +++ b/src/agents/voice/pipeline.py @@ -0,0 +1,151 @@ +from __future__ import annotations + +import asyncio + +from .._run_impl import TraceCtxManager +from ..exceptions import UserError +from ..logger import logger +from .input import AudioInput, StreamedAudioInput +from .model import STTModel, TTSModel +from .pipeline_config import VoicePipelineConfig +from .result import StreamedAudioResult +from .workflow import VoiceWorkflowBase + + +class VoicePipeline: + """An opinionated voice agent pipeline. It works in three steps: + 1. Transcribe audio input into text. + 2. Run the provided `workflow`, which produces a sequence of text responses. + 3. Convert the text responses into streaming audio output. + """ + + def __init__( + self, + *, + workflow: VoiceWorkflowBase, + stt_model: STTModel | str | None = None, + tts_model: TTSModel | str | None = None, + config: VoicePipelineConfig | None = None, + ): + """Create a new voice pipeline. + + Args: + workflow: The workflow to run. See `VoiceWorkflowBase`. + stt_model: The speech-to-text model to use. If not provided, a default OpenAI + model will be used. + tts_model: The text-to-speech model to use. If not provided, a default OpenAI + model will be used. + config: The pipeline configuration. If not provided, a default configuration will be + used. + """ + self.workflow = workflow + self.stt_model = stt_model if isinstance(stt_model, STTModel) else None + self.tts_model = tts_model if isinstance(tts_model, TTSModel) else None + self._stt_model_name = stt_model if isinstance(stt_model, str) else None + self._tts_model_name = tts_model if isinstance(tts_model, str) else None + self.config = config or VoicePipelineConfig() + + async def run(self, audio_input: AudioInput | StreamedAudioInput) -> StreamedAudioResult: + """Run the voice pipeline. + + Args: + audio_input: The audio input to process. This can either be an `AudioInput` instance, + which is a single static buffer, or a `StreamedAudioInput` instance, which is a + stream of audio data that you can append to. + + Returns: + A `StreamedAudioResult` instance. You can use this object to stream audio events and + play them out. + """ + if isinstance(audio_input, AudioInput): + return await self._run_single_turn(audio_input) + elif isinstance(audio_input, StreamedAudioInput): + return await self._run_multi_turn(audio_input) + else: + raise UserError(f"Unsupported audio input type: {type(audio_input)}") + + def _get_tts_model(self) -> TTSModel: + if not self.tts_model: + self.tts_model = self.config.model_provider.get_tts_model(self._tts_model_name) + return self.tts_model + + def _get_stt_model(self) -> STTModel: + if not self.stt_model: + self.stt_model = self.config.model_provider.get_stt_model(self._stt_model_name) + return self.stt_model + + async def _process_audio_input(self, audio_input: AudioInput) -> str: + model = self._get_stt_model() + return await model.transcribe( + audio_input, + self.config.stt_settings, + self.config.trace_include_sensitive_data, + self.config.trace_include_sensitive_audio_data, + ) + + async def _run_single_turn(self, audio_input: AudioInput) -> StreamedAudioResult: + # Since this is single turn, we can use the TraceCtxManager to manage starting/ending the + # trace + with TraceCtxManager( + workflow_name=self.config.workflow_name or "Voice Agent", + trace_id=None, # Automatically generated + group_id=self.config.group_id, + metadata=self.config.trace_metadata, + disabled=self.config.tracing_disabled, + ): + input_text = await self._process_audio_input(audio_input) + + output = StreamedAudioResult( + self._get_tts_model(), self.config.tts_settings, self.config + ) + + async def stream_events(): + try: + async for text_event in self.workflow.run(input_text): + await output._add_text(text_event) + await output._turn_done() + await output._done() + except Exception as e: + logger.error(f"Error processing single turn: {e}") + await output._add_error(e) + raise e + + output._set_task(asyncio.create_task(stream_events())) + return output + + async def _run_multi_turn(self, audio_input: StreamedAudioInput) -> StreamedAudioResult: + with TraceCtxManager( + workflow_name=self.config.workflow_name or "Voice Agent", + trace_id=None, + group_id=self.config.group_id, + metadata=self.config.trace_metadata, + disabled=self.config.tracing_disabled, + ): + output = StreamedAudioResult( + self._get_tts_model(), self.config.tts_settings, self.config + ) + + transcription_session = await self._get_stt_model().create_session( + audio_input, + self.config.stt_settings, + self.config.trace_include_sensitive_data, + self.config.trace_include_sensitive_audio_data, + ) + + async def process_turns(): + try: + async for input_text in transcription_session.transcribe_turns(): + result = self.workflow.run(input_text) + async for text_event in result: + await output._add_text(text_event) + await output._turn_done() + except Exception as e: + logger.error(f"Error processing turns: {e}") + await output._add_error(e) + raise e + finally: + await transcription_session.close() + await output._done() + + output._set_task(asyncio.create_task(process_turns())) + return output diff --git a/src/agents/voice/pipeline_config.py b/src/agents/voice/pipeline_config.py new file mode 100644 index 000000000..a4871612b --- /dev/null +++ b/src/agents/voice/pipeline_config.py @@ -0,0 +1,46 @@ +from __future__ import annotations + +from dataclasses import dataclass, field +from typing import Any + +from ..tracing.util import gen_group_id +from .model import STTModelSettings, TTSModelSettings, VoiceModelProvider +from .models.openai_model_provider import OpenAIVoiceModelProvider + + +@dataclass +class VoicePipelineConfig: + """Configuration for a `VoicePipeline`.""" + + model_provider: VoiceModelProvider = field(default_factory=OpenAIVoiceModelProvider) + """The voice model provider to use for the pipeline. Defaults to OpenAI.""" + + tracing_disabled: bool = False + """Whether to disable tracing of the pipeline. Defaults to `False`.""" + + trace_include_sensitive_data: bool = True + """Whether to include sensitive data in traces. Defaults to `True`. This is specifically for the + voice pipeline, and not for anything that goes on inside your Workflow.""" + + trace_include_sensitive_audio_data: bool = True + """Whether to include audio data in traces. Defaults to `True`.""" + + workflow_name: str = "Voice Agent" + """The name of the workflow to use for tracing. Defaults to `Voice Agent`.""" + + group_id: str = field(default_factory=gen_group_id) + """ + A grouping identifier to use for tracing, to link multiple traces from the same conversation + or process. If not provided, we will create a random group ID. + """ + + trace_metadata: dict[str, Any] | None = None + """ + An optional dictionary of additional metadata to include with the trace. + """ + + stt_settings: STTModelSettings = field(default_factory=STTModelSettings) + """The settings to use for the STT model.""" + + tts_settings: TTSModelSettings = field(default_factory=TTSModelSettings) + """The settings to use for the TTS model.""" diff --git a/src/agents/voice/result.py b/src/agents/voice/result.py new file mode 100644 index 000000000..fea79902e --- /dev/null +++ b/src/agents/voice/result.py @@ -0,0 +1,287 @@ +from __future__ import annotations + +import asyncio +import base64 +from collections.abc import AsyncIterator +from typing import Any + +from ..exceptions import UserError +from ..logger import logger +from ..tracing import Span, SpeechGroupSpanData, speech_group_span, speech_span +from ..tracing.util import time_iso +from .events import ( + VoiceStreamEvent, + VoiceStreamEventAudio, + VoiceStreamEventError, + VoiceStreamEventLifecycle, +) +from .imports import np, npt +from .model import TTSModel, TTSModelSettings +from .pipeline_config import VoicePipelineConfig + + +def _audio_to_base64(audio_data: list[bytes]) -> str: + joined_audio_data = b"".join(audio_data) + return base64.b64encode(joined_audio_data).decode("utf-8") + + +class StreamedAudioResult: + """The output of a `VoicePipeline`. Streams events and audio data as they're generated.""" + + def __init__( + self, + tts_model: TTSModel, + tts_settings: TTSModelSettings, + voice_pipeline_config: VoicePipelineConfig, + ): + """Create a new `StreamedAudioResult` instance. + + Args: + tts_model: The TTS model to use. + tts_settings: The TTS settings to use. + voice_pipeline_config: The voice pipeline config to use. + """ + self.tts_model = tts_model + self.tts_settings = tts_settings + self.total_output_text = "" + self.instructions = tts_settings.instructions + self.text_generation_task: asyncio.Task[Any] | None = None + + self._voice_pipeline_config = voice_pipeline_config + self._text_buffer = "" + self._turn_text_buffer = "" + self._queue: asyncio.Queue[VoiceStreamEvent] = asyncio.Queue() + self._tasks: list[asyncio.Task[Any]] = [] + self._ordered_tasks: list[ + asyncio.Queue[VoiceStreamEvent | None] + ] = [] # New: list to hold local queues for each text segment + self._dispatcher_task: asyncio.Task[Any] | None = ( + None # Task to dispatch audio chunks in order + ) + + self._done_processing = False + self._buffer_size = tts_settings.buffer_size + self._started_processing_turn = False + self._first_byte_received = False + self._generation_start_time: str | None = None + self._completed_session = False + self._stored_exception: BaseException | None = None + self._tracing_span: Span[SpeechGroupSpanData] | None = None + + async def _start_turn(self): + if self._started_processing_turn: + return + + self._tracing_span = speech_group_span() + self._tracing_span.start() + self._started_processing_turn = True + self._first_byte_received = False + self._generation_start_time = time_iso() + await self._queue.put(VoiceStreamEventLifecycle(event="turn_started")) + + def _set_task(self, task: asyncio.Task[Any]): + self.text_generation_task = task + + async def _add_error(self, error: Exception): + await self._queue.put(VoiceStreamEventError(error)) + + def _transform_audio_buffer( + self, buffer: list[bytes], output_dtype: npt.DTypeLike + ) -> npt.NDArray[np.int16 | np.float32]: + np_array = np.frombuffer(b"".join(buffer), dtype=np.int16) + + if output_dtype == np.int16: + return np_array + elif output_dtype == np.float32: + return (np_array.astype(np.float32) / 32767.0).reshape(-1, 1) + else: + raise UserError("Invalid output dtype") + + async def _stream_audio( + self, + text: str, + local_queue: asyncio.Queue[VoiceStreamEvent | None], + finish_turn: bool = False, + ): + with speech_span( + model=self.tts_model.model_name, + input=text if self._voice_pipeline_config.trace_include_sensitive_data else "", + model_config={ + "voice": self.tts_settings.voice, + "instructions": self.instructions, + "speed": self.tts_settings.speed, + }, + output_format="pcm", + parent=self._tracing_span, + ) as tts_span: + try: + first_byte_received = False + buffer: list[bytes] = [] + full_audio_data: list[bytes] = [] + + async for chunk in self.tts_model.run(text, self.tts_settings): + if not first_byte_received: + first_byte_received = True + tts_span.span_data.first_content_at = time_iso() + + if chunk: + buffer.append(chunk) + full_audio_data.append(chunk) + if len(buffer) >= self._buffer_size: + audio_np = self._transform_audio_buffer(buffer, self.tts_settings.dtype) + if self.tts_settings.transform_data: + audio_np = self.tts_settings.transform_data(audio_np) + await local_queue.put( + VoiceStreamEventAudio(data=audio_np) + ) # Use local queue + buffer = [] + if buffer: + audio_np = self._transform_audio_buffer(buffer, self.tts_settings.dtype) + if self.tts_settings.transform_data: + audio_np = self.tts_settings.transform_data(audio_np) + await local_queue.put(VoiceStreamEventAudio(data=audio_np)) # Use local queue + + if self._voice_pipeline_config.trace_include_sensitive_audio_data: + tts_span.span_data.output = _audio_to_base64(full_audio_data) + else: + tts_span.span_data.output = "" + + if finish_turn: + await local_queue.put(VoiceStreamEventLifecycle(event="turn_ended")) + else: + await local_queue.put(None) # Signal completion for this segment + except Exception as e: + tts_span.set_error( + { + "message": str(e), + "data": { + "text": text + if self._voice_pipeline_config.trace_include_sensitive_data + else "", + }, + } + ) + logger.error(f"Error streaming audio: {e}") + + # Signal completion for whole session because of error + await local_queue.put(VoiceStreamEventLifecycle(event="session_ended")) + raise e + + async def _add_text(self, text: str): + await self._start_turn() + + self._text_buffer += text + self.total_output_text += text + self._turn_text_buffer += text + + combined_sentences, self._text_buffer = self.tts_settings.text_splitter(self._text_buffer) + + if len(combined_sentences) >= 20: + local_queue: asyncio.Queue[VoiceStreamEvent | None] = asyncio.Queue() + self._ordered_tasks.append(local_queue) + self._tasks.append( + asyncio.create_task(self._stream_audio(combined_sentences, local_queue)) + ) + if self._dispatcher_task is None: + self._dispatcher_task = asyncio.create_task(self._dispatch_audio()) + + async def _turn_done(self): + if self._text_buffer: + local_queue: asyncio.Queue[VoiceStreamEvent | None] = asyncio.Queue() + self._ordered_tasks.append(local_queue) # Append the local queue for the final segment + self._tasks.append( + asyncio.create_task( + self._stream_audio(self._text_buffer, local_queue, finish_turn=True) + ) + ) + self._text_buffer = "" + self._done_processing = True + if self._dispatcher_task is None: + self._dispatcher_task = asyncio.create_task(self._dispatch_audio()) + await asyncio.gather(*self._tasks) + + def _finish_turn(self): + if self._tracing_span: + if self._voice_pipeline_config.trace_include_sensitive_data: + self._tracing_span.span_data.input = self._turn_text_buffer + else: + self._tracing_span.span_data.input = "" + + self._tracing_span.finish() + self._tracing_span = None + self._turn_text_buffer = "" + self._started_processing_turn = False + + async def _done(self): + self._completed_session = True + await self._wait_for_completion() + + async def _dispatch_audio(self): + # Dispatch audio chunks from each segment in the order they were added + while True: + if len(self._ordered_tasks) == 0: + if self._completed_session: + break + await asyncio.sleep(0) + continue + local_queue = self._ordered_tasks.pop(0) + while True: + chunk = await local_queue.get() + if chunk is None: + break + await self._queue.put(chunk) + if isinstance(chunk, VoiceStreamEventLifecycle): + local_queue.task_done() + if chunk.event == "turn_ended": + self._finish_turn() + break + await self._queue.put(VoiceStreamEventLifecycle(event="session_ended")) + + async def _wait_for_completion(self): + tasks: list[asyncio.Task[Any]] = self._tasks + if self._dispatcher_task is not None: + tasks.append(self._dispatcher_task) + await asyncio.gather(*tasks) + + def _cleanup_tasks(self): + self._finish_turn() + + for task in self._tasks: + if not task.done(): + task.cancel() + + if self._dispatcher_task and not self._dispatcher_task.done(): + self._dispatcher_task.cancel() + + if self.text_generation_task and not self.text_generation_task.done(): + self.text_generation_task.cancel() + + def _check_errors(self): + for task in self._tasks: + if task.done(): + if task.exception(): + self._stored_exception = task.exception() + break + + async def stream(self) -> AsyncIterator[VoiceStreamEvent]: + """Stream the events and audio data as they're generated.""" + while True: + try: + event = await self._queue.get() + except asyncio.CancelledError: + break + if isinstance(event, VoiceStreamEventError): + self._stored_exception = event.error + logger.error(f"Error processing output: {event.error}") + break + if event is None: + break + yield event + if event.type == "voice_stream_event_lifecycle" and event.event == "session_ended": + break + + self._check_errors() + self._cleanup_tasks() + + if self._stored_exception: + raise self._stored_exception diff --git a/src/agents/voice/utils.py b/src/agents/voice/utils.py new file mode 100644 index 000000000..1535bd0d4 --- /dev/null +++ b/src/agents/voice/utils.py @@ -0,0 +1,37 @@ +import re +from typing import Callable + + +def get_sentence_based_splitter( + min_sentence_length: int = 20, +) -> Callable[[str], tuple[str, str]]: + """Returns a function that splits text into chunks based on sentence boundaries. + + Args: + min_sentence_length: The minimum length of a sentence to be included in a chunk. + + Returns: + A function that splits text into chunks based on sentence boundaries. + """ + + def sentence_based_text_splitter(text_buffer: str) -> tuple[str, str]: + """ + A function to split the text into chunks. This is useful if you want to split the text into + chunks before sending it to the TTS model rather than waiting for the whole text to be + processed. + + Args: + text_buffer: The text to split. + + Returns: + A tuple of the text to process and the remaining text buffer. + """ + sentences = re.split(r"(?<=[.!?])\s+", text_buffer.strip()) + if len(sentences) >= 1: + combined_sentences = " ".join(sentences[:-1]) + if len(combined_sentences) >= min_sentence_length: + remaining_text_buffer = sentences[-1] + return combined_sentences, remaining_text_buffer + return "", text_buffer + + return sentence_based_text_splitter diff --git a/src/agents/voice/workflow.py b/src/agents/voice/workflow.py new file mode 100644 index 000000000..c706ec413 --- /dev/null +++ b/src/agents/voice/workflow.py @@ -0,0 +1,93 @@ +from __future__ import annotations + +import abc +from collections.abc import AsyncIterator +from typing import Any + +from ..agent import Agent +from ..items import TResponseInputItem +from ..result import RunResultStreaming +from ..run import Runner + + +class VoiceWorkflowBase(abc.ABC): + """ + A base class for a voice workflow. You must implement the `run` method. A "workflow" is any + code you want, that receives a transcription and yields text that will be turned into speech + by a text-to-speech model. + In most cases, you'll create `Agent`s and use `Runner.run_streamed()` to run them, returning + some or all of the text events from the stream. You can use the `VoiceWorkflowHelper` class to + help with extracting text events from the stream. + If you have a simple workflow that has a single starting agent and no custom logic, you can + use `SingleAgentVoiceWorkflow` directly. + """ + + @abc.abstractmethod + def run(self, transcription: str) -> AsyncIterator[str]: + """ + Run the voice workflow. You will receive an input transcription, and must yield text that + will be spoken to the user. You can run whatever logic you want here. In most cases, the + final logic will involve calling `Runner.run_streamed()` and yielding any text events from + the stream. + """ + pass + + +class VoiceWorkflowHelper: + @classmethod + async def stream_text_from(cls, result: RunResultStreaming) -> AsyncIterator[str]: + """Wraps a `RunResultStreaming` object and yields text events from the stream.""" + async for event in result.stream_events(): + if ( + event.type == "raw_response_event" + and event.data.type == "response.output_text.delta" + ): + yield event.data.delta + + +class SingleAgentWorkflowCallbacks: + def on_run(self, workflow: SingleAgentVoiceWorkflow, transcription: str) -> None: + """Called when the workflow is run.""" + pass + + +class SingleAgentVoiceWorkflow(VoiceWorkflowBase): + """A simple voice workflow that runs a single agent. Each transcription and result is added to + the input history. + For more complex workflows (e.g. multiple Runner calls, custom message history, custom logic, + custom configs), subclass `VoiceWorkflowBase` and implement your own logic. + """ + + def __init__(self, agent: Agent[Any], callbacks: SingleAgentWorkflowCallbacks | None = None): + """Create a new single agent voice workflow. + + Args: + agent: The agent to run. + callbacks: Optional callbacks to call during the workflow. + """ + self._input_history: list[TResponseInputItem] = [] + self._current_agent = agent + self._callbacks = callbacks + + async def run(self, transcription: str) -> AsyncIterator[str]: + if self._callbacks: + self._callbacks.on_run(self, transcription) + + # Add the transcription to the input history + self._input_history.append( + { + "role": "user", + "content": transcription, + } + ) + + # Run the agent + result = Runner.run_streamed(self._current_agent, self._input_history) + + # Stream the text from the result + async for chunk in VoiceWorkflowHelper.stream_text_from(result): + yield chunk + + # Update the input history and current agent + self._input_history = result.to_input_list() + self._current_agent = result.last_agent diff --git a/tests/voice/__init__.py b/tests/voice/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/voice/conftest.py b/tests/voice/conftest.py new file mode 100644 index 000000000..7eeb9cec0 --- /dev/null +++ b/tests/voice/conftest.py @@ -0,0 +1,14 @@ +import os +import sys + +import pytest + + +def pytest_collection_modifyitems(config, items): + if sys.version_info[:2] == (3, 9): + this_dir = os.path.dirname(__file__) + skip_marker = pytest.mark.skip(reason="Skipped on Python 3.9") + + for item in items: + if item.fspath.dirname.startswith(this_dir): + item.add_marker(skip_marker) diff --git a/tests/voice/fake_models.py b/tests/voice/fake_models.py new file mode 100644 index 000000000..3febe4286 --- /dev/null +++ b/tests/voice/fake_models.py @@ -0,0 +1,112 @@ +from __future__ import annotations + +from collections.abc import AsyncIterator +from typing import Literal + +import numpy as np +import numpy.typing as npt + +from agents.voice import ( + AudioInput, + StreamedAudioInput, + StreamedTranscriptionSession, + STTModel, + STTModelSettings, + TTSModel, + TTSModelSettings, + VoiceWorkflowBase, +) + + +class FakeTTS(TTSModel): + """Fakes TTS by just returning string bytes.""" + + def __init__(self, strategy: Literal["default", "split_words"] = "default"): + self.strategy = strategy + + @property + def model_name(self) -> str: + return "fake_tts" + + async def run(self, text: str, settings: TTSModelSettings) -> AsyncIterator[bytes]: + if self.strategy == "default": + yield np.zeros(2, dtype=np.int16).tobytes() + elif self.strategy == "split_words": + for _ in text.split(): + yield np.zeros(2, dtype=np.int16).tobytes() + + async def verify_audio(self, text: str, audio: bytes, dtype: npt.DTypeLike = np.int16) -> None: + assert audio == np.zeros(2, dtype=dtype).tobytes() + + async def verify_audio_chunks( + self, text: str, audio_chunks: list[bytes], dtype: npt.DTypeLike = np.int16 + ) -> None: + assert audio_chunks == [np.zeros(2, dtype=dtype).tobytes() for _word in text.split()] + + +class FakeSession(StreamedTranscriptionSession): + """A fake streamed transcription session that yields preconfigured transcripts.""" + + def __init__(self): + self.outputs: list[str] = [] + + async def transcribe_turns(self) -> AsyncIterator[str]: + for t in self.outputs: + yield t + + async def close(self) -> None: + return None + + +class FakeSTT(STTModel): + """A fake STT model that either returns a single transcript or yields multiple.""" + + def __init__(self, outputs: list[str] | None = None): + self.outputs = outputs or [] + + @property + def model_name(self) -> str: + return "fake_stt" + + async def transcribe(self, _: AudioInput, __: STTModelSettings, ___: bool, ____: bool) -> str: + return self.outputs.pop(0) + + async def create_session( + self, + _: StreamedAudioInput, + __: STTModelSettings, + ___: bool, + ____: bool, + ) -> StreamedTranscriptionSession: + session = FakeSession() + session.outputs = self.outputs + return session + + +class FakeWorkflow(VoiceWorkflowBase): + """A fake workflow that yields preconfigured outputs.""" + + def __init__(self, outputs: list[list[str]] | None = None): + self.outputs = outputs or [] + + def add_output(self, output: list[str]) -> None: + self.outputs.append(output) + + def add_multiple_outputs(self, outputs: list[list[str]]) -> None: + self.outputs.extend(outputs) + + async def run(self, _: str) -> AsyncIterator[str]: + if not self.outputs: + raise ValueError("No output configured") + output = self.outputs.pop(0) + for t in output: + yield t + + +class FakeStreamedAudioInput: + @classmethod + async def get(cls, count: int) -> StreamedAudioInput: + input = StreamedAudioInput() + for _ in range(count): + await input.add_audio(np.zeros(2, dtype=np.int16)) + return input diff --git a/tests/voice/helpers.py b/tests/voice/helpers.py new file mode 100644 index 000000000..d2f9ca2ea --- /dev/null +++ b/tests/voice/helpers.py @@ -0,0 +1,18 @@ +from agents.voice import StreamedAudioResult + + +async def extract_events(result: StreamedAudioResult) -> tuple[list[str], list[bytes]]: + """Collapse pipeline stream events to simple labels for ordering assertions.""" + flattened: list[str] = [] + audio_chunks: list[bytes] = [] + + async for ev in result.stream(): + if ev.type == "voice_stream_event_audio": + if ev.data is not None: + audio_chunks.append(ev.data.tobytes()) + flattened.append("audio") + elif ev.type == "voice_stream_event_lifecycle": + flattened.append(ev.event) + elif ev.type == "voice_stream_event_error": + flattened.append("error") + return flattened, audio_chunks diff --git a/tests/voice/test_input.py b/tests/voice/test_input.py new file mode 100644 index 000000000..7d4197b5c --- /dev/null +++ b/tests/voice/test_input.py @@ -0,0 +1,124 @@ +import io +import wave + +import numpy as np +import pytest + +from agents import UserError +from agents.voice import AudioInput, StreamedAudioInput +from agents.voice.input import DEFAULT_SAMPLE_RATE, _buffer_to_audio_file + + +def test_buffer_to_audio_file_int16(): + # Create a simple sine wave in int16 format + t = np.linspace(0, 1, DEFAULT_SAMPLE_RATE) + buffer = (np.sin(2 * np.pi * 440 * t) * 32767).astype(np.int16) + + filename, audio_file, content_type = _buffer_to_audio_file(buffer) + + assert filename == "audio.wav" + assert content_type == "audio/wav" + assert isinstance(audio_file, io.BytesIO) + + # Verify the WAV file contents + with wave.open(audio_file, "rb") as wav_file: + assert wav_file.getnchannels() == 1 + assert wav_file.getsampwidth() == 2 + assert wav_file.getframerate() == DEFAULT_SAMPLE_RATE + assert wav_file.getnframes() == len(buffer) + + +def test_buffer_to_audio_file_float32(): + # Create a simple sine wave in float32 format + t = np.linspace(0, 1, DEFAULT_SAMPLE_RATE) + buffer = np.sin(2 * np.pi * 440 * t).astype(np.float32) + + filename, audio_file, content_type = _buffer_to_audio_file(buffer) + + assert filename == "audio.wav" + assert content_type == "audio/wav" + assert isinstance(audio_file, io.BytesIO) + + # Verify the WAV file contents + with wave.open(audio_file, "rb") as wav_file: + assert wav_file.getnchannels() == 1 + assert wav_file.getsampwidth() == 2 + assert wav_file.getframerate() == DEFAULT_SAMPLE_RATE + assert wav_file.getnframes() == len(buffer) + + +def test_buffer_to_audio_file_invalid_dtype(): + # Create a buffer with invalid dtype (float64) + buffer = np.array([1.0, 2.0, 3.0], dtype=np.float64) + + with pytest.raises(UserError, match="Buffer must be a numpy array of int16 or float32"): + # Purposely ignore the type error + _buffer_to_audio_file(buffer) # type: ignore + + +class TestAudioInput: + def test_audio_input_default_params(self): + # Create a simple sine wave + t = np.linspace(0, 1, DEFAULT_SAMPLE_RATE) + buffer = np.sin(2 * np.pi * 440 * t).astype(np.float32) + + audio_input = AudioInput(buffer=buffer) + + assert audio_input.frame_rate == DEFAULT_SAMPLE_RATE + assert audio_input.sample_width == 2 + assert audio_input.channels == 1 + assert np.array_equal(audio_input.buffer, buffer) + + def test_audio_input_custom_params(self): + # Create a simple sine wave + t = np.linspace(0, 1, 48000) + buffer = np.sin(2 * np.pi * 440 * t).astype(np.float32) + + audio_input = AudioInput(buffer=buffer, frame_rate=48000, sample_width=4, channels=2) + + assert audio_input.frame_rate == 48000 + assert audio_input.sample_width == 4 + assert audio_input.channels == 2 + assert np.array_equal(audio_input.buffer, buffer) + + def test_audio_input_to_audio_file(self): + # Create a simple sine wave + t = np.linspace(0, 1, DEFAULT_SAMPLE_RATE) + buffer = np.sin(2 * np.pi * 440 * t).astype(np.float32) + + audio_input = AudioInput(buffer=buffer) + filename, audio_file, content_type = audio_input.to_audio_file() + + assert filename == "audio.wav" + assert content_type == "audio/wav" + assert isinstance(audio_file, io.BytesIO) + + # Verify the WAV file contents + with wave.open(audio_file, "rb") as wav_file: + assert wav_file.getnchannels() == 1 + assert wav_file.getsampwidth() == 2 + assert wav_file.getframerate() == DEFAULT_SAMPLE_RATE + assert wav_file.getnframes() == len(buffer) + + +class TestStreamedAudioInput: + @pytest.mark.asyncio + async def test_streamed_audio_input(self): + streamed_input = StreamedAudioInput() + + # Create some test audio data + t = np.linspace(0, 1, DEFAULT_SAMPLE_RATE) + audio1 = np.sin(2 * np.pi * 440 * t).astype(np.float32) + audio2 = np.sin(2 * np.pi * 880 * t).astype(np.float32) + + # Add audio to the queue + await streamed_input.add_audio(audio1) + await streamed_input.add_audio(audio2) + + # Verify the queue contents + assert streamed_input.queue.qsize() == 2 + # Test non-blocking get + assert np.array_equal(streamed_input.queue.get_nowait(), audio1) + # Test blocking get + assert np.array_equal(await streamed_input.queue.get(), audio2) + assert streamed_input.queue.empty() diff --git a/tests/voice/test_openai_stt.py b/tests/voice/test_openai_stt.py new file mode 100644 index 000000000..bb8d3cf82 --- /dev/null +++ b/tests/voice/test_openai_stt.py @@ -0,0 +1,365 @@ +# test_openai_stt_transcription_session.py + +import asyncio +import json +import time +from unittest.mock import AsyncMock, patch + +import numpy as np +import pytest + +from agents.voice import OpenAISTTTranscriptionSession, StreamedAudioInput, STTModelSettings +from agents.voice.exceptions import STTWebsocketConnectionError +from agents.voice.models.openai_stt import EVENT_INACTIVITY_TIMEOUT + +from .fake_models import FakeStreamedAudioInput + +# ===== Helpers ===== + + +def create_mock_websocket(messages: list[str]) -> AsyncMock: + """ + Creates a mock websocket (AsyncMock) that will return the provided incoming_messages + from __aiter__() as if they came from the server. + """ + + mock_ws = AsyncMock() + mock_ws.__aenter__.return_value = mock_ws + # The incoming_messages are strings that we pretend come from the server + mock_ws.__aiter__.return_value = iter(messages) + return mock_ws + + +def fake_time(increment: int): + current = 1000 + while True: + yield current + current += increment + + +# ===== Tests ===== +@pytest.mark.asyncio +async def test_non_json_messages_should_crash(): + """This tests that non-JSON messages will raise an exception""" + # Setup: mock websockets.connect + mock_ws = create_mock_websocket(["not a json message"]) + with patch("websockets.connect", return_value=mock_ws): + # Instantiate the session + input_audio = await FakeStreamedAudioInput.get(count=2) + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=input_audio, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + + with pytest.raises(STTWebsocketConnectionError): + # Start reading from transcribe_turns, which triggers _process_websocket_connection + turns = session.transcribe_turns() + + async for _ in turns: + pass + + await session.close() + + +@pytest.mark.asyncio +async def test_session_connects_and_configures_successfully(): + """ + Test that the session: + 1) Connects to the correct URL with correct headers. + 2) Receives a 'session.created' event. + 3) Sends an update message for session config. + 4) Receives a 'session.updated' event. + """ + # Setup: mock websockets.connect + mock_ws = create_mock_websocket( + [ + json.dumps({"type": "transcription_session.created"}), + json.dumps({"type": "transcription_session.updated"}), + ] + ) + with patch("websockets.connect", return_value=mock_ws) as mock_connect: + # Instantiate the session + input_audio = await FakeStreamedAudioInput.get(count=2) + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=input_audio, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + + # Start reading from transcribe_turns, which triggers _process_websocket_connection + turns = session.transcribe_turns() + + async for _ in turns: + pass + + # Check connect call + args, kwargs = mock_connect.call_args + assert "wss://api.openai.com/v1/realtime?intent=transcription" in args[0] + headers = kwargs.get("additional_headers", {}) + assert headers.get("Authorization") == "Bearer FAKE_KEY" + assert headers.get("OpenAI-Beta") == "realtime=v1" + assert headers.get("OpenAI-Log-Session") == "1" + + # Check that we sent a 'transcription_session.update' message + sent_messages = [call.args[0] for call in mock_ws.send.call_args_list] + assert any('"type": "transcription_session.update"' in msg for msg in sent_messages), ( + f"Expected 'transcription_session.update' in {sent_messages}" + ) + + await session.close() + + +@pytest.mark.asyncio +async def test_stream_audio_sends_correct_json(): + """ + Test that when audio is placed on the input queue, the session: + 1) Base64-encodes the data. + 2) Sends the correct JSON message over the websocket. + """ + # Simulate a single "transcription_session.created" and "transcription_session.updated" event, + # before we test streaming. + mock_ws = create_mock_websocket( + [ + json.dumps({"type": "transcription_session.created"}), + json.dumps({"type": "transcription_session.updated"}), + ] + ) + + with patch("websockets.connect", return_value=mock_ws): + # Prepare + audio_input = StreamedAudioInput() + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=audio_input, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + + # Kick off the transcribe_turns generator + turn_iter = session.transcribe_turns() + async for _ in turn_iter: + pass + + # Now push some audio data + + buffer1 = np.array([1, 2, 3, 4], dtype=np.int16) + await audio_input.add_audio(buffer1) + await asyncio.sleep(0.1) # give time for _stream_audio to consume + await asyncio.sleep(4) + + # Check that the websocket sent an "input_audio_buffer.append" message + found_audio_append = False + for call_arg in mock_ws.send.call_args_list: + print("call_arg", call_arg) + print("test", session._turn_audio_buffer) + sent_str = call_arg.args[0] + print("sent_str", sent_str) + if '"type": "input_audio_buffer.append"' in sent_str: + msg_dict = json.loads(sent_str) + assert msg_dict["type"] == "input_audio_buffer.append" + assert "audio" in msg_dict + found_audio_append = True + assert found_audio_append, "No 'input_audio_buffer.append' message was sent." + + await session.close() + + +@pytest.mark.asyncio +async def test_transcription_event_puts_output_in_queue(): + """ + Test that a 'conversation.item.input_audio_transcription.completed' event + yields a transcript from transcribe_turns(). + """ + mock_ws = create_mock_websocket( + [ + json.dumps({"type": "transcription_session.created"}), + json.dumps({"type": "transcription_session.updated"}), + # Once configured, we mock a completed transcription event: + json.dumps( + { + "type": "conversation.item.input_audio_transcription.completed", + "transcript": "Hello world!", + } + ), + ] + ) + + with patch("websockets.connect", return_value=mock_ws): + # Prepare + audio_input = await FakeStreamedAudioInput.get(count=2) + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=audio_input, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + turns = session.transcribe_turns() + + # We'll collect transcribed turns in a list + collected_turns = [] + async for turn in turns: + collected_turns.append(turn) + await session.close() + + # Check we got "Hello world!" + assert "Hello world!" in collected_turns + # Cleanup + + +@pytest.mark.asyncio +async def test_timeout_waiting_for_created_event(monkeypatch): + """ + If the 'session.created' event does not arrive before SESSION_CREATION_TIMEOUT, + the session should raise a TimeoutError. + """ + time_gen = fake_time(increment=30) # increment by 30 seconds each time + + # Define a replacement function that returns the next time + def fake_time_func(): + return next(time_gen) + + # Monkey-patch time.time with our fake_time_func + monkeypatch.setattr(time, "time", fake_time_func) + + mock_ws = create_mock_websocket( + [ + json.dumps({"type": "unknown"}), + ] + ) # add a fake event to the mock websocket to make sure it doesn't raise a different exception + + with patch("websockets.connect", return_value=mock_ws): + audio_input = await FakeStreamedAudioInput.get(count=2) + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=audio_input, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + turns = session.transcribe_turns() + + # We expect an exception once the generator tries to connect + wait for event + with pytest.raises(STTWebsocketConnectionError) as exc_info: + async for _ in turns: + pass + + assert "Timeout waiting for transcription_session.created event" in str(exc_info.value) + + await session.close() + + +@pytest.mark.asyncio +async def test_session_error_event(): + """ + If the session receives an event with "type": "error", it should propagate an exception + and put an ErrorSentinel in the output queue. + """ + mock_ws = create_mock_websocket( + [ + json.dumps({"type": "transcription_session.created"}), + json.dumps({"type": "transcription_session.updated"}), + # Then an error from the server + json.dumps({"type": "error", "error": "Simulated server error!"}), + ] + ) + + with patch("websockets.connect", return_value=mock_ws): + audio_input = await FakeStreamedAudioInput.get(count=2) + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=audio_input, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + + with pytest.raises(STTWebsocketConnectionError) as exc_info: + turns = session.transcribe_turns() + async for _ in turns: + pass + + assert "Simulated server error!" in str(exc_info.value) + + await session.close() + + +@pytest.mark.asyncio +async def test_inactivity_timeout(): + """ + Test that if no events arrive in EVENT_INACTIVITY_TIMEOUT ms, + _handle_events breaks out and a SessionCompleteSentinel is placed in the output queue. + """ + # We'll feed only the creation + updated events. Then do nothing. + # The handle_events loop should eventually time out. + mock_ws = create_mock_websocket( + [ + json.dumps({"type": "unknown"}), + json.dumps({"type": "unknown"}), + json.dumps({"type": "transcription_session.created"}), + json.dumps({"type": "transcription_session.updated"}), + ] + ) + + # We'll artificially manipulate the "time" to simulate inactivity quickly. + # The code checks time.time() for inactivity over EVENT_INACTIVITY_TIMEOUT. + # We'll increment the return_value manually. + with ( + patch("websockets.connect", return_value=mock_ws), + patch( + "time.time", + side_effect=[ + 1000.0, + 1000.0 + EVENT_INACTIVITY_TIMEOUT + 1, + 2000.0 + EVENT_INACTIVITY_TIMEOUT + 1, + 3000.0 + EVENT_INACTIVITY_TIMEOUT + 1, + 9999, + ], + ), + ): + audio_input = await FakeStreamedAudioInput.get(count=2) + stt_settings = STTModelSettings() + + session = OpenAISTTTranscriptionSession( + input=audio_input, + client=AsyncMock(api_key="FAKE_KEY"), + model="whisper-1", + settings=stt_settings, + trace_include_sensitive_data=False, + trace_include_sensitive_audio_data=False, + ) + + collected_turns: list[str] = [] + with pytest.raises(STTWebsocketConnectionError) as exc_info: + async for turn in session.transcribe_turns(): + collected_turns.append(turn) + + assert "Timeout waiting for transcription_session" in str(exc_info.value) + + assert len(collected_turns) == 0, "No transcripts expected, but we got something?" + + await session.close() diff --git a/tests/voice/test_openai_tts.py b/tests/voice/test_openai_tts.py new file mode 100644 index 000000000..0fbd6ba8e --- /dev/null +++ b/tests/voice/test_openai_tts.py @@ -0,0 +1,91 @@ +# Tests for the OpenAI text-to-speech model (OpenAITTSModel). + +from types import SimpleNamespace +from typing import Any + +import pytest + +from agents.voice import OpenAITTSModel, TTSModelSettings + + +class _FakeStreamResponse: + """A minimal async context manager to simulate streaming audio bytes.""" + + def __init__(self, chunks: list[bytes]): + self._chunks = chunks + + async def __aenter__(self) -> "_FakeStreamResponse": + return self + + async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: + return None + + async def iter_bytes(self, chunk_size: int = 1024): + for chunk in self._chunks: + yield chunk + + +def _make_fake_openai_client(fake_create) -> SimpleNamespace: + """Construct an object with nested audio.speech.with_streaming_response.create.""" + return SimpleNamespace( + audio=SimpleNamespace( + speech=SimpleNamespace(with_streaming_response=SimpleNamespace(create=fake_create)) + ) + ) + + +@pytest.mark.asyncio +async def test_openai_tts_default_voice_and_instructions() -> None: + """If no voice is specified, OpenAITTSModel uses its default voice and passes instructions.""" + chunks = [b"abc", b"def"] + captured: dict[str, object] = {} + + def fake_create( + *, model: str, voice: str, input: str, response_format: str, extra_body: dict[str, Any] + ) -> _FakeStreamResponse: + captured["model"] = model + captured["voice"] = voice + captured["input"] = input + captured["response_format"] = response_format + captured["extra_body"] = extra_body + return _FakeStreamResponse(chunks) + + client = _make_fake_openai_client(fake_create) + tts_model = OpenAITTSModel(model="test-model", openai_client=client) # type: ignore[arg-type] + settings = TTSModelSettings() + out: list[bytes] = [] + async for b in tts_model.run("hello world", settings): + out.append(b) + assert out == chunks + assert captured["model"] == "test-model" + assert captured["voice"] == "ash" + assert captured["input"] == "hello world" + assert captured["response_format"] == "pcm" + assert captured["extra_body"] == {"instructions": settings.instructions} + + +@pytest.mark.asyncio +async def test_openai_tts_custom_voice_and_instructions() -> None: + """Specifying voice and instructions are forwarded to the API.""" + chunks = [b"x"] + captured: dict[str, object] = {} + + def fake_create( + *, model: str, voice: str, input: str, response_format: str, extra_body: dict[str, Any] + ) -> _FakeStreamResponse: + captured["model"] = model + captured["voice"] = voice + captured["input"] = input + captured["response_format"] = response_format + captured["extra_body"] = extra_body + return _FakeStreamResponse(chunks) + + client = _make_fake_openai_client(fake_create) + tts_model = OpenAITTSModel(model="my-model", openai_client=client) # type: ignore[arg-type] + settings = TTSModelSettings(voice="fable", instructions="Custom instructions") + out: list[bytes] = [] + async for b in tts_model.run("hi", settings): + out.append(b) + assert out == chunks + assert captured["voice"] == "fable" + assert captured["extra_body"] == {"instructions": "Custom instructions"} diff --git a/tests/voice/test_pipeline.py b/tests/voice/test_pipeline.py new file mode 100644 index 000000000..f98802674 --- /dev/null +++ b/tests/voice/test_pipeline.py @@ -0,0 +1,176 @@ +from __future__ import annotations + +import numpy as np +import numpy.typing as npt +import pytest + +from agents.voice import AudioInput, TTSModelSettings, VoicePipeline, VoicePipelineConfig + +from .fake_models import FakeStreamedAudioInput, FakeSTT, FakeTTS, FakeWorkflow +from .helpers import extract_events + + +@pytest.mark.asyncio +async def test_voicepipeline_run_single_turn() -> None: + # Single turn. Should produce a single audio output, which is the TTS output for "out_1". + + fake_stt = FakeSTT(["first"]) + workflow = FakeWorkflow([["out_1"]]) + fake_tts = FakeTTS() + config = VoicePipelineConfig(tts_settings=TTSModelSettings(buffer_size=1)) + pipeline = VoicePipeline( + workflow=workflow, stt_model=fake_stt, tts_model=fake_tts, config=config + ) + audio_input = AudioInput(buffer=np.zeros(2, dtype=np.int16)) + result = await pipeline.run(audio_input) + events, audio_chunks = await extract_events(result) + assert events == [ + "turn_started", + "audio", + "turn_ended", + "session_ended", + ] + await fake_tts.verify_audio("out_1", audio_chunks[0]) + + +@pytest.mark.asyncio +async def test_voicepipeline_streamed_audio_input() -> None: + # Multi turn. Should produce 2 audio outputs, which are the TTS outputs of "out_1" and "out_2" + + fake_stt = FakeSTT(["first", "second"]) + workflow = FakeWorkflow([["out_1"], ["out_2"]]) + fake_tts = FakeTTS() + pipeline = VoicePipeline(workflow=workflow, stt_model=fake_stt, tts_model=fake_tts) + + streamed_audio_input = await FakeStreamedAudioInput.get(count=2) + + result = await pipeline.run(streamed_audio_input) + events, audio_chunks = await extract_events(result) + assert events == [ + "turn_started", + "audio", # out_1 + "turn_ended", + "turn_started", + "audio", # out_2 + "turn_ended", + "session_ended", + ] + assert len(audio_chunks) == 2 + await fake_tts.verify_audio("out_1", audio_chunks[0]) + await fake_tts.verify_audio("out_2", audio_chunks[1]) + + +@pytest.mark.asyncio +async def test_voicepipeline_run_single_turn_split_words() -> None: + # Single turn. Should produce multiple audio outputs, which are the TTS outputs of "foo bar baz" + # split into words and then "foo2 bar2 baz2" split into words. + + fake_stt = FakeSTT(["first"]) + workflow = FakeWorkflow([["foo bar baz"]]) + fake_tts = FakeTTS(strategy="split_words") + config = VoicePipelineConfig(tts_settings=TTSModelSettings(buffer_size=1)) + pipeline = VoicePipeline( + workflow=workflow, stt_model=fake_stt, tts_model=fake_tts, config=config + ) + audio_input = AudioInput(buffer=np.zeros(2, dtype=np.int16)) + result = await pipeline.run(audio_input) + events, audio_chunks = await extract_events(result) + assert events == [ + "turn_started", + "audio", # foo + "audio", # bar + "audio", # baz + "turn_ended", + "session_ended", + ] + await fake_tts.verify_audio_chunks("foo bar baz", audio_chunks) + + +@pytest.mark.asyncio +async def test_voicepipeline_run_multi_turn_split_words() -> None: + # Multi turn. Should produce multiple audio outputs, which are the TTS outputs of "foo bar baz" + # split into words. + + fake_stt = FakeSTT(["first", "second"]) + workflow = FakeWorkflow([["foo bar baz"], ["foo2 bar2 baz2"]]) + fake_tts = FakeTTS(strategy="split_words") + config = VoicePipelineConfig(tts_settings=TTSModelSettings(buffer_size=1)) + pipeline = VoicePipeline( + workflow=workflow, stt_model=fake_stt, tts_model=fake_tts, config=config + ) + streamed_audio_input = await FakeStreamedAudioInput.get(count=6) + result = await pipeline.run(streamed_audio_input) + events, audio_chunks = await extract_events(result) + assert events == [ + "turn_started", + "audio", # foo + "audio", # bar + "audio", # baz + "turn_ended", + "turn_started", + "audio", # foo2 + "audio", # bar2 + "audio", # baz2 + "turn_ended", + "session_ended", + ] + assert len(audio_chunks) == 6 + await fake_tts.verify_audio_chunks("foo bar baz", audio_chunks[:3]) + await fake_tts.verify_audio_chunks("foo2 bar2 baz2", audio_chunks[3:]) + + +@pytest.mark.asyncio +async def test_voicepipeline_float32() -> None: + # Single turn. Should produce a single audio output, which is the TTS output for "out_1". + + fake_stt = FakeSTT(["first"]) + workflow = FakeWorkflow([["out_1"]]) + fake_tts = FakeTTS() + config = VoicePipelineConfig(tts_settings=TTSModelSettings(buffer_size=1, dtype=np.float32)) + pipeline = VoicePipeline( + workflow=workflow, stt_model=fake_stt, tts_model=fake_tts, config=config + ) + audio_input = AudioInput(buffer=np.zeros(2, dtype=np.int16)) + result = await pipeline.run(audio_input) + events, audio_chunks = await extract_events(result) + assert events == [ + "turn_started", + "audio", + "turn_ended", + "session_ended", + ] + await fake_tts.verify_audio("out_1", audio_chunks[0], dtype=np.float32) + + +@pytest.mark.asyncio +async def test_voicepipeline_transform_data() -> None: + # Single turn. Should produce a single audio output, which is the TTS output for "out_1". + + def _transform_data( + data_chunk: npt.NDArray[np.int16 | np.float32], + ) -> npt.NDArray[np.int16]: + return data_chunk.astype(np.int16) + + fake_stt = FakeSTT(["first"]) + workflow = FakeWorkflow([["out_1"]]) + fake_tts = FakeTTS() + config = VoicePipelineConfig( + tts_settings=TTSModelSettings( + buffer_size=1, + dtype=np.float32, + transform_data=_transform_data, + ) + ) + pipeline = VoicePipeline( + workflow=workflow, stt_model=fake_stt, tts_model=fake_tts, config=config + ) + audio_input = AudioInput(buffer=np.zeros(2, dtype=np.int16)) + result = await pipeline.run(audio_input) + events, audio_chunks = await extract_events(result) + assert events == [ + "turn_started", + "audio", + "turn_ended", + "session_ended", + ] + await fake_tts.verify_audio("out_1", audio_chunks[0], dtype=np.int16) diff --git a/tests/voice/test_workflow.py b/tests/voice/test_workflow.py new file mode 100644 index 000000000..465c12470 --- /dev/null +++ b/tests/voice/test_workflow.py @@ -0,0 +1,184 @@ +from __future__ import annotations + +import json +from collections.abc import AsyncIterator + +import pytest +from inline_snapshot import snapshot +from openai.types.responses import ResponseCompletedEvent +from openai.types.responses.response_text_delta_event import ResponseTextDeltaEvent + +from agents import Agent, Model, ModelSettings, ModelTracing, Tool +from agents.agent_output import AgentOutputSchema +from agents.handoffs import Handoff +from agents.items import ( + ModelResponse, + TResponseInputItem, + TResponseOutputItem, + TResponseStreamEvent, +) +from agents.voice import SingleAgentVoiceWorkflow + +from ..fake_model import get_response_obj +from ..test_responses import get_function_tool, get_function_tool_call, get_text_message + + +class FakeStreamingModel(Model): + def __init__(self): + self.turn_outputs: list[list[TResponseOutputItem]] = [] + + def set_next_output(self, output: list[TResponseOutputItem]): + self.turn_outputs.append(output) + + def add_multiple_turn_outputs(self, outputs: list[list[TResponseOutputItem]]): + self.turn_outputs.extend(outputs) + + def get_next_output(self) -> list[TResponseOutputItem]: + if not self.turn_outputs: + return [] + return self.turn_outputs.pop(0) + + async def get_response( + self, + system_instructions: str | None, + input: str | list[TResponseInputItem], + model_settings: ModelSettings, + tools: list[Tool], + output_schema: AgentOutputSchema | None, + handoffs: list[Handoff], + tracing: ModelTracing, + ) -> ModelResponse: + raise NotImplementedError("Not implemented") + + async def stream_response( + self, + system_instructions: str | None, + input: str | list[TResponseInputItem], + model_settings: ModelSettings, + tools: list[Tool], + output_schema: AgentOutputSchema | None, + handoffs: list[Handoff], + tracing: ModelTracing, + ) -> AsyncIterator[TResponseStreamEvent]: + output = self.get_next_output() + for item in output: + if ( + item.type == "message" + and len(item.content) == 1 + and item.content[0].type == "output_text" + ): + yield ResponseTextDeltaEvent( + content_index=0, + delta=item.content[0].text, + type="response.output_text.delta", + output_index=0, + item_id=item.id, + ) + + yield ResponseCompletedEvent( + type="response.completed", + response=get_response_obj(output), + ) + + +@pytest.mark.asyncio +async def test_single_agent_workflow(monkeypatch) -> None: + model = FakeStreamingModel() + model.add_multiple_turn_outputs( + [ + # First turn: a message and a tool call + [ + get_function_tool_call("some_function", json.dumps({"a": "b"})), + get_text_message("a_message"), + ], + # Second turn: text message + [get_text_message("done")], + ] + ) + + agent = Agent( + "initial_agent", + model=model, + tools=[get_function_tool("some_function", "tool_result")], + ) + + workflow = SingleAgentVoiceWorkflow(agent) + output = [] + async for chunk in workflow.run("transcription_1"): + output.append(chunk) + + # Validate that the text yielded matches our fake events + assert output == ["a_message", "done"] + # Validate that internal state was updated + assert workflow._input_history == snapshot( + [ + {"content": "transcription_1", "role": "user"}, + { + "arguments": '{"a": "b"}', + "call_id": "2", + "name": "some_function", + "type": "function_call", + "id": "1", + }, + { + "id": "1", + "content": [{"annotations": [], "text": "a_message", "type": "output_text"}], + "role": "assistant", + "status": "completed", + "type": "message", + }, + {"call_id": "2", "output": "tool_result", "type": "function_call_output"}, + { + "id": "1", + "content": [{"annotations": [], "text": "done", "type": "output_text"}], + "role": "assistant", + "status": "completed", + "type": "message", + }, + ] + ) + assert workflow._current_agent == agent + + model.set_next_output([get_text_message("done_2")]) + + # Run it again with a new transcription to make sure the input history is updated + output = [] + async for chunk in workflow.run("transcription_2"): + output.append(chunk) + + assert workflow._input_history == snapshot( + [ + {"role": "user", "content": "transcription_1"}, + { + "arguments": '{"a": "b"}', + "call_id": "2", + "name": "some_function", + "type": "function_call", + "id": "1", + }, + { + "id": "1", + "content": [{"annotations": [], "text": "a_message", "type": "output_text"}], + "role": "assistant", + "status": "completed", + "type": "message", + }, + {"call_id": "2", "output": "tool_result", "type": "function_call_output"}, + { + "id": "1", + "content": [{"annotations": [], "text": "done", "type": "output_text"}], + "role": "assistant", + "status": "completed", + "type": "message", + }, + {"role": "user", "content": "transcription_2"}, + { + "id": "1", + "content": [{"annotations": [], "text": "done_2", "type": "output_text"}], + "role": "assistant", + "status": "completed", + "type": "message", + }, + ] + ) + assert workflow._current_agent == agent diff --git a/uv.lock b/uv.lock index 698c557a2..0f0d22a60 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,10 @@ version = 1 +revision = 1 requires-python = ">=3.9" +resolution-markers = [ + "python_full_version >= '3.10'", + "python_full_version < '3.10'", +] [[package]] name = "annotated-types" @@ -65,6 +70,75 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/38/fc/bce832fd4fd99766c04d1ee0eead6b0ec6486fb100ae5e74c1d91292b982/certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe", size = 166393 }, ] +[[package]] +name = "cffi" +version = "1.17.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pycparser" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/fc/97/c783634659c2920c3fc70419e3af40972dbaf758daa229a7d6ea6135c90d/cffi-1.17.1.tar.gz", hash = "sha256:1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824", size = 516621 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/90/07/f44ca684db4e4f08a3fdc6eeb9a0d15dc6883efc7b8c90357fdbf74e186c/cffi-1.17.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:df8b1c11f177bc2313ec4b2d46baec87a5f3e71fc8b45dab2ee7cae86d9aba14", size = 182191 }, + { url = "https://files.pythonhosted.org/packages/08/fd/cc2fedbd887223f9f5d170c96e57cbf655df9831a6546c1727ae13fa977a/cffi-1.17.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f2cdc858323644ab277e9bb925ad72ae0e67f69e804f4898c070998d50b1a67", size = 178592 }, + { url = "https://files.pythonhosted.org/packages/de/cc/4635c320081c78d6ffc2cab0a76025b691a91204f4aa317d568ff9280a2d/cffi-1.17.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:edae79245293e15384b51f88b00613ba9f7198016a5948b5dddf4917d4d26382", size = 426024 }, + { url = "https://files.pythonhosted.org/packages/b6/7b/3b2b250f3aab91abe5f8a51ada1b717935fdaec53f790ad4100fe2ec64d1/cffi-1.17.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45398b671ac6d70e67da8e4224a065cec6a93541bb7aebe1b198a61b58c7b702", size = 448188 }, + { url = "https://files.pythonhosted.org/packages/d3/48/1b9283ebbf0ec065148d8de05d647a986c5f22586b18120020452fff8f5d/cffi-1.17.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ad9413ccdeda48c5afdae7e4fa2192157e991ff761e7ab8fdd8926f40b160cc3", size = 455571 }, + { url = "https://files.pythonhosted.org/packages/40/87/3b8452525437b40f39ca7ff70276679772ee7e8b394934ff60e63b7b090c/cffi-1.17.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5da5719280082ac6bd9aa7becb3938dc9f9cbd57fac7d2871717b1feb0902ab6", size = 436687 }, + { url = "https://files.pythonhosted.org/packages/8d/fb/4da72871d177d63649ac449aec2e8a29efe0274035880c7af59101ca2232/cffi-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bb1a08b8008b281856e5971307cc386a8e9c5b625ac297e853d36da6efe9c17", size = 446211 }, + { url = "https://files.pythonhosted.org/packages/ab/a0/62f00bcb411332106c02b663b26f3545a9ef136f80d5df746c05878f8c4b/cffi-1.17.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:045d61c734659cc045141be4bae381a41d89b741f795af1dd018bfb532fd0df8", size = 461325 }, + { url = "https://files.pythonhosted.org/packages/36/83/76127035ed2e7e27b0787604d99da630ac3123bfb02d8e80c633f218a11d/cffi-1.17.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:6883e737d7d9e4899a8a695e00ec36bd4e5e4f18fabe0aca0efe0a4b44cdb13e", size = 438784 }, + { url = "https://files.pythonhosted.org/packages/21/81/a6cd025db2f08ac88b901b745c163d884641909641f9b826e8cb87645942/cffi-1.17.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6b8b4a92e1c65048ff98cfe1f735ef8f1ceb72e3d5f0c25fdb12087a23da22be", size = 461564 }, + { url = "https://files.pythonhosted.org/packages/f8/fe/4d41c2f200c4a457933dbd98d3cf4e911870877bd94d9656cc0fcb390681/cffi-1.17.1-cp310-cp310-win32.whl", hash = "sha256:c9c3d058ebabb74db66e431095118094d06abf53284d9c81f27300d0e0d8bc7c", size = 171804 }, + { url = "https://files.pythonhosted.org/packages/d1/b6/0b0f5ab93b0df4acc49cae758c81fe4e5ef26c3ae2e10cc69249dfd8b3ab/cffi-1.17.1-cp310-cp310-win_amd64.whl", hash = "sha256:0f048dcf80db46f0098ccac01132761580d28e28bc0f78ae0d58048063317e15", size = 181299 }, + { url = "https://files.pythonhosted.org/packages/6b/f4/927e3a8899e52a27fa57a48607ff7dc91a9ebe97399b357b85a0c7892e00/cffi-1.17.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a45e3c6913c5b87b3ff120dcdc03f6131fa0065027d0ed7ee6190736a74cd401", size = 182264 }, + { url = "https://files.pythonhosted.org/packages/6c/f5/6c3a8efe5f503175aaddcbea6ad0d2c96dad6f5abb205750d1b3df44ef29/cffi-1.17.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:30c5e0cb5ae493c04c8b42916e52ca38079f1b235c2f8ae5f4527b963c401caf", size = 178651 }, + { url = "https://files.pythonhosted.org/packages/94/dd/a3f0118e688d1b1a57553da23b16bdade96d2f9bcda4d32e7d2838047ff7/cffi-1.17.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f75c7ab1f9e4aca5414ed4d8e5c0e303a34f4421f8a0d47a4d019ceff0ab6af4", size = 445259 }, + { url = "https://files.pythonhosted.org/packages/2e/ea/70ce63780f096e16ce8588efe039d3c4f91deb1dc01e9c73a287939c79a6/cffi-1.17.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1ed2dd2972641495a3ec98445e09766f077aee98a1c896dcb4ad0d303628e41", size = 469200 }, + { url = "https://files.pythonhosted.org/packages/1c/a0/a4fa9f4f781bda074c3ddd57a572b060fa0df7655d2a4247bbe277200146/cffi-1.17.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:46bf43160c1a35f7ec506d254e5c890f3c03648a4dbac12d624e4490a7046cd1", size = 477235 }, + { url = "https://files.pythonhosted.org/packages/62/12/ce8710b5b8affbcdd5c6e367217c242524ad17a02fe5beec3ee339f69f85/cffi-1.17.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a24ed04c8ffd54b0729c07cee15a81d964e6fee0e3d4d342a27b020d22959dc6", size = 459721 }, + { url = "https://files.pythonhosted.org/packages/ff/6b/d45873c5e0242196f042d555526f92aa9e0c32355a1be1ff8c27f077fd37/cffi-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:610faea79c43e44c71e1ec53a554553fa22321b65fae24889706c0a84d4ad86d", size = 467242 }, + { url = "https://files.pythonhosted.org/packages/1a/52/d9a0e523a572fbccf2955f5abe883cfa8bcc570d7faeee06336fbd50c9fc/cffi-1.17.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a9b15d491f3ad5d692e11f6b71f7857e7835eb677955c00cc0aefcd0669adaf6", size = 477999 }, + { url = "https://files.pythonhosted.org/packages/44/74/f2a2460684a1a2d00ca799ad880d54652841a780c4c97b87754f660c7603/cffi-1.17.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:de2ea4b5833625383e464549fec1bc395c1bdeeb5f25c4a3a82b5a8c756ec22f", size = 454242 }, + { url = "https://files.pythonhosted.org/packages/f8/4a/34599cac7dfcd888ff54e801afe06a19c17787dfd94495ab0c8d35fe99fb/cffi-1.17.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b", size = 478604 }, + { url = "https://files.pythonhosted.org/packages/34/33/e1b8a1ba29025adbdcda5fb3a36f94c03d771c1b7b12f726ff7fef2ebe36/cffi-1.17.1-cp311-cp311-win32.whl", hash = "sha256:85a950a4ac9c359340d5963966e3e0a94a676bd6245a4b55bc43949eee26a655", size = 171727 }, + { url = "https://files.pythonhosted.org/packages/3d/97/50228be003bb2802627d28ec0627837ac0bf35c90cf769812056f235b2d1/cffi-1.17.1-cp311-cp311-win_amd64.whl", hash = "sha256:caaf0640ef5f5517f49bc275eca1406b0ffa6aa184892812030f04c2abf589a0", size = 181400 }, + { url = "https://files.pythonhosted.org/packages/5a/84/e94227139ee5fb4d600a7a4927f322e1d4aea6fdc50bd3fca8493caba23f/cffi-1.17.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:805b4371bf7197c329fcb3ead37e710d1bca9da5d583f5073b799d5c5bd1eee4", size = 183178 }, + { url = "https://files.pythonhosted.org/packages/da/ee/fb72c2b48656111c4ef27f0f91da355e130a923473bf5ee75c5643d00cca/cffi-1.17.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:733e99bc2df47476e3848417c5a4540522f234dfd4ef3ab7fafdf555b082ec0c", size = 178840 }, + { url = "https://files.pythonhosted.org/packages/cc/b6/db007700f67d151abadf508cbfd6a1884f57eab90b1bb985c4c8c02b0f28/cffi-1.17.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1257bdabf294dceb59f5e70c64a3e2f462c30c7ad68092d01bbbfb1c16b1ba36", size = 454803 }, + { url = "https://files.pythonhosted.org/packages/1a/df/f8d151540d8c200eb1c6fba8cd0dfd40904f1b0682ea705c36e6c2e97ab3/cffi-1.17.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da95af8214998d77a98cc14e3a3bd00aa191526343078b530ceb0bd710fb48a5", size = 478850 }, + { url = "https://files.pythonhosted.org/packages/28/c0/b31116332a547fd2677ae5b78a2ef662dfc8023d67f41b2a83f7c2aa78b1/cffi-1.17.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d63afe322132c194cf832bfec0dc69a99fb9bb6bbd550f161a49e9e855cc78ff", size = 485729 }, + { url = "https://files.pythonhosted.org/packages/91/2b/9a1ddfa5c7f13cab007a2c9cc295b70fbbda7cb10a286aa6810338e60ea1/cffi-1.17.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f79fc4fc25f1c8698ff97788206bb3c2598949bfe0fef03d299eb1b5356ada99", size = 471256 }, + { url = "https://files.pythonhosted.org/packages/b2/d5/da47df7004cb17e4955df6a43d14b3b4ae77737dff8bf7f8f333196717bf/cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b62ce867176a75d03a665bad002af8e6d54644fad99a3c70905c543130e39d93", size = 479424 }, + { url = "https://files.pythonhosted.org/packages/0b/ac/2a28bcf513e93a219c8a4e8e125534f4f6db03e3179ba1c45e949b76212c/cffi-1.17.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:386c8bf53c502fff58903061338ce4f4950cbdcb23e2902d86c0f722b786bbe3", size = 484568 }, + { url = "https://files.pythonhosted.org/packages/d4/38/ca8a4f639065f14ae0f1d9751e70447a261f1a30fa7547a828ae08142465/cffi-1.17.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4ceb10419a9adf4460ea14cfd6bc43d08701f0835e979bf821052f1805850fe8", size = 488736 }, + { url = "https://files.pythonhosted.org/packages/86/c5/28b2d6f799ec0bdecf44dced2ec5ed43e0eb63097b0f58c293583b406582/cffi-1.17.1-cp312-cp312-win32.whl", hash = "sha256:a08d7e755f8ed21095a310a693525137cfe756ce62d066e53f502a83dc550f65", size = 172448 }, + { url = "https://files.pythonhosted.org/packages/50/b9/db34c4755a7bd1cb2d1603ac3863f22bcecbd1ba29e5ee841a4bc510b294/cffi-1.17.1-cp312-cp312-win_amd64.whl", hash = "sha256:51392eae71afec0d0c8fb1a53b204dbb3bcabcb3c9b807eedf3e1e6ccf2de903", size = 181976 }, + { url = "https://files.pythonhosted.org/packages/8d/f8/dd6c246b148639254dad4d6803eb6a54e8c85c6e11ec9df2cffa87571dbe/cffi-1.17.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f3a2b4222ce6b60e2e8b337bb9596923045681d71e5a082783484d845390938e", size = 182989 }, + { url = "https://files.pythonhosted.org/packages/8b/f1/672d303ddf17c24fc83afd712316fda78dc6fce1cd53011b839483e1ecc8/cffi-1.17.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0984a4925a435b1da406122d4d7968dd861c1385afe3b45ba82b750f229811e2", size = 178802 }, + { url = "https://files.pythonhosted.org/packages/0e/2d/eab2e858a91fdff70533cab61dcff4a1f55ec60425832ddfdc9cd36bc8af/cffi-1.17.1-cp313-cp313-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d01b12eeeb4427d3110de311e1774046ad344f5b1a7403101878976ecd7a10f3", size = 454792 }, + { url = "https://files.pythonhosted.org/packages/75/b2/fbaec7c4455c604e29388d55599b99ebcc250a60050610fadde58932b7ee/cffi-1.17.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:706510fe141c86a69c8ddc029c7910003a17353970cff3b904ff0686a5927683", size = 478893 }, + { url = "https://files.pythonhosted.org/packages/4f/b7/6e4a2162178bf1935c336d4da8a9352cccab4d3a5d7914065490f08c0690/cffi-1.17.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de55b766c7aa2e2a3092c51e0483d700341182f08e67c63630d5b6f200bb28e5", size = 485810 }, + { url = "https://files.pythonhosted.org/packages/c7/8a/1d0e4a9c26e54746dc08c2c6c037889124d4f59dffd853a659fa545f1b40/cffi-1.17.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c59d6e989d07460165cc5ad3c61f9fd8f1b4796eacbd81cee78957842b834af4", size = 471200 }, + { url = "https://files.pythonhosted.org/packages/26/9f/1aab65a6c0db35f43c4d1b4f580e8df53914310afc10ae0397d29d697af4/cffi-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd398dbc6773384a17fe0d3e7eeb8d1a21c2200473ee6806bb5e6a8e62bb73dd", size = 479447 }, + { url = "https://files.pythonhosted.org/packages/5f/e4/fb8b3dd8dc0e98edf1135ff067ae070bb32ef9d509d6cb0f538cd6f7483f/cffi-1.17.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:3edc8d958eb099c634dace3c7e16560ae474aa3803a5df240542b305d14e14ed", size = 484358 }, + { url = "https://files.pythonhosted.org/packages/f1/47/d7145bf2dc04684935d57d67dff9d6d795b2ba2796806bb109864be3a151/cffi-1.17.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:72e72408cad3d5419375fc87d289076ee319835bdfa2caad331e377589aebba9", size = 488469 }, + { url = "https://files.pythonhosted.org/packages/bf/ee/f94057fa6426481d663b88637a9a10e859e492c73d0384514a17d78ee205/cffi-1.17.1-cp313-cp313-win32.whl", hash = "sha256:e03eab0a8677fa80d646b5ddece1cbeaf556c313dcfac435ba11f107ba117b5d", size = 172475 }, + { url = "https://files.pythonhosted.org/packages/7c/fc/6a8cb64e5f0324877d503c854da15d76c1e50eb722e320b15345c4d0c6de/cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a", size = 182009 }, + { url = "https://files.pythonhosted.org/packages/b9/ea/8bb50596b8ffbc49ddd7a1ad305035daa770202a6b782fc164647c2673ad/cffi-1.17.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b2ab587605f4ba0bf81dc0cb08a41bd1c0a5906bd59243d56bad7668a6fc6c16", size = 182220 }, + { url = "https://files.pythonhosted.org/packages/ae/11/e77c8cd24f58285a82c23af484cf5b124a376b32644e445960d1a4654c3a/cffi-1.17.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:28b16024becceed8c6dfbc75629e27788d8a3f9030691a1dbf9821a128b22c36", size = 178605 }, + { url = "https://files.pythonhosted.org/packages/ed/65/25a8dc32c53bf5b7b6c2686b42ae2ad58743f7ff644844af7cdb29b49361/cffi-1.17.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1d599671f396c4723d016dbddb72fe8e0397082b0a77a4fab8028923bec050e8", size = 424910 }, + { url = "https://files.pythonhosted.org/packages/42/7a/9d086fab7c66bd7c4d0f27c57a1b6b068ced810afc498cc8c49e0088661c/cffi-1.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca74b8dbe6e8e8263c0ffd60277de77dcee6c837a3d0881d8c1ead7268c9e576", size = 447200 }, + { url = "https://files.pythonhosted.org/packages/da/63/1785ced118ce92a993b0ec9e0d0ac8dc3e5dbfbcaa81135be56c69cabbb6/cffi-1.17.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87", size = 454565 }, + { url = "https://files.pythonhosted.org/packages/74/06/90b8a44abf3556599cdec107f7290277ae8901a58f75e6fe8f970cd72418/cffi-1.17.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:98e3969bcff97cae1b2def8ba499ea3d6f31ddfdb7635374834cf89a1a08ecf0", size = 435635 }, + { url = "https://files.pythonhosted.org/packages/bd/62/a1f468e5708a70b1d86ead5bab5520861d9c7eacce4a885ded9faa7729c3/cffi-1.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdf5ce3acdfd1661132f2a9c19cac174758dc2352bfe37d98aa7512c6b7178b3", size = 445218 }, + { url = "https://files.pythonhosted.org/packages/5b/95/b34462f3ccb09c2594aa782d90a90b045de4ff1f70148ee79c69d37a0a5a/cffi-1.17.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9755e4345d1ec879e3849e62222a18c7174d65a6a92d5b346b1863912168b595", size = 460486 }, + { url = "https://files.pythonhosted.org/packages/fc/fc/a1e4bebd8d680febd29cf6c8a40067182b64f00c7d105f8f26b5bc54317b/cffi-1.17.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:f1e22e8c4419538cb197e4dd60acc919d7696e5ef98ee4da4e01d3f8cfa4cc5a", size = 437911 }, + { url = "https://files.pythonhosted.org/packages/e6/c3/21cab7a6154b6a5ea330ae80de386e7665254835b9e98ecc1340b3a7de9a/cffi-1.17.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:c03e868a0b3bc35839ba98e74211ed2b05d2119be4e8a0f224fba9384f1fe02e", size = 460632 }, + { url = "https://files.pythonhosted.org/packages/cb/b5/fd9f8b5a84010ca169ee49f4e4ad6f8c05f4e3545b72ee041dbbcb159882/cffi-1.17.1-cp39-cp39-win32.whl", hash = "sha256:e31ae45bc2e29f6b2abd0de1cc3b9d5205aa847cafaecb8af1476a609a2f6eb7", size = 171820 }, + { url = "https://files.pythonhosted.org/packages/8c/52/b08750ce0bce45c143e1b5d7357ee8c55341b52bdef4b0f081af1eb248c2/cffi-1.17.1-cp39-cp39-win_amd64.whl", hash = "sha256:d016c76bdd850f3c626af19b0542c9677ba156e4ee4fccfdd7848803533ef662", size = 181290 }, +] + [[package]] name = "charset-normalizer" version = "3.4.1" @@ -239,6 +313,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277 }, ] +[[package]] +name = "evdev" +version = "1.9.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d1/99/4d24bb6db12fc170a5f209f4c9108054a2c84d289d1e7f743e979b202023/evdev-1.9.1.tar.gz", hash = "sha256:dc640a064cb1c9fe1f8b970dc2039945a2a275d7b7ee62284bf427238abe45ee", size = 33349 } + [[package]] name = "exceptiongroup" version = "1.2.2" @@ -332,14 +412,14 @@ wheels = [ [[package]] name = "griffe" -version = "1.6.1" +version = "1.6.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "colorama" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/6a/ba/1ebe51a22c491a3fc94b44ef9c46a5b5472540e24a5c3f251cebbab7214b/griffe-1.6.1.tar.gz", hash = "sha256:ff0acf706b2680f8c721412623091c891e752b2c61b7037618f7b77d06732cf5", size = 393112 } +sdist = { url = "https://files.pythonhosted.org/packages/2f/f2/b00eb72b853ecb5bf31dd47857cdf6767e380ca24ec2910d43b3fa7cc500/griffe-1.6.2.tar.gz", hash = "sha256:3a46fa7bd83280909b63c12b9a975732a927dd97809efe5b7972290b606c5d91", size = 392836 } wheels = [ - { url = "https://files.pythonhosted.org/packages/1f/d3/a760d1062e44587230aa65573c70edaad4ee8a0e60e193a3172b304d24d8/griffe-1.6.1-py3-none-any.whl", hash = "sha256:b0131670db16834f82383bcf4f788778853c9bf4dc7a1a2b708bb0808ca56a98", size = 128615 }, + { url = "https://files.pythonhosted.org/packages/4e/bc/bd8b7de5e748e078b6be648e76b47189a9182b1ac1eb7791ff7969f39f27/griffe-1.6.2-py3-none-any.whl", hash = "sha256:6399f7e663150e4278a312a8e8a14d2f3d7bd86e2ef2f8056a1058e38579c2ee", size = 128638 }, ] [[package]] @@ -393,7 +473,7 @@ name = "importlib-metadata" version = "8.6.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "zipp" }, + { name = "zipp", marker = "python_full_version < '3.10'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/33/08/c1395a292bb23fd03bdf572a1357c5a733d3eecbab877641ceacab23db6e/importlib_metadata-8.6.1.tar.gz", hash = "sha256:310b41d755445d74569f993ccfc22838295d9fe005425094fad953d7f15c8580", size = 55767 } wheels = [ @@ -402,16 +482,16 @@ wheels = [ [[package]] name = "iniconfig" -version = "2.0.0" +version = "2.1.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 } +sdist = { url = "https://files.pythonhosted.org/packages/f2/97/ebf4da567aa6827c909642694d71c9fcf53e5b504f2d96afea02718862f3/iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7", size = 4793 } wheels = [ - { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 }, + { url = "https://files.pythonhosted.org/packages/2c/e1/e6716421ea10d38022b952c159d5161ca1193197fb744506875fbb87ea7b/iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760", size = 6050 }, ] [[package]] name = "inline-snapshot" -version = "0.20.7" +version = "0.20.8" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "asttokens" }, @@ -419,9 +499,9 @@ dependencies = [ { name = "rich" }, { name = "tomli", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/b0/41/9bd2ecd10ef789e8aff6fb68dcc7677dc31b33b2d27c306c0d40fc982fbc/inline_snapshot-0.20.7.tar.gz", hash = "sha256:d55bbb6254d0727dc304729ca7998cde1c1e984c4bf50281514aa9d727a56cf2", size = 92643 } +sdist = { url = "https://files.pythonhosted.org/packages/5a/69/79babd0f6ad54c430fba36fb7677774398225287482cf494a15394c75894/inline_snapshot-0.20.8.tar.gz", hash = "sha256:52373c15b63097215d1136f292962553f325a5e966957b489fe4326d6fbc77c0", size = 92748 } wheels = [ - { url = "https://files.pythonhosted.org/packages/01/8f/1bf23da63ad1a0b14ca2d9114700123ef76732e375548f4f9ca94052817e/inline_snapshot-0.20.7-py3-none-any.whl", hash = "sha256:2df6dd8710d1f0def2c1f9d6c25fd03d7beba01f3addf52fc370343d9ee9959f", size = 48108 }, + { url = "https://files.pythonhosted.org/packages/76/74/5222a632fd8d3202ddef383b71c8b6c31a9d77989030efba5be561163d41/inline_snapshot-0.20.8-py3-none-any.whl", hash = "sha256:bded4e142b8817930e4df428b88c462308a8f01ad699852e7574a54bad7ea9f2", size = 48157 }, ] [[package]] @@ -507,6 +587,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/4b/13/c10f17dcddd1b4c1313418e64ace5e77cc4f7313246140fb09044516a62c/jiter-0.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:e8b36d8a16a61993be33e75126ad3d8aa29cf450b09576f3c427d27647fcb4aa", size = 208879 }, ] +[[package]] +name = "linkify-it-py" +version = "2.0.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "uc-micro-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/2a/ae/bb56c6828e4797ba5a4821eec7c43b8bf40f69cda4d4f5f8c8a2810ec96a/linkify-it-py-2.0.3.tar.gz", hash = "sha256:68cda27e162e9215c17d786649d1da0021a451bdc436ef9e0fa0ba5234b9b048", size = 27946 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/1e/b832de447dee8b582cac175871d2f6c3d5077cc56d5575cadba1fd1cccfa/linkify_it_py-2.0.3-py3-none-any.whl", hash = "sha256:6bcbc417b0ac14323382aef5c5192c0075bf8a9d6b41820a2b66371eac6b6d79", size = 19820 }, +] + [[package]] name = "markdown" version = "3.7" @@ -531,6 +623,14 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/42/d7/1ec15b46af6af88f19b8e5ffea08fa375d433c998b8a7639e76935c14f1f/markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1", size = 87528 }, ] +[package.optional-dependencies] +linkify = [ + { name = "linkify-it-py" }, +] +plugins = [ + { name = "mdit-py-plugins" }, +] + [[package]] name = "markupsafe" version = "3.0.2" @@ -599,6 +699,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b3/73/085399401383ce949f727afec55ec3abd76648d04b9f22e1c0e99cb4bec3/MarkupSafe-3.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a", size = 15506 }, ] +[[package]] +name = "mdit-py-plugins" +version = "0.4.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/03/a2ecab526543b152300717cf232bb4bb8605b6edb946c845016fa9c9c9fd/mdit_py_plugins-0.4.2.tar.gz", hash = "sha256:5f2cd1fdb606ddf152d37ec30e46101a60512bc0e5fa1a7002c36647b09e26b5", size = 43542 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/f7/7782a043553ee469c1ff49cfa1cdace2d6bf99a1f333cf38676b3ddf30da/mdit_py_plugins-0.4.2-py3-none-any.whl", hash = "sha256:0c673c3f889399a33b95e88d2f0d111b4447bdfea7f237dab2d488f459835636", size = 55316 }, +] + [[package]] name = "mdurl" version = "0.1.2" @@ -728,7 +840,7 @@ python = [ [[package]] name = "mkdocstrings-python" -version = "1.16.6" +version = "1.16.7" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "griffe" }, @@ -736,9 +848,9 @@ dependencies = [ { name = "mkdocstrings" }, { name = "typing-extensions", marker = "python_full_version < '3.11'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/8e/e7/0691e34e807a8f5c28f0988fcfeeb584f0b569ce433bf341944f14bdb3ff/mkdocstrings_python-1.16.6.tar.gz", hash = "sha256:cefe0f0e17ab4a4611f01b0a2af75e4298664e0ff54feb83c91a485bfed82dc9", size = 201565 } +sdist = { url = "https://files.pythonhosted.org/packages/52/e0/cc35acb47593c138efbfc9dc296ccc26b7ad4452e868fd309f05f6ba0ded/mkdocstrings_python-1.16.7.tar.gz", hash = "sha256:cdfc1a99fe5f6f0d90446a364ef7cac12014a4ef46114b2677a58cec84007117", size = 1475398 } wheels = [ - { url = "https://files.pythonhosted.org/packages/6a/42/ed682687ef5f248e104f82806d5d9893f6dd81d8cb4561692e190ba1a252/mkdocstrings_python-1.16.6-py3-none-any.whl", hash = "sha256:de877dd71f69878c973c4897a39683b7b6961bee7b058879095b69681488453f", size = 123207 }, + { url = "https://files.pythonhosted.org/packages/ab/5e/dc978b9fd6331e2070369579ad8f52145e9ef22a69bfc2811110be95e6d4/mkdocstrings_python-1.16.7-py3-none-any.whl", hash = "sha256:a5589a5be247a28ba651287f83630c69524042f8055d93b5c203d804a3409333", size = 1998312 }, ] [[package]] @@ -794,23 +906,146 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2a/e2/5d3f6ada4297caebe1a2add3b126fe800c96f56dbe5d1988a2cbe0b267aa/mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", size = 4695 }, ] +[[package]] +name = "numpy" +version = "2.0.2" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.10'", +] +sdist = { url = "https://files.pythonhosted.org/packages/a9/75/10dd1f8116a8b796cb2c737b674e02d02e80454bda953fa7e65d8c12b016/numpy-2.0.2.tar.gz", hash = "sha256:883c987dee1880e2a864ab0dc9892292582510604156762362d9326444636e78", size = 18902015 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/21/91/3495b3237510f79f5d81f2508f9f13fea78ebfdf07538fc7444badda173d/numpy-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51129a29dbe56f9ca83438b706e2e69a39892b5eda6cedcb6b0c9fdc9b0d3ece", size = 21165245 }, + { url = "https://files.pythonhosted.org/packages/05/33/26178c7d437a87082d11019292dce6d3fe6f0e9026b7b2309cbf3e489b1d/numpy-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f15975dfec0cf2239224d80e32c3170b1d168335eaedee69da84fbe9f1f9cd04", size = 13738540 }, + { url = "https://files.pythonhosted.org/packages/ec/31/cc46e13bf07644efc7a4bf68df2df5fb2a1a88d0cd0da9ddc84dc0033e51/numpy-2.0.2-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:8c5713284ce4e282544c68d1c3b2c7161d38c256d2eefc93c1d683cf47683e66", size = 5300623 }, + { url = "https://files.pythonhosted.org/packages/6e/16/7bfcebf27bb4f9d7ec67332ffebee4d1bf085c84246552d52dbb548600e7/numpy-2.0.2-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:becfae3ddd30736fe1889a37f1f580e245ba79a5855bff5f2a29cb3ccc22dd7b", size = 6901774 }, + { url = "https://files.pythonhosted.org/packages/f9/a3/561c531c0e8bf082c5bef509d00d56f82e0ea7e1e3e3a7fc8fa78742a6e5/numpy-2.0.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2da5960c3cf0df7eafefd806d4e612c5e19358de82cb3c343631188991566ccd", size = 13907081 }, + { url = "https://files.pythonhosted.org/packages/fa/66/f7177ab331876200ac7563a580140643d1179c8b4b6a6b0fc9838de2a9b8/numpy-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:496f71341824ed9f3d2fd36cf3ac57ae2e0165c143b55c3a035ee219413f3318", size = 19523451 }, + { url = "https://files.pythonhosted.org/packages/25/7f/0b209498009ad6453e4efc2c65bcdf0ae08a182b2b7877d7ab38a92dc542/numpy-2.0.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a61ec659f68ae254e4d237816e33171497e978140353c0c2038d46e63282d0c8", size = 19927572 }, + { url = "https://files.pythonhosted.org/packages/3e/df/2619393b1e1b565cd2d4c4403bdd979621e2c4dea1f8532754b2598ed63b/numpy-2.0.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:d731a1c6116ba289c1e9ee714b08a8ff882944d4ad631fd411106a30f083c326", size = 14400722 }, + { url = "https://files.pythonhosted.org/packages/22/ad/77e921b9f256d5da36424ffb711ae79ca3f451ff8489eeca544d0701d74a/numpy-2.0.2-cp310-cp310-win32.whl", hash = "sha256:984d96121c9f9616cd33fbd0618b7f08e0cfc9600a7ee1d6fd9b239186d19d97", size = 6472170 }, + { url = "https://files.pythonhosted.org/packages/10/05/3442317535028bc29cf0c0dd4c191a4481e8376e9f0db6bcf29703cadae6/numpy-2.0.2-cp310-cp310-win_amd64.whl", hash = "sha256:c7b0be4ef08607dd04da4092faee0b86607f111d5ae68036f16cc787e250a131", size = 15905558 }, + { url = "https://files.pythonhosted.org/packages/8b/cf/034500fb83041aa0286e0fb16e7c76e5c8b67c0711bb6e9e9737a717d5fe/numpy-2.0.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:49ca4decb342d66018b01932139c0961a8f9ddc7589611158cb3c27cbcf76448", size = 21169137 }, + { url = "https://files.pythonhosted.org/packages/4a/d9/32de45561811a4b87fbdee23b5797394e3d1504b4a7cf40c10199848893e/numpy-2.0.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:11a76c372d1d37437857280aa142086476136a8c0f373b2e648ab2c8f18fb195", size = 13703552 }, + { url = "https://files.pythonhosted.org/packages/c1/ca/2f384720020c7b244d22508cb7ab23d95f179fcfff33c31a6eeba8d6c512/numpy-2.0.2-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:807ec44583fd708a21d4a11d94aedf2f4f3c3719035c76a2bbe1fe8e217bdc57", size = 5298957 }, + { url = "https://files.pythonhosted.org/packages/0e/78/a3e4f9fb6aa4e6fdca0c5428e8ba039408514388cf62d89651aade838269/numpy-2.0.2-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:8cafab480740e22f8d833acefed5cc87ce276f4ece12fdaa2e8903db2f82897a", size = 6905573 }, + { url = "https://files.pythonhosted.org/packages/a0/72/cfc3a1beb2caf4efc9d0b38a15fe34025230da27e1c08cc2eb9bfb1c7231/numpy-2.0.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a15f476a45e6e5a3a79d8a14e62161d27ad897381fecfa4a09ed5322f2085669", size = 13914330 }, + { url = "https://files.pythonhosted.org/packages/ba/a8/c17acf65a931ce551fee11b72e8de63bf7e8a6f0e21add4c937c83563538/numpy-2.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13e689d772146140a252c3a28501da66dfecd77490b498b168b501835041f951", size = 19534895 }, + { url = "https://files.pythonhosted.org/packages/ba/86/8767f3d54f6ae0165749f84648da9dcc8cd78ab65d415494962c86fac80f/numpy-2.0.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:9ea91dfb7c3d1c56a0e55657c0afb38cf1eeae4544c208dc465c3c9f3a7c09f9", size = 19937253 }, + { url = "https://files.pythonhosted.org/packages/df/87/f76450e6e1c14e5bb1eae6836478b1028e096fd02e85c1c37674606ab752/numpy-2.0.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:c1c9307701fec8f3f7a1e6711f9089c06e6284b3afbbcd259f7791282d660a15", size = 14414074 }, + { url = "https://files.pythonhosted.org/packages/5c/ca/0f0f328e1e59f73754f06e1adfb909de43726d4f24c6a3f8805f34f2b0fa/numpy-2.0.2-cp311-cp311-win32.whl", hash = "sha256:a392a68bd329eafac5817e5aefeb39038c48b671afd242710b451e76090e81f4", size = 6470640 }, + { url = "https://files.pythonhosted.org/packages/eb/57/3a3f14d3a759dcf9bf6e9eda905794726b758819df4663f217d658a58695/numpy-2.0.2-cp311-cp311-win_amd64.whl", hash = "sha256:286cd40ce2b7d652a6f22efdfc6d1edf879440e53e76a75955bc0c826c7e64dc", size = 15910230 }, + { url = "https://files.pythonhosted.org/packages/45/40/2e117be60ec50d98fa08c2f8c48e09b3edea93cfcabd5a9ff6925d54b1c2/numpy-2.0.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:df55d490dea7934f330006d0f81e8551ba6010a5bf035a249ef61a94f21c500b", size = 20895803 }, + { url = "https://files.pythonhosted.org/packages/46/92/1b8b8dee833f53cef3e0a3f69b2374467789e0bb7399689582314df02651/numpy-2.0.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8df823f570d9adf0978347d1f926b2a867d5608f434a7cff7f7908c6570dcf5e", size = 13471835 }, + { url = "https://files.pythonhosted.org/packages/7f/19/e2793bde475f1edaea6945be141aef6c8b4c669b90c90a300a8954d08f0a/numpy-2.0.2-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9a92ae5c14811e390f3767053ff54eaee3bf84576d99a2456391401323f4ec2c", size = 5038499 }, + { url = "https://files.pythonhosted.org/packages/e3/ff/ddf6dac2ff0dd50a7327bcdba45cb0264d0e96bb44d33324853f781a8f3c/numpy-2.0.2-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:a842d573724391493a97a62ebbb8e731f8a5dcc5d285dfc99141ca15a3302d0c", size = 6633497 }, + { url = "https://files.pythonhosted.org/packages/72/21/67f36eac8e2d2cd652a2e69595a54128297cdcb1ff3931cfc87838874bd4/numpy-2.0.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c05e238064fc0610c840d1cf6a13bf63d7e391717d247f1bf0318172e759e692", size = 13621158 }, + { url = "https://files.pythonhosted.org/packages/39/68/e9f1126d757653496dbc096cb429014347a36b228f5a991dae2c6b6cfd40/numpy-2.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0123ffdaa88fa4ab64835dcbde75dcdf89c453c922f18dced6e27c90d1d0ec5a", size = 19236173 }, + { url = "https://files.pythonhosted.org/packages/d1/e9/1f5333281e4ebf483ba1c888b1d61ba7e78d7e910fdd8e6499667041cc35/numpy-2.0.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:96a55f64139912d61de9137f11bf39a55ec8faec288c75a54f93dfd39f7eb40c", size = 19634174 }, + { url = "https://files.pythonhosted.org/packages/71/af/a469674070c8d8408384e3012e064299f7a2de540738a8e414dcfd639996/numpy-2.0.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ec9852fb39354b5a45a80bdab5ac02dd02b15f44b3804e9f00c556bf24b4bded", size = 14099701 }, + { url = "https://files.pythonhosted.org/packages/d0/3d/08ea9f239d0e0e939b6ca52ad403c84a2bce1bde301a8eb4888c1c1543f1/numpy-2.0.2-cp312-cp312-win32.whl", hash = "sha256:671bec6496f83202ed2d3c8fdc486a8fc86942f2e69ff0e986140339a63bcbe5", size = 6174313 }, + { url = "https://files.pythonhosted.org/packages/b2/b5/4ac39baebf1fdb2e72585c8352c56d063b6126be9fc95bd2bb5ef5770c20/numpy-2.0.2-cp312-cp312-win_amd64.whl", hash = "sha256:cfd41e13fdc257aa5778496b8caa5e856dc4896d4ccf01841daee1d96465467a", size = 15606179 }, + { url = "https://files.pythonhosted.org/packages/43/c1/41c8f6df3162b0c6ffd4437d729115704bd43363de0090c7f913cfbc2d89/numpy-2.0.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9059e10581ce4093f735ed23f3b9d283b9d517ff46009ddd485f1747eb22653c", size = 21169942 }, + { url = "https://files.pythonhosted.org/packages/39/bc/fd298f308dcd232b56a4031fd6ddf11c43f9917fbc937e53762f7b5a3bb1/numpy-2.0.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:423e89b23490805d2a5a96fe40ec507407b8ee786d66f7328be214f9679df6dd", size = 13711512 }, + { url = "https://files.pythonhosted.org/packages/96/ff/06d1aa3eeb1c614eda245c1ba4fb88c483bee6520d361641331872ac4b82/numpy-2.0.2-cp39-cp39-macosx_14_0_arm64.whl", hash = "sha256:2b2955fa6f11907cf7a70dab0d0755159bca87755e831e47932367fc8f2f2d0b", size = 5306976 }, + { url = "https://files.pythonhosted.org/packages/2d/98/121996dcfb10a6087a05e54453e28e58694a7db62c5a5a29cee14c6e047b/numpy-2.0.2-cp39-cp39-macosx_14_0_x86_64.whl", hash = "sha256:97032a27bd9d8988b9a97a8c4d2c9f2c15a81f61e2f21404d7e8ef00cb5be729", size = 6906494 }, + { url = "https://files.pythonhosted.org/packages/15/31/9dffc70da6b9bbf7968f6551967fc21156207366272c2a40b4ed6008dc9b/numpy-2.0.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e795a8be3ddbac43274f18588329c72939870a16cae810c2b73461c40718ab1", size = 13912596 }, + { url = "https://files.pythonhosted.org/packages/b9/14/78635daab4b07c0930c919d451b8bf8c164774e6a3413aed04a6d95758ce/numpy-2.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f26b258c385842546006213344c50655ff1555a9338e2e5e02a0756dc3e803dd", size = 19526099 }, + { url = "https://files.pythonhosted.org/packages/26/4c/0eeca4614003077f68bfe7aac8b7496f04221865b3a5e7cb230c9d055afd/numpy-2.0.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fec9451a7789926bcf7c2b8d187292c9f93ea30284802a0ab3f5be8ab36865d", size = 19932823 }, + { url = "https://files.pythonhosted.org/packages/f1/46/ea25b98b13dccaebddf1a803f8c748680d972e00507cd9bc6dcdb5aa2ac1/numpy-2.0.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:9189427407d88ff25ecf8f12469d4d39d35bee1db5d39fc5c168c6f088a6956d", size = 14404424 }, + { url = "https://files.pythonhosted.org/packages/c8/a6/177dd88d95ecf07e722d21008b1b40e681a929eb9e329684d449c36586b2/numpy-2.0.2-cp39-cp39-win32.whl", hash = "sha256:905d16e0c60200656500c95b6b8dca5d109e23cb24abc701d41c02d74c6b3afa", size = 6476809 }, + { url = "https://files.pythonhosted.org/packages/ea/2b/7fc9f4e7ae5b507c1a3a21f0f15ed03e794c1242ea8a242ac158beb56034/numpy-2.0.2-cp39-cp39-win_amd64.whl", hash = "sha256:a3f4ab0caa7f053f6797fcd4e1e25caee367db3112ef2b6ef82d749530768c73", size = 15911314 }, + { url = "https://files.pythonhosted.org/packages/8f/3b/df5a870ac6a3be3a86856ce195ef42eec7ae50d2a202be1f5a4b3b340e14/numpy-2.0.2-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:7f0a0c6f12e07fa94133c8a67404322845220c06a9e80e85999afe727f7438b8", size = 21025288 }, + { url = "https://files.pythonhosted.org/packages/2c/97/51af92f18d6f6f2d9ad8b482a99fb74e142d71372da5d834b3a2747a446e/numpy-2.0.2-pp39-pypy39_pp73-macosx_14_0_x86_64.whl", hash = "sha256:312950fdd060354350ed123c0e25a71327d3711584beaef30cdaa93320c392d4", size = 6762793 }, + { url = "https://files.pythonhosted.org/packages/12/46/de1fbd0c1b5ccaa7f9a005b66761533e2f6a3e560096682683a223631fe9/numpy-2.0.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:26df23238872200f63518dd2aa984cfca675d82469535dc7162dc2ee52d9dd5c", size = 19334885 }, + { url = "https://files.pythonhosted.org/packages/cc/dc/d330a6faefd92b446ec0f0dfea4c3207bb1fef3c4771d19cf4543efd2c78/numpy-2.0.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:a46288ec55ebbd58947d31d72be2c63cbf839f0a63b49cb755022310792a3385", size = 15828784 }, +] + +[[package]] +name = "numpy" +version = "2.2.4" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.10'", +] +sdist = { url = "https://files.pythonhosted.org/packages/e1/78/31103410a57bc2c2b93a3597340a8119588571f6a4539067546cb9a0bfac/numpy-2.2.4.tar.gz", hash = "sha256:9ba03692a45d3eef66559efe1d1096c4b9b75c0986b5dff5530c378fb8331d4f", size = 20270701 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/89/a79e86e5c1433926ed7d60cb267fb64aa578b6101ab645800fd43b4801de/numpy-2.2.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8146f3550d627252269ac42ae660281d673eb6f8b32f113538e0cc2a9aed42b9", size = 21250661 }, + { url = "https://files.pythonhosted.org/packages/79/c2/f50921beb8afd60ed9589ad880332cfefdb805422210d327fb48f12b7a81/numpy-2.2.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e642d86b8f956098b564a45e6f6ce68a22c2c97a04f5acd3f221f57b8cb850ae", size = 14389926 }, + { url = "https://files.pythonhosted.org/packages/c7/b9/2c4e96130b0b0f97b0ef4a06d6dae3b39d058b21a5e2fa2decd7fd6b1c8f/numpy-2.2.4-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:a84eda42bd12edc36eb5b53bbcc9b406820d3353f1994b6cfe453a33ff101775", size = 5428329 }, + { url = "https://files.pythonhosted.org/packages/7f/a5/3d7094aa898f4fc5c84cdfb26beeae780352d43f5d8bdec966c4393d644c/numpy-2.2.4-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:4ba5054787e89c59c593a4169830ab362ac2bee8a969249dc56e5d7d20ff8df9", size = 6963559 }, + { url = "https://files.pythonhosted.org/packages/4c/22/fb1be710a14434c09080dd4a0acc08939f612ec02efcb04b9e210474782d/numpy-2.2.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7716e4a9b7af82c06a2543c53ca476fa0b57e4d760481273e09da04b74ee6ee2", size = 14368066 }, + { url = "https://files.pythonhosted.org/packages/c2/07/2e5cc71193e3ef3a219ffcf6ca4858e46ea2be09c026ddd480d596b32867/numpy-2.2.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:adf8c1d66f432ce577d0197dceaac2ac00c0759f573f28516246351c58a85020", size = 16417040 }, + { url = "https://files.pythonhosted.org/packages/1a/97/3b1537776ad9a6d1a41813818343745e8dd928a2916d4c9edcd9a8af1dac/numpy-2.2.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:218f061d2faa73621fa23d6359442b0fc658d5b9a70801373625d958259eaca3", size = 15879862 }, + { url = "https://files.pythonhosted.org/packages/b0/b7/4472f603dd45ef36ff3d8e84e84fe02d9467c78f92cc121633dce6da307b/numpy-2.2.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:df2f57871a96bbc1b69733cd4c51dc33bea66146b8c63cacbfed73eec0883017", size = 18206032 }, + { url = "https://files.pythonhosted.org/packages/0d/bd/6a092963fb82e6c5aa0d0440635827bbb2910da229545473bbb58c537ed3/numpy-2.2.4-cp310-cp310-win32.whl", hash = "sha256:a0258ad1f44f138b791327961caedffbf9612bfa504ab9597157806faa95194a", size = 6608517 }, + { url = "https://files.pythonhosted.org/packages/01/e3/cb04627bc2a1638948bc13e818df26495aa18e20d5be1ed95ab2b10b6847/numpy-2.2.4-cp310-cp310-win_amd64.whl", hash = "sha256:0d54974f9cf14acf49c60f0f7f4084b6579d24d439453d5fc5805d46a165b542", size = 12943498 }, + { url = "https://files.pythonhosted.org/packages/16/fb/09e778ee3a8ea0d4dc8329cca0a9c9e65fed847d08e37eba74cb7ed4b252/numpy-2.2.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e9e0a277bb2eb5d8a7407e14688b85fd8ad628ee4e0c7930415687b6564207a4", size = 21254989 }, + { url = "https://files.pythonhosted.org/packages/a2/0a/1212befdbecab5d80eca3cde47d304cad986ad4eec7d85a42e0b6d2cc2ef/numpy-2.2.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9eeea959168ea555e556b8188da5fa7831e21d91ce031e95ce23747b7609f8a4", size = 14425910 }, + { url = "https://files.pythonhosted.org/packages/2b/3e/e7247c1d4f15086bb106c8d43c925b0b2ea20270224f5186fa48d4fb5cbd/numpy-2.2.4-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:bd3ad3b0a40e713fc68f99ecfd07124195333f1e689387c180813f0e94309d6f", size = 5426490 }, + { url = "https://files.pythonhosted.org/packages/5d/fa/aa7cd6be51419b894c5787a8a93c3302a1ed4f82d35beb0613ec15bdd0e2/numpy-2.2.4-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:cf28633d64294969c019c6df4ff37f5698e8326db68cc2b66576a51fad634880", size = 6967754 }, + { url = "https://files.pythonhosted.org/packages/d5/ee/96457c943265de9fadeb3d2ffdbab003f7fba13d971084a9876affcda095/numpy-2.2.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2fa8fa7697ad1646b5c93de1719965844e004fcad23c91228aca1cf0800044a1", size = 14373079 }, + { url = "https://files.pythonhosted.org/packages/c5/5c/ceefca458559f0ccc7a982319f37ed07b0d7b526964ae6cc61f8ad1b6119/numpy-2.2.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f4162988a360a29af158aeb4a2f4f09ffed6a969c9776f8f3bdee9b06a8ab7e5", size = 16428819 }, + { url = "https://files.pythonhosted.org/packages/22/31/9b2ac8eee99e001eb6add9fa27514ef5e9faf176169057a12860af52704c/numpy-2.2.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:892c10d6a73e0f14935c31229e03325a7b3093fafd6ce0af704be7f894d95687", size = 15881470 }, + { url = "https://files.pythonhosted.org/packages/f0/dc/8569b5f25ff30484b555ad8a3f537e0225d091abec386c9420cf5f7a2976/numpy-2.2.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:db1f1c22173ac1c58db249ae48aa7ead29f534b9a948bc56828337aa84a32ed6", size = 18218144 }, + { url = "https://files.pythonhosted.org/packages/5e/05/463c023a39bdeb9bb43a99e7dee2c664cb68d5bb87d14f92482b9f6011cc/numpy-2.2.4-cp311-cp311-win32.whl", hash = "sha256:ea2bb7e2ae9e37d96835b3576a4fa4b3a97592fbea8ef7c3587078b0068b8f09", size = 6606368 }, + { url = "https://files.pythonhosted.org/packages/8b/72/10c1d2d82101c468a28adc35de6c77b308f288cfd0b88e1070f15b98e00c/numpy-2.2.4-cp311-cp311-win_amd64.whl", hash = "sha256:f7de08cbe5551911886d1ab60de58448c6df0f67d9feb7d1fb21e9875ef95e91", size = 12947526 }, + { url = "https://files.pythonhosted.org/packages/a2/30/182db21d4f2a95904cec1a6f779479ea1ac07c0647f064dea454ec650c42/numpy-2.2.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a7b9084668aa0f64e64bd00d27ba5146ef1c3a8835f3bd912e7a9e01326804c4", size = 20947156 }, + { url = "https://files.pythonhosted.org/packages/24/6d/9483566acfbda6c62c6bc74b6e981c777229d2af93c8eb2469b26ac1b7bc/numpy-2.2.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:dbe512c511956b893d2dacd007d955a3f03d555ae05cfa3ff1c1ff6df8851854", size = 14133092 }, + { url = "https://files.pythonhosted.org/packages/27/f6/dba8a258acbf9d2bed2525cdcbb9493ef9bae5199d7a9cb92ee7e9b2aea6/numpy-2.2.4-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:bb649f8b207ab07caebba230d851b579a3c8711a851d29efe15008e31bb4de24", size = 5163515 }, + { url = "https://files.pythonhosted.org/packages/62/30/82116199d1c249446723c68f2c9da40d7f062551036f50b8c4caa42ae252/numpy-2.2.4-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:f34dc300df798742b3d06515aa2a0aee20941c13579d7a2f2e10af01ae4901ee", size = 6696558 }, + { url = "https://files.pythonhosted.org/packages/0e/b2/54122b3c6df5df3e87582b2e9430f1bdb63af4023c739ba300164c9ae503/numpy-2.2.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3f7ac96b16955634e223b579a3e5798df59007ca43e8d451a0e6a50f6bfdfba", size = 14084742 }, + { url = "https://files.pythonhosted.org/packages/02/e2/e2cbb8d634151aab9528ef7b8bab52ee4ab10e076509285602c2a3a686e0/numpy-2.2.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4f92084defa704deadd4e0a5ab1dc52d8ac9e8a8ef617f3fbb853e79b0ea3592", size = 16134051 }, + { url = "https://files.pythonhosted.org/packages/8e/21/efd47800e4affc993e8be50c1b768de038363dd88865920439ef7b422c60/numpy-2.2.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:7a4e84a6283b36632e2a5b56e121961f6542ab886bc9e12f8f9818b3c266bfbb", size = 15578972 }, + { url = "https://files.pythonhosted.org/packages/04/1e/f8bb88f6157045dd5d9b27ccf433d016981032690969aa5c19e332b138c0/numpy-2.2.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:11c43995255eb4127115956495f43e9343736edb7fcdb0d973defd9de14cd84f", size = 17898106 }, + { url = "https://files.pythonhosted.org/packages/2b/93/df59a5a3897c1f036ae8ff845e45f4081bb06943039ae28a3c1c7c780f22/numpy-2.2.4-cp312-cp312-win32.whl", hash = "sha256:65ef3468b53269eb5fdb3a5c09508c032b793da03251d5f8722b1194f1790c00", size = 6311190 }, + { url = "https://files.pythonhosted.org/packages/46/69/8c4f928741c2a8efa255fdc7e9097527c6dc4e4df147e3cadc5d9357ce85/numpy-2.2.4-cp312-cp312-win_amd64.whl", hash = "sha256:2aad3c17ed2ff455b8eaafe06bcdae0062a1db77cb99f4b9cbb5f4ecb13c5146", size = 12644305 }, + { url = "https://files.pythonhosted.org/packages/2a/d0/bd5ad792e78017f5decfb2ecc947422a3669a34f775679a76317af671ffc/numpy-2.2.4-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:1cf4e5c6a278d620dee9ddeb487dc6a860f9b199eadeecc567f777daace1e9e7", size = 20933623 }, + { url = "https://files.pythonhosted.org/packages/c3/bc/2b3545766337b95409868f8e62053135bdc7fa2ce630aba983a2aa60b559/numpy-2.2.4-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:1974afec0b479e50438fc3648974268f972e2d908ddb6d7fb634598cdb8260a0", size = 14148681 }, + { url = "https://files.pythonhosted.org/packages/6a/70/67b24d68a56551d43a6ec9fe8c5f91b526d4c1a46a6387b956bf2d64744e/numpy-2.2.4-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:79bd5f0a02aa16808fcbc79a9a376a147cc1045f7dfe44c6e7d53fa8b8a79392", size = 5148759 }, + { url = "https://files.pythonhosted.org/packages/1c/8b/e2fc8a75fcb7be12d90b31477c9356c0cbb44abce7ffb36be39a0017afad/numpy-2.2.4-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:3387dd7232804b341165cedcb90694565a6015433ee076c6754775e85d86f1fc", size = 6683092 }, + { url = "https://files.pythonhosted.org/packages/13/73/41b7b27f169ecf368b52533edb72e56a133f9e86256e809e169362553b49/numpy-2.2.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6f527d8fdb0286fd2fd97a2a96c6be17ba4232da346931d967a0630050dfd298", size = 14081422 }, + { url = "https://files.pythonhosted.org/packages/4b/04/e208ff3ae3ddfbafc05910f89546382f15a3f10186b1f56bd99f159689c2/numpy-2.2.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bce43e386c16898b91e162e5baaad90c4b06f9dcbe36282490032cec98dc8ae7", size = 16132202 }, + { url = "https://files.pythonhosted.org/packages/fe/bc/2218160574d862d5e55f803d88ddcad88beff94791f9c5f86d67bd8fbf1c/numpy-2.2.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:31504f970f563d99f71a3512d0c01a645b692b12a63630d6aafa0939e52361e6", size = 15573131 }, + { url = "https://files.pythonhosted.org/packages/a5/78/97c775bc4f05abc8a8426436b7cb1be806a02a2994b195945600855e3a25/numpy-2.2.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:81413336ef121a6ba746892fad881a83351ee3e1e4011f52e97fba79233611fd", size = 17894270 }, + { url = "https://files.pythonhosted.org/packages/b9/eb/38c06217a5f6de27dcb41524ca95a44e395e6a1decdc0c99fec0832ce6ae/numpy-2.2.4-cp313-cp313-win32.whl", hash = "sha256:f486038e44caa08dbd97275a9a35a283a8f1d2f0ee60ac260a1790e76660833c", size = 6308141 }, + { url = "https://files.pythonhosted.org/packages/52/17/d0dd10ab6d125c6d11ffb6dfa3423c3571befab8358d4f85cd4471964fcd/numpy-2.2.4-cp313-cp313-win_amd64.whl", hash = "sha256:207a2b8441cc8b6a2a78c9ddc64d00d20c303d79fba08c577752f080c4007ee3", size = 12636885 }, + { url = "https://files.pythonhosted.org/packages/fa/e2/793288ede17a0fdc921172916efb40f3cbc2aa97e76c5c84aba6dc7e8747/numpy-2.2.4-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:8120575cb4882318c791f839a4fd66161a6fa46f3f0a5e613071aae35b5dd8f8", size = 20961829 }, + { url = "https://files.pythonhosted.org/packages/3a/75/bb4573f6c462afd1ea5cbedcc362fe3e9bdbcc57aefd37c681be1155fbaa/numpy-2.2.4-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a761ba0fa886a7bb33c6c8f6f20213735cb19642c580a931c625ee377ee8bd39", size = 14161419 }, + { url = "https://files.pythonhosted.org/packages/03/68/07b4cd01090ca46c7a336958b413cdbe75002286295f2addea767b7f16c9/numpy-2.2.4-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:ac0280f1ba4a4bfff363a99a6aceed4f8e123f8a9b234c89140f5e894e452ecd", size = 5196414 }, + { url = "https://files.pythonhosted.org/packages/a5/fd/d4a29478d622fedff5c4b4b4cedfc37a00691079623c0575978d2446db9e/numpy-2.2.4-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:879cf3a9a2b53a4672a168c21375166171bc3932b7e21f622201811c43cdd3b0", size = 6709379 }, + { url = "https://files.pythonhosted.org/packages/41/78/96dddb75bb9be730b87c72f30ffdd62611aba234e4e460576a068c98eff6/numpy-2.2.4-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f05d4198c1bacc9124018109c5fba2f3201dbe7ab6e92ff100494f236209c960", size = 14051725 }, + { url = "https://files.pythonhosted.org/packages/00/06/5306b8199bffac2a29d9119c11f457f6c7d41115a335b78d3f86fad4dbe8/numpy-2.2.4-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2f085ce2e813a50dfd0e01fbfc0c12bbe5d2063d99f8b29da30e544fb6483b8", size = 16101638 }, + { url = "https://files.pythonhosted.org/packages/fa/03/74c5b631ee1ded596945c12027649e6344614144369fd3ec1aaced782882/numpy-2.2.4-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:92bda934a791c01d6d9d8e038363c50918ef7c40601552a58ac84c9613a665bc", size = 15571717 }, + { url = "https://files.pythonhosted.org/packages/cb/dc/4fc7c0283abe0981e3b89f9b332a134e237dd476b0c018e1e21083310c31/numpy-2.2.4-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:ee4d528022f4c5ff67332469e10efe06a267e32f4067dc76bb7e2cddf3cd25ff", size = 17879998 }, + { url = "https://files.pythonhosted.org/packages/e5/2b/878576190c5cfa29ed896b518cc516aecc7c98a919e20706c12480465f43/numpy-2.2.4-cp313-cp313t-win32.whl", hash = "sha256:05c076d531e9998e7e694c36e8b349969c56eadd2cdcd07242958489d79a7286", size = 6366896 }, + { url = "https://files.pythonhosted.org/packages/3e/05/eb7eec66b95cf697f08c754ef26c3549d03ebd682819f794cb039574a0a6/numpy-2.2.4-cp313-cp313t-win_amd64.whl", hash = "sha256:188dcbca89834cc2e14eb2f106c96d6d46f200fe0200310fc29089657379c58d", size = 12739119 }, + { url = "https://files.pythonhosted.org/packages/b2/5c/f09c33a511aff41a098e6ef3498465d95f6360621034a3d95f47edbc9119/numpy-2.2.4-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:7051ee569db5fbac144335e0f3b9c2337e0c8d5c9fee015f259a5bd70772b7e8", size = 21081956 }, + { url = "https://files.pythonhosted.org/packages/ba/30/74c48b3b6494c4b820b7fa1781d441e94d87a08daa5b35d222f06ba41a6f/numpy-2.2.4-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:ab2939cd5bec30a7430cbdb2287b63151b77cf9624de0532d629c9a1c59b1d5c", size = 6827143 }, + { url = "https://files.pythonhosted.org/packages/54/f5/ab0d2f48b490535c7a80e05da4a98902b632369efc04f0e47bb31ca97d8f/numpy-2.2.4-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d0f35b19894a9e08639fd60a1ec1978cb7f5f7f1eace62f38dd36be8aecdef4d", size = 16233350 }, + { url = "https://files.pythonhosted.org/packages/3b/3a/2f6d8c1f8e45d496bca6baaec93208035faeb40d5735c25afac092ec9a12/numpy-2.2.4-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:b4adfbbc64014976d2f91084915ca4e626fbf2057fb81af209c1a6d776d23e3d", size = 12857565 }, +] + [[package]] name = "openai" -version = "1.66.5" +version = "1.68.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyio" }, { name = "distro" }, { name = "httpx" }, { name = "jiter" }, + { name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "numpy", version = "2.2.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, { name = "pydantic" }, { name = "sniffio" }, + { name = "sounddevice" }, { name = "tqdm" }, { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/bb/10/b19dc682c806e6735a8387f2003afe2abada9f9e5227318de642c6949524/openai-1.66.5.tar.gz", hash = "sha256:f61b8fac29490ca8fdc6d996aa6926c18dbe5639536f8c40219c40db05511b11", size = 398595 } +sdist = { url = "https://files.pythonhosted.org/packages/58/ea/58102e9bfda09edc963e6e877e39cca12706b46ebf35d5fc9da7b8af10f2/openai-1.68.0.tar.gz", hash = "sha256:c570c06c9ba10f98b891ac30a3dd7b5c89ed48094c711c7a3f35fb5ade6c0757", size = 413039 } wheels = [ - { url = "https://files.pythonhosted.org/packages/c7/3b/1ba418920ecd1eae7cc4d4ac8a01711ee0879b1a57dd81d10551e5b9a2ea/openai-1.66.5-py3-none-any.whl", hash = "sha256:74be528175f8389f67675830c51a15bd51e874425c86d3de6153bf70ed6c2884", size = 571144 }, + { url = "https://files.pythonhosted.org/packages/a5/b6/bd67b7031572cba7d8451d82ac4a990b3a96bbd3b037634726b48ac972c8/openai-1.68.0-py3-none-any.whl", hash = "sha256:20e279b0f3a78cb4a95f3eab2a180f3ee30c6a196aeebd6bf642a4f88ab85ee1", size = 605645 }, ] [[package]] @@ -826,6 +1061,12 @@ dependencies = [ { name = "typing-extensions" }, ] +[package.optional-dependencies] +voice = [ + { name = "numpy", version = "2.2.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, + { name = "websockets" }, +] + [package.dev-dependencies] dev = [ { name = "coverage" }, @@ -835,22 +1076,29 @@ dev = [ { name = "mkdocstrings", extra = ["python"] }, { name = "mypy" }, { name = "playwright" }, + { name = "pynput" }, { name = "pytest" }, { name = "pytest-asyncio" }, { name = "pytest-mock" }, { name = "rich" }, { name = "ruff" }, + { name = "sounddevice" }, + { name = "textual" }, + { name = "types-pynput" }, ] [package.metadata] requires-dist = [ { name = "griffe", specifier = ">=1.5.6,<2" }, + { name = "numpy", marker = "python_full_version >= '3.10' and extra == 'voice'", specifier = ">=2.2.0,<3" }, { name = "openai", specifier = ">=1.66.5" }, { name = "pydantic", specifier = ">=2.10,<3" }, { name = "requests", specifier = ">=2.0,<3" }, { name = "types-requests", specifier = ">=2.0,<3" }, { name = "typing-extensions", specifier = ">=4.12.2,<5" }, + { name = "websockets", marker = "extra == 'voice'", specifier = ">=15.0,<16" }, ] +provides-extras = ["voice"] [package.metadata.requires-dev] dev = [ @@ -861,11 +1109,15 @@ dev = [ { name = "mkdocstrings", extras = ["python"], specifier = ">=0.28.0" }, { name = "mypy" }, { name = "playwright", specifier = "==1.50.0" }, + { name = "pynput" }, { name = "pytest" }, { name = "pytest-asyncio" }, { name = "pytest-mock", specifier = ">=3.14.0" }, { name = "rich" }, { name = "ruff", specifier = "==0.9.2" }, + { name = "sounddevice" }, + { name = "textual" }, + { name = "types-pynput" }, ] [[package]] @@ -897,11 +1149,11 @@ wheels = [ [[package]] name = "platformdirs" -version = "4.3.6" +version = "4.3.7" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/13/fc/128cc9cb8f03208bdbf93d3aa862e16d376844a14f9a0ce5cf4507372de4/platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907", size = 21302 } +sdist = { url = "https://files.pythonhosted.org/packages/b6/2d/7d512a3913d60623e7eb945c6d1b4f0bddf1d0b7ada5225274c87e5b53d1/platformdirs-4.3.7.tar.gz", hash = "sha256:eb437d586b6a0986388f0d6f74aa0cde27b48d0e3d66843640bfb6bdcdb6e351", size = 21291 } wheels = [ - { url = "https://files.pythonhosted.org/packages/3c/a6/bc1012356d8ece4d66dd75c4b9fc6c1f6650ddd5991e421177d9f8f671be/platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb", size = 18439 }, + { url = "https://files.pythonhosted.org/packages/6d/45/59578566b3275b8fd9157885918fcd0c4d74162928a5310926887b856a51/platformdirs-4.3.7-py3-none-any.whl", hash = "sha256:a03875334331946f13c549dbd8f4bac7a13a50a895a0eb1e8c6a8ace80d40a94", size = 18499 }, ] [[package]] @@ -931,6 +1183,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 }, ] +[[package]] +name = "pycparser" +version = "2.22" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/1d/b2/31537cf4b1ca988837256c910a668b553fceb8f069bedc4b1c826024b52c/pycparser-2.22.tar.gz", hash = "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6", size = 172736 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/13/a3/a812df4e2dd5696d1f351d58b8fe16a405b234ad2886a0dab9183fb78109/pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc", size = 117552 }, +] + [[package]] name = "pydantic" version = "2.10.6" @@ -1076,6 +1337,110 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/eb/f5/b9e2a42aa8f9e34d52d66de87941ecd236570c7ed2e87775ed23bbe4e224/pymdown_extensions-10.14.3-py3-none-any.whl", hash = "sha256:05e0bee73d64b9c71a4ae17c72abc2f700e8bc8403755a00580b49a4e9f189e9", size = 264467 }, ] +[[package]] +name = "pynput" +version = "1.8.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "evdev", marker = "'linux' in sys_platform" }, + { name = "pyobjc-framework-applicationservices", marker = "sys_platform == 'darwin'" }, + { name = "pyobjc-framework-quartz", marker = "sys_platform == 'darwin'" }, + { name = "python-xlib", marker = "'linux' in sys_platform" }, + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f0/c3/dccf44c68225046df5324db0cc7d563a560635355b3e5f1d249468268a6f/pynput-1.8.1.tar.gz", hash = "sha256:70d7c8373ee98911004a7c938742242840a5628c004573d84ba849d4601df81e", size = 82289 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/59/4f/ac3fa906ae8a375a536b12794128c5efacade9eaa917a35dfd27ce0c7400/pynput-1.8.1-py2.py3-none-any.whl", hash = "sha256:42dfcf27404459ca16ca889c8fb8ffe42a9fe54f722fd1a3e130728e59e768d2", size = 91693 }, +] + +[[package]] +name = "pyobjc-core" +version = "11.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5c/94/a111239b98260869780a5767e5d74bfd3a8c13a40457f479c28dcd91f89d/pyobjc_core-11.0.tar.gz", hash = "sha256:63bced211cb8a8fb5c8ff46473603da30e51112861bd02c438fbbbc8578d9a70", size = 994931 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bc/21/ccc992b38670176a615fb67686d709e03be989511da687f6f49ddc4ff6c8/pyobjc_core-11.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:10866b3a734d47caf48e456eea0d4815c2c9b21856157db5917b61dee06893a1", size = 732162 }, + { url = "https://files.pythonhosted.org/packages/52/05/fa97309c3b1bc1ec90d701db89902e0bd5e1024023aa2c5387b889458b1b/pyobjc_core-11.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:50675c0bb8696fe960a28466f9baf6943df2928a1fd85625d678fa2f428bd0bd", size = 727295 }, + { url = "https://files.pythonhosted.org/packages/56/ce/bf3ff9a9347721a398c3dfb83e29b43fb166b7ef590f3f7b7ddcd283df39/pyobjc_core-11.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:a03061d4955c62ddd7754224a80cdadfdf17b6b5f60df1d9169a3b1b02923f0b", size = 739750 }, + { url = "https://files.pythonhosted.org/packages/72/16/0c468e73dbecb821e3da8819236fe832dfc53eb5f66a11775b055a7589ea/pyobjc_core-11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:c338c1deb7ab2e9436d4175d1127da2eeed4a1b564b3d83b9f3ae4844ba97e86", size = 743900 }, + { url = "https://files.pythonhosted.org/packages/f3/88/cecec88fd51f62a6cd7775cc4fb6bfde16652f97df88d28c84fb77ca0c18/pyobjc_core-11.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b4e9dc4296110f251a4033ff3f40320b35873ea7f876bd29a1c9705bb5e08c59", size = 791905 }, + { url = "https://files.pythonhosted.org/packages/14/ba/1c459d0f1fc4c80314040ea6efea433c0641adffa6701679ec3a917b51a3/pyobjc_core-11.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:02406ece449d0f41b31e579e47ca77ced3eb57533df955281bfcecc99da74fba", size = 732648 }, +] + +[[package]] +name = "pyobjc-framework-applicationservices" +version = "11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyobjc-core" }, + { name = "pyobjc-framework-cocoa" }, + { name = "pyobjc-framework-coretext" }, + { name = "pyobjc-framework-quartz" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ba/fb/4e42573b0d3baa3fa18ec53614cf979f951313f1451e8f2e17df9429da1f/pyobjc_framework_applicationservices-11.0.tar.gz", hash = "sha256:d6ea18dfc7d5626a3ecf4ac72d510405c0d3a648ca38cae8db841acdebecf4d2", size = 224334 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/29/2e/23d996e8294cc4d4ac719c410b1d210dfb1f64eecf87170d5e72c966592a/pyobjc_framework_ApplicationServices-11.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:bc8f34b5b59ffd3c210ae883d794345c1197558ff3da0f5800669cf16435271e", size = 30839 }, + { url = "https://files.pythonhosted.org/packages/99/37/3d4dc6c004aaeb67bd43f7261d7c169ff45b8fc0eefbc7ba8cd6b0c881bc/pyobjc_framework_ApplicationServices-11.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:61a99eef23abb704257310db4f5271137707e184768f6407030c01de4731b67b", size = 30846 }, + { url = "https://files.pythonhosted.org/packages/74/a9/7a45a67e126d32c61ea22ffd80e87ff7e05b4acf32bede6cce071fbfffc8/pyobjc_framework_ApplicationServices-11.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:5fbeb425897d6129471d451ec61a29ddd5b1386eb26b1dd49cb313e34616ee21", size = 30908 }, + { url = "https://files.pythonhosted.org/packages/82/47/ab4155ec966aff2f8f0f6978b40f12255e8ef46111ca0bda7987959b4052/pyobjc_framework_ApplicationServices-11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:59becf3cd87a4f4cedf4be02ff6cf46ed736f5c1123ce629f788aaafad91eff0", size = 30924 }, + { url = "https://files.pythonhosted.org/packages/a3/73/747aab95970e0b7b5d38c650028e5e034c0432d9451335ff790ca104f11a/pyobjc_framework_ApplicationServices-11.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:44b466e8745fb49e8ac20f29f2ffd7895b45e97aa63a844b2a80a97c3a34346f", size = 31279 }, + { url = "https://files.pythonhosted.org/packages/a7/db/e8895fffa91031ab348ccad426dbd4c7d787ee0f48e1590ccba841669755/pyobjc_framework_ApplicationServices-11.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:74963e15a751d1454c1b8060914f116956e3a68f6a117c2163f491609125283b", size = 30809 }, +] + +[[package]] +name = "pyobjc-framework-cocoa" +version = "11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyobjc-core" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c5/32/53809096ad5fc3e7a2c5ddea642590a5f2cb5b81d0ad6ea67fdb2263d9f9/pyobjc_framework_cocoa-11.0.tar.gz", hash = "sha256:00346a8cb81ad7b017b32ff7bf596000f9faa905807b1bd234644ebd47f692c5", size = 6173848 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/37/16/905a32c5241848ddd91d94bae346342750f28f49fadb3746e9e796f929f3/pyobjc_framework_Cocoa-11.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:fbc65f260d617d5463c7fb9dbaaffc23c9a4fabfe3b1a50b039b61870b8daefd", size = 385509 }, + { url = "https://files.pythonhosted.org/packages/23/97/81fd41ad90e9c241172110aa635a6239d56f50d75923aaedbbe351828580/pyobjc_framework_Cocoa-11.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3ea7be6e6dd801b297440de02d312ba3fa7fd3c322db747ae1cb237e975f5d33", size = 385534 }, + { url = "https://files.pythonhosted.org/packages/5b/8d/0e2558447c26b3ba64f7c9776a5a6c9d2ae8abf9d34308b174ae0934402e/pyobjc_framework_Cocoa-11.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:280a577b83c68175a28b2b7138d1d2d3111f2b2b66c30e86f81a19c2b02eae71", size = 385811 }, + { url = "https://files.pythonhosted.org/packages/1d/a5/609281a7e89efefbef9db1d8fe66bc0458c3b4e74e2227c644f9c18926fa/pyobjc_framework_Cocoa-11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:15b2bd977ed340074f930f1330f03d42912d5882b697d78bd06f8ebe263ef92e", size = 385889 }, + { url = "https://files.pythonhosted.org/packages/93/f6/2d5a863673ef7b85a3cba875c43e6c495fb1307427a6801001ae94bb5e54/pyobjc_framework_Cocoa-11.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:5750001db544e67f2b66f02067d8f0da96bb2ef71732bde104f01b8628f9d7ea", size = 389831 }, + { url = "https://files.pythonhosted.org/packages/27/29/459cacd815c2e13de60b919c0af3d1056f74ff52172a4841684b5b946492/pyobjc_framework_Cocoa-11.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:ddff25b0755d59873d186e1e07d6aaddb19d55e3ae890d69ff2d9babf8627657", size = 385407 }, +] + +[[package]] +name = "pyobjc-framework-coretext" +version = "11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyobjc-core" }, + { name = "pyobjc-framework-cocoa" }, + { name = "pyobjc-framework-quartz" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9d/e8/9b68dc788828e38143a3e834e66346713751cb83d7f0955016323005c1a2/pyobjc_framework_coretext-11.0.tar.gz", hash = "sha256:a68437153e627847e3898754dd3f13ae0cb852246b016a91f9c9cbccb9f91a43", size = 274222 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ce/af/aa4ab3e029a9f539e782eab894c57590791700d892cda73a324fe22e09a6/pyobjc_framework_CoreText-11.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6939b4ea745b349b5c964823a2071f155f5defdc9b9fc3a13f036d859d7d0439", size = 30395 }, + { url = "https://files.pythonhosted.org/packages/f6/20/b8a967101b585a2425ffe645135f8618edd51e1430aeb668373475a07d1f/pyobjc_framework_CoreText-11.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:56a4889858308b0d9f147d568b4d91c441cc0ffd332497cb4f709bb1990450c1", size = 30397 }, + { url = "https://files.pythonhosted.org/packages/0d/14/d300b8bf18acd1d98d40820d2a9b5c5b6cf96325bdfc5020bc963218e001/pyobjc_framework_CoreText-11.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:fb90e7f370b3fd7cb2fb442e3dc63fedf0b4af6908db1c18df694d10dc94669d", size = 30456 }, + { url = "https://files.pythonhosted.org/packages/94/f0/53b681481e9429e8f9ac2c039da6a820d7417ca92f763f01d629db36c530/pyobjc_framework_CoreText-11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:7947f755782456bd663e0b00c7905eeffd10f839f0bf2af031f68ded6a1ea360", size = 30453 }, + { url = "https://files.pythonhosted.org/packages/2a/3f/a6d09952e83d70be6d337a5f1d457018459a57a110a91c3e771a2f2a7de0/pyobjc_framework_CoreText-11.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:5356116bae33ec49f1f212c301378a7d08000440a2d6a7281aab351945528ab9", size = 31092 }, + { url = "https://files.pythonhosted.org/packages/c8/26/d18fd9fbb71dac6f43bd85d74aae3f3b4294ca96f0375878710763140b4b/pyobjc_framework_CoreText-11.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:4a76e1307747f2ee8180d38844cd62b8bb1701b4203d9234cc41f6603d4ae654", size = 30377 }, +] + +[[package]] +name = "pyobjc-framework-quartz" +version = "11.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyobjc-core" }, + { name = "pyobjc-framework-cocoa" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a5/ad/f00f3f53387c23bbf4e0bb1410e11978cbf87c82fa6baff0ee86f74c5fb6/pyobjc_framework_quartz-11.0.tar.gz", hash = "sha256:3205bf7795fb9ae34747f701486b3db6dfac71924894d1f372977c4d70c3c619", size = 3952463 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bd/b3/75fccb0406aac00eecbd14f278a9b6e6fc0e4483220d57eb3aff68666fb1/pyobjc_framework_Quartz-11.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:da3ab13c9f92361959b41b0ad4cdd41ae872f90a6d8c58a9ed699bc08ab1c45c", size = 212343 }, + { url = "https://files.pythonhosted.org/packages/a3/6a/68957c8c5e8f0128d4d419728bac397d48fa7ad7a66e82b70e64d129ffca/pyobjc_framework_Quartz-11.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d251696bfd8e8ef72fbc90eb29fec95cb9d1cc409008a183d5cc3246130ae8c2", size = 212349 }, + { url = "https://files.pythonhosted.org/packages/60/5d/df827b78dcb5140652ad08af8038c9ddd7e01e6bdf84462bfee644e6e661/pyobjc_framework_Quartz-11.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:cb4a9f2d9d580ea15e25e6b270f47681afb5689cafc9e25712445ce715bcd18e", size = 212061 }, + { url = "https://files.pythonhosted.org/packages/a6/9e/54c48fe8faab06ee5eb80796c8c17ec61fc313d84398540ee70abeaf7070/pyobjc_framework_Quartz-11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:973b4f9b8ab844574461a038bd5269f425a7368d6e677e3cc81fcc9b27b65498", size = 212478 }, + { url = "https://files.pythonhosted.org/packages/4a/28/456b54a59bfe11a91b7b4e94f8ffdcf174ffd1efa169f4283e5b3bc10194/pyobjc_framework_Quartz-11.0-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:66ab58d65348863b8707e63b2ec5cdc54569ee8189d1af90d52f29f5fdf6272c", size = 217973 }, + { url = "https://files.pythonhosted.org/packages/89/a9/c7efb146a2b9c9a7754fed1dd725f7342959644d903006dec28aa65a637e/pyobjc_framework_Quartz-11.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1032f63f2a4ee98366764e69c249f1d93813821e17d224cf626cf11fb1801fc4", size = 212182 }, +] + [[package]] name = "pytest" version = "8.3.5" @@ -1129,6 +1494,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892 }, ] +[[package]] +name = "python-xlib" +version = "0.33" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/86/f5/8c0653e5bb54e0cbdfe27bf32d41f27bc4e12faa8742778c17f2a71be2c0/python-xlib-0.33.tar.gz", hash = "sha256:55af7906a2c75ce6cb280a584776080602444f75815a7aff4d287bb2d7018b32", size = 269068 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/fc/b8/ff33610932e0ee81ae7f1269c890f697d56ff74b9f5b2ee5d9b7fa2c5355/python_xlib-0.33-py2.py3-none-any.whl", hash = "sha256:c3534038d42e0df2f1392a1b30a15a4ff5fdc2b86cfa94f072bf11b10a164398", size = 182185 }, +] + [[package]] name = "pyyaml" version = "6.0.2" @@ -1266,6 +1643,36 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 }, ] +[[package]] +name = "sounddevice" +version = "0.5.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cffi" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/80/2d/b04ae180312b81dbb694504bee170eada5372242e186f6298139fd3a0513/sounddevice-0.5.1.tar.gz", hash = "sha256:09ca991daeda8ce4be9ac91e15a9a81c8f81efa6b695a348c9171ea0c16cb041", size = 52896 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/06/d1/464b5fca3decdd0cfec8c47f7b4161a0b12972453201c1bf03811f367c5e/sounddevice-0.5.1-py3-none-any.whl", hash = "sha256:e2017f182888c3f3c280d9fbac92e5dbddac024a7e3442f6e6116bd79dab8a9c", size = 32276 }, + { url = "https://files.pythonhosted.org/packages/6f/f6/6703fe7cf3d7b7279040c792aeec6334e7305956aba4a80f23e62c8fdc44/sounddevice-0.5.1-py3-none-macosx_10_6_x86_64.macosx_10_6_universal2.whl", hash = "sha256:d16cb23d92322526a86a9490c427bf8d49e273d9ccc0bd096feecd229cde6031", size = 107916 }, + { url = "https://files.pythonhosted.org/packages/57/a5/78a5e71f5ec0faedc54f4053775d61407bfbd7d0c18228c7f3d4252fd276/sounddevice-0.5.1-py3-none-win32.whl", hash = "sha256:d84cc6231526e7a08e89beff229c37f762baefe5e0cc2747cbe8e3a565470055", size = 312494 }, + { url = "https://files.pythonhosted.org/packages/af/9b/15217b04f3b36d30de55fef542389d722de63f1ad81f9c72d8afc98cb6ab/sounddevice-0.5.1-py3-none-win_amd64.whl", hash = "sha256:4313b63f2076552b23ac3e0abd3bcfc0c1c6a696fc356759a13bd113c9df90f1", size = 363634 }, +] + +[[package]] +name = "textual" +version = "2.1.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py", extra = ["linkify", "plugins"] }, + { name = "platformdirs" }, + { name = "rich" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/41/62/4af4689dd971ed4fb3215467624016d53550bff1df9ca02e7625eec07f8b/textual-2.1.2.tar.gz", hash = "sha256:aae3f9fde00c7440be00e3c3ac189e02d014f5298afdc32132f93480f9e09146", size = 1596600 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/07/81/9df1988c908cbba77f10fecb8587496b3dff2838d4510457877a521d87fd/textual-2.1.2-py3-none-any.whl", hash = "sha256:95f37f49e930838e721bba8612f62114d410a3019665b6142adabc14c2fb9611", size = 680148 }, +] + [[package]] name = "tomli" version = "2.2.1" @@ -1317,6 +1724,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2", size = 78540 }, ] +[[package]] +name = "types-pynput" +version = "1.8.1.20250318" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/24/ae/92abffd8cc7b257e095bd87caa2e555d236811d9474b20b24dab0cb6b9e2/types_pynput-1.8.1.20250318.tar.gz", hash = "sha256:13d4df97843a7d1e7cddccbf9987aca7f0d463b214a8a35b4f53275d2c5a3576", size = 11694 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/50/7968a8040915d94c36c25b5ae4b3dcd7804a2ecd84ac537983b56201379a/types_pynput-1.8.1.20250318-py3-none-any.whl", hash = "sha256:0c1038aa1550941633114a2728ad85e392f67dfba970aebf755e369ab57aca70", size = 12280 }, +] + [[package]] name = "types-requests" version = "2.32.0.20250306" @@ -1338,6 +1754,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", size = 37438 }, ] +[[package]] +name = "uc-micro-py" +version = "1.0.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/91/7a/146a99696aee0609e3712f2b44c6274566bc368dfe8375191278045186b8/uc-micro-py-1.0.3.tar.gz", hash = "sha256:d321b92cff673ec58027c04015fcaa8bb1e005478643ff4a500882eaab88c48a", size = 6043 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/37/87/1f677586e8ac487e29672e4b17455758fce261de06a0d086167bb760361a/uc_micro_py-1.0.3-py3-none-any.whl", hash = "sha256:db1dffff340817673d7b466ec86114a9dc0e9d4d9b5ba229d9d60e5c12600cd5", size = 6229 }, +] + [[package]] name = "urllib3" version = "2.3.0" @@ -1384,6 +1809,82 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/33/e8/e40370e6d74ddba47f002a32919d91310d6074130fe4e17dabcafc15cbf1/watchdog-6.0.0-py3-none-win_ia64.whl", hash = "sha256:a1914259fa9e1454315171103c6a30961236f508b9b623eae470268bbcc6a22f", size = 79067 }, ] +[[package]] +name = "websockets" +version = "15.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/21/e6/26d09fab466b7ca9c7737474c52be4f76a40301b08362eb2dbc19dcc16c1/websockets-15.0.1.tar.gz", hash = "sha256:82544de02076bafba038ce055ee6412d68da13ab47f0c60cab827346de828dee", size = 177016 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/da/6462a9f510c0c49837bbc9345aca92d767a56c1fb2939e1579df1e1cdcf7/websockets-15.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d63efaa0cd96cf0c5fe4d581521d9fa87744540d4bc999ae6e08595a1014b45b", size = 175423 }, + { url = "https://files.pythonhosted.org/packages/1c/9f/9d11c1a4eb046a9e106483b9ff69bce7ac880443f00e5ce64261b47b07e7/websockets-15.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ac60e3b188ec7574cb761b08d50fcedf9d77f1530352db4eef1707fe9dee7205", size = 173080 }, + { url = "https://files.pythonhosted.org/packages/d5/4f/b462242432d93ea45f297b6179c7333dd0402b855a912a04e7fc61c0d71f/websockets-15.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5756779642579d902eed757b21b0164cd6fe338506a8083eb58af5c372e39d9a", size = 173329 }, + { url = "https://files.pythonhosted.org/packages/6e/0c/6afa1f4644d7ed50284ac59cc70ef8abd44ccf7d45850d989ea7310538d0/websockets-15.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fdfe3e2a29e4db3659dbd5bbf04560cea53dd9610273917799f1cde46aa725e", size = 182312 }, + { url = "https://files.pythonhosted.org/packages/dd/d4/ffc8bd1350b229ca7a4db2a3e1c482cf87cea1baccd0ef3e72bc720caeec/websockets-15.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c2529b320eb9e35af0fa3016c187dffb84a3ecc572bcee7c3ce302bfeba52bf", size = 181319 }, + { url = "https://files.pythonhosted.org/packages/97/3a/5323a6bb94917af13bbb34009fac01e55c51dfde354f63692bf2533ffbc2/websockets-15.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac1e5c9054fe23226fb11e05a6e630837f074174c4c2f0fe442996112a6de4fb", size = 181631 }, + { url = "https://files.pythonhosted.org/packages/a6/cc/1aeb0f7cee59ef065724041bb7ed667b6ab1eeffe5141696cccec2687b66/websockets-15.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5df592cd503496351d6dc14f7cdad49f268d8e618f80dce0cd5a36b93c3fc08d", size = 182016 }, + { url = "https://files.pythonhosted.org/packages/79/f9/c86f8f7af208e4161a7f7e02774e9d0a81c632ae76db2ff22549e1718a51/websockets-15.0.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0a34631031a8f05657e8e90903e656959234f3a04552259458aac0b0f9ae6fd9", size = 181426 }, + { url = "https://files.pythonhosted.org/packages/c7/b9/828b0bc6753db905b91df6ae477c0b14a141090df64fb17f8a9d7e3516cf/websockets-15.0.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3d00075aa65772e7ce9e990cab3ff1de702aa09be3940d1dc88d5abf1ab8a09c", size = 181360 }, + { url = "https://files.pythonhosted.org/packages/89/fb/250f5533ec468ba6327055b7d98b9df056fb1ce623b8b6aaafb30b55d02e/websockets-15.0.1-cp310-cp310-win32.whl", hash = "sha256:1234d4ef35db82f5446dca8e35a7da7964d02c127b095e172e54397fb6a6c256", size = 176388 }, + { url = "https://files.pythonhosted.org/packages/1c/46/aca7082012768bb98e5608f01658ff3ac8437e563eca41cf068bd5849a5e/websockets-15.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:39c1fec2c11dc8d89bba6b2bf1556af381611a173ac2b511cf7231622058af41", size = 176830 }, + { url = "https://files.pythonhosted.org/packages/9f/32/18fcd5919c293a398db67443acd33fde142f283853076049824fc58e6f75/websockets-15.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:823c248b690b2fd9303ba00c4f66cd5e2d8c3ba4aa968b2779be9532a4dad431", size = 175423 }, + { url = "https://files.pythonhosted.org/packages/76/70/ba1ad96b07869275ef42e2ce21f07a5b0148936688c2baf7e4a1f60d5058/websockets-15.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678999709e68425ae2593acf2e3ebcbcf2e69885a5ee78f9eb80e6e371f1bf57", size = 173082 }, + { url = "https://files.pythonhosted.org/packages/86/f2/10b55821dd40eb696ce4704a87d57774696f9451108cff0d2824c97e0f97/websockets-15.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d50fd1ee42388dcfb2b3676132c78116490976f1300da28eb629272d5d93e905", size = 173330 }, + { url = "https://files.pythonhosted.org/packages/a5/90/1c37ae8b8a113d3daf1065222b6af61cc44102da95388ac0018fcb7d93d9/websockets-15.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d99e5546bf73dbad5bf3547174cd6cb8ba7273062a23808ffea025ecb1cf8562", size = 182878 }, + { url = "https://files.pythonhosted.org/packages/8e/8d/96e8e288b2a41dffafb78e8904ea7367ee4f891dafc2ab8d87e2124cb3d3/websockets-15.0.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:66dd88c918e3287efc22409d426c8f729688d89a0c587c88971a0faa2c2f3792", size = 181883 }, + { url = "https://files.pythonhosted.org/packages/93/1f/5d6dbf551766308f6f50f8baf8e9860be6182911e8106da7a7f73785f4c4/websockets-15.0.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8dd8327c795b3e3f219760fa603dcae1dcc148172290a8ab15158cf85a953413", size = 182252 }, + { url = "https://files.pythonhosted.org/packages/d4/78/2d4fed9123e6620cbf1706c0de8a1632e1a28e7774d94346d7de1bba2ca3/websockets-15.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fdc51055e6ff4adeb88d58a11042ec9a5eae317a0a53d12c062c8a8865909e8", size = 182521 }, + { url = "https://files.pythonhosted.org/packages/e7/3b/66d4c1b444dd1a9823c4a81f50231b921bab54eee2f69e70319b4e21f1ca/websockets-15.0.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:693f0192126df6c2327cce3baa7c06f2a117575e32ab2308f7f8216c29d9e2e3", size = 181958 }, + { url = "https://files.pythonhosted.org/packages/08/ff/e9eed2ee5fed6f76fdd6032ca5cd38c57ca9661430bb3d5fb2872dc8703c/websockets-15.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:54479983bd5fb469c38f2f5c7e3a24f9a4e70594cd68cd1fa6b9340dadaff7cf", size = 181918 }, + { url = "https://files.pythonhosted.org/packages/d8/75/994634a49b7e12532be6a42103597b71098fd25900f7437d6055ed39930a/websockets-15.0.1-cp311-cp311-win32.whl", hash = "sha256:16b6c1b3e57799b9d38427dda63edcbe4926352c47cf88588c0be4ace18dac85", size = 176388 }, + { url = "https://files.pythonhosted.org/packages/98/93/e36c73f78400a65f5e236cd376713c34182e6663f6889cd45a4a04d8f203/websockets-15.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:27ccee0071a0e75d22cb35849b1db43f2ecd3e161041ac1ee9d2352ddf72f065", size = 176828 }, + { url = "https://files.pythonhosted.org/packages/51/6b/4545a0d843594f5d0771e86463606a3988b5a09ca5123136f8a76580dd63/websockets-15.0.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:3e90baa811a5d73f3ca0bcbf32064d663ed81318ab225ee4f427ad4e26e5aff3", size = 175437 }, + { url = "https://files.pythonhosted.org/packages/f4/71/809a0f5f6a06522af902e0f2ea2757f71ead94610010cf570ab5c98e99ed/websockets-15.0.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:592f1a9fe869c778694f0aa806ba0374e97648ab57936f092fd9d87f8bc03665", size = 173096 }, + { url = "https://files.pythonhosted.org/packages/3d/69/1a681dd6f02180916f116894181eab8b2e25b31e484c5d0eae637ec01f7c/websockets-15.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0701bc3cfcb9164d04a14b149fd74be7347a530ad3bbf15ab2c678a2cd3dd9a2", size = 173332 }, + { url = "https://files.pythonhosted.org/packages/a6/02/0073b3952f5bce97eafbb35757f8d0d54812b6174ed8dd952aa08429bcc3/websockets-15.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8b56bdcdb4505c8078cb6c7157d9811a85790f2f2b3632c7d1462ab5783d215", size = 183152 }, + { url = "https://files.pythonhosted.org/packages/74/45/c205c8480eafd114b428284840da0b1be9ffd0e4f87338dc95dc6ff961a1/websockets-15.0.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0af68c55afbd5f07986df82831c7bff04846928ea8d1fd7f30052638788bc9b5", size = 182096 }, + { url = "https://files.pythonhosted.org/packages/14/8f/aa61f528fba38578ec553c145857a181384c72b98156f858ca5c8e82d9d3/websockets-15.0.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64dee438fed052b52e4f98f76c5790513235efaa1ef7f3f2192c392cd7c91b65", size = 182523 }, + { url = "https://files.pythonhosted.org/packages/ec/6d/0267396610add5bc0d0d3e77f546d4cd287200804fe02323797de77dbce9/websockets-15.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d5f6b181bb38171a8ad1d6aa58a67a6aa9d4b38d0f8c5f496b9e42561dfc62fe", size = 182790 }, + { url = "https://files.pythonhosted.org/packages/02/05/c68c5adbf679cf610ae2f74a9b871ae84564462955d991178f95a1ddb7dd/websockets-15.0.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5d54b09eba2bada6011aea5375542a157637b91029687eb4fdb2dab11059c1b4", size = 182165 }, + { url = "https://files.pythonhosted.org/packages/29/93/bb672df7b2f5faac89761cb5fa34f5cec45a4026c383a4b5761c6cea5c16/websockets-15.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3be571a8b5afed347da347bfcf27ba12b069d9d7f42cb8c7028b5e98bbb12597", size = 182160 }, + { url = "https://files.pythonhosted.org/packages/ff/83/de1f7709376dc3ca9b7eeb4b9a07b4526b14876b6d372a4dc62312bebee0/websockets-15.0.1-cp312-cp312-win32.whl", hash = "sha256:c338ffa0520bdb12fbc527265235639fb76e7bc7faafbb93f6ba80d9c06578a9", size = 176395 }, + { url = "https://files.pythonhosted.org/packages/7d/71/abf2ebc3bbfa40f391ce1428c7168fb20582d0ff57019b69ea20fa698043/websockets-15.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:fcd5cf9e305d7b8338754470cf69cf81f420459dbae8a3b40cee57417f4614a7", size = 176841 }, + { url = "https://files.pythonhosted.org/packages/cb/9f/51f0cf64471a9d2b4d0fc6c534f323b664e7095640c34562f5182e5a7195/websockets-15.0.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ee443ef070bb3b6ed74514f5efaa37a252af57c90eb33b956d35c8e9c10a1931", size = 175440 }, + { url = "https://files.pythonhosted.org/packages/8a/05/aa116ec9943c718905997412c5989f7ed671bc0188ee2ba89520e8765d7b/websockets-15.0.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5a939de6b7b4e18ca683218320fc67ea886038265fd1ed30173f5ce3f8e85675", size = 173098 }, + { url = "https://files.pythonhosted.org/packages/ff/0b/33cef55ff24f2d92924923c99926dcce78e7bd922d649467f0eda8368923/websockets-15.0.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:746ee8dba912cd6fc889a8147168991d50ed70447bf18bcda7039f7d2e3d9151", size = 173329 }, + { url = "https://files.pythonhosted.org/packages/31/1d/063b25dcc01faa8fada1469bdf769de3768b7044eac9d41f734fd7b6ad6d/websockets-15.0.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:595b6c3969023ecf9041b2936ac3827e4623bfa3ccf007575f04c5a6aa318c22", size = 183111 }, + { url = "https://files.pythonhosted.org/packages/93/53/9a87ee494a51bf63e4ec9241c1ccc4f7c2f45fff85d5bde2ff74fcb68b9e/websockets-15.0.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c714d2fc58b5ca3e285461a4cc0c9a66bd0e24c5da9911e30158286c9b5be7f", size = 182054 }, + { url = "https://files.pythonhosted.org/packages/ff/b2/83a6ddf56cdcbad4e3d841fcc55d6ba7d19aeb89c50f24dd7e859ec0805f/websockets-15.0.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f3c1e2ab208db911594ae5b4f79addeb3501604a165019dd221c0bdcabe4db8", size = 182496 }, + { url = "https://files.pythonhosted.org/packages/98/41/e7038944ed0abf34c45aa4635ba28136f06052e08fc2168520bb8b25149f/websockets-15.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:229cf1d3ca6c1804400b0a9790dc66528e08a6a1feec0d5040e8b9eb14422375", size = 182829 }, + { url = "https://files.pythonhosted.org/packages/e0/17/de15b6158680c7623c6ef0db361da965ab25d813ae54fcfeae2e5b9ef910/websockets-15.0.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:756c56e867a90fb00177d530dca4b097dd753cde348448a1012ed6c5131f8b7d", size = 182217 }, + { url = "https://files.pythonhosted.org/packages/33/2b/1f168cb6041853eef0362fb9554c3824367c5560cbdaad89ac40f8c2edfc/websockets-15.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:558d023b3df0bffe50a04e710bc87742de35060580a293c2a984299ed83bc4e4", size = 182195 }, + { url = "https://files.pythonhosted.org/packages/86/eb/20b6cdf273913d0ad05a6a14aed4b9a85591c18a987a3d47f20fa13dcc47/websockets-15.0.1-cp313-cp313-win32.whl", hash = "sha256:ba9e56e8ceeeedb2e080147ba85ffcd5cd0711b89576b83784d8605a7df455fa", size = 176393 }, + { url = "https://files.pythonhosted.org/packages/1b/6c/c65773d6cab416a64d191d6ee8a8b1c68a09970ea6909d16965d26bfed1e/websockets-15.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:e09473f095a819042ecb2ab9465aee615bd9c2028e4ef7d933600a8401c79561", size = 176837 }, + { url = "https://files.pythonhosted.org/packages/36/db/3fff0bcbe339a6fa6a3b9e3fbc2bfb321ec2f4cd233692272c5a8d6cf801/websockets-15.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:5f4c04ead5aed67c8a1a20491d54cdfba5884507a48dd798ecaf13c74c4489f5", size = 175424 }, + { url = "https://files.pythonhosted.org/packages/46/e6/519054c2f477def4165b0ec060ad664ed174e140b0d1cbb9fafa4a54f6db/websockets-15.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:abdc0c6c8c648b4805c5eacd131910d2a7f6455dfd3becab248ef108e89ab16a", size = 173077 }, + { url = "https://files.pythonhosted.org/packages/1a/21/c0712e382df64c93a0d16449ecbf87b647163485ca1cc3f6cbadb36d2b03/websockets-15.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a625e06551975f4b7ea7102bc43895b90742746797e2e14b70ed61c43a90f09b", size = 173324 }, + { url = "https://files.pythonhosted.org/packages/1c/cb/51ba82e59b3a664df54beed8ad95517c1b4dc1a913730e7a7db778f21291/websockets-15.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d591f8de75824cbb7acad4e05d2d710484f15f29d4a915092675ad3456f11770", size = 182094 }, + { url = "https://files.pythonhosted.org/packages/fb/0f/bf3788c03fec679bcdaef787518dbe60d12fe5615a544a6d4cf82f045193/websockets-15.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:47819cea040f31d670cc8d324bb6435c6f133b8c7a19ec3d61634e62f8d8f9eb", size = 181094 }, + { url = "https://files.pythonhosted.org/packages/5e/da/9fb8c21edbc719b66763a571afbaf206cb6d3736d28255a46fc2fe20f902/websockets-15.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ac017dd64572e5c3bd01939121e4d16cf30e5d7e110a119399cf3133b63ad054", size = 181397 }, + { url = "https://files.pythonhosted.org/packages/2e/65/65f379525a2719e91d9d90c38fe8b8bc62bd3c702ac651b7278609b696c4/websockets-15.0.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:4a9fac8e469d04ce6c25bb2610dc535235bd4aa14996b4e6dbebf5e007eba5ee", size = 181794 }, + { url = "https://files.pythonhosted.org/packages/d9/26/31ac2d08f8e9304d81a1a7ed2851c0300f636019a57cbaa91342015c72cc/websockets-15.0.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:363c6f671b761efcb30608d24925a382497c12c506b51661883c3e22337265ed", size = 181194 }, + { url = "https://files.pythonhosted.org/packages/98/72/1090de20d6c91994cd4b357c3f75a4f25ee231b63e03adea89671cc12a3f/websockets-15.0.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:2034693ad3097d5355bfdacfffcbd3ef5694f9718ab7f29c29689a9eae841880", size = 181164 }, + { url = "https://files.pythonhosted.org/packages/2d/37/098f2e1c103ae8ed79b0e77f08d83b0ec0b241cf4b7f2f10edd0126472e1/websockets-15.0.1-cp39-cp39-win32.whl", hash = "sha256:3b1ac0d3e594bf121308112697cf4b32be538fb1444468fb0a6ae4feebc83411", size = 176381 }, + { url = "https://files.pythonhosted.org/packages/75/8b/a32978a3ab42cebb2ebdd5b05df0696a09f4d436ce69def11893afa301f0/websockets-15.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:b7643a03db5c95c799b89b31c036d5f27eeb4d259c798e878d6937d71832b1e4", size = 176841 }, + { url = "https://files.pythonhosted.org/packages/02/9e/d40f779fa16f74d3468357197af8d6ad07e7c5a27ea1ca74ceb38986f77a/websockets-15.0.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0c9e74d766f2818bb95f84c25be4dea09841ac0f734d1966f415e4edfc4ef1c3", size = 173109 }, + { url = "https://files.pythonhosted.org/packages/bc/cd/5b887b8585a593073fd92f7c23ecd3985cd2c3175025a91b0d69b0551372/websockets-15.0.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:1009ee0c7739c08a0cd59de430d6de452a55e42d6b522de7aa15e6f67db0b8e1", size = 173343 }, + { url = "https://files.pythonhosted.org/packages/fe/ae/d34f7556890341e900a95acf4886833646306269f899d58ad62f588bf410/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76d1f20b1c7a2fa82367e04982e708723ba0e7b8d43aa643d3dcd404d74f1475", size = 174599 }, + { url = "https://files.pythonhosted.org/packages/71/e6/5fd43993a87db364ec60fc1d608273a1a465c0caba69176dd160e197ce42/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f29d80eb9a9263b8d109135351caf568cc3f80b9928bccde535c235de55c22d9", size = 174207 }, + { url = "https://files.pythonhosted.org/packages/2b/fb/c492d6daa5ec067c2988ac80c61359ace5c4c674c532985ac5a123436cec/websockets-15.0.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b359ed09954d7c18bbc1680f380c7301f92c60bf924171629c5db97febb12f04", size = 174155 }, + { url = "https://files.pythonhosted.org/packages/68/a1/dcb68430b1d00b698ae7a7e0194433bce4f07ded185f0ee5fb21e2a2e91e/websockets-15.0.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:cad21560da69f4ce7658ca2cb83138fb4cf695a2ba3e475e0559e05991aa8122", size = 176884 }, + { url = "https://files.pythonhosted.org/packages/b7/48/4b67623bac4d79beb3a6bb27b803ba75c1bdedc06bd827e465803690a4b2/websockets-15.0.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:7f493881579c90fc262d9cdbaa05a6b54b3811c2f300766748db79f098db9940", size = 173106 }, + { url = "https://files.pythonhosted.org/packages/ed/f0/adb07514a49fe5728192764e04295be78859e4a537ab8fcc518a3dbb3281/websockets-15.0.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:47b099e1f4fbc95b701b6e85768e1fcdaf1630f3cbe4765fa216596f12310e2e", size = 173339 }, + { url = "https://files.pythonhosted.org/packages/87/28/bd23c6344b18fb43df40d0700f6d3fffcd7cef14a6995b4f976978b52e62/websockets-15.0.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:67f2b6de947f8c757db2db9c71527933ad0019737ec374a8a6be9a956786aaf9", size = 174597 }, + { url = "https://files.pythonhosted.org/packages/6d/79/ca288495863d0f23a60f546f0905ae8f3ed467ad87f8b6aceb65f4c013e4/websockets-15.0.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d08eb4c2b7d6c41da6ca0600c077e93f5adcfd979cd777d747e9ee624556da4b", size = 174205 }, + { url = "https://files.pythonhosted.org/packages/04/e4/120ff3180b0872b1fe6637f6f995bcb009fb5c87d597c1fc21456f50c848/websockets-15.0.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b826973a4a2ae47ba357e4e82fa44a463b8f168e1ca775ac64521442b19e87f", size = 174150 }, + { url = "https://files.pythonhosted.org/packages/cb/c3/30e2f9c539b8da8b1d76f64012f3b19253271a63413b2d3adb94b143407f/websockets-15.0.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:21c1fa28a6a7e3cbdc171c694398b6df4744613ce9b36b1a498e816787e28123", size = 176877 }, + { url = "https://files.pythonhosted.org/packages/fa/a8/5b41e0da817d64113292ab1f8247140aac61cbf6cfd085d6a0fa77f4984f/websockets-15.0.1-py3-none-any.whl", hash = "sha256:f7a866fbc1e97b5c617ee4116daaa09b722101d4a3c170c787450ba409f9736f", size = 169743 }, +] + [[package]] name = "zipp" version = "3.21.0"