Merge pull request #2857 from dan-ince-aai/main
feat: add keyterms_prompt to AssemblyAI service
This commit is contained in:
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Added `keyterms_prompt` parameter to `AssemblyAIConnectionParams`.
|
||||||
|
|
||||||
|
- Added `speech_model` parameter to `AssemblyAIConnectionParams` to access the multilingual model.
|
||||||
|
-
|
||||||
- Added support for trickle ICE to the `SmallWebRTCTransport`.
|
- Added support for trickle ICE to the `SmallWebRTCTransport`.
|
||||||
|
|
||||||
- Added support for updating `OpenAITTSService` settings (`instructions` and
|
- Added support for updating `OpenAITTSService` settings (`instructions` and
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ class AssemblyAIConnectionParams(BaseModel):
|
|||||||
end_of_turn_confidence_threshold: Confidence threshold for end-of-turn detection.
|
end_of_turn_confidence_threshold: Confidence threshold for end-of-turn detection.
|
||||||
min_end_of_turn_silence_when_confident: Minimum silence duration when confident about end-of-turn.
|
min_end_of_turn_silence_when_confident: Minimum silence duration when confident about end-of-turn.
|
||||||
max_turn_silence: Maximum silence duration before forcing end-of-turn.
|
max_turn_silence: Maximum silence duration before forcing end-of-turn.
|
||||||
|
keyterms_prompt: List of key terms to guide transcription. Will be JSON serialized before sending.
|
||||||
|
speech_model: Select between English and multilingual models. Defaults to "universal-streaming-english".
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sample_rate: int = 16000
|
sample_rate: int = 16000
|
||||||
@@ -117,3 +119,7 @@ class AssemblyAIConnectionParams(BaseModel):
|
|||||||
end_of_turn_confidence_threshold: Optional[float] = None
|
end_of_turn_confidence_threshold: Optional[float] = None
|
||||||
min_end_of_turn_silence_when_confident: Optional[int] = None
|
min_end_of_turn_silence_when_confident: Optional[int] = None
|
||||||
max_turn_silence: Optional[int] = None
|
max_turn_silence: Optional[int] = None
|
||||||
|
keyterms_prompt: Optional[List[str]] = None
|
||||||
|
speech_model: Literal["universal-streaming-english", "universal-streaming-multilingual"] = (
|
||||||
|
"universal-streaming-english"
|
||||||
|
)
|
||||||
|
|||||||
@@ -174,11 +174,16 @@ class AssemblyAISTTService(STTService):
|
|||||||
|
|
||||||
def _build_ws_url(self) -> str:
|
def _build_ws_url(self) -> str:
|
||||||
"""Build WebSocket URL with query parameters using urllib.parse.urlencode."""
|
"""Build WebSocket URL with query parameters using urllib.parse.urlencode."""
|
||||||
params = {
|
params = {}
|
||||||
k: str(v).lower() if isinstance(v, bool) else v
|
for k, v in self._connection_params.model_dump().items():
|
||||||
for k, v in self._connection_params.model_dump().items()
|
if v is not None:
|
||||||
if v is not None
|
if k == "keyterms_prompt":
|
||||||
}
|
params[k] = json.dumps(v)
|
||||||
|
elif isinstance(v, bool):
|
||||||
|
params[k] = str(v).lower()
|
||||||
|
else:
|
||||||
|
params[k] = v
|
||||||
|
|
||||||
if params:
|
if params:
|
||||||
query_string = urlencode(params)
|
query_string = urlencode(params)
|
||||||
return f"{self._api_endpoint_base_url}?{query_string}"
|
return f"{self._api_endpoint_base_url}?{query_string}"
|
||||||
|
|||||||
Reference in New Issue
Block a user