Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
25 lines
704 B
Python
25 lines
704 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
|
|
|
|
async def close(self) -> None:
|
|
pass
|