Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies = [
# Pinned exactly: the CLI derives its flags and help text from these
# clients, so one that moves changes the CLI's surface. Each release re-pins
# deliberately, against the specs vendored in `src/unstract_cli/specs`.
"unstract-client==1.7.0",
"llmwhisperer-client==2.9.0",
"unstract-client==1.7.1",
"llmwhisperer-client==2.9.1",
# Both clients pull this in, but the CLI imports its exception classes
# directly to classify a failure, so it names the dependency itself.
"requests>=2.32.3",
Expand Down
13 changes: 9 additions & 4 deletions src/unstract_cli/specs/docstudio.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
"readOnly": true,
"type": "string"
},
"owner_emails": {
"description": "Email of each owner, earliest first. Empty if none is a person.",
"items": {
"type": "string"
},
"readOnly": true,
"type": "array"
},
"run_count": {
"readOnly": true,
"type": "integer"
Expand All @@ -91,6 +99,7 @@
"is_owner",
"last_5_run_statuses",
"last_run_time",
"owner_emails",
"run_count",
"workflow",
"workflow_name"
Expand Down Expand Up @@ -230,10 +239,6 @@
"maximum": 300,
"minimum": -1,
"type": "integer"
},
"use_file_history": {
"default": false,
"type": "boolean"
}
},
"type": "object"
Expand Down
13 changes: 6 additions & 7 deletions src/unstract_cli/specs/llmwhisperer.json
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,8 @@
"schema": {
"default": 10.0,
"type": "number"
}
},
"x-internal": true
},
{
"in": "query",
Expand Down Expand Up @@ -1585,7 +1586,8 @@
"schema": {
"default": false,
"type": "boolean"
}
},
"x-internal": true
},
{
"in": "query",
Expand Down Expand Up @@ -1662,7 +1664,8 @@
"schema": {
"default": 0.0,
"type": "number"
}
},
"x-internal": true
},
{
"in": "query",
Expand All @@ -1671,8 +1674,6 @@
"schema": {
"default": "form",
"enum": [
"document_insights",
"excel",
"form",
"high_quality",
"low_cost",
Expand All @@ -1689,9 +1690,7 @@
"schema": {
"default": "layout_preserving",
"enum": [
"dump-text",
"layout_preserving",
"line-printer",
"text"
],
"type": "string"
Expand Down
12 changes: 6 additions & 6 deletions src/unstract_cli/specs/provenance.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"docstudio.json": {
"client": "unstract-client==1.7.0",
"client": "unstract-client==1.7.1",
"repo": "https://github.com/Zipstack/unstract",
"commit": "520b98d7acf5a6d138b24d9787bd788b89150b76",
"commit": "5d46c66ccff8ae1ac3c31a3c3d5d64206e329002",
"path": "specs/docstudio-oss.json",
"sha256": "68a31eaf72e54daf8173ae3ef42e4174b257c93b1afc608114582a81be135bd1"
"sha256": "c0de3a14254600f436483561ebb737feac4023fdef2fd46d6abf15dcd2182ad9"
},
"llmwhisperer.json": {
"client": "llmwhisperer-client==2.9.0",
"client": "llmwhisperer-client==2.9.1",
"repo": "https://github.com/Zipstack/unstract-llm-whisperer",
"commit": "750f941ee229e12cc05d8bd85edaab6a337a8758",
"commit": "fa6cf651a594227f2249dfe0990f80f1ff780398",
"path": "specs/llmwhisperer.json",
"sha256": "88ecc01e92443ba5ba6079db7f57cf3038f97670cb796f13c326268a3d79f366"
"sha256": "c015d035b9e06f58e80aabdb5190fbb582dc1b4b8ee48c3a6924fe4392edc650"
}
}
48 changes: 0 additions & 48 deletions tests/derived_flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@
"choices": [],
"short": null
},
"--derotate-threshold": {
"name": "derotate_threshold",
"type": "number",
"default": null,
"description": "The page rotation in degrees beyond which the page is straightened and re-read.",
"array": false,
"nullable": false,
"required": false,
"choices": [],
"short": null
},
"--file-name": {
"name": "file_name",
"type": "string",
Expand Down Expand Up @@ -77,17 +66,6 @@
"choices": [],
"short": null
},
"--ignore-vertical-text": {
"name": "ignore_vertical_text",
"type": "boolean",
"default": null,
"description": "Whether to drop vertically oriented text instead of extracting it.",
"array": false,
"nullable": false,
"required": false,
"choices": [],
"short": null
},
"--include-line-confidence": {
"name": "include_line_confidence",
"type": "boolean",
Expand Down Expand Up @@ -169,17 +147,6 @@
"choices": [],
"short": null
},
"--min-table-width": {
"name": "min_table_width",
"type": "number",
"default": null,
"description": "The minimum width a table must span, as a fraction of the page width, to be extracted as a table.",
"array": false,
"nullable": false,
"required": false,
"choices": [],
"short": null
},
"--mode": {
"name": "mode",
"type": "string",
Expand All @@ -189,8 +156,6 @@
"nullable": false,
"required": false,
"choices": [
"document_insights",
"excel",
"form",
"high_quality",
"low_cost",
Expand All @@ -208,9 +173,7 @@
"nullable": false,
"required": false,
"choices": [
"dump-text",
"layout_preserving",
"line-printer",
"text"
],
"short": null
Expand Down Expand Up @@ -449,17 +412,6 @@
"required": false,
"choices": [],
"short": null
},
"--use-file-history": {
"name": "use_file_history",
"type": "boolean",
"default": false,
"description": "Reuse a previous result for the same file.",
"array": false,
"nullable": false,
"required": false,
"choices": [],
"short": null
}
},
"docstudio:status": {
Expand Down
28 changes: 28 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,34 @@ def test_the_v1_commands_are_registered():
assert set(tree["auth"]["commands"]) == {"login", "whoami"}


@pytest.mark.parametrize(
("command", "flag"),
[
(("whisper", "extract"), "--derotate-threshold"),
(("whisper", "extract"), "--min-table-width"),
(("whisper", "extract"), "--ignore-vertical-text"),
(("docstudio", "deployment", "run"), "--use-file-history"),
],
)
def test_a_withdrawn_option_is_unknown_to_the_shipped_command(capsys, command, flag):
"""The services stopped publishing these; a caller still passing one must
learn that before the request, not from a silently ignored setting."""
code, out, _ = run(capsys, *command, "x.pdf", flag)
assert code == int(ExitCode.USAGE)
message = envelope(out)["error"]["message"]
assert "No such option" in message and flag in message


@pytest.mark.parametrize(
("flag", "value"),
[("--output-mode", "line-printer"), ("--mode", "excel")],
)
def test_a_withdrawn_choice_is_refused_by_the_shipped_command(capsys, flag, value):
code, out, _ = run(capsys, "whisper", "extract", "x.pdf", flag, value)
assert code == int(ExitCode.USAGE)
assert f"'{value}' is not one of" in envelope(out)["error"]["message"]


# --------------------------------------------------------------------------- #
# whisper extract
# --------------------------------------------------------------------------- #
Expand Down
2 changes: 0 additions & 2 deletions tests/test_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def test_full_carries_enough_to_build_a_call(capsys):

assert params["source"]["kind"] == "argument" and params["source"]["required"]
assert params["mode"]["choices"] == [
"document_insights",
"excel",
"form",
"high_quality",
"low_cost",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_choices_come_from_the_spec_unless_the_overlay_narrows_them():
"""A wrong value must fail before the request, not after -- and the list it
is checked against is the service's own, not a copy that can fall behind."""
spec_declared = _by_name(operation_params("llmwhisperer", "extract"))["mode"]
assert "excel" in spec_declared.choices
assert "form" in spec_declared.choices
assert click_option(spec_declared, {}).type.choices == spec_declared.choices

option = click_option(spec_declared, {"mode": {"choices": ["form", "table"]}})
Expand Down
16 changes: 8 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading