MM58-crypto commited on
Commit
cb048b6
·
1 Parent(s): 348d98a

wooo another commit

Browse files
Files changed (2) hide show
  1. haystack_pipeline.py +5 -1
  2. main.py +10 -4
haystack_pipeline.py CHANGED
@@ -67,8 +67,11 @@ try:
67
  except Exception as e:
68
  print("An error occured when trying to connect to the cluster: ", e)
69
 
70
- # retrieve docs from mongodb and stringify them
 
 
71
 
 
72
 
73
  qdrant_doc_store = QdrantDocumentStore(
74
  url="https://a7ec1c00-7522-415a-9152-d6fd4ac3479e.eu-central-1-0.aws.cloud.qdrant.io",
@@ -272,6 +275,7 @@ Rules:
272
  - No greetings, intros, or closing remarks.
273
 
274
  If the student asks a general knowledge question about Arabic grammar rather than asking about a specific sentence, direct them to the Knowledge section in the navigator sidebar.
 
275
  """
276
 
277
 
 
67
  except Exception as e:
68
  print("An error occured when trying to connect to the cluster: ", e)
69
 
70
+ docs = list(collection.find({
71
+ "role": {"$in": ["ai-assistant", "user"]}
72
+ }))
73
 
74
+ msg_history = json.dumps(docs, indent=2, default=str)
75
 
76
  qdrant_doc_store = QdrantDocumentStore(
77
  url="https://a7ec1c00-7522-415a-9152-d6fd4ac3479e.eu-central-1-0.aws.cloud.qdrant.io",
 
275
  - No greetings, intros, or closing remarks.
276
 
277
  If the student asks a general knowledge question about Arabic grammar rather than asking about a specific sentence, direct them to the Knowledge section in the navigator sidebar.
278
+
279
  """
280
 
281
 
main.py CHANGED
@@ -52,11 +52,14 @@ collection = db.get_collection("collection_0")
52
 
53
  # retrieve docs from mongodb and stringify them
54
 
55
- docs = list(collection.find({
56
- "role": {"$in": ["ai-assistant", "user"]}
57
- }))
 
 
58
 
59
- msg_history = json.dumps(docs, indent=2, default=str)
 
60
 
61
  def run_query(message: str, intent: str) -> str:
62
  """
@@ -70,6 +73,9 @@ def run_query(message: str, intent: str) -> str:
70
  Returns:
71
  LLM reply as a string
72
  """
 
 
 
73
  match intent:
74
  case "i3rab":
75
  # Strip any leading instruction words so the parser gets
 
52
 
53
  # retrieve docs from mongodb and stringify them
54
 
55
+ msg_history = ""
56
+ def retrieve_docs():
57
+ docs = list(collection.find({
58
+ "role": {"$in": ["ai-assistant", "user"]}
59
+ }))
60
 
61
+ msg_history = json.dumps(docs, indent=2, default=str)
62
+
63
 
64
  def run_query(message: str, intent: str) -> str:
65
  """
 
73
  Returns:
74
  LLM reply as a string
75
  """
76
+ while(intent=="knowledge"):
77
+ retrieve_docs()
78
+
79
  match intent:
80
  case "i3rab":
81
  # Strip any leading instruction words so the parser gets