Adding support for Claude, PaLM, Llama2, and Cohere models

pull/94/head
Krish Dholakia 9 months ago committed by GitHub
parent abce6d9f49
commit f2c707277e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,7 @@ import shutil
import urllib.request
from pathlib import Path
from tempfile import NamedTemporaryFile
from litellm import completion
import fitz
import numpy as np
import openai
@ -109,17 +109,19 @@ def load_recommender(path, start_page=1):
def generate_text(openAI_key, prompt, engine="text-davinci-003"):
openai.api_key = openAI_key
# openai.api_key = openAI_key
try:
completions = openai.Completion.create(
engine=engine,
prompt=prompt,
messages=[{ "content": prompt,"role": "user"}]
completions = completion(
model=engine,
messages=messages,
max_tokens=512,
n=1,
stop=None,
temperature=0.7,
api_key=openAI_key
)
message = completions.choices[0].text
message = completions['choices'][0]['message']['content']
except Exception as e:
message = f'API Error: {str(e)}'
return message

@ -6,3 +6,4 @@ tensorflow-hub
openai==0.10.2
gradio
langchain-serve>=0.0.19
litellm

Loading…
Cancel
Save