raannakasturi commited on
Commit
5761f43
·
1 Parent(s): bc2c019

Update provider lists in NLP processing functions to include ChatGptEs, DarkAI, and Jmuz

Browse files
Files changed (1) hide show
  1. nlp_processes.py +4 -12
nlp_processes.py CHANGED
@@ -18,13 +18,12 @@ def generate_nlp_summary(temp_summary):
18
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \" {temp_summary}\".You have three tasks, which are:\\n 1.to summarize the text I provided into a Summary .Please answer within 150-300 characters.\\n 2.to summarize the text I provided, using up to seven Highlight.\\n 3.to summarize the text I provided, using up to seven Key Insights. Each insight should include a brief in-depth analysis. Key Insight should not include timestamps.\\n Your output should use the following template strictly, provide the results for the three tasks:\\n ## Summary\\n ## Highlights\\n - Highlights\\n ## Key Insights\\n - Key Insights .\\n Importantly your output must use language \"English\"'}
19
  ],
20
  )
21
- print(completion.provider)
22
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
23
  except Exception as e:
24
  print(str(e))
25
  client = Client(
26
  provider=RetryProvider(
27
- providers=[Chatgpt4o],
28
  max_retries=6,
29
  ),
30
  )
@@ -35,7 +34,6 @@ def generate_nlp_summary(temp_summary):
35
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \" {temp_summary}\".You have three tasks, which are:\\n 1.to summarize the text I provided into a Summary .Please answer within 150-300 characters.\\n 2.to summarize the text I provided, using up to seven Highlight.\\n 3.to summarize the text I provided, using up to seven Key Insights. Each insight should include a brief in-depth analysis. Key Insight should not include timestamps.\\n Your output should use the following template strictly, provide the results for the three tasks:\\n ## Summary\\n ## Highlights\\n - Highlights\\n ## Key Insights\\n - Key Insights .\\n Importantly your output must use language \"English\"'}
36
  ],
37
  )
38
- print(completion.provider)
39
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
40
  except Exception as e:
41
  print(str(e))
@@ -57,13 +55,12 @@ def generate_nlp_mindmap(temp_summary):
57
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \"{temp_summary}\".Your output should use the following template:\\n\\n## {{Subtitle01}}\\n- {{Bulletpoint01}}\\n- {{Bulletpoint02}}\\n## {{Subtitle02}}\\n- {{Bulletpoint03}}\\n- {{Bulletpoint04}}\\n\\nSummarize the giving topic to generate a mind map (as many subtitles as possible, with a minimum of three subtitles) structure markdown. Do not include anything in the response, that is not the part of mindmap.\\n Most Importantly your output must use language \"English\" and each point or pointer should include no more than 9 words.'}
58
  ],
59
  )
60
- print(completion.provider)
61
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
62
  except Exception as e:
63
  print(str(e))
64
  client = Client(
65
  provider=RetryProvider(
66
- providers=[Chatgpt4o],
67
  max_retries=6,
68
  ),
69
  )
@@ -74,7 +71,6 @@ def generate_nlp_mindmap(temp_summary):
74
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \"{temp_summary}\".Your output should use the following template:\\n\\n## {{Subtitle01}}\\n- {{Bulletpoint01}}\\n- {{Bulletpoint02}}\\n## {{Subtitle02}}\\n- {{Bulletpoint03}}\\n- {{Bulletpoint04}}\\n\\nSummarize the giving topic to generate a mind map (as many subtitles as possible, with a minimum of three subtitles) structure markdown. Do not include anything in the response, that is not the part of mindmap.\\n Most Importantly your output must use language \"English\" and each point or pointer should include no more than 9 words.'}
75
  ],
76
  )
77
- print(completion.provider)
78
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
79
  except Exception as e:
80
  print(str(e))
@@ -119,13 +115,12 @@ def fix_title(title):
119
  },
120
  ],
121
  )
122
- print(completion.provider)
123
  return completion.choices[0].message.content
124
  except Exception as e:
125
  print(str(e))
126
  client = Client(
127
  provider=RetryProvider(
128
- providers=[Chatgpt4o],
129
  max_retries=6,
130
  ),
131
  )
@@ -159,7 +154,6 @@ def fix_title(title):
159
  },
160
  ],
161
  )
162
- print(completion.provider)
163
  return completion.choices[0].message.content
164
  except Exception as e:
165
  print(str(e))
@@ -202,13 +196,12 @@ def fix_citation(citation):
202
  },
203
  ],
204
  )
205
- print(completion.provider)
206
  return completion.choices[0].message.content
207
  except Exception as e:
208
  print(str(e))
209
  client = Client(
210
  provider=RetryProvider(
211
- providers=[Chatgpt4o],
212
  max_retries=6,
213
  ),
214
  )
