kolzchut-ragbot 1.3.0__tar.gz → 1.4.1__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.3.0 → kolzchut_ragbot-1.4.1}/PKG-INFO +3 -3
  2. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/model.py +27 -14
  3. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot.egg-info/PKG-INFO +3 -3
  4. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/setup.py +3 -2
  5. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/README.md +0 -0
  6. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/Document.py +0 -0
  7. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/IntegrateService.py +0 -0
  8. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/__init__.py +0 -0
  9. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/config.py +0 -0
  10. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/engine.py +0 -0
  11. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot/llm_client.py +0 -0
  12. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot.egg-info/SOURCES.txt +0 -0
  13. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot.egg-info/dependency_links.txt +0 -0
  14. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot.egg-info/requires.txt +0 -0
  15. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/kolzchut_ragbot.egg-info/top_level.txt +0 -0
  16. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/pyproject.toml +0 -0
  17. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/setup.cfg +0 -0
  18. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/test/test_configs.py +0 -0
  19. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/test/test_document.py +0 -0
  20. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/test/test_engine.py +0 -0
  21. {kolzchut_ragbot-1.3.0 → kolzchut_ragbot-1.4.1}/test/test_model.py +0 -0
@@ -1,8 +1,8 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: kolzchut-ragbot
3
- Version: 1.3.0
3
+ Version: 1.4.1
4
4
  Summary: A search engine using machine learning models and Elasticsearch for advanced document retrieval.
5
- Home-page: https://github.com/shmuelrob/ragbot
5
+ Home-page: https://github.com/shmuelrob/rag-bot
6
6
  Author: Shmuel Robinov
7
7
  Author-email: shmuel_robinov@webiks.com
8
8
  Classifier: Programming Language :: Python :: 3
@@ -21,6 +21,31 @@ def index_from_page_id(page_id: int):
21
21
  index_postfix = round(page_id / 1000)
22
22
  return EMBEDDING_INDEX + "_" + str(index_postfix)
23
23
 
24
+ def create_mapping():
25
+ """
26
+ Creates a mapping for the model in Elasticsearch.
27
+ """
28
+ vector_fields = {f"{name}_{semantic_model}_vectors": {"type": "dense_vector", "dims": 1024}
29
+ for name, semantic_model in definitions_singleton.models.items()}
30
+
31
+ data_fields = {}
32
+ for field in definitions_singleton.saved_fields.keys():
33
+ field_type = definitions_singleton.saved_fields[field]
34
+ field_mapping = {"type": field_type}
35
+ if field_type == "date":
36
+ field_mapping["format"] = "yyyyMMddHHmmss"
37
+ data_fields[f"{field}"] = field_mapping
38
+
39
+ mappings = {
40
+ "properties": {
41
+ "last_update": {
42
+ "type": "date",
43
+ },
44
+ **vector_fields,
45
+ **data_fields,
46
+ }
47
+ }
48
+ return mappings
24
49
 
25
50
  class Model:
26
51
  """
@@ -59,23 +84,11 @@ class Model:
59
84
  """
60
85
  Creates an index for the model in Elasticsearch.
61
86
  """
87
+ mapping = create_mapping()
62
88
  if not self.es_client.indices.exists(index=os.getenv("ES_EMBEDDING_INDEX")):
63
- vector_fields = {f"{name}_{semantic_model}_vectors": {"type": "dense_vector", "dims": 1024}
64
- for name, semantic_model in definitions_singleton.models.items()}
65
- data_fields = {f"{field}": {"type": definitions_singleton.saved_fields[field]}
66
- for field in definitions_singleton.saved_fields.keys()}
67
-
68
89
  self.es_client.indices.create(
69
90
  index=os.getenv("ES_EMBEDDING_INDEX"),
70
- mappings={
71
- "properties": {
72
- "last_update": {
73
- "type": "date"
74
- },
75
- **vector_fields,
76
- **data_fields,
77
- }
78
- })
91
+ mappings=mapping)
79
92
 
80
93
  def create_or_update_documents(self, paragraphs_dicts: list[dict], update=False):
81
94
  """
@@ -1,8 +1,8 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: kolzchut-ragbot
3
- Version: 1.3.0
3
+ Version: 1.4.1
4
4
  Summary: A search engine using machine learning models and Elasticsearch for advanced document retrieval.
5
- Home-page: https://github.com/shmuelrob/ragbot
5
+ Home-page: https://github.com/shmuelrob/rag-bot
6
6
  Author: Shmuel Robinov
7
7
  Author-email: shmuel_robinov@webiks.com
8
8
  Classifier: Programming Language :: Python :: 3
@@ -1,18 +1,19 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
3
  # to deploy the package to PyPI, run the following command:
4
+ # pip install setuptools wheel twine
4
5
  # python setup.py sdist bdist_wheel
5
6
  # twine upload dist/*
6
7
 
7
8
  setup(
8
9
  name='kolzchut-ragbot',
9
- version='1.3.0',
10
+ version='1.4.1',
10
11
  author='Shmuel Robinov',
11
12
  author_email='shmuel_robinov@webiks.com',
12
13
  description='A search engine using machine learning models and Elasticsearch for advanced document retrieval.',
13
14
  long_description=open('README.md').read(),
14
15
  long_description_content_type='text/markdown',
15
- url='https://github.com/shmuelrob/ragbot',
16
+ url='https://github.com/shmuelrob/rag-bot',
16
17
  packages=find_packages(),
17
18
  install_requires=[
18
19
  'elasticsearch==8.17.1',