Spaces:
Running
Running
Update trace.py
Browse files
trace.py
CHANGED
@@ -4,9 +4,6 @@ from wandb.sdk.data_types.trace_tree import Trace
|
|
4 |
|
5 |
WANDB_API_KEY = os.environ["WANDB_API_KEY"]
|
6 |
|
7 |
-
AGENT_LANGCHAIN = "LangChain"
|
8 |
-
AGENT_LLAMAINDEX = "LlamaIndex"
|
9 |
-
|
10 |
def trace_wandb(config,
|
11 |
agent_option,
|
12 |
prompt,
|
@@ -17,20 +14,12 @@ def trace_wandb(config,
|
|
17 |
end_time_ms):
|
18 |
wandb.init(project = "openai-llm-agent")
|
19 |
|
20 |
-
if (agent_option == AGENT_LANGCHAIN):
|
21 |
-
prompt_template = os.environ["LANGCHAIN_TEMPLATE"]
|
22 |
-
elif (agent_option == AGENT_LLAMAINDEX):
|
23 |
-
prompt_template = os.environ["LLAMAINDEX_TEMPLATE"]
|
24 |
-
else:
|
25 |
-
prompt_template = os.environ["TEMPLATE"]
|
26 |
-
|
27 |
trace = Trace(
|
28 |
kind = "LLM",
|
29 |
name = "Real-Time Reasoning Application",
|
30 |
status_code = "success" if (str(err_msg) == "") else "error",
|
31 |
status_message = str(err_msg),
|
32 |
inputs = {"prompt": prompt,
|
33 |
-
"prompt_template": prompt_template,
|
34 |
"agent_option": agent_option,
|
35 |
"config": str(config)
|
36 |
} if (str(err_msg) == "") else {},
|
|
|
4 |
|
5 |
WANDB_API_KEY = os.environ["WANDB_API_KEY"]
|
6 |
|
|
|
|
|
|
|
7 |
def trace_wandb(config,
|
8 |
agent_option,
|
9 |
prompt,
|
|
|
14 |
end_time_ms):
|
15 |
wandb.init(project = "openai-llm-agent")
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
trace = Trace(
|
18 |
kind = "LLM",
|
19 |
name = "Real-Time Reasoning Application",
|
20 |
status_code = "success" if (str(err_msg) == "") else "error",
|
21 |
status_message = str(err_msg),
|
22 |
inputs = {"prompt": prompt,
|
|
|
23 |
"agent_option": agent_option,
|
24 |
"config": str(config)
|
25 |
} if (str(err_msg) == "") else {},
|