Skip to content

Commit

Permalink
code updates for 0.1.112 (vocodedev#555)
Browse files Browse the repository at this point in the history
* 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 (vocodedev#2)

* The Big Diff

* remove tests on 3.8 and 3.9

* Update README.md

* Update README.md

* fix turn based quickstart (vocodedev#3)

* [hotfix] remove unused import (vocodedev#4)

* Update README.md

* Update README.md

* Remove create_speech() from rime synthesizer (vocodedev#6)

* Fix default factory for elevenlabs WS (vocodedev#12)

* dispatch into elvenlabsws if experimental_websocket is on

* fix mypy

* Merge In Recent Fixes (vocodedev#14)

* [docs sprint] Updates docs for using transcribers (vocodedev#9)

* [docs sprint] phrase trigger documentation (vocodedev#16)

* [docs sprint] update open source quickstarts (vocodedev#15)

* [docs sprint] Add Documentation on Using Vocode's Loguru Implementation (vocodedev#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 (vocodedev#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 (vocodedev#10)

* [docs sprint] Updates docs for react quickstart

* PR feedback

* changes azure to override create_speech_uncached (vocodedev#21)

* [docs sprint] Adds docs for conversation mechanics and moves endpointing docs from transcribers (vocodedev#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 (vocodedev#7)

* add cartesia synthesizer (vocodedev#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]>
  • Loading branch information
5 people authored Jun 13, 2024
1 parent 9b24020 commit 53b01da
Show file tree
Hide file tree
Showing 227 changed files with 18,116 additions and 9,809 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
poetry-version:
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ transcribe:
synthesize:
poetry run python playground/streaming/synthesizer/synthesize.py

turn_based_conversation:
poetry run python quickstarts/turn_based_conversation.py

streaming_conversation:
poetry run python quickstarts/streaming_conversation.py

PYTHON_FILES=.
lint: PYTHON_FILES=vocode/ quickstarts/ playground/
lint_diff typecheck_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d main | grep -E '\.py$$')
Expand Down
2 changes: 1 addition & 1 deletion apps/client_backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ RUN poetry config virtualenvs.create false
RUN poetry install --no-dev --no-interaction --no-ansi
COPY main.py /code/main.py

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
17 changes: 6 additions & 11 deletions apps/client_backend/main.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import logging
from dotenv import load_dotenv
from fastapi import FastAPI

from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
from vocode.streaming.synthesizer.azure_synthesizer import AzureSynthesizer

from vocode.logging import configure_pretty_logging
from vocode.streaming.agent.chat_gpt_agent import ChatGPTAgent
from vocode.streaming.client_backend.conversation import ConversationRouter
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage

from dotenv import load_dotenv
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
from vocode.streaming.synthesizer.azure_synthesizer import AzureSynthesizer

load_dotenv()

app = FastAPI(docs_url=None)

logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
configure_pretty_logging()

conversation_router = ConversationRouter(
agent_thunk=lambda: ChatGPTAgent(
Expand All @@ -31,7 +27,6 @@
output_audio_config, voice_name="en-US-SteffanNeural"
)
),
logger=logger,
)

app.include_router(conversation_router.get_router())
3,373 changes: 2,384 additions & 989 deletions apps/client_backend/poetry.lock

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions apps/client_backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
python-dotenv = "^1.0.0"
vocode = "0.1.111"
elevenlabs = "^0.2.23"
python-dotenv = "^1.0.1"
vocode = { path = "../..", extras = [
"all",
], develop = true, python = ">=3.11,<3.12" }
elevenlabs = "^1.2.2"


[build-system]
Expand Down
2 changes: 1 addition & 1 deletion apps/telephony_app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ RUN poetry install --no-dev --no-interaction --no-ansi
COPY main.py /code/main.py
COPY speller_agent.py /code/speller_agent.py

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "3000"]
10 changes: 5 additions & 5 deletions apps/telephony_app/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ services:
image: redis:7.0.9-alpine
command: redis-server --bind 0.0.0.0
ports:
- 6379:6379
- 6379:6379
app:
image: vocode-telephony-app
env_file:
- .env
- .env
ports:
- 3000:3000
- 3000:3000
depends_on:
- redis
- redis
environment:
- REDISHOST=redis
- REDISHOST=redis
42 changes: 17 additions & 25 deletions apps/telephony_app/main.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
# Standard library imports
import logging
import os
import sys

from dotenv import load_dotenv

# Third-party imports
from fastapi import FastAPI
from vocode.streaming.models.telephony import TwilioConfig
from loguru import logger
from pyngrok import ngrok
from vocode.streaming.telephony.config_manager.redis_config_manager import (
RedisConfigManager,
)
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.telephony.server.base import (
TwilioInboundCallConfig,
TelephonyServer,
)
from dotenv import load_dotenv

# Local application/library specific imports
from speller_agent import (
SpellerAgentFactory,
SpellerAgentConfig,
)
from speller_agent import SpellerAgentFactory

from vocode.logging import configure_pretty_logging
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.models.telephony import TwilioConfig
from vocode.streaming.telephony.config_manager.redis_config_manager import RedisConfigManager
from vocode.streaming.telephony.server.base import TelephonyServer, TwilioInboundCallConfig

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

app = FastAPI(docs_url=None)
configure_pretty_logging()

logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
app = FastAPI(docs_url=None)

config_manager = RedisConfigManager(
logger=logger,
)
config_manager = RedisConfigManager()

BASE_URL = os.getenv("BASE_URL")

Expand Down Expand Up @@ -66,7 +57,9 @@
),
# uncomment this to use the speller agent instead
# agent_config=SpellerAgentConfig(
# initial_message=BaseMessage(text="im a speller agent, say something to me and ill spell it out for you"),
# initial_message=BaseMessage(
# text="im a speller agent, say something to me and ill spell it out for you"
# ),
# generate_responses=False,
# ),
twilio_config=TwilioConfig(
Expand All @@ -76,7 +69,6 @@
)
],
agent_factory=SpellerAgentFactory(),
logger=logger,
)

app.include_router(telephony_server.get_router())
25 changes: 19 additions & 6 deletions apps/telephony_app/outbound_call.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import os

from dotenv import load_dotenv

load_dotenv()
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.models.telephony import TwilioConfig

from vocode.streaming.telephony.conversation.outbound_call import OutboundCall
from vocode.streaming.telephony.config_manager.redis_config_manager import (
RedisConfigManager,
)
load_dotenv()

from speller_agent import SpellerAgentConfig

from vocode.streaming.telephony.config_manager.redis_config_manager import RedisConfigManager
from vocode.streaming.telephony.conversation.outbound_call import OutboundCall

BASE_URL = os.environ["BASE_URL"]


Expand All @@ -21,12 +24,22 @@ async def main():
to_phone="+15555555555",
from_phone="+15555555555",
config_manager=config_manager,
agent_config=SpellerAgentConfig(generate_responses=False),
agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"),
prompt_preamble="Have a pleasant conversation about life",
generate_responses=True,
),
telephony_config=TwilioConfig(
account_sid=os.environ["TWILIO_ACCOUNT_SID"],
auth_token=os.environ["TWILIO_AUTH_TOKEN"],
),
)

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


if __name__ == "__main__":
import asyncio

asyncio.run(main())
Loading

0 comments on commit 53b01da

Please sign in to comment.