Enforce modern typing (#258)

* Allow UP

* Upgrade typing

* test smolagents

* Change to contextlib

---------

Co-authored-by: Marcus Valtonen Örnhag <marcus.valtonen.ornhag@ericsson.com>
This commit is contained in:
Marcus Valtonen Örnhag
2025-04-08 22:46:12 +02:00
committed by GitHub
parent a07e9439b6
commit f70b27bd41
15 changed files with 43 additions and 47 deletions

View File

@@ -1,5 +1,4 @@
from pathlib import Path
from typing import Dict, List
from dotenv import load_dotenv
from fastrtc import (
@@ -22,7 +21,7 @@ stt_model = get_stt_model()
tts_model = get_tts_model()
# Conversation state to maintain history
conversation_state: List[Dict[str, str]] = []
conversation_state: list[dict[str, str]] = []
# System prompt for agent
system_prompt = """You are a helpful assistant that can helps with finding places to
@@ -78,9 +77,7 @@ def process_response(audio):
response_content = agent.run(input_text)
# Convert response to audio using TTS model
for audio_chunk in tts_model.stream_tts_sync(response_content or ""):
# Yield the audio chunk
yield audio_chunk
yield from tts_model.stream_tts_sync(response_content or "")
stream = Stream(