Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ config = {
|
|
36 |
"chunk_overlap": 150,
|
37 |
"chunk_size": 1500,
|
38 |
"k": 3,
|
39 |
-
"
|
40 |
"temperature": 0,
|
41 |
}
|
42 |
|
@@ -128,14 +128,15 @@ def wandb_trace(rag_option, prompt, completion, chain, err_msg, start_time_ms, e
|
|
128 |
wandb.init(project = "openai-llm-rag")
|
129 |
trace = Trace(
|
130 |
kind = "chain",
|
131 |
-
name = type(chain).__name__ if (chain != None) else "",
|
|
|
132 |
status_code = "success" if (str(err_msg) == "") else "error",
|
133 |
status_message = str(err_msg),
|
134 |
metadata = {
|
135 |
"chunk_overlap": "" if (rag_option == RAG_OFF) else config["chunk_overlap"],
|
136 |
"chunk_size": "" if (rag_option == RAG_OFF) else config["chunk_size"],
|
137 |
"k": "" if (rag_option == RAG_OFF) else config["k"],
|
138 |
-
"
|
139 |
"temperature": config["temperature"],
|
140 |
},
|
141 |
inputs = {"rag_option": rag_option if (str(err_msg) == "") else "",
|
@@ -162,7 +163,7 @@ def invoke(openai_api_key, rag_option, prompt):
|
|
162 |
err_msg = ""
|
163 |
try:
|
164 |
start_time_ms = round(time.time() * 1000)
|
165 |
-
llm = ChatOpenAI(model_name = config["
|
166 |
openai_api_key = openai_api_key,
|
167 |
temperature = config["temperature"])
|
168 |
if (rag_option == RAG_CHROMA):
|
|
|
36 |
"chunk_overlap": 150,
|
37 |
"chunk_size": 1500,
|
38 |
"k": 3,
|
39 |
+
"model_name": "gpt-4",
|
40 |
"temperature": 0,
|
41 |
}
|
42 |
|
|
|
128 |
wandb.init(project = "openai-llm-rag")
|
129 |
trace = Trace(
|
130 |
kind = "chain",
|
131 |
+
#name = type(chain).__name__ if (chain != None) else "",
|
132 |
+
name = str(chain) if (chain != None) else "",
|
133 |
status_code = "success" if (str(err_msg) == "") else "error",
|
134 |
status_message = str(err_msg),
|
135 |
metadata = {
|
136 |
"chunk_overlap": "" if (rag_option == RAG_OFF) else config["chunk_overlap"],
|
137 |
"chunk_size": "" if (rag_option == RAG_OFF) else config["chunk_size"],
|
138 |
"k": "" if (rag_option == RAG_OFF) else config["k"],
|
139 |
+
"model_name": config["model_name"],
|
140 |
"temperature": config["temperature"],
|
141 |
},
|
142 |
inputs = {"rag_option": rag_option if (str(err_msg) == "") else "",
|
|
|
163 |
err_msg = ""
|
164 |
try:
|
165 |
start_time_ms = round(time.time() * 1000)
|
166 |
+
llm = ChatOpenAI(model_name = config["model_name"],
|
167 |
openai_api_key = openai_api_key,
|
168 |
temperature = config["temperature"])
|
169 |
if (rag_option == RAG_CHROMA):
|