kolzchut-ragbot 1.6.0__tar.gz → 1.6.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.
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/PKG-INFO +1 -1
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/engine.py +0 -36
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/llm_client.py +1 -1
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot.egg-info/PKG-INFO +1 -1
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/pyproject.toml +1 -1
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/setup.py +1 -1
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/test/test_engine.py +2 -3
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/README.md +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/Document.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/IntegrateService.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/__init__.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/config.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/get_full_documents_utilities.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/model.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot.egg-info/SOURCES.txt +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot.egg-info/dependency_links.txt +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot.egg-info/requires.txt +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot.egg-info/top_level.txt +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/setup.cfg +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/test/test_configs.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/test/test_docs.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/test/test_document.py +0 -0
- {kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/test/test_model.py +0 -0
@@ -286,42 +286,6 @@ class Engine:
|
|
286
286
|
full_document = unite_docs_to_single_instance(parts_of_documents)
|
287
287
|
return full_document
|
288
288
|
|
289
|
-
def transform_document_to_full_page(self, document: dict) -> dict:
|
290
|
-
"""
|
291
|
-
Adds the full page content to the document by retrieving it from Elasticsearch.
|
292
|
-
|
293
|
-
Args:
|
294
|
-
document (dict): The document to which the full page content will be added.
|
295
|
-
|
296
|
-
Returns:
|
297
|
-
dict: The updated document with the full page content added.
|
298
|
-
"""
|
299
|
-
if not document.get("page_id"):
|
300
|
-
return document
|
301
|
-
full_document = self.get_full_document_by_page_id(document["page_id"])
|
302
|
-
if full_document and full_document.get("content"):
|
303
|
-
document["content"] = full_document["content"]
|
304
|
-
return document
|
305
|
-
|
306
|
-
def get_full_document_by_page_id(self, page_id: int) -> dict | None:
|
307
|
-
"""
|
308
|
-
Retrieves a unified document instance for a given page_id by searching all indices in Elasticsearch.
|
309
|
-
|
310
|
-
Args:
|
311
|
-
page_id (int): The page ID to search for.
|
312
|
-
|
313
|
-
Returns:
|
314
|
-
dict | None: A single dict representing the united document (with metadata and concatenated content),
|
315
|
-
or None if no documents are found.
|
316
|
-
"""
|
317
|
-
es_client = self.elastic_model.es_client
|
318
|
-
indices = es_client.indices.get_alias(index="*").keys()
|
319
|
-
parts_of_documents = find_page_id_in_all_indices(page_id=page_id, es_client=es_client, indices=indices)
|
320
|
-
if not parts_of_documents:
|
321
|
-
return None
|
322
|
-
full_document = unite_docs_to_single_instance(parts_of_documents)
|
323
|
-
return full_document
|
324
|
-
|
325
289
|
|
326
290
|
engine = None
|
327
291
|
|
@@ -7,5 +7,5 @@ class LLMClient(ABC):
|
|
7
7
|
def __init__(self):
|
8
8
|
self.field_for_answer = definitions.field_for_llm
|
9
9
|
@abstractmethod
|
10
|
-
def answer(self, _question, _top_k_docs) -> tuple[str, float, int]:
|
10
|
+
def answer(self, _question, _top_k_docs) -> tuple[str, float, int, dict]:
|
11
11
|
raise NotImplementedError
|
@@ -7,7 +7,7 @@ from setuptools import setup, find_packages
|
|
7
7
|
|
8
8
|
setup(
|
9
9
|
name='kolzchut-ragbot',
|
10
|
-
version='1.6.
|
10
|
+
version='1.6.1',
|
11
11
|
author='Shmuel Robinov',
|
12
12
|
author_email='shmuel_robinov@webiks.com',
|
13
13
|
description='A search engine using machine learning models and Elasticsearch for advanced document retrieval.',
|
@@ -135,8 +135,8 @@ class TestEngine:
|
|
135
135
|
{'page_id': 5, 'title': 'title5'}
|
136
136
|
], {})
|
137
137
|
|
138
|
-
llm_client.answer.return_value = ('answer', 0.5, 100)
|
139
|
-
actual_top_k_documents, actual_gpt_answer, actual_stats,
|
138
|
+
llm_client.answer.return_value = ('answer', 0.5, 100, {})
|
139
|
+
actual_top_k_documents, actual_gpt_answer, actual_stats, all_docs_and_score, request_params = engine.answer_query("test query", 5, 'gpt-4o')
|
140
140
|
|
141
141
|
expected_top_k_documents = [
|
142
142
|
{'page_id': 3, 'title': 'title3'},
|
@@ -156,4 +156,3 @@ class TestEngine:
|
|
156
156
|
assert expected_top_k_documents == actual_top_k_documents
|
157
157
|
assert expected_gpt_answer == actual_gpt_answer
|
158
158
|
assert expected_stats == actual_stats
|
159
|
-
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot/get_full_documents_utilities.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{kolzchut_ragbot-1.6.0 → kolzchut_ragbot-1.6.1}/kolzchut_ragbot.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|