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

Update Readme with usage instructions #1

Merged
merged 2 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Note if you want to remotely connect to a RealChar server, SSL set up is require

<br/>

## 🆕! Anyscale and LangSmith integration
## 🆕! Anyscale, LangSmith, LiteLLM integrations
<details><summary>👇click me</summary>

### Anyscale
Expand All @@ -279,6 +279,16 @@ LANGCHAIN_PROJECT=YOUR_LANGCHAIN_PROJECT
```
And it should work out of the box.


### LiteLLM
Use any model from Replicate, Cohere, AI21, Huggingface, TogetherAI, Aleph Alpha, and more - https://docs.litellm.ai/docs/completion/supported

in your .env, just set the `LITELLM_API_KEY` to be the one for any of the providers you want to use
```
LITELLM_API_KEY="" # this is the api key for any of the providers supported by litellm
```

and this will be passed to litellm to use!
</details>

<br/>
Expand Down
13 changes: 4 additions & 9 deletions realtime_ai_character/llm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import os
from functools import cache
from realtime_ai_character.llm.base import AsyncCallbackAudioHandler, AsyncCallbackTextHandler, LLM
import litellm

from langchain.chat_models.base import BaseChatModel

from realtime_ai_character.llm.base import LLM


def get_llm(model="gpt-3.5-turbo-16k") -> LLM:
if model.startswith('gpt'):
def get_llm(model='gpt-3.5-turbo-16k') -> LLM:
if model.startswith('gpt') or model in litellm.model_list or model.split("/")[0] in litellm.provider_list:
from realtime_ai_character.llm.openai_llm import OpenaiLlm
return OpenaiLlm(model=model)
elif model.startswith('claude'):
Expand Down
3 changes: 2 additions & 1 deletion realtime_ai_character/llm/openai_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def __init__(self, model):
self.chat_open_ai = ChatLiteLLM(
model=model,
temperature=0.5,
streaming=True
streaming=True,
api_key=os.getenv("LITELLM_API_KEY")
)
self.config = {
"model": model,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ typing
uvicorn
websockets
google-auth
litellm