Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ from dotenv import load_dotenv, find_dotenv
|
|
20 |
_ = load_dotenv(find_dotenv())
|
21 |
|
22 |
#openai.api_key = os.environ["OPENAI_API_KEY"]
|
|
|
23 |
|
24 |
MONGODB_URI = os.environ["MONGODB_ATLAS_CLUSTER_URI"]
|
25 |
client = MongoClient(MONGODB_URI)
|
@@ -33,11 +34,6 @@ config = {
|
|
33 |
"temperature": 0,
|
34 |
}
|
35 |
|
36 |
-
wandb_api_key = os.environ["WANDB_API_KEY"]
|
37 |
-
wandb.login(key = wandb_api_key)
|
38 |
-
wandb.init(project = "openai-llm-rag", config = config)
|
39 |
-
config = wandb.config
|
40 |
-
|
41 |
template = """If you don't know the answer, just say that you don't know, don't try to make up an answer. Keep the answer as concise as possible. Always say
|
42 |
"🧠 Thanks for using the app - Bernd" at the end of the answer. """
|
43 |
|
@@ -140,7 +136,11 @@ def invoke(openai_api_key, rag_option, prompt):
|
|
140 |
completion = llm_chain(llm, prompt)
|
141 |
except Exception as e:
|
142 |
raise gr.Error(e)
|
|
|
|
|
|
|
143 |
wandb.config[rag_option] = rag_option
|
|
|
144 |
wandb.log({"prompt": prompt, "completion": completion})
|
145 |
return completion
|
146 |
|
|
|
20 |
_ = load_dotenv(find_dotenv())
|
21 |
|
22 |
#openai.api_key = os.environ["OPENAI_API_KEY"]
|
23 |
+
wandb_api_key = os.environ["WANDB_API_KEY"]
|
24 |
|
25 |
MONGODB_URI = os.environ["MONGODB_ATLAS_CLUSTER_URI"]
|
26 |
client = MongoClient(MONGODB_URI)
|
|
|
34 |
"temperature": 0,
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
37 |
template = """If you don't know the answer, just say that you don't know, don't try to make up an answer. Keep the answer as concise as possible. Always say
|
38 |
"🧠 Thanks for using the app - Bernd" at the end of the answer. """
|
39 |
|
|
|
136 |
completion = llm_chain(llm, prompt)
|
137 |
except Exception as e:
|
138 |
raise gr.Error(e)
|
139 |
+
wandb.login(key = wandb_api_key)
|
140 |
+
wandb.config[model] = model
|
141 |
+
wandb.config[temperature] = temperature
|
142 |
wandb.config[rag_option] = rag_option
|
143 |
+
wandb.init(project = "openai-llm-rag")
|
144 |
wandb.log({"prompt": prompt, "completion": completion})
|
145 |
return completion
|
146 |
|