Skip to content

Commit

Permalink
Add support for Azure, OpenAI, Palm, Anthropic, Cohere, Replicate Mod…
Browse files Browse the repository at this point in the history
…els - using litellm (#54)
  • Loading branch information
madawei2699 authored Apr 19, 2024
2 parents e656aaf + ef09619 commit 08166a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/gpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import random
import uuid
import openai
import litellm
from pathlib import Path
from llama_index import ServiceContext, GPTVectorStoreIndex, LLMPredictor, RssReader, SimpleDirectoryReader, StorageContext, load_index_from_storage
from llama_index.readers.schema.base import Document
Expand Down Expand Up @@ -104,11 +105,12 @@ def get_index_name_from_file(file: str):
file_md5 = file_md5_with_extension.split('.')[0]
return file_md5

# use any of the models specified here: https://litellm.readthedocs.io/en/latest/supported/
def get_answer_from_chatGPT(messages):
dialog_messages = format_dialog_messages(messages)
logging.info('=====> Use chatGPT to answer!')
logging.info(dialog_messages)
completion = openai.ChatCompletion.create(
completion = litellm.completion(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": dialog_messages}]
)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Flask==2.2.3
gunicorn==20.1.0
llama-index==0.6.9
langchain==0.0.154
litellm==0.1.232
httpx==0.23.3
requests==2.28.2
openai==0.27.1
Expand Down

0 comments on commit 08166a3

Please sign in to comment.