tanveeshsingh commited on
Commit
641d337
1 Parent(s): 3c54675
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -22,7 +22,14 @@ ANSWER:
22
 
23
  --
24
  """)
25
-
 
 
 
 
 
 
 
26
  def update_inputs(input_style):
27
  if input_style == "Dialog":
28
  return gr.update(visible=True), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
@@ -75,7 +82,7 @@ Your output should be in JSON FORMAT with the keys "REASONING" and "SCORE":
75
  async def judge_reliability(input_style, document, conversation, claim, question, answer):
76
  start_time = time.time()
77
  if input_style == "Dialog":
78
- conversation = json.loads(conversation)
79
  print(conversation)
80
  outputs= await collinear.judge.veritas.conversation(document,conversation[:-1],conversation[-1])
81
  elif input_style == "NLI":
@@ -167,7 +174,10 @@ Initiates Third Quarter FY25 Revenue Guidance of $9.31 Billion to $9.36 Billion,
167
  Maintains Full Year FY25 Revenue Guidance of $37.7 Billion to $38.0 Billion, up 8% - 9% Y/Y and Maintains Full Year FY25 Subscription & Support Revenue Growth Guidance of Slightly Below 10% Y/Y & Approximately 10% in CC
168
  Updates Full Year FY25 GAAP Operating Margin Guidance to 19.7% and Updates non-GAAP Operating Margin Guidance to 32.8%
169
  Raises Full Year FY25 Operating Cash Flow Growth Guidance to 23% to 25% Y/Y""")
170
- conversation_input = gr.Textbox(label="Conversation", lines=5, visible=True, value="""[{"role": "user", "content": "Salesforce has a fantastic year with Agent Force"}, {"role": "assistant", "content": "Yes, they seem to be doing quite well."}, {"role": "user", "content": "Can you tell me their projected earnings for next year?"}, {"role": "assistant", "content": "Yes, it is about $38Bn."}]""")
 
 
 
171
  claim_input = gr.Textbox(label="Claim", lines=5, visible=False, value="Salesforce might earn about $38Bn next year")
172
  question_input = gr.Textbox(label="Question", lines=5, visible=False, value="What is Salesforce's revenue guidance for next year?")
173
  answer_input = gr.Textbox(label="Answer", lines=5, visible=False, value="Salesforce revenue guidance for next year is about $37.8Bn ")
 
22
 
23
  --
24
  """)
25
+ def convert_to_message_array(conversation):
26
+ message_array = []
27
+
28
+ for line in conversation.split('\n'):
29
+ if line.startswith('user:'):
30
+ message_array.append({'role': 'user', 'content': line.replace('user:', '').strip()})
31
+ elif line.startswith('assistant:'):
32
+ message_array.append({'role': 'assistant', 'content': line.replace('assistant:', '').strip()})
33
  def update_inputs(input_style):
34
  if input_style == "Dialog":
35
  return gr.update(visible=True), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
 
82
  async def judge_reliability(input_style, document, conversation, claim, question, answer):
83
  start_time = time.time()
84
  if input_style == "Dialog":
85
+ conversation = convert_to_message_array(conversation=conversation)
86
  print(conversation)
87
  outputs= await collinear.judge.veritas.conversation(document,conversation[:-1],conversation[-1])
88
  elif input_style == "NLI":
 
174
  Maintains Full Year FY25 Revenue Guidance of $37.7 Billion to $38.0 Billion, up 8% - 9% Y/Y and Maintains Full Year FY25 Subscription & Support Revenue Growth Guidance of Slightly Below 10% Y/Y & Approximately 10% in CC
175
  Updates Full Year FY25 GAAP Operating Margin Guidance to 19.7% and Updates non-GAAP Operating Margin Guidance to 32.8%
176
  Raises Full Year FY25 Operating Cash Flow Growth Guidance to 23% to 25% Y/Y""")
177
+ conversation_input = gr.Textbox(label="Conversation", lines=5, visible=True, value="""user:Salesforce has a fantastic year with Agent Force
178
+ assistant: Yes, they seem to be doing quite well.
179
+ user:Can you tell me their projected earnings for next year?
180
+ assistant:Yes, it is about $38Bn.""")
181
  claim_input = gr.Textbox(label="Claim", lines=5, visible=False, value="Salesforce might earn about $38Bn next year")
182
  question_input = gr.Textbox(label="Question", lines=5, visible=False, value="What is Salesforce's revenue guidance for next year?")
183
  answer_input = gr.Textbox(label="Answer", lines=5, visible=False, value="Salesforce revenue guidance for next year is about $37.8Bn ")