Skip to content

Commit 53b01da

Browse files
ajar98Mac Wilkinsonsrhinosadnaansrjheeta
authored
code updates for 0.1.112 (vocodedev#555)
* Update Readme with Preview Info (#1) * Update Readme with Preview Info * We're not quite that far along * Update Structure to be more Pleasing to the Eyes * Add changelog to readme --------- Co-authored-by: srhinos <[email protected]> Co-authored-by: Adnaan Sachidanandan <[email protected]> * The Big Diff (#2) * The Big Diff * remove tests on 3.8 and 3.9 * Update README.md * Update README.md * fix turn based quickstart (#3) * [hotfix] remove unused import (#4) * Update README.md * Update README.md * Remove create_speech() from rime synthesizer (#6) * Fix default factory for elevenlabs WS (#12) * dispatch into elvenlabsws if experimental_websocket is on * fix mypy * Merge In Recent Fixes (#14) * [docs sprint] Updates docs for using transcribers (#9) * [docs sprint] phrase trigger documentation (#16) * [docs sprint] update open source quickstarts (#15) * [docs sprint] Add Documentation on Using Vocode's Loguru Implementation (#19) * [docs sprint] Add Documentation on Using Vocode's Loguru Implementation * Remove Tracing --------- Co-authored-by: srhinos <[email protected]> * [docs sprint] Updates docs for using synthesizers (#8) * [docs sprint] using synthesizers docs update * update docs for elevenlabs ws * Apply suggestions from code review Co-authored-by: Adnaan Sachidanandan <[email protected]> --------- Co-authored-by: Adnaan Sachidanandan <[email protected]> * [docs sprint] Updates docs for react quickstart (#10) * [docs sprint] Updates docs for react quickstart * PR feedback * changes azure to override create_speech_uncached (#21) * [docs sprint] Adds docs for conversation mechanics and moves endpointing docs from transcribers (#11) * [docs sprint] Updates docs for using transcribers * Adds docs for conversation mechanics and moves endpointing docs from transcribers * Update docs/open-source/conversation-mechanics.md Co-authored-by: Adnaan Sachidanandan <[email protected]> * use mdx * PR feedback --------- Co-authored-by: Adnaan Sachidanandan <[email protected]> * updates docs for events manager (#7) * add cartesia synthesizer (#17) * add cartesia synthesizer * make Cartesia dependency optional, add it to the synthesizers extra group * lazy import cartesia * improved lazy loading, and added api_key as a config parameter * improvements to cartesia synth * use create_speech_uncached * use existing abstractions default encoding and sample rates * Remove redundant api_key assignment Co-authored-by: Ajay Raj <[email protected]> * Remove default setting of sampling rate Co-authored-by: Ajay Raj <[email protected]> * Remove default setting of audio_encoding Co-authored-by: Ajay Raj <[email protected]> * remove default setting of sampling rate Co-authored-by: Ajay Raj <[email protected]> * Remove redundant setting of audio enconding the output device handles this Co-authored-by: Ajay Raj <[email protected]> * build failed with poetry.lock file. re-updating it --------- Co-authored-by: Ajay Raj <[email protected]> * Unset docs / README changes * Unset docs changes (cont.) * unset poetry version change * update poetry.lock --------- Co-authored-by: Mac Wilkinson <[email protected]> Co-authored-by: srhinos <[email protected]> Co-authored-by: Adnaan Sachidanandan <[email protected]> Co-authored-by: rjheeta <[email protected]>
1 parent 9b24020 commit 53b01da

File tree

227 files changed

+18116
-9809
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+18116
-9809
lines changed

.github/workflows/test.yml

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
python-version:
15-
- "3.8"
16-
- "3.9"
1715
- "3.10"
1816
- "3.11"
1917
poetry-version:

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ transcribe:
99
synthesize:
1010
poetry run python playground/streaming/synthesizer/synthesize.py
1111

12+
turn_based_conversation:
13+
poetry run python quickstarts/turn_based_conversation.py
14+
15+
streaming_conversation:
16+
poetry run python quickstarts/streaming_conversation.py
17+
1218
PYTHON_FILES=.
1319
lint: PYTHON_FILES=vocode/ quickstarts/ playground/
1420
lint_diff typecheck_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$')

apps/client_backend/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ RUN poetry config virtualenvs.create false
1515
RUN poetry install --no-dev --no-interaction --no-ansi
1616
COPY main.py /code/main.py
1717

18-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
18+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]

apps/client_backend/main.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
import logging
1+
from dotenv import load_dotenv
22
from fastapi import FastAPI
33

4-
from vocode.streaming.models.agent import ChatGPTAgentConfig
5-
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
6-
from vocode.streaming.synthesizer.azure_synthesizer import AzureSynthesizer
7-
4+
from vocode.logging import configure_pretty_logging
85
from vocode.streaming.agent.chat_gpt_agent import ChatGPTAgent
96
from vocode.streaming.client_backend.conversation import ConversationRouter
7+
from vocode.streaming.models.agent import ChatGPTAgentConfig
108
from vocode.streaming.models.message import BaseMessage
11-
12-
from dotenv import load_dotenv
9+
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
10+
from vocode.streaming.synthesizer.azure_synthesizer import AzureSynthesizer
1311

1412
load_dotenv()
1513

1614
app = FastAPI(docs_url=None)
1715

18-
logging.basicConfig()
19-
logger = logging.getLogger(__name__)
20-
logger.setLevel(logging.DEBUG)
16+
configure_pretty_logging()
2117

2218
conversation_router = ConversationRouter(
2319
agent_thunk=lambda: ChatGPTAgent(
@@ -31,7 +27,6 @@
3127
output_audio_config, voice_name="en-US-SteffanNeural"
3228
)
3329
),
34-
logger=logger,
3530
)
3631

