bstraehle commited on
Commit
df6d4c7
·
1 Parent(s): 3d0c9a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- import logging, os, sys
3
 
4
  from agent_langchain import agent_langchain
5
  from agent_llamaindex import agent_llamaindex
@@ -33,6 +33,8 @@ def invoke(openai_api_key, prompt, agent_option):
33
  output = ""
34
 
35
  try:
 
 
36
  if (agent_option == AGENT_LANGCHAIN):
37
  completion = agent_langchain(
38
  config,
@@ -59,6 +61,20 @@ def invoke(openai_api_key, prompt, agent_option):
59
  err_msg = e
60
 
61
  raise gr.Error(e)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  return output
64
 
 
1
  import gradio as gr
2
+ import logging, os, sys, time
3
 
4
  from agent_langchain import agent_langchain
5
  from agent_llamaindex import agent_llamaindex
 
33
  output = ""
34
 
35
  try:
36
+ start_time_ms = round(time.time() * 1000)
37
+
38
  if (agent_option == AGENT_LANGCHAIN):
39
  completion = agent_langchain(
40
  config,
 
61
  err_msg = e
62
 
63
  raise gr.Error(e)
64
+ finally:
65
+ end_time_ms = round(time.time() * 1000)
66
+
67
+ trace_wandb(
68
+ config,
69
+ rag_option,
70
+ prompt,
71
+ completion,
72
+ result,
73
+ callback,
74
+ err_msg,
75
+ start_time_ms,
76
+ end_time_ms
77
+ )
78
 
79
  return output
80