From 84e73406b4f3f09924e275f5720abbfaeb4242b2 Mon Sep 17 00:00:00 2001 From: Chandrasekharan M Date: Fri, 30 Aug 2024 14:29:59 +0530 Subject: [PATCH] Bumped SDK for backend and structure tool to fix chunking issue on indexing --- backend/pyproject.toml | 2 +- prompt-service/src/unstract/prompt_service/main.py | 5 ++--- tools/structure/requirements.txt | 2 +- tools/structure/src/config/properties.json | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/pyproject.toml b/backend/pyproject.toml index f3d7d756d..910032e94 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "python-socketio==5.9.0", # For log_events "social-auth-app-django==5.3.0", # For OAuth "social-auth-core==4.4.2", # For OAuth - "unstract-sdk~=0.46.0", + "unstract-sdk~=0.48.0", # ! IMPORTANT! # Indirect local dependencies usually need to be added in their own projects # as: https://pdm-project.org/latest/usage/dependency/#local-dependencies. diff --git a/prompt-service/src/unstract/prompt_service/main.py b/prompt-service/src/unstract/prompt_service/main.py index 90d824a20..14d24ecbe 100644 --- a/prompt-service/src/unstract/prompt_service/main.py +++ b/prompt-service/src/unstract/prompt_service/main.py @@ -92,7 +92,7 @@ def prompt_processor() -> Any: doc_name = str(payload.get(PSKeys.FILE_NAME, "")) log_events_id: str = payload.get(PSKeys.LOG_EVENTS_ID, "") structured_output: dict[str, Any] = {} - metadata: Optional[dict[str, Any]] = { + metadata: dict[str, Any] = { PSKeys.RUN_ID: run_id, PSKeys.CONTEXT: {}, } @@ -276,8 +276,6 @@ def prompt_processor() -> Any: ) try: - vector_index = vector_db.get_vector_store_index() - context = "" if output[PSKeys.CHUNK_SIZE] == 0: # We can do this only for chunkless indexes @@ -374,6 +372,7 @@ def prompt_processor() -> Any: retrieval_strategy = output.get(PSKeys.RETRIEVAL_STRATEGY) if retrieval_strategy in {PSKeys.SIMPLE, PSKeys.SUBQUESTION}: + vector_index = vector_db.get_vector_store_index() answer, context = run_retrieval( tool_settings=tool_settings, output=output, diff --git a/tools/structure/requirements.txt b/tools/structure/requirements.txt index 0c4e48aea..1cbc6f9cc 100644 --- a/tools/structure/requirements.txt +++ b/tools/structure/requirements.txt @@ -1,4 +1,4 @@ # Add your dependencies here # Required for all unstract tools -unstract-sdk~=0.46.0 +unstract-sdk~=0.48.0 diff --git a/tools/structure/src/config/properties.json b/tools/structure/src/config/properties.json index 1ae89a631..d3719c7f9 100644 --- a/tools/structure/src/config/properties.json +++ b/tools/structure/src/config/properties.json @@ -2,7 +2,7 @@ "schemaVersion": "0.0.1", "displayName": "Structure Tool", "functionName": "structure_tool", - "toolVersion": "0.0.40", + "toolVersion": "0.0.41", "description": "This is a template tool which can answer set of input prompts designed in the Prompt Studio", "input": { "description": "File that needs to be indexed and parsed for answers"