Spaces:
Sleeping
Sleeping
Neurolingua
commited on
Update other_function.py
Browse files- other_function.py +32 -1
other_function.py
CHANGED
@@ -212,11 +212,42 @@ def respond_pdf(query):
|
|
212 |
for chunk in AI71(AI71_API_KEY).chat.completions.create(
|
213 |
model="tiiuae/falcon-11b",
|
214 |
messages=[
|
215 |
-
{"role": "system", "content": "You are a pdf answering assistant."},
|
216 |
{"role": "user", "content": f"Content:{extracted_text},Query:{query}"},
|
217 |
],
|
218 |
stream=True,
|
219 |
):
|
220 |
if chunk.choices[0].delta.content:
|
221 |
res += chunk.choices[0].delta.content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
return ( res.replace("User:",'').strip())
|
|
|
212 |
for chunk in AI71(AI71_API_KEY).chat.completions.create(
|
213 |
model="tiiuae/falcon-11b",
|
214 |
messages=[
|
215 |
+
{"role": "system", "content": "You are a agriculture pdf answering assistant."},
|
216 |
{"role": "user", "content": f"Content:{extracted_text},Query:{query}"},
|
217 |
],
|
218 |
stream=True,
|
219 |
):
|
220 |
if chunk.choices[0].delta.content:
|
221 |
res += chunk.choices[0].delta.content
|
222 |
+
return ( res.replace("User:",'').strip())
|
223 |
+
|
224 |
+
|
225 |
+
def booktask(data):
|
226 |
+
res = ''
|
227 |
+
for chunk in AI71(AI71_API_KEY).chat.completions.create(
|
228 |
+
model="tiiuae/falcon-11b",
|
229 |
+
messages=[
|
230 |
+
{"role": "system", "content": "You are a agriculture bookkeeping assistant."},
|
231 |
+
{"role": "user", "content": f"My bookkeeping data is {data}.Provide the data in points."},
|
232 |
+
],
|
233 |
+
stream=True,
|
234 |
+
):
|
235 |
+
if chunk.choices[0].delta.content:
|
236 |
+
res += chunk.choices[0].delta.content
|
237 |
+
return ( res.replace("User:",'').strip())
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
def return_bookdata(querry,data):
|
242 |
+
res = ''
|
243 |
+
for chunk in AI71(AI71_API_KEY).chat.completions.create(
|
244 |
+
model="tiiuae/falcon-11b",
|
245 |
+
messages=[
|
246 |
+
{"role": "system", "content": "You are a agriculture bookkeeping responding assistant."},
|
247 |
+
{"role": "user", "content": f"My bookkeeping data is {data}.do what user is telling. user:{querry"},
|
248 |
+
],
|
249 |
+
stream=True,
|
250 |
+
):
|
251 |
+
if chunk.choices[0].delta.content:
|
252 |
+
res += chunk.choices[0].delta.content
|
253 |
return ( res.replace("User:",'').strip())
|