Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,7 @@ import torch
|
|
21 |
import tqdm
|
22 |
import accelerate
|
23 |
import re
|
|
|
24 |
|
25 |
def get_credentials():
|
26 |
creds_json_str = os.getenv("GOOGLE_APPLICATION_CREDENTIALS_JSON")
|
@@ -34,11 +35,14 @@ def get_credentials():
|
|
34 |
|
35 |
return temp_filename
|
36 |
|
37 |
-
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]= get_credentials()
|
|
|
38 |
|
39 |
|
40 |
|
41 |
-
|
|
|
|
|
42 |
list_llm_simple = [os.path.basename(llm) for llm in list_llm]
|
43 |
|
44 |
# Load PDF document and create doc splits
|
@@ -89,7 +93,11 @@ def initialize_llmchain(llm_model, temperature, max_tokens, top_k, vector_db, pr
|
|
89 |
# HuggingFaceHub uses HF inference endpoints
|
90 |
progress(0.5, desc="Initializing HF Hub...")
|
91 |
vertexai.init(project="imgcp-ff81e7053b072ce5", location="us-central1")
|
92 |
-
llm =
|
|
|
|
|
|
|
|
|
93 |
|
94 |
|
95 |
progress(0.75, desc="Defining buffer memory...")
|
|
|
21 |
import tqdm
|
22 |
import accelerate
|
23 |
import re
|
24 |
+
from langchain_openai import AzureChatOpenAI
|
25 |
|
26 |
def get_credentials():
|
27 |
creds_json_str = os.getenv("GOOGLE_APPLICATION_CREDENTIALS_JSON")
|
|
|
35 |
|
36 |
return temp_filename
|
37 |
|
38 |
+
# os.environ["GOOGLE_APPLICATION_CREDENTIALS"]= get_credentials()
|
39 |
+
os.environ["AZURE_OPENAI_API_KEY"] = os.getenv("AZURE_OPENAI_API_KEY")
|
40 |
|
41 |
|
42 |
|
43 |
+
|
44 |
+
|
45 |
+
list_llm = ["Azure-OpenAI"]
|
46 |
list_llm_simple = [os.path.basename(llm) for llm in list_llm]
|
47 |
|
48 |
# Load PDF document and create doc splits
|
|
|
93 |
# HuggingFaceHub uses HF inference endpoints
|
94 |
progress(0.5, desc="Initializing HF Hub...")
|
95 |
vertexai.init(project="imgcp-ff81e7053b072ce5", location="us-central1")
|
96 |
+
llm = AzureChatOpenAI(
|
97 |
+
azure_endpoint = "https://cloudcafe42.openai.azure.com/",
|
98 |
+
azure_deployment = "gpt-4",
|
99 |
+
openai_api_version = "2024-02-15-preview"
|
100 |
+
)
|
101 |
|
102 |
|
103 |
progress(0.75, desc="Defining buffer memory...")
|