3732
app.include_router(conversation_router.get_router())

apps/client_backend/poetry.lock

+2,384-989
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/client_backend/pyproject.toml

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ readme = "README.md"
77

88
[tool.poetry.dependencies]
99
python = ">=3.9,<3.12"
10-
python-dotenv = "^1.0.0"
11-
vocode = "0.1.111"
12-
elevenlabs = "^0.2.23"
10+
python-dotenv = "^1.0.1"
11+
vocode = { path = "../..", extras = [
12+
"all",
13+
], develop = true, python = ">=3.11,<3.12" }
14+
elevenlabs = "^1.2.2"
1315

1416

1517
[build-system]

apps/telephony_app/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ RUN poetry install --no-dev --no-interaction --no-ansi
1616
COPY main.py /code/main.py
1717
COPY speller_agent.py /code/speller_agent.py
1818

19-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
19+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]

apps/telephony_app/docker-compose.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ services:
33
image: redis:7.0.9-alpine
44
command: redis-server --bind 0.0.0.0
55
ports:
6-
- 6379:6379
6+
- 6379:6379
77
app:
88
image: vocode-telephony-app
99
env_file:
10-
- .env
10+
- .env
1111
ports:
12-
- 3000:3000
12+
- 3000:3000
1313
depends_on:
14-
- redis
14+
- redis
1515
environment:
16-
- REDISHOST=redis
16+
- REDISHOST=redis

apps/telephony_app/main.py

+17-25
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,33 @@
11
# Standard library imports
2-
import logging
32
import os
43
import sys
54

5+
from dotenv import load_dotenv
6+
67
# Third-party imports
78
from fastapi import FastAPI
8-
from vocode.streaming.models.telephony import TwilioConfig
9+
from loguru import logger
910
from pyngrok import ngrok
10-
from vocode.streaming.telephony.config_manager.redis_config_manager import (
11-
RedisConfigManager,
12-
)
13-
from vocode.streaming.models.agent import ChatGPTAgentConfig
14-
from vocode.streaming.models.message import BaseMessage
15-
from vocode.streaming.telephony.server.base import (
16-
TwilioInboundCallConfig,
17-
TelephonyServer,
18-
)
19-
from dotenv import load_dotenv
2011

