tferhan commited on
Commit
a408dc9
·
verified ·
1 Parent(s): b7d3039

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from langchain.prompts import StringPromptTemplate
2
  import re
 
3
  import langchain
4
  from qa_txt import conversation_chain
5
  # from key_extract import chain
@@ -43,6 +44,19 @@ qa_faq = StructuredTool.from_function(
43
  - string : the output as returned from the function in french.
44
  """
45
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  def request_data(query: str) -> str:
47
  mot_cle = nettoyer_string(query)
48
  mots = mot_cle.split()
@@ -52,7 +66,7 @@ def request_data(query: str) -> str:
52
  reponse_final = format_reponse(rg)
53
  return reponse_final
54
  else:
55
- return query + "salam"
56
 
57
  fetch_data = StructuredTool.from_function(
58
  func=request_data,
@@ -107,6 +121,7 @@ fetch_data = StructuredTool.from_function(
107
  tools_add = [
108
  qa_faq,
109
  fetch_data,
 
110
  # translate_text,
111
  ]
112
 
 
1
  from langchain.prompts import StringPromptTemplate
2
  import re
3
+ from document_scrapped import get_data
4
  import langchain
5
  from qa_txt import conversation_chain
6
  # from key_extract import chain
 
44
  - string : the output as returned from the function in french.
45
  """
46
  )
47
+
48
+ analyze_data = StructuredTool.from_function(
49
+ func=get_data,
50
+ description = """
51
+ Extract and analyze and summarize data from a given url.
52
+ Parameters :
53
+ - url (string) : must be in the domain data.gov.ma if not return a message warning the user.
54
+ Returns :
55
+ - string : A summary about the data extracted and some insights about it in french obligatory.
56
+ """
57
+ )
58
+
59
+
60
  def request_data(query: str) -> str:
61
  mot_cle = nettoyer_string(query)
62
  mots = mot_cle.split()
 
66
  reponse_final = format_reponse(rg)
67
  return reponse_final
68
  else:
69
+ return query
70
 
71
  fetch_data = StructuredTool.from_function(
72
  func=request_data,
 
121
  tools_add = [
122
  qa_faq,
123
  fetch_data,
124
+ analyze_data,
125
  # translate_text,
126
  ]
127