kolzchut-ragbot 1.1.3__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/PKG-INFO +1 -1
  2. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/engine.py +2 -2
  3. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/model.py +8 -13
  4. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot.egg-info/PKG-INFO +1 -1
  5. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/setup.py +5 -1
  6. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/README.md +0 -0
  7. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/Document.py +0 -0
  8. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/IntegrateService.py +0 -0
  9. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/__init__.py +0 -0
  10. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/config.py +0 -0
  11. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot/llm_client.py +0 -0
  12. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot.egg-info/SOURCES.txt +0 -0
  13. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot.egg-info/dependency_links.txt +0 -0
  14. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot.egg-info/requires.txt +0 -0
  15. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/kolzchut_ragbot.egg-info/top_level.txt +0 -0
  16. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/pyproject.toml +0 -0
  17. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/setup.cfg +0 -0
  18. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/test/test_configs.py +0 -0
  19. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/test/test_document.py +0 -0
  20. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/test/test_engine.py +0 -0
  21. {kolzchut_ragbot-1.1.3 → kolzchut_ragbot-1.3.0}/test/test_model.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kolzchut-ragbot
3
- Version: 1.1.3
3
+ Version: 1.3.0
4
4
  Summary: A search engine using machine learning models and Elasticsearch for advanced document retrieval.
5
5
  Home-page: https://github.com/shmuelrob/ragbot
6
6
  Author: Shmuel Robinov
@@ -178,7 +178,7 @@ class Engine:
178
178
  all_docs_by_model = self.elastic_model.search(query_embeddings)
179
179
  all_docs = []
180
180
  ids_for_fusion = []
181
- all_docs_and_scores = []
181
+ all_docs_and_scores = {}
182
182
 
183
183
  for key, values in all_docs_by_model.items():
184
184
  print(f"\nFound {len(values)} documents for model\n")
@@ -190,7 +190,7 @@ class Engine:
190
190
  all_docs.append(doc)
191
191
  scores_for_model.append({"doc": doc["_source"]["title"], "score": doc["_score"]})
192
192
  ids_for_fusion.append(model_ids)
193
- all_docs_and_scores.append({f'{key}': scores_for_model})
193
+ all_docs_and_scores[f'{key}'] = scores_for_model
194
194
  print(f"\nFusing {len(ids_for_fusion)} results\n")
195
195
  fused_ids = self.reciprocal_rank_fusion(ids_for_fusion, k=top_k)
196
196
  top_k_documents = []
@@ -93,23 +93,18 @@ class Model:
93
93
  index = index_from_page_id(int(doc_id))
94
94
 
95
95
  if update:
96
- hits = []
97
96
  try:
98
- existing_doc = self.es_client.search(
99
- index=index,
100
- body={
101
- "query": {
102
- "term": {f"{identifier}": {"value": doc_id}}}
103
- })
104
- hits = existing_doc["hits"]["hits"]
97
+ query = {
98
+ "query": {
99
+ "match": {
100
+ f"{identifier}": doc_id
101
+ }
102
+ }
103
+ }
104
+ self.es_client.delete_by_query(index=f"{EMBEDDING_INDEX}*", body=query)
105
105
 
106
106
  except Exception as e:
107
107
  logging.error(f"Error while searching for existing document: {e}")
108
- if len(hits) > 0:
109
- print("delete existing documents")
110
- for hit in hits:
111
- print("delete existing document", hit["_id"])
112
- self.es_client.delete(index=index, id=hit["_id"])
113
108
 
114
109
  for i, doc_dict in enumerate(paragraphs_dicts):
115
110
  print(f"saving paragraph {i}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: kolzchut-ragbot
3
- Version: 1.1.3
3
+ Version: 1.3.0
4
4
  Summary: A search engine using machine learning models and Elasticsearch for advanced document retrieval.
5
5
  Home-page: https://github.com/shmuelrob/ragbot
6
6
  Author: Shmuel Robinov
@@ -1,8 +1,12 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
+ # to deploy the package to PyPI, run the following command:
4
+ # python setup.py sdist bdist_wheel
5
+ # twine upload dist/*
6
+
3
7
  setup(
4
8
  name='kolzchut-ragbot',
5
- version='1.1.3',
9
+ version='1.3.0',
6
10
  author='Shmuel Robinov',
7
11
  author_email='shmuel_robinov@webiks.com',
8
12
  description='A search engine using machine learning models and Elasticsearch for advanced document retrieval.',