2112
# Local application/library specific imports
22-
from speller_agent import (
23-
SpellerAgentFactory,
24-
SpellerAgentConfig,
25-
)
13+
from speller_agent import SpellerAgentFactory
14+
15+
from vocode.logging import configure_pretty_logging
16+
from vocode.streaming.models.agent import ChatGPTAgentConfig
17+
from vocode.streaming.models.message import BaseMessage
18+
from vocode.streaming.models.telephony import TwilioConfig
19+
from vocode.streaming.telephony.config_manager.redis_config_manager import RedisConfigManager
20+
from vocode.streaming.telephony.server.base import TelephonyServer, TwilioInboundCallConfig
2621

2722
# if running from python, this will load the local .env
2823
# docker-compose will load the .env file by itself
2924
load_dotenv()
3025

31-
app = FastAPI(docs_url=None)
26+
configure_pretty_logging()
3227

33-
logging.basicConfig()
34-
logger = logging.getLogger(__name__)
35-
logger.setLevel(logging.DEBUG)
28+
app = FastAPI(docs_url=None)
3629

37-
config_manager = RedisConfigManager(
38-
logger=logger,
39-
)
30+
config_manager = RedisConfigManager()
4031

4132
BASE_URL = os.getenv("BASE_URL")
4233

@@ -66,7 +57,9 @@
6657
),
6758
# uncomment this to use the speller agent instead
6859
# agent_config=SpellerAgentConfig(
69-
# initial_message=BaseMessage(text="im a speller agent, say something to me and ill spell it out for you"),
60+
# initial_message=BaseMessage(
61+
# text="im a speller agent, say something to me and ill spell it out for you"
62+
# ),
7063
# generate_responses=False,
7164
# ),
7265
twilio_config=TwilioConfig(
@@ -76,7 +69,6 @@
7669
)
7770
],
7871
agent_factory=SpellerAgentFactory(),
79-
logger=logger,
8072
)
8173

8274
app.include_router(telephony_server.get_router())

apps/telephony_app/outbound_call.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import os
2+
23
from dotenv import load_dotenv
34

4-
load_dotenv()
5+
from vocode.streaming.models.agent import ChatGPTAgentConfig
6+
from vocode.streaming.models.message import BaseMessage
7+
from vocode.streaming.models.telephony import TwilioConfig
58

6-
from vocode.streaming.telephony.conversation.outbound_call import OutboundCall
7-
from vocode.streaming.telephony.config_manager.redis_config_manager import (
8-
RedisConfigManager,
9-
)
9+
load_dotenv()
1010

1111
from speller_agent import SpellerAgentConfig
1212

13+
from vocode.streaming.telephony.config_manager.redis_config_manager import RedisConfigManager
14+
from vocode.streaming.telephony.conversation.outbound_call import OutboundCall
15+
1316
BASE_URL = os.environ["BASE_URL"]
1417

1518

@@ -21,12 +24,22 @@ async def main():
2124
to_phone="+15555555555",
2225
from_phone="+15555555555",
2326
config_manager=config_manager,
24-
agent_config=SpellerAgentConfig(generate_responses=False),
27+
agent_config=ChatGPTAgentConfig(
28+
initial_message=BaseMessage(text="What up"),
29+
prompt_preamble="Have a pleasant conversation about life",
30+
generate_responses=True,
31+
),
32+
telephony_config=TwilioConfig(
33+
account_sid=os.environ["TWILIO_ACCOUNT_SID"],
34+
auth_token=os.environ["TWILIO_AUTH_TOKEN"],
35+
),
2536
)
2637

2738
input("Press enter to start call...")
2839
await outbound_call.start()
2940

41+
3042
if __name__ == "__main__":
3143
import asyncio
44+
3245
asyncio.run(main())

0 commit comments

Comments
 (0)