Mudassir939 commited on
Commit
26df7f2
·
verified ·
1 Parent(s): 3b90f25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -25
app.py CHANGED
@@ -29,18 +29,23 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
29
 
30
  # Refined Instructions for Gemini
31
  GEMINI_INSTRUCTIONS = """
32
- The purpose of the category 'Reason for Outbound Call' is to identify the reason that a connected call was placed by the caller.
33
-
34
- Consider the following options and select the one that best matches the content of the call:
35
- 1. Yes: The agent attempted to discuss buying, selling, trading, leasing, or test driving a vehicle. This includes any discussion of vehicle needs, interests, or potential sales, but this only applies if the call was live.
36
- 2. No: The agent followed up on a previous purchase or had a general discussion. This option should be selected if the call does not include any sales-related discussion.
37
- 3. No: The agent only confirmed, changed, or canceled an existing appointment. This includes any mention of scheduling, rescheduling, confirming, or canceling appointments.
38
- 4. Correction: The call was not connected to the intended party (e.g., it was a voicemail or a one-sided message).
39
-
40
- Remember:
41
- - Option 1 should only be selected if there was a live conversation with the intended contact.
42
- - Option 4 should be selected if the call was not connected (e.g., it was a voicemail or no live interaction occurred).
43
- - Option 4 if it is voicemail, make it option 4
 
 
 
 
 
44
  """
45
 
46
  # Home route to serve the index.html file from the root directory
@@ -81,19 +86,17 @@ def generate_api():
81
 
82
  result_text = ''.join(buffer).lower()
83
 
84
- # Adjusted logic to determine the correct option
85
- if ("option 4" in result_text or "voicemail" in result_text or
86
- "just wanted to reach out" in result_text or "thank you, bye" in result_text or
87
- "this is" in result_text and "see if" in result_text and not "response" in result_text):
88
- selected_option = 4
89
- elif "option 1" in result_text or "yes" in result_text or "vehicle needs" in result_text:
90
- selected_option = 1
91
- elif "option 2" in result_text:
92
- selected_option = 2
93
- elif "option 3" in result_text or "reschedule" in result_text or "confirm" in result_text or "cancel" in result_text:
94
- selected_option = 3
95
- else:
96
- selected_option = "Could not determine the correct option."
97
 
98
  # Return the transcription and selected option
99
  return jsonify({
 
29
 
30
  # Refined Instructions for Gemini
31
  GEMINI_INSTRUCTIONS = """
32
+ **Step 1: Identify the Agent**
33
+ - The agent is the representative from the company who interacts with the customer. They typically provide information, answer questions, or ask about the customer's car or services.
34
+ - Clues that can help identify the agent:
35
+ - They often have structured and formal responses.
36
+ - They provide company information such as service hours, contact details, or specific procedures.
37
+ - They ask questions related to the customer's inquiry, especially about the car (e.g., make, model, condition).
38
+ - Their language is more focused on offering help or gathering information rather than seeking help.
39
+
40
+ **Step 2: Determine the Correct Option**
41
+ **Option 1 (Yes)**:
42
+ Agent offered two dates and times
43
+ Example: Agent: “I have Wednesday 3:00 or Thursday at 10:00, if either of those times are good for you.”
44
+ Agent offered multiple days and narrowed down to specific times
45
+ Example: Agent: “Can you do Monday or Tuesday?” // Caller: “Tuesday is better for me.” // Agent: “What's better? I have 10:00 AM or 2:00 PM.”
46
+ Example: Agent: “Can you do Friday afternoon or Saturday morning?” // Caller: “Friday afternoon might work.” // Agent: “How does 3:00 PM sound?”
47
+ **Option 2 (No)**:
48
+ Agent did not offer two dates and times
49
  """
50
 
51
  # Home route to serve the index.html file from the root directory
 
86
 
87
  result_text = ''.join(buffer).lower()
88
 
89
+ const options = {
90
+ 'option 1': 1,
91
+ 'option 2': 2,
92
+ };
93
+
94
+ for (let option in options) {
95
+ if (resultText.includes(option)) {
96
+ selectedOption = options[option];
97
+ break; // Exit the loop once the option is found
98
+ }
99
+ }
 
 
100
 
101
  # Return the transcription and selected option
102
  return jsonify({