Spaces:
Paused
Paused
Commit
·
ba26b8e
1
Parent(s):
1bb1a73
Update app.py
Browse files
app.py
CHANGED
|
@@ -127,31 +127,49 @@ def process_input():
|
|
| 127 |
|
| 128 |
|
| 129 |
def get_case_summary(conv_detail):
|
| 130 |
-
chatresponse_desc = openai.ChatCompletion.create(
|
| 131 |
-
model="gpt-3.5-turbo",
|
| 132 |
-
temperature=0,
|
| 133 |
-
max_tokens=128,
|
| 134 |
-
messages=[
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
)
|
| 140 |
-
case_desc = chatresponse_desc.choices[0].
|
| 141 |
return case_desc
|
| 142 |
|
| 143 |
def get_case_subject(conv_detail):
|
| 144 |
-
chatresponse_subj = openai.ChatCompletion.create(
|
| 145 |
-
model="gpt-3.5-turbo",
|
| 146 |
-
temperature=0,
|
| 147 |
-
max_tokens=32,
|
| 148 |
-
messages=[
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
)
|
| 154 |
-
case_subj = chatresponse_subj.choices[0].
|
| 155 |
return case_subj
|
| 156 |
|
| 157 |
# Define a function to create a case record in Salesforce
|
|
|
|
| 127 |
|
| 128 |
|
| 129 |
def get_case_summary(conv_detail):
|
| 130 |
+
#chatresponse_desc = openai.ChatCompletion.create(
|
| 131 |
+
#model="gpt-3.5-turbo",
|
| 132 |
+
#temperature=0,
|
| 133 |
+
#max_tokens=128,
|
| 134 |
+
#messages=[
|
| 135 |
+
# {"role": "system", "content": "You are an Text Summarizer."},
|
| 136 |
+
# {"role": "user", "content": "You need to summarise the conversation between an agent and customer mentioned below. Remember to keep the Product Name, Customer Tone and other key elements from the convsersation"},
|
| 137 |
+
# {"role": "user", "content": conv_detail}
|
| 138 |
+
#]
|
| 139 |
+
#)
|
| 140 |
+
#case_desc = chatresponse_desc.choices[0].message.content
|
| 141 |
+
chatresponse_desc = completion.create(
|
| 142 |
+
model = 'text-davinci-003',
|
| 143 |
+
prompt = 'Summarise the conversation between an agent and customer.Remember to keep the Product Name, Customer Tone and other key elements from the convsersation.Here is the conversation: ' + conv_detail,
|
| 144 |
+
temperature = 0,
|
| 145 |
+
top_p =1,
|
| 146 |
+
best_of=1,
|
| 147 |
+
max_tokens=256
|
| 148 |
)
|
| 149 |
+
case_desc = chatresponse_desc.choices[0].text.strip()
|
| 150 |
return case_desc
|
| 151 |
|
| 152 |
def get_case_subject(conv_detail):
|
| 153 |
+
#chatresponse_subj = openai.ChatCompletion.create(
|
| 154 |
+
#model="gpt-3.5-turbo",
|
| 155 |
+
#temperature=0,
|
| 156 |
+
#max_tokens=32,
|
| 157 |
+
#messages=[
|
| 158 |
+
# {"role": "system", "content": "You are an Text Summarizer."},
|
| 159 |
+
# {"role": "user", "content": "You need to summarise the conversation between an agent and customer in 15 words mentioned below for case subject."},
|
| 160 |
+
# {"role": "user", "content": conv_detail}
|
| 161 |
+
#]
|
| 162 |
+
#)
|
| 163 |
+
#case_subj = chatresponse_subj.choices[0].message.content
|
| 164 |
+
chatresponse_subj = completion.create(
|
| 165 |
+
model = 'text-davinci-003',
|
| 166 |
+
prompt = 'Summarise the conversation between an agent and customer in 15 words mentioned below for Case Subject. Here is the conversation: ' + conv_detail,
|
| 167 |
+
temperature = 0,
|
| 168 |
+
top_p =1,
|
| 169 |
+
best_of=1,
|
| 170 |
+
max_tokens=256
|
| 171 |
)
|
| 172 |
+
case_subj = chatresponse_subj.choices[0].text.strip()
|
| 173 |
return case_subj
|
| 174 |
|
| 175 |
# Define a function to create a case record in Salesforce
|