ShynBui commited on
Commit
f541e42
·
verified ·
1 Parent(s): b13c6ff

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +6 -6
utils.py CHANGED
@@ -34,6 +34,12 @@ example_selector = SemanticSimilarityExampleSelector.from_examples(
34
 
35
  db = SQLDatabase.from_uri("sqlite:///attendance_system.db")
36
 
 
 
 
 
 
 
37
  employee = query_as_list(db, "SELECT FullName FROM Employee")
38
 
39
  vector_db = Chroma.from_texts(employee, OpenAIEmbeddings(model="text-embedding-3-small", api_key=os.environ['API_KEY']))
@@ -47,12 +53,6 @@ retriever_tool = create_retriever_tool(
47
  )
48
 
49
 
50
- def query_as_list(db, query):
51
- res = db.run(query)
52
- res = [el for sub in ast.literal_eval(res) for el in sub if el]
53
- res = [re.sub(r"\b\d+\b", "", string).strip() for string in res]
54
- return list(set(res))
55
-
56
 
57
  def get_answer(user_query):
58
 
 
34
 
35
  db = SQLDatabase.from_uri("sqlite:///attendance_system.db")
36
 
37
+ def query_as_list(db, query):
38
+ res = db.run(query)
39
+ res = [el for sub in ast.literal_eval(res) for el in sub if el]
40
+ res = [re.sub(r"\b\d+\b", "", string).strip() for string in res]
41
+ return list(set(res))
42
+
43
  employee = query_as_list(db, "SELECT FullName FROM Employee")
44
 
45
  vector_db = Chroma.from_texts(employee, OpenAIEmbeddings(model="text-embedding-3-small", api_key=os.environ['API_KEY']))
 
53
  )
54
 
55
 
 
 
 
 
 
 
56
 
57
  def get_answer(user_query):
58