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
13 changes: 9 additions & 4 deletions specs/docstudio-oss.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

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.

3 changes: 0 additions & 3 deletions src/unstract/api_deployments/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ def structure_file(
include_metadata: bool | Unset = UNSET,
include_metrics: bool | Unset = UNSET,
include_extracted_text: bool | Unset = UNSET,
use_file_history: bool | Unset = UNSET,
tags: str | Unset = UNSET,
llm_profile_id: str | None | Unset = UNSET,
hitl_queue_name: str | None | Unset = UNSET,
Expand All @@ -638,7 +637,6 @@ def structure_file(
include_metadata (bool): Include metadata in the result.
include_metrics (bool): Include metrics in the result.
include_extracted_text (bool): Include the extracted text.
use_file_history (bool): Reuse a previous result for the same file.
tags (str): Comma-separated tag names.
llm_profile_id (str): LLM profile to override the deployment's.
hitl_queue_name (str): Human-in-the-loop queue to route the file to.
Expand All @@ -662,7 +660,6 @@ def structure_file(
"include_metadata": include_metadata,
"include_metrics": include_metrics,
"include_extracted_text": include_extracted_text,
"use_file_history": use_file_history,
"tags": tags,
"llm_profile_id": llm_profile_id,
"hitl_queue_name": hitl_queue_name,
Expand Down
24 changes: 22 additions & 2 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from unittest.mock import MagicMock, patch
from urllib.parse import parse_qs, urlparse

import attrs
import httpx
import pytest
import requests
Expand All @@ -58,6 +59,7 @@
WhoAmIResponse,
)
from unstract.api_deployments._sdk_docstudio import AuthenticatedClient
from unstract.api_deployments._sdk_docstudio.models import ExecuteRequest
from unstract.api_deployments._sdk_docstudio.types import UNSET
from unstract.api_deployments.client import (
_EXECUTE_SEND_ONLY,
Expand Down Expand Up @@ -469,11 +471,28 @@ def test_a_requested_parameter_is_sent(sample_file):
sample_file,
tags="a,b",
llm_profile_id="profile-1",
use_file_history=True,
)
assert parts["tags"][1] == b"a,b"
assert parts["llm_profile_id"][1] == b"profile-1"
assert parts["use_file_history"][1] == b"True"


def test_the_withdrawn_option_is_refused_not_forwarded(sample_file):
"""`use_file_history` is internal-only and no longer in the published spec.
Accepting it here would send a field the contract does not declare."""
with pytest.raises(TypeError):
_client().structure_file([sample_file], use_file_history=True)


def test_the_facade_neither_sends_nor_the_model_declares_the_withdrawn_option(
sample_file,
):
"""The generated model still forwards any unknown key a direct caller puts
in `additional_properties`; the claim here is only about the facade's
request and the model's declared fields."""
parts = _execute_parts(_client(api_timeout=300), sample_file)
assert "use_file_history" not in parts
assert "use_file_history" not in _EXECUTE_SEND_ONLY
assert "use_file_history" not in attrs.fields_dict(ExecuteRequest)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -1994,6 +2013,7 @@ def _deployment_page() -> dict:
"created_by_email": "a@b.c",
"co_owners_count": 0,
"is_owner": True,
"owner_emails": ["a@b.c"],
"last_run_time": None,
"run_count": 0,
"last_5_run_statuses": [],
Expand Down
4 changes: 2 additions & 2 deletions tools/gen_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# both this script and the drift gate report clean either way.
#
# SPEC_SOURCE: Zipstack/unstract specs/docstudio-oss.json
# @ 520b98d7acf5a6d138b24d9787bd788b89150b76
# sha256 68a31eaf72e54daf8173ae3ef42e4174b257c93b1afc608114582a81be135bd1
# @ 3851a5866e92c2607b4a7323f5618a6a21c7ae8b
# sha256 c0de3a14254600f436483561ebb737feac4023fdef2fd46d6abf15dcd2182ad9
set -euo pipefail

REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
Expand Down
Loading