bump all packages and set up rime

This commit is contained in:
Ajay Raj 2023-03-21 18:08:55 -07:00
commit 0fdd6e6502
5 changed files with 871 additions and 65 deletions

View file

@ -12,6 +12,7 @@ class SynthesizerType(str, Enum):
AZURE = "synthesizer_azure"
GOOGLE = "synthesizer_google"
ELEVEN_LABS = "synthesizer_eleven_labs"
RIME = "synthesizer_rime"
class TrackBotSentimentConfig(BaseModel):
@ -71,3 +72,19 @@ class AzureSynthesizerConfig(SynthesizerConfig, type=SynthesizerType.AZURE):
class GoogleSynthesizerConfig(SynthesizerConfig, type=SynthesizerType.GOOGLE):
pass
class RimeSynthesizerConfig(SynthesizerConfig, type=SynthesizerType.RIME):
speaker: str
@classmethod
def from_output_device(
cls,
output_device: BaseOutputDevice,
speaker: str,
):
return cls(
sampling_rate=output_device.sampling_rate,
audio_encoding=output_device.audio_encoding,
speaker=speaker,
)

View file

@ -0,0 +1,40 @@
from typing import Optional, Union
from vocode.streaming.models.telephony import TwilioConfig
from vocode.streaming.telephony.inbound_call_server import InboundCallServer
from vocode.streaming.models.agent import (
RESTfulAgentEnd,
RESTfulAgentInput,
RESTfulAgentText,
RESTfulUserImplementedAgentConfig,
)
from vocode.streaming.models.transcriber import (
TranscriberConfig,
)
from vocode.streaming.models.synthesizer import SynthesizerConfig
class InboundCallAndAgentServer(InboundCallServer):
def __init__(
self,
agent_config: RESTfulUserImplementedAgentConfig,
transcriber_config: Optional[TranscriberConfig] = None,
synthesizer_config: Optional[SynthesizerConfig] = None,
response_on_rate_limit: Optional[str] = None,
twilio_config: Optional[TwilioConfig] = None,
):
super().__init__(
agent_config=agent_config,
transcriber_config=transcriber_config,
synthesizer_config=synthesizer_config,
response_on_rate_limit=response_on_rate_limit,
twilio_config=twilio_config,
)
assert isinstance(agent_config, RESTfulUserImplementedAgentConfig), "agent_config must be a RESTfulUserImplementedAgentConfig"
self.app.post("/respond")(self.respond_rest)
async def respond(self, human_input, conversation_id) -> Union[RESTfulAgentText, RESTfulAgentEnd]:
raise NotImplementedError
async def respond_rest(self, request: RESTfulAgentInput) -> Union[RESTfulAgentText, RESTfulAgentEnd]:
return await self.respond(request.human_input, request.conversation_id)