Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import json
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
-
from openai import
|
| 8 |
|
| 9 |
from langchain_community.embeddings.sentence_transformer import SentenceTransformerEmbeddings
|
| 10 |
from langchain_community.vectorstores import Chroma
|
|
@@ -13,9 +13,10 @@ from huggingface_hub import CommitScheduler
|
|
| 13 |
from pathlib import Path
|
| 14 |
|
| 15 |
|
| 16 |
-
client =
|
| 17 |
-
|
| 18 |
-
|
|
|
|
| 19 |
)
|
| 20 |
|
| 21 |
embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-small')
|
|
@@ -83,7 +84,7 @@ def predict(user_input):
|
|
| 83 |
|
| 84 |
try:
|
| 85 |
response = client.chat.completions.create(
|
| 86 |
-
model='
|
| 87 |
messages=prompt,
|
| 88 |
temperature=0
|
| 89 |
)
|
|
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
|
| 7 |
+
from openai import AzureOpenAI
|
| 8 |
|
| 9 |
from langchain_community.embeddings.sentence_transformer import SentenceTransformerEmbeddings
|
| 10 |
from langchain_community.vectorstores import Chroma
|
|
|
|
| 13 |
from pathlib import Path
|
| 14 |
|
| 15 |
|
| 16 |
+
client = AzureOpenAI(
|
| 17 |
+
api_key = os.environ["AZURE_OPENAI_KEY"],
|
| 18 |
+
azure_endpoint = os.environ["AZURE_OPENAI_ENDPOINT"]
|
| 19 |
+
api_version = "2024-02-01"
|
| 20 |
)
|
| 21 |
|
| 22 |
embedding_model = SentenceTransformerEmbeddings(model_name='thenlper/gte-small')
|
|
|
|
| 84 |
|
| 85 |
try:
|
| 86 |
response = client.chat.completions.create(
|
| 87 |
+
model='gpt-35-turbo',
|
| 88 |
messages=prompt,
|
| 89 |
temperature=0
|
| 90 |
)
|