Skip to content

Commit

Permalink
bump protocol & API version (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidzhao authored Dec 27, 2024
1 parent f86afdf commit 1db26f0
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# 📹🎙️🐍 Python SDK for LiveKit

<!--BEGIN_DESCRIPTION-->

Use this SDK to add realtime video, audio and data features to your Python app. By connecting to <a href="https://livekit.io/">LiveKit</a> Cloud or a self-hosted server, you can quickly build applications such as multi-modal AI, live streaming, or video calls with just a few lines of code.

<!--END_DESCRIPTION-->

This repo contains two packages
Expand Down Expand Up @@ -52,9 +54,7 @@ from livekit import api
import asyncio

async def main():
lkapi = api.LiveKitAPI(
'http://localhost:7880',
)
lkapi = api.LiveKitAPI("https://my-project.livekit.cloud")
room_info = await lkapi.room.create_room(
api.CreateRoomRequest(name="my-room"),
)
Expand All @@ -66,6 +66,29 @@ async def main():
asyncio.run(main())
```

### Using other APIs

Services can be accessed via the LiveKitAPI object.

```python
lkapi = api.LiveKitAPI("https://my-project.livekit.cloud")

# Room Service
room_svc = lkapi.room

# Egress Service
egress_svc = lkapi.egress

# Ingress Service
ingress_svc = lkapi.ingress

# Sip Service
sip_svc = lkapi.sip

# Agent Dispatch
dispatch_svc = lkapi.agent_dispatch
```

## Using Real-time SDK

```shell
Expand Down Expand Up @@ -132,10 +155,9 @@ def on_message_received(msg: rtc.ChatMessage):
await chat.send_message("hello world")
```


### RPC

Perform your own predefined method calls from one participant to another.
Perform your own predefined method calls from one participant to another.

This feature is especially powerful when used with [Agents](https://docs.livekit.io/agents), for instance to forward LLM function calls to your client application.

Expand Down Expand Up @@ -172,11 +194,10 @@ You may find it useful to adjust the `response_timeout` parameter, which indicat

#### Errors

LiveKit is a dynamic realtime environment and calls can fail for various reasons.
LiveKit is a dynamic realtime environment and calls can fail for various reasons.

You may throw errors of the type `RpcError` with a string `message` in an RPC method handler and they will be received on the caller's side with the message intact. Other errors will not be transmitted and will instead arrive to the caller as `1500` ("Application Error"). Other built-in errors are detailed in `RpcError`.


## Examples

- [Facelandmark](https://github.com/livekit/python-sdks/tree/main/examples/face_landmark): Use mediapipe to detect face landmarks (eyes, nose ...)
Expand All @@ -189,7 +210,9 @@ You may throw errors of the type `RpcError` with a string `message` in an RPC me
Please join us on [Slack](https://livekit.io/join-slack) to get help from our devs / community members. We welcome your contributions(PRs) and details can be discussed there.

<!--BEGIN_REPO_NAV-->

<br/><table>

<thead><tr><th colspan="2">LiveKit Ecosystem</th></tr></thead>
<tbody>
<tr><td>Realtime SDKs</td><td><a href="https://github.com/livekit/components-js">React Components</a> · <a href="https://github.com/livekit/client-sdk-js">Browser</a> · <a href="https://github.com/livekit/components-swift">Swift Components</a> · <a href="https://github.com/livekit/client-sdk-swift">iOS/macOS/visionOS</a> · <a href="https://github.com/livekit/client-sdk-android">Android</a> · <a href="https://github.com/livekit/client-sdk-flutter">Flutter</a> · <a href="https://github.com/livekit/client-sdk-react-native">React Native</a> · <a href="https://github.com/livekit/rust-sdks">Rust</a> · <a href="https://github.com/livekit/node-sdks">Node.js</a> · <b>Python</b> · <a href="https://github.com/livekit/client-sdk-unity-web">Unity (web)</a> · <a href="https://github.com/livekit/client-sdk-unity">Unity (beta)</a></td></tr><tr></tr>
Expand Down
3 changes: 3 additions & 0 deletions livekit-api/livekit/api/sip_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def __init__(
super().__init__(session, url, api_key, api_secret)

async def create_sip_trunk(self, create: CreateSIPTrunkRequest) -> SIPTrunkInfo:
"""
@deprecated Use create_sip_inbound_trunk or create_sip_outbound_trunk instead
"""
return await self._client.request(
SVC,
"CreateSIPTrunk",
Expand Down
2 changes: 1 addition & 1 deletion livekit-api/livekit/api/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.0"
__version__ = "0.8.1"
2 changes: 1 addition & 1 deletion livekit-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"aiohttp>=3.9.0",
"protobuf>=3",
"types-protobuf>=4,<5",
"livekit-protocol>=0.7.0,<2",
"livekit-protocol>=0.8.0,<2",
],
package_data={
"livekit.api": ["py.typed", "*.pyi", "**/*.pyi"],
Expand Down
2 changes: 1 addition & 1 deletion livekit-protocol/livekit/protocol/version.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1db26f0

Please sign in to comment.