Update trace.py
Browse files
trace.py
CHANGED
|
@@ -14,14 +14,21 @@ def trace_wandb(config,
|
|
| 14 |
start_time_ms,
|
| 15 |
end_time_ms):
|
| 16 |
wandb.init(project = "openai-llm-rag")
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
trace = Trace(
|
| 19 |
kind = "LLM",
|
| 20 |
name = "Context-Aware Reasoning Application",
|
| 21 |
status_code = "success" if (str(err_msg) == "") else "error",
|
| 22 |
status_message = str(err_msg),
|
| 23 |
inputs = {"prompt": prompt,
|
| 24 |
-
|
| 25 |
"rag_option": rag_option,
|
| 26 |
"config": str(config)
|
| 27 |
} if (str(err_msg) == "") else {},
|
|
|
|
| 14 |
start_time_ms,
|
| 15 |
end_time_ms):
|
| 16 |
wandb.init(project = "openai-llm-rag")
|
| 17 |
+
|
| 18 |
+
if (rag_option = ""):
|
| 19 |
+
prompt_template = os.environ["LANGCHAIN_TEMPLATE"]
|
| 20 |
+
elif (rag_option = ""):
|
| 21 |
+
prompt_template = os.environ["LLAMAINDEX_TEMPLATE"]
|
| 22 |
+
else:
|
| 23 |
+
prompt_template = os.environ["TEMPLATE"]
|
| 24 |
+
|
| 25 |
trace = Trace(
|
| 26 |
kind = "LLM",
|
| 27 |
name = "Context-Aware Reasoning Application",
|
| 28 |
status_code = "success" if (str(err_msg) == "") else "error",
|
| 29 |
status_message = str(err_msg),
|
| 30 |
inputs = {"prompt": prompt,
|
| 31 |
+
"prompt_template": prompt_template,
|
| 32 |
"rag_option": rag_option,
|
| 33 |
"config": str(config)
|
| 34 |
} if (str(err_msg) == "") else {},
|