AmpParth commited on
Commit
5da74e8
·
verified ·
1 Parent(s): 18c0521

changes to validate call flow

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -256,9 +256,12 @@ def check_agent_steps(text: str):
256
  "responses": []
257
  }
258
  for question in questions:
259
- response = openai.Completion.create(
260
- engine="AmplifAI-Chat",
261
- prompt=f"Based on the transcript, did the agent follow the step: {question}? Provide a 'right' or 'wrong' answer.\nTranscript: {text}\nAnswer: ",
 
 
 
262
  temperature=0.2,
263
  max_tokens=10,
264
  top_p=1.0,
@@ -266,7 +269,7 @@ def check_agent_steps(text: str):
266
  presence_penalty=0.0,
267
  stop=["\n"]
268
  )
269
- answer = response.choices[0].text.strip()
270
  response_map = {
271
  "lable": question,
272
  "icon": answer
 
256
  "responses": []
257
  }
258
  for question in questions:
259
+ response = client.chat.completions.create(
260
+ model = deployment_name,
261
+ messages=[
262
+ {"role": "system", "content": "You are an AI assistant evaluating call center agent performance. Keep answers concise."},
263
+ {"role": "user", "content": f"Based on the transcript, did the agent follow this step: '{question}'?\nTranscript: {text}\nAnswer with 'Right' or 'Wrong' only:"}
264
+ ],
265
  temperature=0.2,
266
  max_tokens=10,
267
  top_p=1.0,
 
269
  presence_penalty=0.0,
270
  stop=["\n"]
271
  )
272
+ answer = response.choices[0].message.content.strip()
273
  response_map = {
274
  "lable": question,
275
  "icon": answer