Skip to content

Commit

Permalink
Merge pull request #1 from krrishdholakia/main
Browse files Browse the repository at this point in the history
Update Readme with usage instructions
  • Loading branch information
krrishdholakia authored Sep 2, 2023
2 parents 491021b + c5e6623 commit c925bb5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
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

0 comments on commit c925bb5

Please sign in to comment.