diff --git a/pyproject.toml b/pyproject.toml index f004a1d..7f8c4a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ dependencies = [ "httpx>=0.25.2", "pdfplumber>=0.11.2", "redis>=5.2.1", - "llmwhisperer-client>=2.5.0", + "llmwhisperer-client>=2.8.0", ] [project.optional-dependencies] diff --git a/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/constants.py b/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/constants.py index 8c46ead..98d203d 100644 --- a/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/constants.py +++ b/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/constants.py @@ -57,11 +57,12 @@ class WhispererConfig: MEDIAN_FILTER_SIZE = "median_filter_size" GAUSSIAN_BLUR_RADIUS = "gaussian_blur_radius" LINE_SPLITTER_TOLERANCE = "line_splitter_tolerance" - LINE_SPLITTER_STRATEGY = "line_spitter_strategy" + LINE_SPLITTER_STRATEGY = "line_splitter_strategy" HORIZONTAL_STRETCH_FACTOR = "horizontal_stretch_factor" PAGES_TO_EXTRACT = "pages_to_extract" MARK_VERTICAL_LINES = "mark_vertical_lines" MARK_HORIZONTAL_LINES = "mark_horizontal_lines" + # Misspelling retained: it is the key existing adapter configs are stored under PAGE_SEPARATOR = "page_seperator" URL_IN_POST = "url_in_post" TAG = "tag" @@ -77,6 +78,13 @@ class WhispererConfig: LINES = "lines" +class WhispererParam: + """Params passed to the client whose name differs from the config key.""" + + PAGE_SEPARATOR = "page_separator" + FILE_NAME = "file_name" + + class WhisperStatus: """Values returned / used by /whisper-status endpoint.""" diff --git a/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/helper.py b/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/helper.py index 1e887a9..1dd9bba 100644 --- a/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/helper.py +++ b/src/unstract/sdk/adapters/x2text/llm_whisperer_v2/src/helper.py @@ -20,6 +20,7 @@ WhispererConfig, WhispererDefaults, WhispererHeader, + WhispererParam, WhisperStatus, ) from unstract.sdk.adapters.x2text.llm_whisperer_v2.src.dto import WhispererRequestParams @@ -196,7 +197,7 @@ def get_whisperer_params( WhispererConfig.MARK_HORIZONTAL_LINES, WhispererDefaults.MARK_HORIZONTAL_LINES, ), - WhispererConfig.PAGE_SEPARATOR: config.get( + WhispererParam.PAGE_SEPARATOR: config.get( WhispererConfig.PAGE_SEPARATOR, WhispererDefaults.PAGE_SEPARATOR, ), @@ -244,6 +245,8 @@ def send_whisper_request( params = LLMWhispererHelper.get_whisperer_params( config=config, extra_params=extra_params ) + # Recorded against the extraction for cross referencing in usage reports + params[WhispererParam.FILE_NAME] = Path(input_file_path).name response: requests.Response try: input_file_data = BytesIO(fs.read(path=input_file_path, mode="rb"))