Skip to content

Commit

Permalink
Merge pull request #198 from pipecat-ai/aleix/websocket-transport
Browse files Browse the repository at this point in the history
websocket transport support
  • Loading branch information
aconchillo authored May 31, 2024
2 parents 0d6eee7 + 58d20ec commit 0b691ff
Show file tree
Hide file tree
Showing 43 changed files with 836 additions and 462 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added WebsocketServerTransport. This will create a websocket server and will
read messages coming from a client. The messages are serialized/deserialized
with protobufs. See `examples/websocket-server` for a detailed example.

- Added function calling (LLMService.register_function()). This will allow the
LLM to call functions you have registered when needed. For example, if you
register a function to get the weather in Los Angeles and ask the LLM about
Expand All @@ -24,6 +28,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed an issue where `camera_out_enabled` would cause the highg CPU usage if
no image was provided.

### Performance

- Removed unnecessary audio input tasks.

## [0.0.24] - 2024-05-29

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 2-Clause License

Copyright (c) 2024, Kwindla Hultman Kramer
Copyright (c) 2024, Daily

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
autopep8~=2.1.0
build~=1.2.1
grpcio-tools~=1.62.2
pip-tools~=7.4.1
pytest~=8.2.0
setuptools~=69.5.1
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/02-llm-say-one-thing.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async def main(room_url):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

messages = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/05-sync-speech-and-image.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def main(room_url):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

imagegen = FalImageGenService(
params=FalImageGenService.InputParams(
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/05a-local-sync-speech-and-image.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def process_frame(self, frame: Frame, direction: FrameDirection):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

tts = ElevenLabsTTSService(
aiohttp_session=session,
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/06a-image-sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

messages = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/07-interruptible.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

messages = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/07c-interruptible-deepgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

messages = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/11-sound-effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

tts = ElevenLabsTTSService(
aiohttp_session=session,
Expand Down
2 changes: 1 addition & 1 deletion examples/foundational/14-function-calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")
llm.register_function(
"get_current_weather",
fetch_weather_from_api,
Expand Down
25 changes: 0 additions & 25 deletions examples/foundational/websocket-server/frames.proto

This file was deleted.

134 changes: 0 additions & 134 deletions examples/foundational/websocket-server/index.html

This file was deleted.

50 changes: 0 additions & 50 deletions examples/foundational/websocket-server/sample.py

This file was deleted.

2 changes: 1 addition & 1 deletion examples/moondream-chatbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

ta = TalkingAnimation()

Expand Down
2 changes: 1 addition & 1 deletion examples/simple-chatbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async def main(room_url: str, token):

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo-preview")
model="gpt-4o")

messages = [
{
Expand Down
2 changes: 1 addition & 1 deletion examples/storytelling-chatbot/src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def main(room_url, token=None):

llm_service = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4-turbo"
model="gpt-4o"
)

tts_service = ElevenLabsTTSService(
Expand Down
3 changes: 2 additions & 1 deletion examples/translation-chatbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ async def main(room_url: str, token):
)

llm = OpenAILLMService(
api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4-turbo-preview"
api_key=os.getenv("OPENAI_API_KEY"),
model="gpt-4o"
)

sa = SentenceAggregator()
Expand Down
27 changes: 27 additions & 0 deletions examples/websocket-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Websocket Server

This is an example that shows how to use `WebsocketServerTransport` to communicate with a web client.

## Get started

```python
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

## Run the bot

```bash
python bot.py
```

## Run the HTTP server

This will host the static web client:

```bash
python -m http.server
```

Then, visit `http://localhost:8000` in your browser to start a session.
Loading

0 comments on commit 0b691ff

Please sign in to comment.