@@ -240,7 +233,6 @@ def fix_citation(citation):
240
  },
241
  ],
242
  )
243
- print(completion.provider)
244
  return completion.choices[0].message.content
245
  except Exception as e:
246
  print(str(e))
 
18
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \" {temp_summary}\".You have three tasks, which are:\\n 1.to summarize the text I provided into a Summary .Please answer within 150-300 characters.\\n 2.to summarize the text I provided, using up to seven Highlight.\\n 3.to summarize the text I provided, using up to seven Key Insights. Each insight should include a brief in-depth analysis. Key Insight should not include timestamps.\\n Your output should use the following template strictly, provide the results for the three tasks:\\n ## Summary\\n ## Highlights\\n - Highlights\\n ## Key Insights\\n - Key Insights .\\n Importantly your output must use language \"English\"'}
19
  ],
20
  )
 
21
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
22
  except Exception as e:
23
  print(str(e))
24
  client = Client(
25
  provider=RetryProvider(
26
+ providers=[ChatGptEs, Chatgpt4o, DarkAI, Liaobots, PollinationsAI, Jmuz],
27
  max_retries=6,
28
  ),
29
  )
 
34
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \" {temp_summary}\".You have three tasks, which are:\\n 1.to summarize the text I provided into a Summary .Please answer within 150-300 characters.\\n 2.to summarize the text I provided, using up to seven Highlight.\\n 3.to summarize the text I provided, using up to seven Key Insights. Each insight should include a brief in-depth analysis. Key Insight should not include timestamps.\\n Your output should use the following template strictly, provide the results for the three tasks:\\n ## Summary\\n ## Highlights\\n - Highlights\\n ## Key Insights\\n - Key Insights .\\n Importantly your output must use language \"English\"'}
35
  ],
36
  )
 
37
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
38
  except Exception as e:
39
  print(str(e))
 
55
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \"{temp_summary}\".Your output should use the following template:\\n\\n## {{Subtitle01}}\\n- {{Bulletpoint01}}\\n- {{Bulletpoint02}}\\n## {{Subtitle02}}\\n- {{Bulletpoint03}}\\n- {{Bulletpoint04}}\\n\\nSummarize the giving topic to generate a mind map (as many subtitles as possible, with a minimum of three subtitles) structure markdown. Do not include anything in the response, that is not the part of mindmap.\\n Most Importantly your output must use language \"English\" and each point or pointer should include no more than 9 words.'}
56
  ],
57
  )
 
58
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
59
  except Exception as e:
60
  print(str(e))
61
  client = Client(
62
  provider=RetryProvider(
63
+ providers=[ChatGptEs, Chatgpt4o, DarkAI, Liaobots, PollinationsAI, Jmuz],
64
  max_retries=6,
65
  ),
66
  )
 
71
  {"role": "user", "content": f'As a text script expert, please help me to write a short text script with the topic \"{temp_summary}\".Your output should use the following template:\\n\\n## {{Subtitle01}}\\n- {{Bulletpoint01}}\\n- {{Bulletpoint02}}\\n## {{Subtitle02}}\\n- {{Bulletpoint03}}\\n- {{Bulletpoint04}}\\n\\nSummarize the giving topic to generate a mind map (as many subtitles as possible, with a minimum of three subtitles) structure markdown. Do not include anything in the response, that is not the part of mindmap.\\n Most Importantly your output must use language \"English\" and each point or pointer should include no more than 9 words.'}
72
  ],
73
  )
 
74
  return completion.choices[0].message.content.replace("**", "").replace("\n\n", "\n").replace("\n \n", "\n").replace("##", "\n##").strip()
75
  except Exception as e:
76
  print(str(e))
 
115
  },
116
  ],
117
  )
 
118
  return completion.choices[0].message.content
119
  except Exception as e:
120
  print(str(e))
121
  client = Client(
122
  provider=RetryProvider(
123
+ providers=[ChatGptEs, Chatgpt4o, DarkAI, Liaobots, PollinationsAI, Jmuz],
124
  max_retries=6,
125
  ),
126
  )
 
154
  },
155
  ],
156
  )
 
157
  return completion.choices[0].message.content
158
  except Exception as e:
159
  print(str(e))
 
196
  },
197
  ],
198
  )
 
199
  return completion.choices[0].message.content
200
  except Exception as e:
201
  print(str(e))
202
  client = Client(
203
  provider=RetryProvider(
204
+ providers=[ChatGptEs, Chatgpt4o, DarkAI, Liaobots, PollinationsAI, Jmuz],
205
  max_retries=6,
206
  ),
207
  )
 
233
  },
234
  ],
235
  )
 
236
  return completion.choices[0].message.content
237
  except Exception as e:
238
  print(str(e))