-
Notifications
You must be signed in to change notification settings - Fork 702
UN-3987 [FIX] Send LLMWhisperer V2 params under the correct names #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b1bda54
8b74d6f
c4cde21
06fb5fe
162de04
86ddb79
ff4b6e1
8efd221
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| """Tests for the query params the LLMWhisperer V2 adapter sends.""" | ||
|
|
||
| import pytest | ||
| from unstract.sdk1.adapters.x2text.llm_whisperer_v2.src.dto import ( | ||
| WhispererRequestParams, | ||
| ) | ||
| from unstract.sdk1.adapters.x2text.llm_whisperer_v2.src.helper import LLMWhispererHelper | ||
|
|
||
|
|
||
| def _params(config: dict) -> dict: | ||
| return LLMWhispererHelper.get_whisperer_params( | ||
| config=config, extra_params=WhispererRequestParams() | ||
| ) | ||
|
|
||
|
|
||
| def test_line_splitter_strategy_from_config() -> None: | ||
| """The key stored by the adapter's JSON schema is the one that is read.""" | ||
| params = _params({"line_splitter_strategy": "right-priority"}) | ||
|
|
||
| assert params["line_splitter_strategy"] == "right-priority" | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("strategy", ["left-priority", "mid-priority", "right-priority"]) | ||
| def test_supported_line_splitter_strategies_pass_through(strategy: str) -> None: | ||
| """Every value the service accepts reaches it unchanged.""" | ||
| params = _params({"line_splitter_strategy": strategy}) | ||
|
|
||
| assert params["line_splitter_strategy"] == strategy | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "stored", ["", " ", "left_priority", "LEFT-PRIORITY", "nonsense"] | ||
| ) | ||
| def test_unsupported_line_splitter_strategy_falls_back( | ||
| stored: str, caplog: pytest.LogCaptureFixture | ||
| ) -> None: | ||
| """A stored value the service would reject keeps the previous behaviour.""" | ||
| params = _params({"line_splitter_strategy": stored}) | ||
|
|
||
| assert params["line_splitter_strategy"] == "left-priority" | ||
| assert "Unsupported line splitter strategy" in caplog.text | ||
|
|
||
|
|
||
| def test_page_separator_read_under_legacy_config_key() -> None: | ||
| """Existing configs store the misspelled key but the client kwarg is correct.""" | ||
| params = _params({"page_seperator": "<<< {{page_no}} >>>"}) | ||
|
|
||
| assert params["page_separator"] == "<<< {{page_no}} >>>" | ||
| assert "page_seperator" not in params |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.