Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -119,8 +119,8 @@ def rag_chain(llm, prompt, db):
|
|
119 |
def wandb_trace(rag_option, prompt, completion, status_msg, start_time_ms, end_time_ms):
|
120 |
wandb.init(project = "openai-llm-rag")
|
121 |
trace = Trace(
|
122 |
-
name = "LLMChain" if (rag_option == "Off") else "RetrievalQA",
|
123 |
kind = "chain",
|
|
|
124 |
status_code = "SUCCESS" if (str(status_msg) == "") else "ERROR",
|
125 |
status_message = str(status_msg),
|
126 |
metadata={
|
@@ -130,10 +130,12 @@ def wandb_trace(rag_option, prompt, completion, status_msg, start_time_ms, end_t
|
|
130 |
"model": config["model"],
|
131 |
"temperature": config["temperature"],
|
132 |
},
|
|
|
|
|
|
|
|
|
133 |
start_time_ms = start_time_ms,
|
134 |
end_time_ms = end_time_ms,
|
135 |
-
inputs = {"rag_option": rag_option, "prompt": str(prompt), "prompt_template": str(llm_template if (rag_option == "Off") else rag_template)},
|
136 |
-
outputs = {"completion": str(completion)},
|
137 |
#model_dict = {"llm": str(llm)}
|
138 |
)
|
139 |
trace.log("test")
|
|
|
119 |
def wandb_trace(rag_option, prompt, completion, status_msg, start_time_ms, end_time_ms):
|
120 |
wandb.init(project = "openai-llm-rag")
|
121 |
trace = Trace(
|
|
|
122 |
kind = "chain",
|
123 |
+
name = "LLMChain" if (rag_option == "Off") else "RetrievalQA",
|
124 |
status_code = "SUCCESS" if (str(status_msg) == "") else "ERROR",
|
125 |
status_message = str(status_msg),
|
126 |
metadata={
|
|
|
130 |
"model": config["model"],
|
131 |
"temperature": config["temperature"],
|
132 |
},
|
133 |
+
inputs = {"rag_option": rag_option,
|
134 |
+
"prompt": str(prompt if (str(status_msg) == "") else ""),
|
135 |
+
"prompt_template": str((llm_template if (rag_option == "Off") else rag_template) if (str(status_msg) == "") else "")},
|
136 |
+
outputs = {"completion": str(completion)},
|
137 |
start_time_ms = start_time_ms,
|
138 |
end_time_ms = end_time_ms,
|
|
|
|
|
139 |
#model_dict = {"llm": str(llm)}
|
140 |
)
|
141 |
trace.log("test")
|