Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agents-core/vision_agents/core/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ async def simple_response(
"""
Overwrite simple_response if you want to change how the Agent class calls the LLM
"""
logger.info("asking LLM to reply to %s", text)
with self.tracer.start_as_current_span("simple_response") as span:
response = await self.llm.simple_response(
text=text, processors=self.processors, participant=participant
Expand Down
3 changes: 2 additions & 1 deletion agents-core/vision_agents/core/stt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .stt import STT
from .events import TranscriptResponse

__all__ = ["STT"]
__all__ = ["STT", "TranscriptResponse"]
65 changes: 53 additions & 12 deletions agents-core/vision_agents/core/stt/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,47 @@


@dataclass
class STTTranscriptEvent(PluginBaseEvent):
"""Event emitted when a complete transcript is available."""

type: str = field(default='plugin.stt_transcript', init=False)
text: str = ""
class TranscriptResponse:
confidence: Optional[float] = None
language: Optional[str] = None
processing_time_ms: Optional[float] = None
audio_duration_ms: Optional[float] = None
model_name: Optional[str] = None
words: Optional[list[dict[str, Any]]] = None
other: Optional[dict] = None

@dataclass
class STTTranscriptEvent(PluginBaseEvent):
"""Event emitted when a complete transcript is available."""

type: str = field(default='plugin.stt_transcript', init=False)
text: str = ""
response: TranscriptResponse = field(default_factory=TranscriptResponse)
is_final: bool = True

def __post_init__(self):
if not self.text:
raise ValueError("Transcript text cannot be empty")

# Convenience properties for backward compatibility
@property
def confidence(self) -> Optional[float]:
return self.response.confidence

@property
def language(self) -> Optional[str]:
return self.response.language

@property
def processing_time_ms(self) -> Optional[float]:
return self.response.processing_time_ms

@property
def audio_duration_ms(self) -> Optional[float]:
return self.response.audio_duration_ms

@property
def model_name(self) -> Optional[str]:
return self.response.model_name


@dataclass
Expand All @@ -28,13 +53,29 @@ class STTPartialTranscriptEvent(PluginBaseEvent):

type: str = field(default='plugin.stt_partial_transcript', init=False)
text: str = ""
confidence: Optional[float] = None
language: Optional[str] = None
processing_time_ms: Optional[float] = None
audio_duration_ms: Optional[float] = None
model_name: Optional[str] = None
words: Optional[list[dict[str, Any]]] = None
response: TranscriptResponse = field(default_factory=TranscriptResponse)
is_final: bool = False

# Convenience properties for backward compatibility
@property
def confidence(self) -> Optional[float]:
return self.response.confidence

@property
def language(self) -> Optional[str]:
return self.response.language

@property
def processing_time_ms(self) -> Optional[float]:
return self.response.processing_time_ms

@property
def audio_duration_ms(self) -> Optional[float]:
return self.response.audio_duration_ms

@property
def model_name(self) -> Optional[str]:
return self.response.model_name


@dataclass
Expand Down
Loading