Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add livekit docs #621

Merged
merged 11 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/livekit/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret
LIVEKIT_WS_URL=your_livekit_ws_url
OPENAI_API_KEY=your_openai_api_key
DEEPGRAM_API_KEY=your_deepgram_api_key
ELEVENLABS_API_KEY=your_elevenlabs_api_key
Binary file added docs/images/livekit_keys.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"open-source/python-quickstart",
"open-source/react-quickstart",
"open-source/telephony",
"open-source/livekit-webrtc",
"open-source/turn-based-conversation"
]
},
Expand Down
45 changes: 45 additions & 0 deletions docs/open-source/livekit-webrtc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: "Working with WebRTC"
ajar98 marked this conversation as resolved.
Show resolved Hide resolved
description: "Use LiveKit to connect Vocode Agents to WebRTC"
---

# Overview

[WebRTC](https://webrtc.org/) is an alternative to websockets for real-time P2P communication. Vocode Agents are compatible with both WebRTC and websockets, enabling developers to pick
the stack best suited for their application.

To connect Vocode agents to WebRTC, Vocode uses [LiveKit](https://livekit.io/)–an open source platform for building on WebRTC. For a background on how LiveKit
works, please see their [documentation](https://docs.livekit.io/home/get-started/intro-to-livekit/).

In this guide, we'll be walking through how to connect a Vocode Agent to the [LiveKit Agents Playground](https://agents-playground.livekit.io/).

# Walkthrough: hooking up a Vocode Agent to a LiveKit Room

## Setting up your LiveKit Server

First, you'll want to set up a LiveKit Server for your Agent. For simplicity, we are using LiveKit's hosted offering–but it can also be self hosted, since LiveKit is open source!

In our LiveKit dashboard, we first generate our websocket URL, API key, and Secret Key.

![Setup](/images/livekit_keys.png)

## Deploying your Vocode agent to a LiveKit Room

Once you have your LiveKit Server credentials, we can hook it up to Vocode via the `LiveKitConversation` abstraction. Using the starter code in
[vocode-core/apps/livekit/app.py](https://github.com/vocodedev/vocode-core/blob/main/apps/livekit/app.py), you can quickly deploy a Vocode Agent to accept
new job requests.

Fill in your credentials in `.env`:

```bash

LIVEKIT_SERVER_URL=wss://vocode-agent-b5oqfgl9.livekit.cloud
ajar98 marked this conversation as resolved.
Show resolved Hide resolved
LIVEKIT_API_KEY="KEY"
LIVEKIT_API_SECRET="SECRET"
```

Followed by
`poetry run python app.py dev`

And now you can connect to the [Agents Playground](https://agents-playground.livekit.io/) to interact with your agent. With LiveKit, you can connect Vocode
agents to any web application and leverage their [React Component](https://docs.livekit.io/reference/components/react/) library.
Loading