Co-authored-by: Quentin Torroba <quentin.torroba@mistral.ai> Co-authored-by: Clement Sirieix <clem.sirieix@gmail.com> Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@mistral.ai> Co-authored-by: Vincent Guilloux <vincent.guilloux@mistral.ai> Co-authored-by: Michel Thomazo <michel.thomazo@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
22 lines
655 B
Python
22 lines
655 B
Python
from __future__ import annotations
|
|
|
|
from collections.abc import AsyncIterator
|
|
from typing import Any
|
|
|
|
from vibe.core.transcribe.transcribe_client_port import TranscribeEvent
|
|
|
|
|
|
class FakeTranscribeClient:
|
|
def __init__(
|
|
self, *_args: Any, events: list[TranscribeEvent] | None = None, **_kwargs: Any
|
|
) -> None:
|
|
self._events: list[TranscribeEvent] = events or []
|
|
|
|
def set_events(self, events: list[TranscribeEvent]) -> None:
|
|
self._events = events
|
|
|
|
async def transcribe(
|
|
self, audio_stream: AsyncIterator[bytes]
|
|
) -> AsyncIterator[TranscribeEvent]:
|
|
for event in self._events:
|
|
yield event
|