From 8c48f1b05dbebb99a432ab9fd7b57f8aed109d60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Jul 2025 02:15:21 +0000 Subject: [PATCH 001/130] fix(parsing): ignore empty metadata --- src/asktable/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asktable/_models.py b/src/asktable/_models.py index 528d5680..ffcbf67b 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -439,7 +439,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if metadata is not None: + if metadata is not None and len(metadata) > 0: meta: tuple[Any, ...] = tuple(metadata) elif is_annotated_type(type_): meta = get_args(type_)[1:] From 40c9351059a44df1f640f5791a126e175ebadad6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Jul 2025 02:18:23 +0000 Subject: [PATCH 002/130] fix(parsing): parse extra field types --- src/asktable/_models.py | 25 +++++++++++++++++++++++-- tests/test_models.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/asktable/_models.py b/src/asktable/_models.py index ffcbf67b..b8387ce9 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -208,14 +208,18 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] else: fields_values[name] = field_get_default(field) + extra_field_type = _get_extra_fields_type(__cls) + _extra = {} for key, value in values.items(): if key not in model_fields: + parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value + if PYDANTIC_V2: - _extra[key] = value + _extra[key] = parsed else: _fields_set.add(key) - fields_values[key] = value + fields_values[key] = parsed object.__setattr__(m, "__dict__", fields_values) @@ -370,6 +374,23 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) +def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: + if not PYDANTIC_V2: + # TODO + return None + + schema = cls.__pydantic_core_schema__ + if schema["type"] == "model": + fields = schema["schema"] + if fields["type"] == "model-fields": + extras = fields.get("extras_schema") + if extras and "cls" in extras: + # mypy can't narrow the type + return extras["cls"] # type: ignore[no-any-return] + + return None + + def is_basemodel(type_: type) -> bool: """Returns whether or not the given type is either a `BaseModel` or a union of `BaseModel`""" if is_union(type_): diff --git a/tests/test_models.py b/tests/test_models.py index 7864490f..f3d3874e 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,5 +1,5 @@ import json -from typing import Any, Dict, List, Union, Optional, cast +from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone from typing_extensions import Literal, Annotated, TypeAliasType @@ -934,3 +934,30 @@ class Type2(BaseModel): ) assert isinstance(model, Type1) assert isinstance(model.value, InnerType2) + + +@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +def test_extra_properties() -> None: + class Item(BaseModel): + prop: int + + class Model(BaseModel): + __pydantic_extra__: Dict[str, Item] = Field(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + other: str + + if TYPE_CHECKING: + + def __getattr__(self, attr: str) -> Item: ... + + model = construct_type( + type_=Model, + value={ + "a": {"prop": 1}, + "other": "foo", + }, + ) + assert isinstance(model, Model) + assert model.a.prop == 1 + assert isinstance(model.a, Item) + assert model.other == "foo" From 1641a3d8c4a5647a81b6292b3fd8805ab3132bb8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 25 Jul 2025 04:26:03 +0000 Subject: [PATCH 003/130] chore(project): add settings file for vscode --- .gitignore | 1 - .vscode/settings.json | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 87797408..95ceb189 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .prism.log -.vscode _dev __pycache__ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..5b010307 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.analysis.importFormat": "relative", +} From e9bac63f9b86123f21df0343e44bd9423e053bbe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 06:26:59 +0000 Subject: [PATCH 004/130] feat(client): support file upload requests --- src/asktable/_base_client.py | 5 ++++- src/asktable/_files.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py index 4678a3ee..f0e12764 100644 --- a/src/asktable/_base_client.py +++ b/src/asktable/_base_client.py @@ -532,7 +532,10 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - kwargs["json"] = json_data if is_given(json_data) else None + if isinstance(json_data, bytes): + kwargs["content"] = json_data + else: + kwargs["json"] = json_data if is_given(json_data) else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/asktable/_files.py b/src/asktable/_files.py index 25ff804f..978df31d 100644 --- a/src/asktable/_files.py +++ b/src/asktable/_files.py @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], _read_file_content(file[1]), *file[2:]) + return (file[0], read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -def _read_file_content(file: FileContent) -> HttpxFileContent: +def read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return pathlib.Path(file).read_bytes() return file @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], await _async_read_file_content(file[1]), *file[2:]) + return (file[0], await async_read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -async def _async_read_file_content(file: FileContent) -> HttpxFileContent: +async def async_read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return await anyio.Path(file).read_bytes() From ffc99debb7771e71f5427b2f46b3f3187baddbe0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 03:23:22 +0000 Subject: [PATCH 005/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b3408abe..ed356097 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-420512609e3f9f33f8a5b2d0086d4d3152b78935f1dc689cf4c5adf245241ba8.yml -openapi_spec_hash: a0055c3c329900b7a66dc27f4bea86cb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-68edd348d029baa627d7da6eff3cfd70d0a0a1451a474acb8e1e69be06f78e9e.yml +openapi_spec_hash: 0e042cae76ef900969ea1b28f91d1e23 config_hash: acdf4142177ed1932c2d82372693f811 From 21141b6014313eec9223aeaa0197675130c625ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 07:24:07 +0000 Subject: [PATCH 006/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ed356097..6676eb34 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-68edd348d029baa627d7da6eff3cfd70d0a0a1451a474acb8e1e69be06f78e9e.yml -openapi_spec_hash: 0e042cae76ef900969ea1b28f91d1e23 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5c5d0938bedbbd748ded261ced13ecd80e0b5fab9cfa7d7a29664d02b0953ac9.yml +openapi_spec_hash: c0693322a074fc54e49504943c59c4f3 config_hash: acdf4142177ed1932c2d82372693f811 From 47ae33089939da844b9fc6f96ea1d7a56d57887e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Aug 2025 07:39:55 +0000 Subject: [PATCH 007/130] chore(internal): fix ruff target version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 371a4680..74c59b0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ reportPrivateUsage = false [tool.ruff] line-length = 120 output-format = "grouped" -target-version = "py37" +target-version = "py38" [tool.ruff.format] docstring-code-format = true From 5d3abad79640464784e731af282d02600606db98 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 Aug 2025 04:39:56 +0000 Subject: [PATCH 008/130] chore: update @stainless-api/prism-cli to v5.15.0 --- scripts/mock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/mock b/scripts/mock index d2814ae6..0b28f6ea 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" fi From 595c4022caf668b57ad4dab50ec2e8a7dc3227af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 9 Aug 2025 04:42:57 +0000 Subject: [PATCH 009/130] chore(internal): update comment in script --- scripts/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test b/scripts/test index 2b878456..dbeda2d2 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! prism_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the prism command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" echo exit 1 From b388e91f2be0f54c8375d3077da1a8ee5110fa88 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Aug 2025 15:23:52 +0000 Subject: [PATCH 010/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6676eb34..5005a699 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5c5d0938bedbbd748ded261ced13ecd80e0b5fab9cfa7d7a29664d02b0953ac9.yml -openapi_spec_hash: c0693322a074fc54e49504943c59c4f3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-e5dff6c4e46c2beba390d894b165ef6efc345d1f3f2838abafb395a04d06ea9d.yml +openapi_spec_hash: b99f2c82ee5bea53e895fec4acbf53e8 config_hash: acdf4142177ed1932c2d82372693f811 From fd2153419e2ba1424b40398fef454d01db6d4a79 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 15:23:49 +0000 Subject: [PATCH 011/130] feat(api): api update --- .stats.yml | 4 ++-- .../types/ats/task_get_case_tasks_response.py | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5005a699..078916c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-e5dff6c4e46c2beba390d894b165ef6efc345d1f3f2838abafb395a04d06ea9d.yml -openapi_spec_hash: b99f2c82ee5bea53e895fec4acbf53e8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dc53acf4bfb4deead53bc008e3f9c1f33d6bd345cfdc4957cea85c1bb1f775ce.yml +openapi_spec_hash: 0e80862ca984d26998a61e20f44e37d7 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/ats/task_get_case_tasks_response.py b/src/asktable/types/ats/task_get_case_tasks_response.py index 0592193e..55869d60 100644 --- a/src/asktable/types/ats/task_get_case_tasks_response.py +++ b/src/asktable/types/ats/task_get_case_tasks_response.py @@ -2,10 +2,19 @@ from typing import List, Union, Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel -__all__ = ["TaskGetCaseTasksResponse", "Item"] +__all__ = ["TaskGetCaseTasksResponse", "Item", "ItemCompareLog"] + + +class ItemCompareLog(BaseModel): + check: str + + level: Literal["ERROR", "WARNING", "INFO"] + + message: str class Item(BaseModel): @@ -33,6 +42,9 @@ class Item(BaseModel): atc_id: Optional[str] = None """对应的测试用例 ID""" + compare_logs: Optional[List[ItemCompareLog]] = None + """测试样本生成 sql 和预期 sql 的对比日志""" + duration: Optional[float] = None """测试用例执行时间,单位为秒""" From 259b363b58be6e6405ad6eb6170baa9d7b90ec7f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 12:23:59 +0000 Subject: [PATCH 012/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 078916c4..de8b781e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dc53acf4bfb4deead53bc008e3f9c1f33d6bd345cfdc4957cea85c1bb1f775ce.yml -openapi_spec_hash: 0e80862ca984d26998a61e20f44e37d7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c592aa3fcfaaacb3aef527d52f295ad26fb6787a74a96e6876574be73b62aebd.yml +openapi_spec_hash: ada404ab258244a4f183f1ac51da6ddc config_hash: acdf4142177ed1932c2d82372693f811 From d2a054d2f92ef07dc2d5253266a3a28a123f91ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 08:23:48 +0000 Subject: [PATCH 013/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index de8b781e..73c73dfb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c592aa3fcfaaacb3aef527d52f295ad26fb6787a74a96e6876574be73b62aebd.yml -openapi_spec_hash: ada404ab258244a4f183f1ac51da6ddc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-edbcc3442262501d6e1507016dc3613b6e1d2e9072c4f007c928f2594e35fc62.yml +openapi_spec_hash: c81e5064795a7d3d6375a574efa25f97 config_hash: acdf4142177ed1932c2d82372693f811 From 653ff06315c440c09e931828916b8ff38a41d6bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 Aug 2025 06:43:08 +0000 Subject: [PATCH 014/130] chore: update github action --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ccc7f01..c024b56f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: run: ./scripts/lint build: - if: github.repository == 'stainless-sdks/asktable-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork) + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork timeout-minutes: 10 name: build permissions: @@ -61,12 +61,14 @@ jobs: run: rye build - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/asktable-python' id: github-oidc uses: actions/github-script@v6 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball + if: github.repository == 'stainless-sdks/asktable-python' env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From 7a17247ed3d0cb95ec279c1627b51dfb2ce48572 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 23 Aug 2025 14:23:54 +0000 Subject: [PATCH 015/130] feat(api): api update --- .stats.yml | 4 ++-- .../types/ats/task_get_case_tasks_response.py | 3 +++ src/asktable/types/ats/task_list_response.py | 21 ++++++++++++++++++- .../types/ats/task_retrieve_response.py | 21 ++++++++++++++++++- src/asktable/types/ats/task_run_response.py | 21 ++++++++++++++++++- 5 files changed, 65 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 73c73dfb..b1d0552d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-edbcc3442262501d6e1507016dc3613b6e1d2e9072c4f007c928f2594e35fc62.yml -openapi_spec_hash: c81e5064795a7d3d6375a574efa25f97 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5130dc7d1680f39d23d77fdf515d1aa623db761a23b8519ef1741d861f7b0881.yml +openapi_spec_hash: 4e4a30ff36b7c8df98a038742736ea10 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/ats/task_get_case_tasks_response.py b/src/asktable/types/ats/task_get_case_tasks_response.py index 55869d60..37821e0c 100644 --- a/src/asktable/types/ats/task_get_case_tasks_response.py +++ b/src/asktable/types/ats/task_get_case_tasks_response.py @@ -72,6 +72,9 @@ class Item(BaseModel): task_id: Optional[str] = None """测试调用接口对应任务的 id""" + trace_id: Optional[str] = None + """测试样本运行时对应的 trace_id""" + class TaskGetCaseTasksResponse(BaseModel): items: List[Item] diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index a3591ca0..9e922b87 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -3,9 +3,25 @@ from typing import Optional from datetime import datetime +from pydantic import Field as FieldInfo + from ..._models import BaseModel -__all__ = ["TaskListResponse"] +__all__ = ["TaskListResponse", "ModelGroup"] + + +class ModelGroup(BaseModel): + agent: str + + fast: str + + image: str + + name: str + + omni: str + + sql: str class TaskListResponse(BaseModel): @@ -45,5 +61,8 @@ class TaskListResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" + api_model_group: Optional[ModelGroup] = FieldInfo(alias="model_group", default=None) + """运行使用的模型组""" + status_message: Optional[str] = None """测试日志""" diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index bc81d5bc..d4c03ec4 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -3,9 +3,25 @@ from typing import Optional from datetime import datetime +from pydantic import Field as FieldInfo + from ..._models import BaseModel -__all__ = ["TaskRetrieveResponse"] +__all__ = ["TaskRetrieveResponse", "ModelGroup"] + + +class ModelGroup(BaseModel): + agent: str + + fast: str + + image: str + + name: str + + omni: str + + sql: str class TaskRetrieveResponse(BaseModel): @@ -45,5 +61,8 @@ class TaskRetrieveResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" + api_model_group: Optional[ModelGroup] = FieldInfo(alias="model_group", default=None) + """运行使用的模型组""" + status_message: Optional[str] = None """测试日志""" diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index fbc3533c..c9b65685 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -3,9 +3,25 @@ from typing import Optional from datetime import datetime +from pydantic import Field as FieldInfo + from ..._models import BaseModel -__all__ = ["TaskRunResponse"] +__all__ = ["TaskRunResponse", "ModelGroup"] + + +class ModelGroup(BaseModel): + agent: str + + fast: str + + image: str + + name: str + + omni: str + + sql: str class TaskRunResponse(BaseModel): @@ -45,5 +61,8 @@ class TaskRunResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" + api_model_group: Optional[ModelGroup] = FieldInfo(alias="model_group", default=None) + """运行使用的模型组""" + status_message: Optional[str] = None """测试日志""" From 945b50b781a9d2753968276602898a32a0962cd1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 04:23:51 +0000 Subject: [PATCH 016/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b1d0552d..0eb367db 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5130dc7d1680f39d23d77fdf515d1aa623db761a23b8519ef1741d861f7b0881.yml -openapi_spec_hash: 4e4a30ff36b7c8df98a038742736ea10 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-58763886ec6930f6592b8880e24f5f9b3ad5df623a006a4c9499ef9146896175.yml +openapi_spec_hash: 307f8d7a166dd12eae5a1f0ff201e84e config_hash: acdf4142177ed1932c2d82372693f811 From 17818149ddfaa3397db71e1a6a2500b997576a97 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 26 Aug 2025 05:23:33 +0000 Subject: [PATCH 017/130] chore(internal): change ci workflow machines --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c024b56f..cb20fc47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: permissions: contents: read id-token: write - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/asktable-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 From 2bc84ae95415f7377dcbf554faf6d057605f5c74 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 07:47:06 +0000 Subject: [PATCH 018/130] fix: avoid newer type syntax --- src/asktable/_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/asktable/_models.py b/src/asktable/_models.py index b8387ce9..92f7c10b 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -304,7 +304,7 @@ def model_dump( exclude_none=exclude_none, ) - return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped + return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped @override def model_dump_json( From 5bf3c78a9d79882f1c2e7e4245187cbb1813229d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Aug 2025 07:50:31 +0000 Subject: [PATCH 019/130] chore(internal): update pyright exclude list --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 74c59b0c..2c14e074 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -148,6 +148,7 @@ exclude = [ "_dev", ".venv", ".nox", + ".git", ] reportImplicitOverride = true From d34ae74d7dd281b8b1bc806aec5965a042550d88 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 30 Aug 2025 04:04:54 +0000 Subject: [PATCH 020/130] chore(internal): add Sequence related utils --- src/asktable/_types.py | 36 ++++++++++++++++++++++++++++++++- src/asktable/_utils/__init__.py | 1 + src/asktable/_utils/_typing.py | 5 +++++ tests/utils.py | 10 ++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/asktable/_types.py b/src/asktable/_types.py index 6a08b156..e2c44efd 100644 --- a/src/asktable/_types.py +++ b/src/asktable/_types.py @@ -13,10 +13,21 @@ Mapping, TypeVar, Callable, + Iterator, Optional, Sequence, ) -from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable +from typing_extensions import ( + Set, + Literal, + Protocol, + TypeAlias, + TypedDict, + SupportsIndex, + overload, + override, + runtime_checkable, +) import httpx import pydantic @@ -217,3 +228,26 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth follow_redirects: bool + + +_T_co = TypeVar("_T_co", covariant=True) + + +if TYPE_CHECKING: + # This works because str.__contains__ does not accept object (either in typeshed or at runtime) + # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + class SequenceNotStr(Protocol[_T_co]): + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... + @overload + def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... + def __contains__(self, value: object, /) -> bool: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T_co]: ... + def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... + def count(self, value: Any, /) -> int: ... + def __reversed__(self) -> Iterator[_T_co]: ... +else: + # just point this to a normal `Sequence` at runtime to avoid having to special case + # deserializing our custom sequence type + SequenceNotStr = Sequence diff --git a/src/asktable/_utils/__init__.py b/src/asktable/_utils/__init__.py index d4fda26f..ca547ce5 100644 --- a/src/asktable/_utils/__init__.py +++ b/src/asktable/_utils/__init__.py @@ -38,6 +38,7 @@ extract_type_arg as extract_type_arg, is_iterable_type as is_iterable_type, is_required_type as is_required_type, + is_sequence_type as is_sequence_type, is_annotated_type as is_annotated_type, is_type_alias_type as is_type_alias_type, strip_annotated_type as strip_annotated_type, diff --git a/src/asktable/_utils/_typing.py b/src/asktable/_utils/_typing.py index 1bac9542..845cd6b2 100644 --- a/src/asktable/_utils/_typing.py +++ b/src/asktable/_utils/_typing.py @@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool: return (get_origin(typ) or typ) == list +def is_sequence_type(typ: type) -> bool: + origin = get_origin(typ) or typ + return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence + + def is_iterable_type(typ: type) -> bool: """If the given type is `typing.Iterable[T]`""" origin = get_origin(typ) or typ diff --git a/tests/utils.py b/tests/utils.py index 7497343a..b5025b8b 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,7 +4,7 @@ import inspect import traceback import contextlib -from typing import Any, TypeVar, Iterator, cast +from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type @@ -15,6 +15,7 @@ is_list_type, is_union_type, extract_type_arg, + is_sequence_type, is_annotated_type, is_type_alias_type, ) @@ -71,6 +72,13 @@ def assert_matches_type( if is_list_type(type_): return _assert_list_type(type_, value) + if is_sequence_type(type_): + assert isinstance(value, Sequence) + inner_type = get_args(type_)[0] + for entry in value: # type: ignore + assert_type(inner_type, entry) # type: ignore + return + if origin == str: assert isinstance(value, str) elif origin == int: From 8a970519267c51898f37208bee7d23d19b229f8c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 09:24:00 +0000 Subject: [PATCH 021/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0eb367db..0090fdbe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-58763886ec6930f6592b8880e24f5f9b3ad5df623a006a4c9499ef9146896175.yml -openapi_spec_hash: 307f8d7a166dd12eae5a1f0ff201e84e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c70fe29b2ea84d35e58630bb0a4200f8cf85b127e0383e36b4495204783bcb11.yml +openapi_spec_hash: a86bb7a28ddd873d0095a34d9be5f4a0 config_hash: acdf4142177ed1932c2d82372693f811 From cfdf227798357631a1fc0624a6e69af532b3ca96 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 11:23:57 +0000 Subject: [PATCH 022/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0090fdbe..6266d8bd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c70fe29b2ea84d35e58630bb0a4200f8cf85b127e0383e36b4495204783bcb11.yml -openapi_spec_hash: a86bb7a28ddd873d0095a34d9be5f4a0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ee0d0ec1be56bcbb7b4a3e8aefc485f0bdd13f5bd92bea36d5df69bc6cc26bef.yml +openapi_spec_hash: eb9958361dd5c63964098fc84e7c1833 config_hash: acdf4142177ed1932c2d82372693f811 From c5956553b51492975d8f61893bfad4bee4823cd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:23:59 +0000 Subject: [PATCH 023/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6266d8bd..12ea4a11 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ee0d0ec1be56bcbb7b4a3e8aefc485f0bdd13f5bd92bea36d5df69bc6cc26bef.yml -openapi_spec_hash: eb9958361dd5c63964098fc84e7c1833 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-74016f416ae8d2fe9ce7dca5de690f0b67433e79ade778c0342d9f4b8b83d26d.yml +openapi_spec_hash: 855ba462f670281117bce9b1ed341dcd config_hash: acdf4142177ed1932c2d82372693f811 From 3726cd6a80b80da87dc98050182a4de50858a56a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 14:24:02 +0000 Subject: [PATCH 024/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 12ea4a11..606dcd26 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-74016f416ae8d2fe9ce7dca5de690f0b67433e79ade778c0342d9f4b8b83d26d.yml -openapi_spec_hash: 855ba462f670281117bce9b1ed341dcd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-28856833eec1e087b8e5d0e963c8fc8bf11889af78ff928bdd9ef20a4c3e80f9.yml +openapi_spec_hash: b90d3fb8c86a54e4a346f7b0147a5b77 config_hash: acdf4142177ed1932c2d82372693f811 From 2780cd97e9f20b419ebc887c6ebedbeabc607c05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:24:06 +0000 Subject: [PATCH 025/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 606dcd26..18772870 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-28856833eec1e087b8e5d0e963c8fc8bf11889af78ff928bdd9ef20a4c3e80f9.yml -openapi_spec_hash: b90d3fb8c86a54e4a346f7b0147a5b77 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-97a21be7a4d31aa5111284dc5360207b2a3f1dbf442563fb018402c6d1229a8f.yml +openapi_spec_hash: 34b9a1b70ed7df13054ec075f0ef331e config_hash: acdf4142177ed1932c2d82372693f811 From 19c28316b8d259d823664221f2628b4ee95628ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 15:24:08 +0000 Subject: [PATCH 026/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 18772870..ec8cd681 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-97a21be7a4d31aa5111284dc5360207b2a3f1dbf442563fb018402c6d1229a8f.yml -openapi_spec_hash: 34b9a1b70ed7df13054ec075f0ef331e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ff7d082ad264c17cb0d72225edb17c0cc4d319bb61ba29160d83c04279a87f6f.yml +openapi_spec_hash: 7cb8167670e5ca6cd5baa487473c0a55 config_hash: acdf4142177ed1932c2d82372693f811 From 24f5841d54b96ec8eca29911fa081fc9d21123bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 16:24:06 +0000 Subject: [PATCH 027/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ec8cd681..d21d7655 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ff7d082ad264c17cb0d72225edb17c0cc4d319bb61ba29160d83c04279a87f6f.yml -openapi_spec_hash: 7cb8167670e5ca6cd5baa487473c0a55 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ec24aac86e4b81535737601bbb5a32bff17d2bab33fab964654b35294c65361c.yml +openapi_spec_hash: 197f10722fd42cb2b711d847a64cae25 config_hash: acdf4142177ed1932c2d82372693f811 From be4a6d685ff133354c4b242992de4a80f475c2d4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 03:38:06 +0000 Subject: [PATCH 028/130] feat(types): replace List[str] with SequenceNotStr in params --- src/asktable/_utils/_transform.py | 6 +++ src/asktable/resources/ats/task.py | 8 ++-- src/asktable/resources/bots.py | 40 +++++++++---------- src/asktable/resources/business_glossary.py | 8 ++-- src/asktable/resources/datasources/meta.py | 12 +++--- src/asktable/resources/policies.py | 8 ++-- src/asktable/resources/roles.py | 20 +++++----- .../resources/sys/projects/projects.py | 8 ++-- src/asktable/types/ats/task_run_params.py | 5 ++- src/asktable/types/bot_create_params.py | 14 ++++--- src/asktable/types/bot_list_params.py | 6 ++- src/asktable/types/bot_update_params.py | 14 ++++--- .../types/business_glossary_create_params.py | 6 ++- .../types/business_glossary_update_params.py | 6 ++- .../types/datasource_create_params.py | 6 ++- .../types/datasources/meta_create_params.py | 6 ++- .../types/datasources/meta_update_params.py | 6 ++- src/asktable/types/policy_create_params.py | 8 ++-- src/asktable/types/policy_list_params.py | 6 ++- src/asktable/types/policy_update_params.py | 8 ++-- src/asktable/types/role_create_params.py | 6 ++- .../types/role_get_variables_params.py | 6 ++- src/asktable/types/role_list_params.py | 6 ++- src/asktable/types/role_update_params.py | 6 ++- src/asktable/types/sys/project_list_params.py | 6 ++- 25 files changed, 134 insertions(+), 97 deletions(-) diff --git a/src/asktable/_utils/_transform.py b/src/asktable/_utils/_transform.py index b0cc20a7..f0bcefd4 100644 --- a/src/asktable/_utils/_transform.py +++ b/src/asktable/_utils/_transform.py @@ -16,6 +16,7 @@ lru_cache, is_mapping, is_iterable, + is_sequence, ) from .._files import is_base64_file_input from ._typing import ( @@ -24,6 +25,7 @@ extract_type_arg, is_iterable_type, is_required_type, + is_sequence_type, is_annotated_type, strip_annotated_type, ) @@ -184,6 +186,8 @@ def _transform_recursive( (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually # intended as an iterable, so we don't transform it. @@ -346,6 +350,8 @@ async def _async_transform_recursive( (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually # intended as an iterable, so we don't transform it. diff --git a/src/asktable/resources/ats/task.py b/src/asktable/resources/ats/task.py index 7950fed9..5d2d1393 100644 --- a/src/asktable/resources/ats/task.py +++ b/src/asktable/resources/ats/task.py @@ -2,11 +2,9 @@ from __future__ import annotations -from typing import List - import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -190,7 +188,7 @@ def run( ats_id: str, *, datasource_id: str, - specific_case_ids: List[str], + specific_case_ids: SequenceNotStr[str], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -395,7 +393,7 @@ async def run( ats_id: str, *, datasource_id: str, - specific_case_ids: List[str], + specific_case_ids: SequenceNotStr[str], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index a64fb2d0..7568bd9b 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional import httpx from ..types import bot_list_params, bot_create_params, bot_invite_params, bot_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -47,18 +47,18 @@ def with_streaming_response(self) -> BotsResourceWithStreamingResponse: def create( self, *, - datasource_ids: List[str], + datasource_ids: SequenceNotStr[str], name: str, color_theme: Optional[str] | NotGiven = NOT_GIVEN, debug: bool | NotGiven = NOT_GIVEN, - extapi_ids: List[str] | NotGiven = NOT_GIVEN, + extapi_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN, magic_input: Optional[str] | NotGiven = NOT_GIVEN, max_rows: int | NotGiven = NOT_GIVEN, publish: bool | NotGiven = NOT_GIVEN, query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN, - webhooks: List[str] | NotGiven = NOT_GIVEN, + sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + webhooks: SequenceNotStr[str] | NotGiven = NOT_GIVEN, welcome_message: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -170,17 +170,17 @@ def update( *, avatar_url: Optional[str] | NotGiven = NOT_GIVEN, color_theme: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, debug: Optional[bool] | NotGiven = NOT_GIVEN, - extapi_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + extapi_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN, magic_input: Optional[str] | NotGiven = NOT_GIVEN, max_rows: Optional[int] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, publish: Optional[bool] | NotGiven = NOT_GIVEN, query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN, - webhooks: Optional[List[str]] | NotGiven = NOT_GIVEN, + sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + webhooks: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, welcome_message: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -261,7 +261,7 @@ def update( def list( self, *, - bot_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + bot_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, @@ -408,18 +408,18 @@ def with_streaming_response(self) -> AsyncBotsResourceWithStreamingResponse: async def create( self, *, - datasource_ids: List[str], + datasource_ids: SequenceNotStr[str], name: str, color_theme: Optional[str] | NotGiven = NOT_GIVEN, debug: bool | NotGiven = NOT_GIVEN, - extapi_ids: List[str] | NotGiven = NOT_GIVEN, + extapi_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN, magic_input: Optional[str] | NotGiven = NOT_GIVEN, max_rows: int | NotGiven = NOT_GIVEN, publish: bool | NotGiven = NOT_GIVEN, query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN, - webhooks: List[str] | NotGiven = NOT_GIVEN, + sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + webhooks: SequenceNotStr[str] | NotGiven = NOT_GIVEN, welcome_message: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -531,17 +531,17 @@ async def update( *, avatar_url: Optional[str] | NotGiven = NOT_GIVEN, color_theme: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, debug: Optional[bool] | NotGiven = NOT_GIVEN, - extapi_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + extapi_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN, magic_input: Optional[str] | NotGiven = NOT_GIVEN, max_rows: Optional[int] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, publish: Optional[bool] | NotGiven = NOT_GIVEN, query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[List[str]] | NotGiven = NOT_GIVEN, - webhooks: Optional[List[str]] | NotGiven = NOT_GIVEN, + sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + webhooks: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, welcome_message: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -622,7 +622,7 @@ async def update( def list( self, *, - bot_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + bot_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py index 2eed15db..f32f3886 100644 --- a/src/asktable/resources/business_glossary.py +++ b/src/asktable/resources/business_glossary.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional import httpx from ..types import business_glossary_list_params, business_glossary_create_params, business_glossary_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -116,7 +116,7 @@ def update( entry_id: str, *, active: Optional[bool] | NotGiven = NOT_GIVEN, - aliases: Optional[List[str]] | NotGiven = NOT_GIVEN, + aliases: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, definition: Optional[str] | NotGiven = NOT_GIVEN, payload: Optional[object] | NotGiven = NOT_GIVEN, term: Optional[str] | NotGiven = NOT_GIVEN, @@ -344,7 +344,7 @@ async def update( entry_id: str, *, active: Optional[bool] | NotGiven = NOT_GIVEN, - aliases: Optional[List[str]] | NotGiven = NOT_GIVEN, + aliases: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, definition: Optional[str] | NotGiven = NOT_GIVEN, payload: Optional[object] | NotGiven = NOT_GIVEN, term: Optional[str] | NotGiven = NOT_GIVEN, diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py index 431f1fba..933c63e4 100644 --- a/src/asktable/resources/datasources/meta.py +++ b/src/asktable/resources/datasources/meta.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -50,7 +50,7 @@ def create( async_process_meta: bool | NotGiven = NOT_GIVEN, value_index: bool | NotGiven = NOT_GIVEN, meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -140,7 +140,7 @@ def update( *, async_process_meta: bool | NotGiven = NOT_GIVEN, meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -244,7 +244,7 @@ async def create( async_process_meta: bool | NotGiven = NOT_GIVEN, value_index: bool | NotGiven = NOT_GIVEN, meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -334,7 +334,7 @@ async def update( *, async_process_meta: bool | NotGiven = NOT_GIVEN, meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, List[str]]] | NotGiven = NOT_GIVEN, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/asktable/resources/policies.py b/src/asktable/resources/policies.py index fc27f2c4..bbe961e8 100644 --- a/src/asktable/resources/policies.py +++ b/src/asktable/resources/policies.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Literal import httpx from ..types import policy_list_params, policy_create_params, policy_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -180,7 +180,7 @@ def list( *, name: Optional[str] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, - policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -420,7 +420,7 @@ def list( *, name: Optional[str] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, - policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py index c05f9a91..ee40c249 100644 --- a/src/asktable/resources/roles.py +++ b/src/asktable/resources/roles.py @@ -2,12 +2,12 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional import httpx from ..types import role_list_params, role_create_params, role_update_params, role_get_variables_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -49,7 +49,7 @@ def create( self, *, name: str, - policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -126,7 +126,7 @@ def update( role_id: str, *, name: Optional[str] | NotGiven = NOT_GIVEN, - policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -172,7 +172,7 @@ def list( *, name: Optional[str] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, - role_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + role_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -293,7 +293,7 @@ def get_variables( role_id: str, *, bot_id: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -362,7 +362,7 @@ async def create( self, *, name: str, - policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -439,7 +439,7 @@ async def update( role_id: str, *, name: Optional[str] | NotGiven = NOT_GIVEN, - policy_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -485,7 +485,7 @@ def list( *, name: Optional[str] | NotGiven = NOT_GIVEN, page: int | NotGiven = NOT_GIVEN, - role_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + role_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -606,7 +606,7 @@ async def get_variables( role_id: str, *, bot_id: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index 6c7c5f13..b4a07c78 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional import httpx @@ -14,7 +14,7 @@ APIKeysResourceWithStreamingResponse, AsyncAPIKeysResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -178,7 +178,7 @@ def list( self, *, page: int | NotGiven = NOT_GIVEN, - project_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + project_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -488,7 +488,7 @@ def list( self, *, page: int | NotGiven = NOT_GIVEN, - project_ids: Optional[List[str]] | NotGiven = NOT_GIVEN, + project_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, size: int | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/asktable/types/ats/task_run_params.py b/src/asktable/types/ats/task_run_params.py index b86b4193..a397edcb 100644 --- a/src/asktable/types/ats/task_run_params.py +++ b/src/asktable/types/ats/task_run_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing import List from typing_extensions import Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["TaskRunParams"] @@ -12,5 +13,5 @@ class TaskRunParams(TypedDict, total=False): datasource_id: Required[str] """数据源 ID""" - specific_case_ids: Required[List[str]] + specific_case_ids: Required[SequenceNotStr[str]] """测试用例 ID 列表""" diff --git a/src/asktable/types/bot_create_params.py b/src/asktable/types/bot_create_params.py index e2a2f550..6c73b116 100644 --- a/src/asktable/types/bot_create_params.py +++ b/src/asktable/types/bot_create_params.py @@ -2,14 +2,16 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from .._types import SequenceNotStr + __all__ = ["BotCreateParams", "InteractionRule"] class BotCreateParams(TypedDict, total=False): - datasource_ids: Required[List[str]] + datasource_ids: Required[SequenceNotStr[str]] """数据源 ID,目前只支持 1 个数据源。""" name: Required[str] @@ -21,7 +23,7 @@ class BotCreateParams(TypedDict, total=False): debug: bool """调试模式""" - extapi_ids: List[str] + extapi_ids: SequenceNotStr[str] """扩展 API ID 列表,扩展 API ID 的逗号分隔列表。""" interaction_rules: Iterable[InteractionRule] @@ -39,10 +41,10 @@ class BotCreateParams(TypedDict, total=False): query_balance: Optional[int] """bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数""" - sample_questions: Optional[List[str]] + sample_questions: Optional[SequenceNotStr[str]] """示例问题列表""" - webhooks: List[str] + webhooks: SequenceNotStr[str] """Webhook URL 列表""" welcome_message: Optional[str] @@ -58,4 +60,4 @@ class InteractionRule(TypedDict, total=False): version: Required[Literal["1.0.0"]] - words: Required[List[str]] + words: Required[SequenceNotStr[str]] diff --git a/src/asktable/types/bot_list_params.py b/src/asktable/types/bot_list_params.py index 2463c813..063a000f 100644 --- a/src/asktable/types/bot_list_params.py +++ b/src/asktable/types/bot_list_params.py @@ -2,14 +2,16 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from .._types import SequenceNotStr + __all__ = ["BotListParams"] class BotListParams(TypedDict, total=False): - bot_ids: Optional[List[str]] + bot_ids: Optional[SequenceNotStr[str]] """Bot ID""" name: Optional[str] diff --git a/src/asktable/types/bot_update_params.py b/src/asktable/types/bot_update_params.py index e08d5a37..a183a38e 100644 --- a/src/asktable/types/bot_update_params.py +++ b/src/asktable/types/bot_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from .._types import SequenceNotStr + __all__ = ["BotUpdateParams", "InteractionRule"] @@ -15,13 +17,13 @@ class BotUpdateParams(TypedDict, total=False): color_theme: Optional[str] """颜色主题""" - datasource_ids: Optional[List[str]] + datasource_ids: Optional[SequenceNotStr[str]] """数据源 ID,目前只支持 1 个数据源。""" debug: Optional[bool] """调试模式""" - extapi_ids: Optional[List[str]] + extapi_ids: Optional[SequenceNotStr[str]] """扩展 API ID 列表,扩展 API ID 的逗号分隔列表。""" interaction_rules: Optional[Iterable[InteractionRule]] @@ -42,10 +44,10 @@ class BotUpdateParams(TypedDict, total=False): query_balance: Optional[int] """bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数""" - sample_questions: Optional[List[str]] + sample_questions: Optional[SequenceNotStr[str]] """示例问题列表""" - webhooks: Optional[List[str]] + webhooks: Optional[SequenceNotStr[str]] """Webhook URL 列表""" welcome_message: Optional[str] @@ -61,4 +63,4 @@ class InteractionRule(TypedDict, total=False): version: Required[Literal["1.0.0"]] - words: Required[List[str]] + words: Required[SequenceNotStr[str]] diff --git a/src/asktable/types/business_glossary_create_params.py b/src/asktable/types/business_glossary_create_params.py index e9f3d42d..b01bbcd8 100644 --- a/src/asktable/types/business_glossary_create_params.py +++ b/src/asktable/types/business_glossary_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Iterable, Optional +from typing import Iterable, Optional from typing_extensions import Required, TypedDict +from .._types import SequenceNotStr + __all__ = ["BusinessGlossaryCreateParams", "Body"] @@ -22,7 +24,7 @@ class Body(TypedDict, total=False): active: bool """业务术语是否生效""" - aliases: Optional[List[str]] + aliases: Optional[SequenceNotStr[str]] """业务术语同义词""" payload: Optional[object] diff --git a/src/asktable/types/business_glossary_update_params.py b/src/asktable/types/business_glossary_update_params.py index 89bad224..092cebe8 100644 --- a/src/asktable/types/business_glossary_update_params.py +++ b/src/asktable/types/business_glossary_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from .._types import SequenceNotStr + __all__ = ["BusinessGlossaryUpdateParams"] @@ -12,7 +14,7 @@ class BusinessGlossaryUpdateParams(TypedDict, total=False): active: Optional[bool] """业务术语是否生效""" - aliases: Optional[List[str]] + aliases: Optional[SequenceNotStr[str]] """业务术语同义词""" definition: Optional[str] diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py index afd362b0..ae38892b 100644 --- a/src/asktable/types/datasource_create_params.py +++ b/src/asktable/types/datasource_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Union, Optional +from typing import Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .._types import SequenceNotStr + __all__ = [ "DatasourceCreateParams", "AccessConfig", @@ -75,7 +77,7 @@ class AccessConfigAccessConfigConnectionCreate(TypedDict, total=False): class AccessConfigAccessConfigFileCreate(TypedDict, total=False): - files: Required[List[str]] + files: Required[SequenceNotStr[str]] """数据源文件 URL 列表, 创建时可以传入 URL""" diff --git a/src/asktable/types/datasources/meta_create_params.py b/src/asktable/types/datasources/meta_create_params.py index 86783588..caebf645 100644 --- a/src/asktable/types/datasources/meta_create_params.py +++ b/src/asktable/types/datasources/meta_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["MetaCreateParams", "Meta", "MetaSchemas", "MetaSchemasTables", "MetaSchemasTablesFields"] @@ -15,7 +17,7 @@ class MetaCreateParams(TypedDict, total=False): meta: Optional[Meta] - selected_tables: Optional[Dict[str, List[str]]] + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] class MetaSchemasTablesFields(TypedDict, total=False): diff --git a/src/asktable/types/datasources/meta_update_params.py b/src/asktable/types/datasources/meta_update_params.py index 2a14b685..bf1938eb 100644 --- a/src/asktable/types/datasources/meta_update_params.py +++ b/src/asktable/types/datasources/meta_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict +from ..._types import SequenceNotStr + __all__ = ["MetaUpdateParams", "Meta", "MetaSchemas", "MetaSchemasTables", "MetaSchemasTablesFields"] @@ -13,7 +15,7 @@ class MetaUpdateParams(TypedDict, total=False): meta: Optional[Meta] - selected_tables: Optional[Dict[str, List[str]]] + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] class MetaSchemasTablesFields(TypedDict, total=False): diff --git a/src/asktable/types/policy_create_params.py b/src/asktable/types/policy_create_params.py index 9630207c..16b8de53 100644 --- a/src/asktable/types/policy_create_params.py +++ b/src/asktable/types/policy_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Optional +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict +from .._types import SequenceNotStr + __all__ = ["PolicyCreateParams", "DatasetConfig", "DatasetConfigRegexPatterns"] @@ -31,7 +33,7 @@ class DatasetConfigRegexPatterns(TypedDict, total=False): class DatasetConfig(TypedDict, total=False): - datasource_ids: Required[List[str]] + datasource_ids: Required[SequenceNotStr[str]] """ 数据源 ID 列表,必填。 - 描述:用于指定策略适用的数据源。可以使用通配符 _ 表示所 有数据源。 - 示例:["ds_id_1","ds_id_2"],["_"]。 @@ -44,7 +46,7 @@ class DatasetConfig(TypedDict, total=False): 注意:此字段为可选项。如果未提供,则默认包含指定数据源的所有数据。 """ - rows_filters: Optional[Dict[str, List[str]]] + rows_filters: Optional[Dict[str, SequenceNotStr[str]]] """行级别过滤器。 - 描述:指定行级别的过滤器,满足条件的行才可访问。 用户在查询数据的时候会自动对 diff --git a/src/asktable/types/policy_list_params.py b/src/asktable/types/policy_list_params.py index 5a9e7ea6..a8e91ab3 100644 --- a/src/asktable/types/policy_list_params.py +++ b/src/asktable/types/policy_list_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from .._types import SequenceNotStr + __all__ = ["PolicyListParams"] @@ -15,7 +17,7 @@ class PolicyListParams(TypedDict, total=False): page: int """Page number""" - policy_ids: Optional[List[str]] + policy_ids: Optional[SequenceNotStr[str]] """策略 ID 列表""" size: int diff --git a/src/asktable/types/policy_update_params.py b/src/asktable/types/policy_update_params.py index dc1675b2..a50f190c 100644 --- a/src/asktable/types/policy_update_params.py +++ b/src/asktable/types/policy_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Literal, Required, TypedDict +from .._types import SequenceNotStr + __all__ = ["PolicyUpdateParams", "DatasetConfig", "DatasetConfigRegexPatterns", "DatasetConfigRowsFilter"] @@ -46,12 +48,12 @@ class DatasetConfigRowsFilter(TypedDict, total=False): table_regex: Required[str] """Table regex pattern""" - variables: List[str] + variables: SequenceNotStr[str] """Jinja2 variables in the condition""" class DatasetConfig(TypedDict, total=False): - datasource_ids: Required[List[str]] + datasource_ids: Required[SequenceNotStr[str]] """ 数据源 ID 列表,必填。 - 描述:用于指定策略适用的数据源。可以使用通配符 _ 表示所 有数据源。 - 示例:["ds_id_1","ds_id_2"],["_"]。 diff --git a/src/asktable/types/role_create_params.py b/src/asktable/types/role_create_params.py index 4750a3e0..4e0679c7 100644 --- a/src/asktable/types/role_create_params.py +++ b/src/asktable/types/role_create_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import Required, TypedDict +from .._types import SequenceNotStr + __all__ = ["RoleCreateParams"] @@ -12,5 +14,5 @@ class RoleCreateParams(TypedDict, total=False): name: Required[str] """名称""" - policy_ids: Optional[List[str]] + policy_ids: Optional[SequenceNotStr[str]] """策略列表。注意:如果为空或者不传则不绑定策略""" diff --git a/src/asktable/types/role_get_variables_params.py b/src/asktable/types/role_get_variables_params.py index cebb567c..35a79f86 100644 --- a/src/asktable/types/role_get_variables_params.py +++ b/src/asktable/types/role_get_variables_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from .._types import SequenceNotStr + __all__ = ["RoleGetVariablesParams"] @@ -12,5 +14,5 @@ class RoleGetVariablesParams(TypedDict, total=False): bot_id: Optional[str] """Bot ID""" - datasource_ids: Optional[List[str]] + datasource_ids: Optional[SequenceNotStr[str]] """数据源 ID 列表""" diff --git a/src/asktable/types/role_list_params.py b/src/asktable/types/role_list_params.py index 851c0904..a5e6e489 100644 --- a/src/asktable/types/role_list_params.py +++ b/src/asktable/types/role_list_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from .._types import SequenceNotStr + __all__ = ["RoleListParams"] @@ -15,7 +17,7 @@ class RoleListParams(TypedDict, total=False): page: int """Page number""" - role_ids: Optional[List[str]] + role_ids: Optional[SequenceNotStr[str]] """角色 ID 列表""" size: int diff --git a/src/asktable/types/role_update_params.py b/src/asktable/types/role_update_params.py index 6cb3bb99..2cb20bea 100644 --- a/src/asktable/types/role_update_params.py +++ b/src/asktable/types/role_update_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from .._types import SequenceNotStr + __all__ = ["RoleUpdateParams"] @@ -12,5 +14,5 @@ class RoleUpdateParams(TypedDict, total=False): name: Optional[str] """名称""" - policy_ids: Optional[List[str]] + policy_ids: Optional[SequenceNotStr[str]] """策略列表。注意:如果为空或者不传则不绑定策略""" diff --git a/src/asktable/types/sys/project_list_params.py b/src/asktable/types/sys/project_list_params.py index f0b103dc..661b42ad 100644 --- a/src/asktable/types/sys/project_list_params.py +++ b/src/asktable/types/sys/project_list_params.py @@ -2,9 +2,11 @@ from __future__ import annotations -from typing import List, Optional +from typing import Optional from typing_extensions import TypedDict +from ..._types import SequenceNotStr + __all__ = ["ProjectListParams"] @@ -12,7 +14,7 @@ class ProjectListParams(TypedDict, total=False): page: int """Page number""" - project_ids: Optional[List[str]] + project_ids: Optional[SequenceNotStr[str]] """项目 ID 列表""" size: int From 8fa327a7bb92dc4b4aeb81ff356989c13712166d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 04:24:00 +0000 Subject: [PATCH 029/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/types/ats/task_list_response.py | 2 -- src/asktable/types/ats/task_retrieve_response.py | 2 -- src/asktable/types/ats/task_run_response.py | 2 -- src/asktable/types/sys/model_group.py | 3 --- 5 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index d21d7655..1513891e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ec24aac86e4b81535737601bbb5a32bff17d2bab33fab964654b35294c65361c.yml -openapi_spec_hash: 197f10722fd42cb2b711d847a64cae25 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-578aabf55c18a10f4654e7d6f45b756b4ca735a06e2eeb4aebdf5c02b61e88e5.yml +openapi_spec_hash: 22ba960dfcb0689ddfc921d891a8a8af config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 9e922b87..17dceee1 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -15,8 +15,6 @@ class ModelGroup(BaseModel): fast: str - image: str - name: str omni: str diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index d4c03ec4..5bf66936 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -15,8 +15,6 @@ class ModelGroup(BaseModel): fast: str - image: str - name: str omni: str diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index c9b65685..b3357fe9 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -15,8 +15,6 @@ class ModelGroup(BaseModel): fast: str - image: str - name: str omni: str diff --git a/src/asktable/types/sys/model_group.py b/src/asktable/types/sys/model_group.py index d37d6270..8ddd96e3 100644 --- a/src/asktable/types/sys/model_group.py +++ b/src/asktable/types/sys/model_group.py @@ -15,9 +15,6 @@ class ModelGroup(BaseModel): fast: str """快速模型""" - image: str - """图片模型""" - name: str """模型组名称""" From 7d6836dc486cd6287e806f18177b2c4afb1be2e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 03:41:05 +0000 Subject: [PATCH 030/130] feat: improve future compat with pydantic v3 --- src/asktable/_base_client.py | 6 +- src/asktable/_compat.py | 96 ++++++++--------- src/asktable/_models.py | 80 +++++++------- src/asktable/_utils/__init__.py | 10 +- src/asktable/_utils/_compat.py | 45 ++++++++ src/asktable/_utils/_datetime_parse.py | 136 ++++++++++++++++++++++++ src/asktable/_utils/_transform.py | 6 +- src/asktable/_utils/_typing.py | 2 +- src/asktable/_utils/_utils.py | 1 - tests/test_models.py | 48 ++++----- tests/test_transform.py | 16 +-- tests/test_utils/test_datetime_parse.py | 110 +++++++++++++++++++ tests/utils.py | 8 +- 13 files changed, 432 insertions(+), 132 deletions(-) create mode 100644 src/asktable/_utils/_compat.py create mode 100644 src/asktable/_utils/_datetime_parse.py create mode 100644 tests/test_utils/test_datetime_parse.py diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py index f0e12764..c6740ef2 100644 --- a/src/asktable/_base_client.py +++ b/src/asktable/_base_client.py @@ -59,7 +59,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import PYDANTIC_V2, model_copy, model_dump +from ._compat import PYDANTIC_V1, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -232,7 +232,7 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model @@ -320,7 +320,7 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: - if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: self.__pydantic_private__ = {} self._model = model diff --git a/src/asktable/_compat.py b/src/asktable/_compat.py index 92d9ee61..bdef67f0 100644 --- a/src/asktable/_compat.py +++ b/src/asktable/_compat.py @@ -12,14 +12,13 @@ _T = TypeVar("_T") _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) -# --------------- Pydantic v2 compatibility --------------- +# --------------- Pydantic v2, v3 compatibility --------------- # Pyright incorrectly reports some of our functions as overriding a method when they don't # pyright: reportIncompatibleMethodOverride=false -PYDANTIC_V2 = pydantic.VERSION.startswith("2.") +PYDANTIC_V1 = pydantic.VERSION.startswith("1.") -# v1 re-exports if TYPE_CHECKING: def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 @@ -44,90 +43,92 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 ... else: - if PYDANTIC_V2: - from pydantic.v1.typing import ( + # v1 re-exports + if PYDANTIC_V1: + from pydantic.typing import ( get_args as get_args, is_union as is_union, get_origin as get_origin, is_typeddict as is_typeddict, is_literal_type as is_literal_type, ) - from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime else: - from pydantic.typing import ( + from ._utils import ( get_args as get_args, is_union as is_union, get_origin as get_origin, + parse_date as parse_date, is_typeddict as is_typeddict, + parse_datetime as parse_datetime, is_literal_type as is_literal_type, ) - from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime # refactored config if TYPE_CHECKING: from pydantic import ConfigDict as ConfigDict else: - if PYDANTIC_V2: - from pydantic import ConfigDict - else: + if PYDANTIC_V1: # TODO: provide an error message here? ConfigDict = None + else: + from pydantic import ConfigDict as ConfigDict # renamed methods / properties def parse_obj(model: type[_ModelT], value: object) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(value) - else: + if PYDANTIC_V1: return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + else: + return model.model_validate(value) def field_is_required(field: FieldInfo) -> bool: - if PYDANTIC_V2: - return field.is_required() - return field.required # type: ignore + if PYDANTIC_V1: + return field.required # type: ignore + return field.is_required() def field_get_default(field: FieldInfo) -> Any: value = field.get_default() - if PYDANTIC_V2: - from pydantic_core import PydanticUndefined - - if value == PydanticUndefined: - return None + if PYDANTIC_V1: return value + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None return value def field_outer_type(field: FieldInfo) -> Any: - if PYDANTIC_V2: - return field.annotation - return field.outer_type_ # type: ignore + if PYDANTIC_V1: + return field.outer_type_ # type: ignore + return field.annotation def get_model_config(model: type[pydantic.BaseModel]) -> Any: - if PYDANTIC_V2: - return model.model_config - return model.__config__ # type: ignore + if PYDANTIC_V1: + return model.__config__ # type: ignore + return model.model_config def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: - if PYDANTIC_V2: - return model.model_fields - return model.__fields__ # type: ignore + if PYDANTIC_V1: + return model.__fields__ # type: ignore + return model.model_fields def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: - if PYDANTIC_V2: - return model.model_copy(deep=deep) - return model.copy(deep=deep) # type: ignore + if PYDANTIC_V1: + return model.copy(deep=deep) # type: ignore + return model.model_copy(deep=deep) def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: - if PYDANTIC_V2: - return model.model_dump_json(indent=indent) - return model.json(indent=indent) # type: ignore + if PYDANTIC_V1: + return model.json(indent=indent) # type: ignore + return model.model_dump_json(indent=indent) def model_dump( @@ -139,14 +140,14 @@ def model_dump( warnings: bool = True, mode: Literal["json", "python"] = "python", ) -> dict[str, Any]: - if PYDANTIC_V2 or hasattr(model, "model_dump"): + if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( mode=mode, exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 - warnings=warnings if PYDANTIC_V2 else True, + warnings=True if PYDANTIC_V1 else warnings, ) return cast( "dict[str, Any]", @@ -159,9 +160,9 @@ def model_dump( def model_parse(model: type[_ModelT], data: Any) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(data) - return model.parse_obj(data) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + return model.model_validate(data) # generic models @@ -170,17 +171,16 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT: class GenericModel(pydantic.BaseModel): ... else: - if PYDANTIC_V2: + if PYDANTIC_V1: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + else: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors class GenericModel(pydantic.BaseModel): ... - else: - import pydantic.generics - - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... - # cached properties if TYPE_CHECKING: diff --git a/src/asktable/_models.py b/src/asktable/_models.py index 92f7c10b..3a6017ef 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -50,7 +50,7 @@ strip_annotated_type, ) from ._compat import ( - PYDANTIC_V2, + PYDANTIC_V1, ConfigDict, GenericModel as BaseGenericModel, get_args, @@ -81,11 +81,7 @@ class _ConfigProtocol(Protocol): class BaseModel(pydantic.BaseModel): - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict( - extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) - ) - else: + if PYDANTIC_V1: @property @override @@ -95,6 +91,10 @@ def model_fields_set(self) -> set[str]: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] extra: Any = pydantic.Extra.allow # type: ignore + else: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) def to_dict( self, @@ -215,25 +215,25 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] if key not in model_fields: parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value - if PYDANTIC_V2: - _extra[key] = parsed - else: + if PYDANTIC_V1: _fields_set.add(key) fields_values[key] = parsed + else: + _extra[key] = parsed object.__setattr__(m, "__dict__", fields_values) - if PYDANTIC_V2: - # these properties are copied from Pydantic's `model_construct()` method - object.__setattr__(m, "__pydantic_private__", None) - object.__setattr__(m, "__pydantic_extra__", _extra) - object.__setattr__(m, "__pydantic_fields_set__", _fields_set) - else: + if PYDANTIC_V1: # init_private_attributes() does not exist in v2 m._init_private_attributes() # type: ignore # copied from Pydantic v1's `construct()` method object.__setattr__(m, "__fields_set__", _fields_set) + else: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) return m @@ -243,7 +243,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride] # although not in practice model_construct = construct - if not PYDANTIC_V2: + if PYDANTIC_V1: # we define aliases for some of the new pydantic v2 methods so # that we can just document these methods without having to specify # a specific pydantic version as some users may not know which @@ -363,10 +363,10 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if value is None: return field_get_default(field) - if PYDANTIC_V2: - type_ = field.annotation - else: + if PYDANTIC_V1: type_ = cast(type, field.outer_type_) # type: ignore + else: + type_ = field.annotation # type: ignore if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") @@ -375,7 +375,7 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: - if not PYDANTIC_V2: + if PYDANTIC_V1: # TODO return None @@ -628,30 +628,30 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, for variant in get_args(union): variant = strip_annotated_type(variant) if is_basemodel_type(variant): - if PYDANTIC_V2: - field = _extract_field_schema_pv2(variant, discriminator_field_name) - if not field: + if PYDANTIC_V1: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field.get("serialization_alias") - - field_schema = field["schema"] + discriminator_alias = field_info.alias - if field_schema["type"] == "literal": - for entry in cast("LiteralSchema", field_schema)["expected"]: + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant else: - field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - if not field_info: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field_info.alias + discriminator_alias = field.get("serialization_alias") - if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): - for entry in get_args(annotation): + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: if isinstance(entry, str): mapping[entry] = variant @@ -714,7 +714,7 @@ class GenericModel(BaseGenericModel, BaseModel): pass -if PYDANTIC_V2: +if not PYDANTIC_V1: from pydantic import TypeAdapter as _TypeAdapter _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) @@ -782,12 +782,12 @@ class FinalRequestOptions(pydantic.BaseModel): json_data: Union[Body, None] = None extra_json: Union[AnyMapping, None] = None - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) - else: + if PYDANTIC_V1: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] arbitrary_types_allowed: bool = True + else: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) def get_max_retries(self, max_retries: int) -> int: if isinstance(self.max_retries, NotGiven): @@ -820,9 +820,9 @@ def construct( # type: ignore key: strip_not_given(value) for key, value in values.items() } - if PYDANTIC_V2: - return super().model_construct(_fields_set, **kwargs) - return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + return super().model_construct(_fields_set, **kwargs) if not TYPE_CHECKING: # type checkers incorrectly complain about this assignment diff --git a/src/asktable/_utils/__init__.py b/src/asktable/_utils/__init__.py index ca547ce5..dc64e29a 100644 --- a/src/asktable/_utils/__init__.py +++ b/src/asktable/_utils/__init__.py @@ -10,7 +10,6 @@ lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, - parse_date as parse_date, is_iterable as is_iterable, is_sequence as is_sequence, coerce_float as coerce_float, @@ -23,7 +22,6 @@ coerce_boolean as coerce_boolean, coerce_integer as coerce_integer, file_from_path as file_from_path, - parse_datetime as parse_datetime, strip_not_given as strip_not_given, deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, @@ -32,6 +30,13 @@ maybe_coerce_boolean as maybe_coerce_boolean, maybe_coerce_integer as maybe_coerce_integer, ) +from ._compat import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, +) from ._typing import ( is_list_type as is_list_type, is_union_type as is_union_type, @@ -56,3 +61,4 @@ function_has_argument as function_has_argument, assert_signatures_in_sync as assert_signatures_in_sync, ) +from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime diff --git a/src/asktable/_utils/_compat.py b/src/asktable/_utils/_compat.py new file mode 100644 index 00000000..dd703233 --- /dev/null +++ b/src/asktable/_utils/_compat.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import sys +import typing_extensions +from typing import Any, Type, Union, Literal, Optional +from datetime import date, datetime +from typing_extensions import get_args as _get_args, get_origin as _get_origin + +from .._types import StrBytesIntFloat +from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime + +_LITERAL_TYPES = {Literal, typing_extensions.Literal} + + +def get_args(tp: type[Any]) -> tuple[Any, ...]: + return _get_args(tp) + + +def get_origin(tp: type[Any]) -> type[Any] | None: + return _get_origin(tp) + + +def is_union(tp: Optional[Type[Any]]) -> bool: + if sys.version_info < (3, 10): + return tp is Union # type: ignore[comparison-overlap] + else: + import types + + return tp is Union or tp is types.UnionType + + +def is_typeddict(tp: Type[Any]) -> bool: + return typing_extensions.is_typeddict(tp) + + +def is_literal_type(tp: Type[Any]) -> bool: + return get_origin(tp) in _LITERAL_TYPES + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + return _parse_date(value) + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + return _parse_datetime(value) diff --git a/src/asktable/_utils/_datetime_parse.py b/src/asktable/_utils/_datetime_parse.py new file mode 100644 index 00000000..7cb9d9e6 --- /dev/null +++ b/src/asktable/_utils/_datetime_parse.py @@ -0,0 +1,136 @@ +""" +This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py +without the Pydantic v1 specific errors. +""" + +from __future__ import annotations + +import re +from typing import Dict, Union, Optional +from datetime import date, datetime, timezone, timedelta + +from .._types import StrBytesIntFloat + +date_expr = r"(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})" +time_expr = ( + r"(?P\d{1,2}):(?P\d{1,2})" + r"(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?" + r"(?PZ|[+-]\d{2}(?::?\d{2})?)?$" +) + +date_re = re.compile(f"{date_expr}$") +datetime_re = re.compile(f"{date_expr}[T ]{time_expr}") + + +EPOCH = datetime(1970, 1, 1) +# if greater than this, the number is in ms, if less than or equal it's in seconds +# (in seconds this is 11th October 2603, in ms it's 20th August 1970) +MS_WATERSHED = int(2e10) +# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9 +MAX_NUMBER = int(3e20) + + +def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: + if isinstance(value, (int, float)): + return value + try: + return float(value) + except ValueError: + return None + except TypeError: + raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None + + +def _from_unix_seconds(seconds: Union[int, float]) -> datetime: + if seconds > MAX_NUMBER: + return datetime.max + elif seconds < -MAX_NUMBER: + return datetime.min + + while abs(seconds) > MS_WATERSHED: + seconds /= 1000 + dt = EPOCH + timedelta(seconds=seconds) + return dt.replace(tzinfo=timezone.utc) + + +def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]: + if value == "Z": + return timezone.utc + elif value is not None: + offset_mins = int(value[-2:]) if len(value) > 3 else 0 + offset = 60 * int(value[1:3]) + offset_mins + if value[0] == "-": + offset = -offset + return timezone(timedelta(minutes=offset)) + else: + return None + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + """ + Parse a datetime/int/float/string and return a datetime.datetime. + + This function supports time zone offsets. When the input contains one, + the output uses a timezone with a fixed offset from UTC. + + Raise ValueError if the input is well formatted but not a valid datetime. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, datetime): + return value + + number = _get_numeric(value, "datetime") + if number is not None: + return _from_unix_seconds(number) + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + + match = datetime_re.match(value) + if match is None: + raise ValueError("invalid datetime format") + + kw = match.groupdict() + if kw["microsecond"]: + kw["microsecond"] = kw["microsecond"].ljust(6, "0") + + tzinfo = _parse_timezone(kw.pop("tzinfo")) + kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None} + kw_["tzinfo"] = tzinfo + + return datetime(**kw_) # type: ignore + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + """ + Parse a date/int/float/string and return a datetime.date. + + Raise ValueError if the input is well formatted but not a valid date. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, date): + if isinstance(value, datetime): + return value.date() + else: + return value + + number = _get_numeric(value, "date") + if number is not None: + return _from_unix_seconds(number).date() + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + match = date_re.match(value) + if match is None: + raise ValueError("invalid date format") + + kw = {k: int(v) for k, v in match.groupdict().items()} + + try: + return date(**kw) + except ValueError: + raise ValueError("invalid date format") from None diff --git a/src/asktable/_utils/_transform.py b/src/asktable/_utils/_transform.py index f0bcefd4..c19124f0 100644 --- a/src/asktable/_utils/_transform.py +++ b/src/asktable/_utils/_transform.py @@ -19,6 +19,7 @@ is_sequence, ) from .._files import is_base64_file_input +from ._compat import get_origin, is_typeddict from ._typing import ( is_list_type, is_union_type, @@ -29,7 +30,6 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -169,6 +169,8 @@ def _transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation @@ -333,6 +335,8 @@ async def _async_transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation diff --git a/src/asktable/_utils/_typing.py b/src/asktable/_utils/_typing.py index 845cd6b2..193109f3 100644 --- a/src/asktable/_utils/_typing.py +++ b/src/asktable/_utils/_typing.py @@ -15,7 +15,7 @@ from ._utils import lru_cache from .._types import InheritsGeneric -from .._compat import is_union as _is_union +from ._compat import is_union as _is_union def is_annotated_type(typ: type) -> bool: diff --git a/src/asktable/_utils/_utils.py b/src/asktable/_utils/_utils.py index ea3cf3f2..f0818595 100644 --- a/src/asktable/_utils/_utils.py +++ b/src/asktable/_utils/_utils.py @@ -22,7 +22,6 @@ import sniffio from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike -from .._compat import parse_date as parse_date, parse_datetime as parse_datetime _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) diff --git a/tests/test_models.py b/tests/test_models.py index f3d3874e..69c74f2c 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -8,7 +8,7 @@ from pydantic import Field from asktable._utils import PropertyInfo -from asktable._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from asktable._compat import PYDANTIC_V1, parse_obj, model_dump, model_json from asktable._models import BaseModel, construct_type @@ -294,12 +294,12 @@ class Model(BaseModel): assert cast(bool, m.foo) is True m = Model.construct(foo={"name": 3}) - if PYDANTIC_V2: - assert isinstance(m.foo, Submodel1) - assert m.foo.name == 3 # type: ignore - else: + if PYDANTIC_V1: assert isinstance(m.foo, Submodel2) assert m.foo.name == "3" + else: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore def test_list_of_unions() -> None: @@ -426,10 +426,10 @@ class Model(BaseModel): expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) - if PYDANTIC_V2: - expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' - else: + if PYDANTIC_V1: expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + else: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' model = Model.construct(created_at="2019-12-27T18:11:19.117Z") assert model.created_at == expected @@ -531,7 +531,7 @@ class Model2(BaseModel): assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} assert m4.to_dict(mode="json") == {"created_at": time_str} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_dict(warnings=False) @@ -556,7 +556,7 @@ class Model(BaseModel): assert m3.model_dump() == {"foo": None} assert m3.model_dump(exclude_none=True) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) @@ -580,10 +580,10 @@ class Model(BaseModel): assert json.loads(m.to_json()) == {"FOO": "hello"} assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} - if PYDANTIC_V2: - assert m.to_json(indent=None) == '{"FOO":"hello"}' - else: + if PYDANTIC_V1: assert m.to_json(indent=None) == '{"FOO": "hello"}' + else: + assert m.to_json(indent=None) == '{"FOO":"hello"}' m2 = Model() assert json.loads(m2.to_json()) == {} @@ -595,7 +595,7 @@ class Model(BaseModel): assert json.loads(m3.to_json()) == {"FOO": None} assert json.loads(m3.to_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): m.to_json(warnings=False) @@ -622,7 +622,7 @@ class Model(BaseModel): assert json.loads(m3.model_dump_json()) == {"foo": None} assert json.loads(m3.model_dump_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump_json(round_trip=True) @@ -679,12 +679,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_unknown_variant() -> None: @@ -768,12 +768,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.foo_type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: @@ -833,7 +833,7 @@ class B(BaseModel): assert UnionType.__discriminator__ is discriminator -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_type_alias_type() -> None: Alias = TypeAliasType("Alias", str) # pyright: ignore @@ -849,7 +849,7 @@ class Model(BaseModel): assert m.union == "bar" -@pytest.mark.skipif(not PYDANTIC_V2, reason="TypeAliasType is not supported in Pydantic v1") +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") def test_field_named_cls() -> None: class Model(BaseModel): cls: str @@ -936,7 +936,7 @@ class Type2(BaseModel): assert isinstance(model.value, InnerType2) -@pytest.mark.skipif(not PYDANTIC_V2, reason="this is only supported in pydantic v2 for now") +@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2 for now") def test_extra_properties() -> None: class Item(BaseModel): prop: int diff --git a/tests/test_transform.py b/tests/test_transform.py index 33ea35d8..5955375a 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -15,7 +15,7 @@ parse_datetime, async_transform as _async_transform, ) -from asktable._compat import PYDANTIC_V2 +from asktable._compat import PYDANTIC_V1 from asktable._models import BaseModel _T = TypeVar("_T") @@ -189,7 +189,7 @@ class DateModel(BaseModel): @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") - tz = "Z" if PYDANTIC_V2 else "+00:00" + tz = "+00:00" if PYDANTIC_V1 else "Z" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] @@ -297,11 +297,11 @@ async def test_pydantic_unknown_field(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_types(use_async: bool) -> None: model = MyModel.construct(foo=True) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": True} @@ -309,11 +309,11 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None: @pytest.mark.asyncio async def test_pydantic_mismatched_object_type(use_async: bool) -> None: model = MyModel.construct(foo=MyModel.construct(hello="world")) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) assert cast(Any, params) == {"foo": {"hello": "world"}} diff --git a/tests/test_utils/test_datetime_parse.py b/tests/test_utils/test_datetime_parse.py new file mode 100644 index 00000000..e710e2d2 --- /dev/null +++ b/tests/test_utils/test_datetime_parse.py @@ -0,0 +1,110 @@ +""" +Copied from https://github.com/pydantic/pydantic/blob/v1.10.22/tests/test_datetime_parse.py +with modifications so it works without pydantic v1 imports. +""" + +from typing import Type, Union +from datetime import date, datetime, timezone, timedelta + +import pytest + +from asktable._utils import parse_date, parse_datetime + + +def create_tz(minutes: int) -> timezone: + return timezone(timedelta(minutes=minutes)) + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + ("1494012444.883309", date(2017, 5, 5)), + (b"1494012444.883309", date(2017, 5, 5)), + (1_494_012_444.883_309, date(2017, 5, 5)), + ("1494012444", date(2017, 5, 5)), + (1_494_012_444, date(2017, 5, 5)), + (0, date(1970, 1, 1)), + ("2012-04-23", date(2012, 4, 23)), + (b"2012-04-23", date(2012, 4, 23)), + ("2012-4-9", date(2012, 4, 9)), + (date(2012, 4, 9), date(2012, 4, 9)), + (datetime(2012, 4, 9, 12, 15), date(2012, 4, 9)), + # Invalid inputs + ("x20120423", ValueError), + ("2012-04-56", ValueError), + (19_999_999_999, date(2603, 10, 11)), # just before watershed + (20_000_000_001, date(1970, 8, 20)), # just after watershed + (1_549_316_052, date(2019, 2, 4)), # nowish in s + (1_549_316_052_104, date(2019, 2, 4)), # nowish in ms + (1_549_316_052_104_324, date(2019, 2, 4)), # nowish in μs + (1_549_316_052_104_324_096, date(2019, 2, 4)), # nowish in ns + ("infinity", date(9999, 12, 31)), + ("inf", date(9999, 12, 31)), + (float("inf"), date(9999, 12, 31)), + ("infinity ", date(9999, 12, 31)), + (int("1" + "0" * 100), date(9999, 12, 31)), + (1e1000, date(9999, 12, 31)), + ("-infinity", date(1, 1, 1)), + ("-inf", date(1, 1, 1)), + ("nan", ValueError), + ], +) +def test_date_parsing(value: Union[str, bytes, int, float], result: Union[date, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_date(value) + else: + assert parse_date(value) == result + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + # values in seconds + ("1494012444.883309", datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + (1_494_012_444.883_309, datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + ("1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (b"1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (1_494_012_444, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + # values in ms + ("1494012444000.883309", datetime(2017, 5, 5, 19, 27, 24, 883, tzinfo=timezone.utc)), + ("-1494012444000.883309", datetime(1922, 8, 29, 4, 32, 35, 999117, tzinfo=timezone.utc)), + (1_494_012_444_000, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + ("2012-04-23T09:15:00", datetime(2012, 4, 23, 9, 15)), + ("2012-4-9 4:8:16", datetime(2012, 4, 9, 4, 8, 16)), + ("2012-04-23T09:15:00Z", datetime(2012, 4, 23, 9, 15, 0, 0, timezone.utc)), + ("2012-4-9 4:8:16-0320", datetime(2012, 4, 9, 4, 8, 16, 0, create_tz(-200))), + ("2012-04-23T10:20:30.400+02:30", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(150))), + ("2012-04-23T10:20:30.400+02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(120))), + ("2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (b"2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (datetime(2017, 5, 5), datetime(2017, 5, 5)), + (0, datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc)), + # Invalid inputs + ("x20120423091500", ValueError), + ("2012-04-56T09:15:90", ValueError), + ("2012-04-23T11:05:00-25:00", ValueError), + (19_999_999_999, datetime(2603, 10, 11, 11, 33, 19, tzinfo=timezone.utc)), # just before watershed + (20_000_000_001, datetime(1970, 8, 20, 11, 33, 20, 1000, tzinfo=timezone.utc)), # just after watershed + (1_549_316_052, datetime(2019, 2, 4, 21, 34, 12, 0, tzinfo=timezone.utc)), # nowish in s + (1_549_316_052_104, datetime(2019, 2, 4, 21, 34, 12, 104_000, tzinfo=timezone.utc)), # nowish in ms + (1_549_316_052_104_324, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in μs + (1_549_316_052_104_324_096, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in ns + ("infinity", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf ", datetime(9999, 12, 31, 23, 59, 59, 999999)), + (1e50, datetime(9999, 12, 31, 23, 59, 59, 999999)), + (float("inf"), datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("-infinity", datetime(1, 1, 1, 0, 0)), + ("-inf", datetime(1, 1, 1, 0, 0)), + ("nan", ValueError), + ], +) +def test_datetime_parsing(value: Union[str, bytes, int, float], result: Union[datetime, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_datetime(value) + else: + assert parse_datetime(value) == result diff --git a/tests/utils.py b/tests/utils.py index b5025b8b..b84eaf23 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -19,7 +19,7 @@ is_annotated_type, is_type_alias_type, ) -from asktable._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from asktable._compat import PYDANTIC_V1, field_outer_type, get_model_fields from asktable._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel) @@ -28,12 +28,12 @@ def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: for name, field in get_model_fields(model).items(): field_value = getattr(value, name) - if PYDANTIC_V2: - allow_none = False - else: + if PYDANTIC_V1: # in v1 nullability was structured differently # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields allow_none = getattr(field, "allow_none", False) + else: + allow_none = False assert_matches_type( field_outer_type(field), From 14bda033bb621107d557c02caaf9add0ccf6f37d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 4 Sep 2025 09:23:59 +0000 Subject: [PATCH 031/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1513891e..80e36b3f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-578aabf55c18a10f4654e7d6f45b756b4ca735a06e2eeb4aebdf5c02b61e88e5.yml -openapi_spec_hash: 22ba960dfcb0689ddfc921d891a8a8af +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4a1511b408b67d7971c6bdb8e0dea32c49bc2ed11d5258892861e6ea56d1fb54.yml +openapi_spec_hash: 8543a27470e1c19eaf4581249f311898 config_hash: acdf4142177ed1932c2d82372693f811 From 3a81ab10fc9090dd6e0c850ebf4d2bc5dd0774aa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 04:10:32 +0000 Subject: [PATCH 032/130] chore(internal): move mypy configurations to `pyproject.toml` file --- mypy.ini | 50 ------------------------------------------------ pyproject.toml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 50 deletions(-) delete mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index b0156385..00000000 --- a/mypy.ini +++ /dev/null @@ -1,50 +0,0 @@ -[mypy] -pretty = True -show_error_codes = True - -# Exclude _files.py because mypy isn't smart enough to apply -# the correct type narrowing and as this is an internal module -# it's fine to just use Pyright. -# -# We also exclude our `tests` as mypy doesn't always infer -# types correctly and Pyright will still catch any type errors. -exclude = ^(src/asktable/_files\.py|_dev/.*\.py|tests/.*)$ - -strict_equality = True -implicit_reexport = True -check_untyped_defs = True -no_implicit_optional = True - -warn_return_any = True -warn_unreachable = True -warn_unused_configs = True - -# Turn these options off as it could cause conflicts -# with the Pyright options. -warn_unused_ignores = False -warn_redundant_casts = False - -disallow_any_generics = True -disallow_untyped_defs = True -disallow_untyped_calls = True -disallow_subclassing_any = True -disallow_incomplete_defs = True -disallow_untyped_decorators = True -cache_fine_grained = True - -# By default, mypy reports an error if you assign a value to the result -# of a function call that doesn't return anything. We do this in our test -# cases: -# ``` -# result = ... -# assert result is None -# ``` -# Changing this codegen to make mypy happy would increase complexity -# and would not be worth it. -disable_error_code = func-returns-value,overload-cannot-match - -# https://github.com/python/mypy/issues/12162 -[mypy.overrides] -module = "black.files.*" -ignore_errors = true -ignore_missing_imports = true diff --git a/pyproject.toml b/pyproject.toml index 2c14e074..bdb0a135 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,6 +157,58 @@ reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false +[tool.mypy] +pretty = true +show_error_codes = true + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ['src/asktable/_files.py', '_dev/.*.py', 'tests/.*'] + +strict_equality = true +implicit_reexport = true +check_untyped_defs = true +no_implicit_optional = true + +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = false +warn_redundant_casts = false + +disallow_any_generics = true +disallow_untyped_defs = true +disallow_untyped_calls = true +disallow_subclassing_any = true +disallow_incomplete_defs = true +disallow_untyped_decorators = true +cache_fine_grained = true + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = "func-returns-value,overload-cannot-match" + +# https://github.com/python/mypy/issues/12162 +[[tool.mypy.overrides]] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true + + [tool.ruff] line-length = 120 output-format = "grouped" From f8251b5a76926a6603865967d8e94071a72f5d26 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 04:43:41 +0000 Subject: [PATCH 033/130] chore(tests): simplify `get_platform` test `nest_asyncio` is archived and broken on some platforms so it's not worth keeping in our test suite. --- pyproject.toml | 1 - requirements-dev.lock | 1 - tests/test_client.py | 53 +++++-------------------------------------- 3 files changed, 6 insertions(+), 49 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bdb0a135..6be44832 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,7 +56,6 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", - "nest_asyncio==1.6.0", "pytest-xdist>=3.6.1", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index 9701ab71..ec5981a8 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -75,7 +75,6 @@ multidict==6.4.4 mypy==1.14.1 mypy-extensions==1.0.0 # via mypy -nest-asyncio==1.6.0 nodeenv==1.8.0 # via pyright nox==2023.4.22 diff --git a/tests/test_client.py b/tests/test_client.py index 76c130aa..e4071ddb 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -6,13 +6,10 @@ import os import sys import json -import time import asyncio import inspect -import subprocess import tracemalloc from typing import Any, Union, cast -from textwrap import dedent from unittest import mock from typing_extensions import Literal @@ -23,14 +20,17 @@ from asktable import Asktable, AsyncAsktable, APIResponseValidationError from asktable._types import Omit +from asktable._utils import asyncify from asktable._models import BaseModel, FinalRequestOptions from asktable._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError from asktable._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + OtherPlatform, DefaultHttpxClient, DefaultAsyncHttpxClient, + get_platform, make_request_options, ) @@ -1617,50 +1617,9 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: assert response.http_request.headers.get("x-stainless-retry-count") == "42" - def test_get_platform(self) -> None: - # A previous implementation of asyncify could leave threads unterminated when - # used with nest_asyncio. - # - # Since nest_asyncio.apply() is global and cannot be un-applied, this - # test is run in a separate process to avoid affecting other tests. - test_code = dedent(""" - import asyncio - import nest_asyncio - import threading - - from asktable._utils import asyncify - from asktable._base_client import get_platform - - async def test_main() -> None: - result = await asyncify(get_platform)() - print(result) - for thread in threading.enumerate(): - print(thread.name) - - nest_asyncio.apply() - asyncio.run(test_main()) - """) - with subprocess.Popen( - [sys.executable, "-c", test_code], - text=True, - ) as process: - timeout = 10 # seconds - - start_time = time.monotonic() - while True: - return_code = process.poll() - if return_code is not None: - if return_code != 0: - raise AssertionError("calling get_platform using asyncify resulted in a non-zero exit code") - - # success - break - - if time.monotonic() - start_time > timeout: - process.kill() - raise AssertionError("calling get_platform using asyncify resulted in a hung process") - - time.sleep(0.1) + async def test_get_platform(self) -> None: + platform = await asyncify(get_platform)() + assert isinstance(platform, (str, OtherPlatform)) async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly From c549248b2020f0007b3a1b57648b2bc1331cd70d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 10:24:03 +0000 Subject: [PATCH 034/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 80e36b3f..672b7010 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4a1511b408b67d7971c6bdb8e0dea32c49bc2ed11d5258892861e6ea56d1fb54.yml -openapi_spec_hash: 8543a27470e1c19eaf4581249f311898 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a69687e8d1fe97c3be4ecd4af262ffd5174a090b4ae2b00699e7e2a207cfee26.yml +openapi_spec_hash: c822c8e972aa78d15ceb320dd0f4c6dd config_hash: acdf4142177ed1932c2d82372693f811 From eb2d95882dd6646a11927498ec174482176dd997 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 6 Sep 2025 11:24:02 +0000 Subject: [PATCH 035/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 672b7010..2ef26a35 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a69687e8d1fe97c3be4ecd4af262ffd5174a090b4ae2b00699e7e2a207cfee26.yml -openapi_spec_hash: c822c8e972aa78d15ceb320dd0f4c6dd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-90c9af95ec0fa74f8d5d8b6107b3e29168de2f0e45e34d95b2c81f34767791ee.yml +openapi_spec_hash: c03aaf6103d5a7921f11d9bfcb94b26d config_hash: acdf4142177ed1932c2d82372693f811 From d94483502707389c67522c453bda5acc93ddf7c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 12:24:02 +0000 Subject: [PATCH 036/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2ef26a35..784a4cff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-90c9af95ec0fa74f8d5d8b6107b3e29168de2f0e45e34d95b2c81f34767791ee.yml -openapi_spec_hash: c03aaf6103d5a7921f11d9bfcb94b26d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c7a55adc04cd39f9aecf1989f3606feb94161a06a6f5c95f9791b8639ee68445.yml +openapi_spec_hash: 7e23a0b240be262c0fc0daf58345ec91 config_hash: acdf4142177ed1932c2d82372693f811 From 181ebc72a5811526e0018c219105093f553eabb4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 17:24:06 +0000 Subject: [PATCH 037/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 784a4cff..d3d76c28 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c7a55adc04cd39f9aecf1989f3606feb94161a06a6f5c95f9791b8639ee68445.yml -openapi_spec_hash: 7e23a0b240be262c0fc0daf58345ec91 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1d16750dd19581584836a2d65e4bac62e44972282a26dfbf9bee353f90a20cbf.yml +openapi_spec_hash: 4059d0e83dde99a49fa2f53e19fab87a config_hash: acdf4142177ed1932c2d82372693f811 From ce1ef015d78e377188760ba6f8c1983b09cd83d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 14:24:23 +0000 Subject: [PATCH 038/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d3d76c28..a9d157c6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1d16750dd19581584836a2d65e4bac62e44972282a26dfbf9bee353f90a20cbf.yml -openapi_spec_hash: 4059d0e83dde99a49fa2f53e19fab87a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-50a374a464646803bf37ae0f69c17640a17dd49f20890a0e9d230410177a476e.yml +openapi_spec_hash: 8a55cce893ea2120acaf2153ec7358d3 config_hash: acdf4142177ed1932c2d82372693f811 From 7acca037dd89b70de1d3f3d5b116ce5e6331d99f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 06:24:13 +0000 Subject: [PATCH 039/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a9d157c6..94c07687 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-50a374a464646803bf37ae0f69c17640a17dd49f20890a0e9d230410177a476e.yml -openapi_spec_hash: 8a55cce893ea2120acaf2153ec7358d3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f66fcf47a15a489bb15c8ddc6921c8a98c53f4ffee164fb091bc75e9b6755b21.yml +openapi_spec_hash: 0ec7ca0fbceedaf80d4aeb0430750d03 config_hash: acdf4142177ed1932c2d82372693f811 From b555909e49c4d1dbf238b184f66e32f62173bb3c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 07:24:10 +0000 Subject: [PATCH 040/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 94c07687..e1b8bee7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f66fcf47a15a489bb15c8ddc6921c8a98c53f4ffee164fb091bc75e9b6755b21.yml -openapi_spec_hash: 0ec7ca0fbceedaf80d4aeb0430750d03 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-8f5e88e4fb3e5c4973c56a7b756570e693e4dc454065d8d2d31908ed1ccae749.yml +openapi_spec_hash: a32327cd2f72567cd48cb0fd2389f536 config_hash: acdf4142177ed1932c2d82372693f811 From 7768ab57521d3e09e550013c14b188e6aeb62fd1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 03:08:03 +0000 Subject: [PATCH 041/130] chore(internal): update pydantic dependency --- requirements-dev.lock | 7 +++++-- requirements.lock | 7 +++++-- src/asktable/_models.py | 14 ++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/requirements-dev.lock b/requirements-dev.lock index ec5981a8..3364cc9a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -88,9 +88,9 @@ pluggy==1.5.0 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via asktable -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic pygments==2.18.0 # via rich @@ -126,6 +126,9 @@ typing-extensions==4.12.2 # via pydantic # via pydantic-core # via pyright + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic virtualenv==20.24.5 # via nox yarl==1.20.0 diff --git a/requirements.lock b/requirements.lock index ac6e943f..10e18f0e 100644 --- a/requirements.lock +++ b/requirements.lock @@ -55,9 +55,9 @@ multidict==6.4.4 propcache==0.3.1 # via aiohttp # via yarl -pydantic==2.10.3 +pydantic==2.11.9 # via asktable -pydantic-core==2.27.1 +pydantic-core==2.33.2 # via pydantic sniffio==1.3.0 # via anyio @@ -68,5 +68,8 @@ typing-extensions==4.12.2 # via multidict # via pydantic # via pydantic-core + # via typing-inspection +typing-inspection==0.4.1 + # via pydantic yarl==1.20.0 # via aiohttp diff --git a/src/asktable/_models.py b/src/asktable/_models.py index 3a6017ef..6a3cd1d2 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -256,7 +256,7 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, @@ -264,6 +264,7 @@ def model_dump( warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, serialize_as_any: bool = False, + fallback: Callable[[Any], Any] | None = None, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -295,10 +296,12 @@ def model_dump( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, @@ -313,13 +316,14 @@ def model_dump_json( indent: int | None = None, include: IncEx | None = None, exclude: IncEx | None = None, - by_alias: bool = False, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, context: dict[str, Any] | None = None, + fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -348,11 +352,13 @@ def model_dump_json( raise ValueError("context is only supported in Pydantic v2") if serialize_as_any != False: raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, From 6293506ce71179508637ee4b6787200b200563ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 17 Sep 2025 06:24:09 +0000 Subject: [PATCH 042/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e1b8bee7..c0828538 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-8f5e88e4fb3e5c4973c56a7b756570e693e4dc454065d8d2d31908ed1ccae749.yml -openapi_spec_hash: a32327cd2f72567cd48cb0fd2389f536 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-36a963e6c328a93ce0efd8647f2805d26bc31106d3e494d5e2a3b35387a0352a.yml +openapi_spec_hash: f9cb1bf47edd3b21767361c8a2864921 config_hash: acdf4142177ed1932c2d82372693f811 From 8e2933a2a07175e5b2a817f9243df5952b19a9fa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 18 Sep 2025 14:24:15 +0000 Subject: [PATCH 043/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/resources/datasources/datasources.py | 8 ++++++++ src/asktable/types/datasource.py | 2 ++ src/asktable/types/datasource_create_params.py | 2 ++ src/asktable/types/datasource_retrieve_response.py | 2 ++ src/asktable/types/datasource_update_params.py | 2 ++ 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c0828538..1f8cb798 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-36a963e6c328a93ce0efd8647f2805d26bc31106d3e494d5e2a3b35387a0352a.yml -openapi_spec_hash: f9cb1bf47edd3b21767361c8a2864921 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-0242228e003ec6c562e80cd4bb3b5429237f2168f2379ebe5ef9d9c958552482.yml +openapi_spec_hash: 772280fd4316ae74f76e3cba9f48e96d config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index 239b7943..20b822b0 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -114,6 +114,8 @@ def create( "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ], access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, @@ -220,6 +222,8 @@ def update( "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ] ] | NotGiven = NOT_GIVEN, @@ -608,6 +612,8 @@ async def create( "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ], access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN, name: Optional[str] | NotGiven = NOT_GIVEN, @@ -714,6 +720,8 @@ async def update( "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ] ] | NotGiven = NOT_GIVEN, diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py index 70a1ae18..ac024c00 100644 --- a/src/asktable/types/datasource.py +++ b/src/asktable/types/datasource.py @@ -38,6 +38,8 @@ class Datasource(BaseModel): "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py index ae38892b..c1fb8d06 100644 --- a/src/asktable/types/datasource_create_params.py +++ b/src/asktable/types/datasource_create_params.py @@ -39,6 +39,8 @@ class DatasourceCreateParams(TypedDict, total=False): "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ] ] """数据源引擎""" diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index d244225c..9fe27b35 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -93,6 +93,8 @@ class DatasourceRetrieveResponse(BaseModel): "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index ff22daff..11a03ede 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -44,6 +44,8 @@ class DatasourceUpdateParams(TypedDict, total=False): "databend", "sqlserver", "mogdb", + "hologres", + "maxcompute", ] ] """数据源引擎""" From e2ab3d3508972ea2ac5df4ab1824036070eaf732 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 03:29:23 +0000 Subject: [PATCH 044/130] chore(types): change optional parameter type from NotGiven to Omit --- src/asktable/__init__.py | 4 +- src/asktable/_base_client.py | 18 +-- src/asktable/_client.py | 16 +- src/asktable/_qs.py | 14 +- src/asktable/_types.py | 29 ++-- src/asktable/_utils/_transform.py | 4 +- src/asktable/_utils/_utils.py | 8 +- src/asktable/resources/answers.py | 38 ++--- src/asktable/resources/ats/ats.py | 30 ++-- src/asktable/resources/ats/task.py | 34 ++--- src/asktable/resources/ats/test_case.py | 46 +++--- src/asktable/resources/auth.py | 26 ++-- src/asktable/resources/bots.py | 142 +++++++++--------- src/asktable/resources/business_glossary.py | 54 +++---- src/asktable/resources/caches.py | 6 +- src/asktable/resources/chats/chats.py | 46 +++--- src/asktable/resources/chats/messages.py | 22 +-- src/asktable/resources/dataframes.py | 6 +- .../resources/datasources/datasources.py | 106 ++++++------- src/asktable/resources/datasources/indexes.py | 26 ++-- src/asktable/resources/datasources/meta.py | 46 +++--- .../resources/datasources/upload_params.py | 14 +- src/asktable/resources/files.py | 6 +- src/asktable/resources/integration.py | 18 +-- src/asktable/resources/policies.py | 50 +++--- src/asktable/resources/polish.py | 10 +- src/asktable/resources/preferences.py | 30 ++-- src/asktable/resources/project.py | 22 +-- src/asktable/resources/roles.py | 66 ++++---- src/asktable/resources/scores.py | 6 +- src/asktable/resources/securetunnels.py | 54 +++---- src/asktable/resources/sqls.py | 34 ++--- .../resources/sys/projects/api_keys.py | 34 ++--- .../resources/sys/projects/projects.py | 58 +++---- src/asktable/resources/sys/sys.py | 10 +- src/asktable/resources/trainings.py | 42 +++--- src/asktable/resources/user/projects.py | 22 +-- tests/test_transform.py | 11 +- 38 files changed, 612 insertions(+), 596 deletions(-) diff --git a/src/asktable/__init__.py b/src/asktable/__init__.py index 03765db6..38566e5b 100644 --- a/src/asktable/__init__.py +++ b/src/asktable/__init__.py @@ -3,7 +3,7 @@ import typing as _t from . import types -from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import ( Client, @@ -48,7 +48,9 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", "Omit", + "omit", "AsktableError", "APIError", "APIStatusError", diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py index c6740ef2..c2104487 100644 --- a/src/asktable/_base_client.py +++ b/src/asktable/_base_client.py @@ -42,7 +42,6 @@ from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -57,6 +56,7 @@ RequestOptions, HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping from ._compat import PYDANTIC_V1, model_copy, model_dump @@ -145,9 +145,9 @@ def __init__( def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - json: Body | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url self.json = json @@ -595,7 +595,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -825,7 +825,7 @@ def __init__( version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1356,7 +1356,7 @@ def __init__( base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, @@ -1818,8 +1818,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} diff --git a/src/asktable/_client.py b/src/asktable/_client.py index 5c06a135..3fe572dd 100644 --- a/src/asktable/_client.py +++ b/src/asktable/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Union, Mapping +from typing import Any, Mapping from typing_extensions import Self, override import httpx @@ -11,13 +11,13 @@ from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, RequestOptions, + not_given, ) from ._utils import is_given, get_async_library from ._version import __version__ @@ -99,7 +99,7 @@ def __init__( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -195,9 +195,9 @@ def copy( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -309,7 +309,7 @@ def __init__( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -405,9 +405,9 @@ def copy( *, api_key: str | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, diff --git a/src/asktable/_qs.py b/src/asktable/_qs.py index 274320ca..ada6fd3f 100644 --- a/src/asktable/_qs.py +++ b/src/asktable/_qs.py @@ -4,7 +4,7 @@ from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ def stringify( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ def stringify_items( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -143,8 +143,8 @@ def __init__( self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/asktable/_types.py b/src/asktable/_types.py index e2c44efd..40066be4 100644 --- a/src/asktable/_types.py +++ b/src/asktable/_types.py @@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False): # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -140,13 +143,14 @@ def __repr__(self) -> str: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -156,8 +160,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -165,6 +169,9 @@ def __bool__(self) -> Literal[False]: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod diff --git a/src/asktable/_utils/_transform.py b/src/asktable/_utils/_transform.py index c19124f0..52075492 100644 --- a/src/asktable/_utils/_transform.py +++ b/src/asktable/_utils/_transform.py @@ -268,7 +268,7 @@ def _transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue @@ -434,7 +434,7 @@ async def _async_transform_typeddict( annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): if not is_given(value): - # we don't need to include `NotGiven` values here as they'll + # we don't need to include omitted values here as they'll # be stripped out before the request is sent anyway continue diff --git a/src/asktable/_utils/_utils.py b/src/asktable/_utils/_utils.py index f0818595..50d59269 100644 --- a/src/asktable/_utils/_utils.py +++ b/src/asktable/_utils/_utils.py @@ -21,7 +21,7 @@ import sniffio -from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -126,8 +126,8 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. diff --git a/src/asktable/resources/answers.py b/src/asktable/resources/answers.py index 8dbd2955..9d9e5f4a 100644 --- a/src/asktable/resources/answers.py +++ b/src/asktable/resources/answers.py @@ -7,7 +7,7 @@ import httpx from ..types import answer_list_params, answer_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -49,16 +49,16 @@ def create( *, datasource_id: str, question: str, - max_rows: Optional[int] | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, - with_json: Optional[bool] | NotGiven = NOT_GIVEN, + max_rows: Optional[int] | Omit = omit, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, + with_json: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AnswerResponse: """ 发起查询的请求 @@ -107,15 +107,15 @@ def create( def list( self, *, - datasource_id: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + datasource_id: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[AnswerResponse]: """ 获取所有的 Q2A 记录 @@ -181,16 +181,16 @@ async def create( *, datasource_id: str, question: str, - max_rows: Optional[int] | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, - with_json: Optional[bool] | NotGiven = NOT_GIVEN, + max_rows: Optional[int] | Omit = omit, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, + with_json: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AnswerResponse: """ 发起查询的请求 @@ -239,15 +239,15 @@ async def create( def list( self, *, - datasource_id: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + datasource_id: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AnswerResponse, AsyncPage[AnswerResponse]]: """ 获取所有的 Q2A 记录 diff --git a/src/asktable/resources/ats/ats.py b/src/asktable/resources/ats/ats.py index 64276c0d..0ef6a647 100644 --- a/src/asktable/resources/ats/ats.py +++ b/src/asktable/resources/ats/ats.py @@ -13,7 +13,7 @@ AsyncTaskResourceWithStreamingResponse, ) from ...types import ats_list_params, ats_create_params, ats_delete_params, ats_update_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from .test_case import ( @@ -79,7 +79,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ATSCreateResponse: """ Create Test Set Endpoint @@ -121,7 +121,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ATSRetrieveResponse: """ Get Test Set Endpoint @@ -155,7 +155,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ATSUpdateResponse: """ Update Test Set Endpoint @@ -186,14 +186,14 @@ def list( self, *, datasource_id: str, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[ATSListResponse]: """ Get Test Sets Endpoint @@ -243,7 +243,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Test Set Endpoint @@ -312,7 +312,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ATSCreateResponse: """ Create Test Set Endpoint @@ -354,7 +354,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ATSRetrieveResponse: """ Get Test Set Endpoint @@ -388,7 +388,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ATSUpdateResponse: """ Update Test Set Endpoint @@ -419,14 +419,14 @@ def list( self, *, datasource_id: str, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ATSListResponse, AsyncPage[ATSListResponse]]: """ Get Test Sets Endpoint @@ -476,7 +476,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Test Set Endpoint diff --git a/src/asktable/resources/ats/task.py b/src/asktable/resources/ats/task.py index 5d2d1393..8c384687 100644 --- a/src/asktable/resources/ats/task.py +++ b/src/asktable/resources/ats/task.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -55,7 +55,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskRetrieveResponse: """ Get Test Task Endpoint @@ -85,14 +85,14 @@ def list( self, ats_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[TaskListResponse]: """ Get Test Tasks Endpoint @@ -136,14 +136,14 @@ def get_case_tasks( ats_task_id: str, *, ats_id: str, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskGetCaseTasksResponse: """ Get Test Case Tasks Endpoint @@ -194,7 +194,7 @@ def run( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskRunResponse: """ Run Task Endpoint @@ -260,7 +260,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskRetrieveResponse: """ Get Test Task Endpoint @@ -290,14 +290,14 @@ def list( self, ats_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[TaskListResponse, AsyncPage[TaskListResponse]]: """ Get Test Tasks Endpoint @@ -341,14 +341,14 @@ async def get_case_tasks( ats_task_id: str, *, ats_id: str, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskGetCaseTasksResponse: """ Get Test Case Tasks Endpoint @@ -399,7 +399,7 @@ async def run( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TaskRunResponse: """ Run Task Endpoint diff --git a/src/asktable/resources/ats/test_case.py b/src/asktable/resources/ats/test_case.py index 58852a1a..a08fa3c9 100644 --- a/src/asktable/resources/ats/test_case.py +++ b/src/asktable/resources/ats/test_case.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -55,14 +55,14 @@ def create( *, expected_sql: str, question: str, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TestCaseCreateResponse: """ Create Test Case Endpoint @@ -113,7 +113,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TestCaseRetrieveResponse: """ Get Test Case Endpoint @@ -146,14 +146,14 @@ def update( ats_id: str, expected_sql: str, question: str, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TestCaseUpdateResponse: """ Update Test Case Endpoint @@ -200,14 +200,14 @@ def list( self, ats_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[TestCaseListResponse]: """ Get Test Cases Endpoint @@ -256,7 +256,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Test Case Endpoint @@ -309,14 +309,14 @@ async def create( *, expected_sql: str, question: str, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TestCaseCreateResponse: """ Create Test Case Endpoint @@ -367,7 +367,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TestCaseRetrieveResponse: """ Get Test Case Endpoint @@ -400,14 +400,14 @@ async def update( ats_id: str, expected_sql: str, question: str, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TestCaseUpdateResponse: """ Update Test Case Endpoint @@ -454,14 +454,14 @@ def list( self, ats_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[TestCaseListResponse, AsyncPage[TestCaseListResponse]]: """ Get Test Cases Endpoint @@ -510,7 +510,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Test Case Endpoint diff --git a/src/asktable/resources/auth.py b/src/asktable/resources/auth.py index 065e06f1..75b3433f 100644 --- a/src/asktable/resources/auth.py +++ b/src/asktable/resources/auth.py @@ -8,7 +8,7 @@ import httpx from ..types import auth_create_token_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -47,16 +47,16 @@ def with_streaming_response(self) -> AuthResourceWithStreamingResponse: def create_token( self, *, - ak_role: Literal["sys", "admin", "asker", "visitor"] | NotGiven = NOT_GIVEN, - chat_role: Optional[auth_create_token_params.ChatRole] | NotGiven = NOT_GIVEN, - token_ttl: int | NotGiven = NOT_GIVEN, - user_profile: Optional[object] | NotGiven = NOT_GIVEN, + ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, + chat_role: Optional[auth_create_token_params.ChatRole] | Omit = omit, + token_ttl: int | Omit = omit, + user_profile: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Create Token @@ -103,7 +103,7 @@ def me( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AuthMeResponse: """获取当前登录的 TokenID""" return self._get( @@ -138,16 +138,16 @@ def with_streaming_response(self) -> AsyncAuthResourceWithStreamingResponse: async def create_token( self, *, - ak_role: Literal["sys", "admin", "asker", "visitor"] | NotGiven = NOT_GIVEN, - chat_role: Optional[auth_create_token_params.ChatRole] | NotGiven = NOT_GIVEN, - token_ttl: int | NotGiven = NOT_GIVEN, - user_profile: Optional[object] | NotGiven = NOT_GIVEN, + ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, + chat_role: Optional[auth_create_token_params.ChatRole] | Omit = omit, + token_ttl: int | Omit = omit, + user_profile: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Create Token @@ -194,7 +194,7 @@ async def me( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AuthMeResponse: """获取当前登录的 TokenID""" return await self._get( diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index 7568bd9b..266458e4 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -7,7 +7,7 @@ import httpx from ..types import bot_list_params, bot_create_params, bot_invite_params, bot_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -49,23 +49,23 @@ def create( *, datasource_ids: SequenceNotStr[str], name: str, - color_theme: Optional[str] | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - extapi_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN, - magic_input: Optional[str] | NotGiven = NOT_GIVEN, - max_rows: int | NotGiven = NOT_GIVEN, - publish: bool | NotGiven = NOT_GIVEN, - query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - webhooks: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - welcome_message: Optional[str] | NotGiven = NOT_GIVEN, + color_theme: Optional[str] | Omit = omit, + debug: bool | Omit = omit, + extapi_ids: SequenceNotStr[str] | Omit = omit, + interaction_rules: Iterable[bot_create_params.InteractionRule] | Omit = omit, + magic_input: Optional[str] | Omit = omit, + max_rows: int | Omit = omit, + publish: bool | Omit = omit, + query_balance: Optional[int] | Omit = omit, + sample_questions: Optional[SequenceNotStr[str]] | Omit = omit, + webhooks: SequenceNotStr[str] | Omit = omit, + welcome_message: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ 创建一个新的 Bot @@ -140,7 +140,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ 获取某个 Bot @@ -168,26 +168,26 @@ def update( self, bot_id: str, *, - avatar_url: Optional[str] | NotGiven = NOT_GIVEN, - color_theme: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - debug: Optional[bool] | NotGiven = NOT_GIVEN, - extapi_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN, - magic_input: Optional[str] | NotGiven = NOT_GIVEN, - max_rows: Optional[int] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - publish: Optional[bool] | NotGiven = NOT_GIVEN, - query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - webhooks: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - welcome_message: Optional[str] | NotGiven = NOT_GIVEN, + avatar_url: Optional[str] | Omit = omit, + color_theme: Optional[str] | Omit = omit, + datasource_ids: Optional[SequenceNotStr[str]] | Omit = omit, + debug: Optional[bool] | Omit = omit, + extapi_ids: Optional[SequenceNotStr[str]] | Omit = omit, + interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | Omit = omit, + magic_input: Optional[str] | Omit = omit, + max_rows: Optional[int] | Omit = omit, + name: Optional[str] | Omit = omit, + publish: Optional[bool] | Omit = omit, + query_balance: Optional[int] | Omit = omit, + sample_questions: Optional[SequenceNotStr[str]] | Omit = omit, + webhooks: Optional[SequenceNotStr[str]] | Omit = omit, + welcome_message: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ 更新某个 Bot @@ -261,16 +261,16 @@ def update( def list( self, *, - bot_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + bot_ids: Optional[SequenceNotStr[str]] | Omit = omit, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Chatbot]: """ 查询所有 Bot @@ -322,7 +322,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除某个 Bot @@ -356,7 +356,7 @@ def invite( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 邀请用户加入对话 @@ -410,23 +410,23 @@ async def create( *, datasource_ids: SequenceNotStr[str], name: str, - color_theme: Optional[str] | NotGiven = NOT_GIVEN, - debug: bool | NotGiven = NOT_GIVEN, - extapi_ids: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - interaction_rules: Iterable[bot_create_params.InteractionRule] | NotGiven = NOT_GIVEN, - magic_input: Optional[str] | NotGiven = NOT_GIVEN, - max_rows: int | NotGiven = NOT_GIVEN, - publish: bool | NotGiven = NOT_GIVEN, - query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - webhooks: SequenceNotStr[str] | NotGiven = NOT_GIVEN, - welcome_message: Optional[str] | NotGiven = NOT_GIVEN, + color_theme: Optional[str] | Omit = omit, + debug: bool | Omit = omit, + extapi_ids: SequenceNotStr[str] | Omit = omit, + interaction_rules: Iterable[bot_create_params.InteractionRule] | Omit = omit, + magic_input: Optional[str] | Omit = omit, + max_rows: int | Omit = omit, + publish: bool | Omit = omit, + query_balance: Optional[int] | Omit = omit, + sample_questions: Optional[SequenceNotStr[str]] | Omit = omit, + webhooks: SequenceNotStr[str] | Omit = omit, + welcome_message: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ 创建一个新的 Bot @@ -501,7 +501,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ 获取某个 Bot @@ -529,26 +529,26 @@ async def update( self, bot_id: str, *, - avatar_url: Optional[str] | NotGiven = NOT_GIVEN, - color_theme: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - debug: Optional[bool] | NotGiven = NOT_GIVEN, - extapi_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | NotGiven = NOT_GIVEN, - magic_input: Optional[str] | NotGiven = NOT_GIVEN, - max_rows: Optional[int] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - publish: Optional[bool] | NotGiven = NOT_GIVEN, - query_balance: Optional[int] | NotGiven = NOT_GIVEN, - sample_questions: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - webhooks: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - welcome_message: Optional[str] | NotGiven = NOT_GIVEN, + avatar_url: Optional[str] | Omit = omit, + color_theme: Optional[str] | Omit = omit, + datasource_ids: Optional[SequenceNotStr[str]] | Omit = omit, + debug: Optional[bool] | Omit = omit, + extapi_ids: Optional[SequenceNotStr[str]] | Omit = omit, + interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | Omit = omit, + magic_input: Optional[str] | Omit = omit, + max_rows: Optional[int] | Omit = omit, + name: Optional[str] | Omit = omit, + publish: Optional[bool] | Omit = omit, + query_balance: Optional[int] | Omit = omit, + sample_questions: Optional[SequenceNotStr[str]] | Omit = omit, + webhooks: Optional[SequenceNotStr[str]] | Omit = omit, + welcome_message: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ 更新某个 Bot @@ -622,16 +622,16 @@ async def update( def list( self, *, - bot_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + bot_ids: Optional[SequenceNotStr[str]] | Omit = omit, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Chatbot, AsyncPage[Chatbot]]: """ 查询所有 Bot @@ -683,7 +683,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除某个 Bot @@ -717,7 +717,7 @@ async def invite( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 邀请用户加入对话 diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py index f32f3886..a65ad951 100644 --- a/src/asktable/resources/business_glossary.py +++ b/src/asktable/resources/business_glossary.py @@ -7,7 +7,7 @@ import httpx from ..types import business_glossary_list_params, business_glossary_create_params, business_glossary_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -55,7 +55,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BusinessGlossaryCreateResponse: """ 创建业务术语 @@ -87,7 +87,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EntryWithDefinition: """ 获取某个业务术语 @@ -115,17 +115,17 @@ def update( self, entry_id: str, *, - active: Optional[bool] | NotGiven = NOT_GIVEN, - aliases: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - definition: Optional[str] | NotGiven = NOT_GIVEN, - payload: Optional[object] | NotGiven = NOT_GIVEN, - term: Optional[str] | NotGiven = NOT_GIVEN, + active: Optional[bool] | Omit = omit, + aliases: Optional[SequenceNotStr[str]] | Omit = omit, + definition: Optional[str] | Omit = omit, + payload: Optional[object] | Omit = omit, + term: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Entry: """ 更新业务术语 @@ -172,15 +172,15 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - term: str | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, + term: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[EntryWithDefinition]: """ 查询所有业务术语 @@ -229,7 +229,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除某个业务术语 @@ -283,7 +283,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BusinessGlossaryCreateResponse: """ 创建业务术语 @@ -315,7 +315,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EntryWithDefinition: """ 获取某个业务术语 @@ -343,17 +343,17 @@ async def update( self, entry_id: str, *, - active: Optional[bool] | NotGiven = NOT_GIVEN, - aliases: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - definition: Optional[str] | NotGiven = NOT_GIVEN, - payload: Optional[object] | NotGiven = NOT_GIVEN, - term: Optional[str] | NotGiven = NOT_GIVEN, + active: Optional[bool] | Omit = omit, + aliases: Optional[SequenceNotStr[str]] | Omit = omit, + definition: Optional[str] | Omit = omit, + payload: Optional[object] | Omit = omit, + term: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Entry: """ 更新业务术语 @@ -400,15 +400,15 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, - term: str | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, + term: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[EntryWithDefinition, AsyncPage[EntryWithDefinition]]: """ 查询所有业务术语 @@ -457,7 +457,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除某个业务术语 diff --git a/src/asktable/resources/caches.py b/src/asktable/resources/caches.py index b89b7d6b..9c3ffe55 100644 --- a/src/asktable/resources/caches.py +++ b/src/asktable/resources/caches.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from .._types import Body, Query, Headers, NoneType, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -47,7 +47,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 清除缓存 @@ -102,7 +102,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 清除缓存 diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py index fd159838..3f7e3591 100644 --- a/src/asktable/resources/chats/chats.py +++ b/src/asktable/resources/chats/chats.py @@ -7,7 +7,7 @@ import httpx from ...types import chat_list_params, chat_create_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from .messages import ( MessagesResource, @@ -60,17 +60,17 @@ def with_streaming_response(self) -> ChatsResourceWithStreamingResponse: def create( self, *, - bot_id: Optional[str] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[Dict[str, Union[str, int, bool]]] | NotGiven = NOT_GIVEN, - user_profile: Optional[Dict[str, Union[str, int, bool]]] | NotGiven = NOT_GIVEN, + bot_id: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[Dict[str, Union[str, int, bool]]] | Omit = omit, + user_profile: Optional[Dict[str, Union[str, int, bool]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chat: """ 创建对话 @@ -123,7 +123,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ChatRetrieveResponse: """ 获取某个对话 @@ -150,14 +150,14 @@ def retrieve( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Chat]: """ 查询对话列表 @@ -203,7 +203,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 删除某个对话(包含消息) @@ -256,17 +256,17 @@ def with_streaming_response(self) -> AsyncChatsResourceWithStreamingResponse: async def create( self, *, - bot_id: Optional[str] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[Dict[str, Union[str, int, bool]]] | NotGiven = NOT_GIVEN, - user_profile: Optional[Dict[str, Union[str, int, bool]]] | NotGiven = NOT_GIVEN, + bot_id: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[Dict[str, Union[str, int, bool]]] | Omit = omit, + user_profile: Optional[Dict[str, Union[str, int, bool]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chat: """ 创建对话 @@ -319,7 +319,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ChatRetrieveResponse: """ 获取某个对话 @@ -346,14 +346,14 @@ async def retrieve( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Chat, AsyncPage[Chat]]: """ 查询对话列表 @@ -399,7 +399,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 删除某个对话(包含消息) diff --git a/src/asktable/resources/chats/messages.py b/src/asktable/resources/chats/messages.py index 7c3ca18a..8c891817 100644 --- a/src/asktable/resources/chats/messages.py +++ b/src/asktable/resources/chats/messages.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MessageCreateResponse: """ Send a message to the chat @@ -99,7 +99,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MessageRetrieveResponse: """ 查询某条消息 @@ -134,14 +134,14 @@ def list( self, chat_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[MessageListResponse]: """ 查询所有的消息 @@ -211,7 +211,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MessageCreateResponse: """ Send a message to the chat @@ -256,7 +256,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> MessageRetrieveResponse: """ 查询某条消息 @@ -291,14 +291,14 @@ def list( self, chat_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[MessageListResponse, AsyncPage[MessageListResponse]]: """ 查询所有的消息 diff --git a/src/asktable/resources/dataframes.py b/src/asktable/resources/dataframes.py index 4320689d..43a49cea 100644 --- a/src/asktable/resources/dataframes.py +++ b/src/asktable/resources/dataframes.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -48,7 +48,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DataframeRetrieveResponse: """ Get Dataframe @@ -102,7 +102,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DataframeRetrieveResponse: """ Get Dataframe diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index 20b822b0..ab762e2f 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -30,7 +30,7 @@ IndexesResourceWithStreamingResponse, AsyncIndexesResourceWithStreamingResponse, ) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes +from ..._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -117,14 +117,14 @@ def create( "hologres", "maxcompute", ], - access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Datasource: """ 创建一个新的数据源 @@ -169,7 +169,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasourceRetrieveResponse: """ 根据 id 获取指定数据源 @@ -197,8 +197,8 @@ def update( self, datasource_id: str, *, - access_config: Optional[datasource_update_params.AccessConfig] | NotGiven = NOT_GIVEN, - desc: Optional[str] | NotGiven = NOT_GIVEN, + access_config: Optional[datasource_update_params.AccessConfig] | Omit = omit, + desc: Optional[str] | Omit = omit, engine: Optional[ Literal[ "mysql", @@ -226,20 +226,20 @@ def update( "maxcompute", ] ] - | NotGiven = NOT_GIVEN, - field_count: Optional[int] | NotGiven = NOT_GIVEN, - meta_error: Optional[str] | NotGiven = NOT_GIVEN, - meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - sample_questions: Optional[str] | NotGiven = NOT_GIVEN, - schema_count: Optional[int] | NotGiven = NOT_GIVEN, - table_count: Optional[int] | NotGiven = NOT_GIVEN, + | Omit = omit, + field_count: Optional[int] | Omit = omit, + meta_error: Optional[str] | Omit = omit, + meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | Omit = omit, + name: Optional[str] | Omit = omit, + sample_questions: Optional[str] | Omit = omit, + schema_count: Optional[int] | Omit = omit, + table_count: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Datasource: """ 更新指定数据源信息 @@ -301,15 +301,15 @@ def update( def list( self, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Datasource]: """ 获取所有的数据源 @@ -356,7 +356,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 根据 id 删除指定数据源 @@ -390,7 +390,7 @@ def add_file( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 为数据源添加文件 @@ -432,7 +432,7 @@ def delete_file( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除数据源的单个文件 @@ -467,7 +467,7 @@ def retrieve_runtime_meta( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasourceRetrieveRuntimeMetaResponse: """ 获取指定数据源的运行时元数据 @@ -501,14 +501,14 @@ def update_field( identifiable_type: Optional[ Literal["plain", "person_name", "email", "ssn", "id", "phone", "address", "company", "bank_card"] ] - | NotGiven = NOT_GIVEN, - visibility: Optional[bool] | NotGiven = NOT_GIVEN, + | Omit = omit, + visibility: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 更新数据源的某个字段的描述 @@ -615,14 +615,14 @@ async def create( "hologres", "maxcompute", ], - access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Datasource: """ 创建一个新的数据源 @@ -667,7 +667,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasourceRetrieveResponse: """ 根据 id 获取指定数据源 @@ -695,8 +695,8 @@ async def update( self, datasource_id: str, *, - access_config: Optional[datasource_update_params.AccessConfig] | NotGiven = NOT_GIVEN, - desc: Optional[str] | NotGiven = NOT_GIVEN, + access_config: Optional[datasource_update_params.AccessConfig] | Omit = omit, + desc: Optional[str] | Omit = omit, engine: Optional[ Literal[ "mysql", @@ -724,20 +724,20 @@ async def update( "maxcompute", ] ] - | NotGiven = NOT_GIVEN, - field_count: Optional[int] | NotGiven = NOT_GIVEN, - meta_error: Optional[str] | NotGiven = NOT_GIVEN, - meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - sample_questions: Optional[str] | NotGiven = NOT_GIVEN, - schema_count: Optional[int] | NotGiven = NOT_GIVEN, - table_count: Optional[int] | NotGiven = NOT_GIVEN, + | Omit = omit, + field_count: Optional[int] | Omit = omit, + meta_error: Optional[str] | Omit = omit, + meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | Omit = omit, + name: Optional[str] | Omit = omit, + sample_questions: Optional[str] | Omit = omit, + schema_count: Optional[int] | Omit = omit, + table_count: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Datasource: """ 更新指定数据源信息 @@ -799,15 +799,15 @@ async def update( def list( self, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Datasource, AsyncPage[Datasource]]: """ 获取所有的数据源 @@ -854,7 +854,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 根据 id 删除指定数据源 @@ -888,7 +888,7 @@ async def add_file( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 为数据源添加文件 @@ -930,7 +930,7 @@ async def delete_file( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除数据源的单个文件 @@ -965,7 +965,7 @@ async def retrieve_runtime_meta( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasourceRetrieveRuntimeMetaResponse: """ 获取指定数据源的运行时元数据 @@ -999,14 +999,14 @@ async def update_field( identifiable_type: Optional[ Literal["plain", "person_name", "email", "ssn", "id", "phone", "address", "company", "bank_card"] ] - | NotGiven = NOT_GIVEN, - visibility: Optional[bool] | NotGiven = NOT_GIVEN, + | Omit = omit, + visibility: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 更新数据源的某个字段的描述 diff --git a/src/asktable/resources/datasources/indexes.py b/src/asktable/resources/datasources/indexes.py index 3ffd6f4a..64148b70 100644 --- a/src/asktable/resources/datasources/indexes.py +++ b/src/asktable/resources/datasources/indexes.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -49,13 +49,13 @@ def create( field_name: str, schema_name: str, table_name: str, - async_process: bool | NotGiven = NOT_GIVEN, + async_process: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 创建索引 Args: ds_id: 数据源 ID index: 索引创建参数,包含 @@ -102,14 +102,14 @@ def list( self, ds_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Index]: """ 获取数据源的所有索引 Args: ds_id: 数据源 ID Returns: 索引列表,包含索引的完整信 @@ -159,7 +159,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除索引 Args: ds_id: 数据源 ID index_id: 索引 ID @@ -213,13 +213,13 @@ async def create( field_name: str, schema_name: str, table_name: str, - async_process: bool | NotGiven = NOT_GIVEN, + async_process: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 创建索引 Args: ds_id: 数据源 ID index: 索引创建参数,包含 @@ -268,14 +268,14 @@ def list( self, ds_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Index, AsyncPage[Index]]: """ 获取数据源的所有索引 Args: ds_id: 数据源 ID Returns: 索引列表,包含索引的完整信 @@ -325,7 +325,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除索引 Args: ds_id: 数据源 ID index_id: 索引 ID diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py index 933c63e4..3c5ddde1 100644 --- a/src/asktable/resources/datasources/meta.py +++ b/src/asktable/resources/datasources/meta.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -47,16 +47,16 @@ def create( self, datasource_id: str, *, - async_process_meta: bool | NotGiven = NOT_GIVEN, - value_index: bool | NotGiven = NOT_GIVEN, - meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, + async_process_meta: bool | Omit = omit, + value_index: bool | Omit = omit, + meta: Optional[meta_create_params.Meta] | Omit = omit, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 创建数据源的 meta,如果已经存在,则删除旧的 @@ -110,7 +110,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Meta: """ 从数据源中获取最新的元数据 @@ -138,15 +138,15 @@ def update( self, datasource_id: str, *, - async_process_meta: bool | NotGiven = NOT_GIVEN, - meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, + async_process_meta: bool | Omit = omit, + meta: Optional[meta_update_params.Meta] | Omit = omit, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 用于更新 DB 类型的数据源的 Meta(增加新表或者删除老表) @@ -191,7 +191,7 @@ def annotate( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 修改数据 meta 的描述,用来修改表和字段的备注 @@ -241,16 +241,16 @@ async def create( self, datasource_id: str, *, - async_process_meta: bool | NotGiven = NOT_GIVEN, - value_index: bool | NotGiven = NOT_GIVEN, - meta: Optional[meta_create_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, + async_process_meta: bool | Omit = omit, + value_index: bool | Omit = omit, + meta: Optional[meta_create_params.Meta] | Omit = omit, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 创建数据源的 meta,如果已经存在,则删除旧的 @@ -304,7 +304,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Meta: """ 从数据源中获取最新的元数据 @@ -332,15 +332,15 @@ async def update( self, datasource_id: str, *, - async_process_meta: bool | NotGiven = NOT_GIVEN, - meta: Optional[meta_update_params.Meta] | NotGiven = NOT_GIVEN, - selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | NotGiven = NOT_GIVEN, + async_process_meta: bool | Omit = omit, + meta: Optional[meta_update_params.Meta] | Omit = omit, + selected_tables: Optional[Dict[str, SequenceNotStr[str]]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 用于更新 DB 类型的数据源的 Meta(增加新表或者删除老表) @@ -387,7 +387,7 @@ async def annotate( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 修改数据 meta 的描述,用来修改表和字段的备注 diff --git a/src/asktable/resources/datasources/upload_params.py b/src/asktable/resources/datasources/upload_params.py index 01578571..bb5637e0 100644 --- a/src/asktable/resources/datasources/upload_params.py +++ b/src/asktable/resources/datasources/upload_params.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -45,14 +45,14 @@ def with_streaming_response(self) -> UploadParamsResourceWithStreamingResponse: def create( self, *, - expiration: Optional[int] | NotGiven = NOT_GIVEN, - file_max_size: Optional[int] | NotGiven = NOT_GIVEN, + expiration: Optional[int] | Omit = omit, + file_max_size: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 获取 OSS 签名参数 @@ -109,14 +109,14 @@ def with_streaming_response(self) -> AsyncUploadParamsResourceWithStreamingRespo async def create( self, *, - expiration: Optional[int] | NotGiven = NOT_GIVEN, - file_max_size: Optional[int] | NotGiven = NOT_GIVEN, + expiration: Optional[int] | Omit = omit, + file_max_size: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 获取 OSS 签名参数 diff --git a/src/asktable/resources/files.py b/src/asktable/resources/files.py index 6673a7bf..88983f93 100644 --- a/src/asktable/resources/files.py +++ b/src/asktable/resources/files.py @@ -4,7 +4,7 @@ import httpx -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -47,7 +47,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 获取文件 @@ -101,7 +101,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 获取文件 diff --git a/src/asktable/resources/integration.py b/src/asktable/resources/integration.py index e82d2672..b3dbb640 100644 --- a/src/asktable/resources/integration.py +++ b/src/asktable/resources/integration.py @@ -7,7 +7,7 @@ import httpx from ..types import integration_excel_csv_ask_params, integration_create_excel_ds_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -48,13 +48,13 @@ def create_excel_ds( self, *, file_url: str, - value_index: bool | NotGiven = NOT_GIVEN, + value_index: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Datasource: """ 通过 Excel/CSV 文件 URL 创建数据源 @@ -91,13 +91,13 @@ def excel_csv_ask( *, file_url: str, question: str, - with_json: Optional[bool] | NotGiven = NOT_GIVEN, + with_json: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileAskResponse: """ 通过 Excel/CSV 文件 URL 添加数据并提问 @@ -158,13 +158,13 @@ async def create_excel_ds( self, *, file_url: str, - value_index: bool | NotGiven = NOT_GIVEN, + value_index: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Datasource: """ 通过 Excel/CSV 文件 URL 创建数据源 @@ -201,13 +201,13 @@ async def excel_csv_ask( *, file_url: str, question: str, - with_json: Optional[bool] | NotGiven = NOT_GIVEN, + with_json: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FileAskResponse: """ 通过 Excel/CSV 文件 URL 添加数据并提问 diff --git a/src/asktable/resources/policies.py b/src/asktable/resources/policies.py index bbe961e8..ba28635e 100644 --- a/src/asktable/resources/policies.py +++ b/src/asktable/resources/policies.py @@ -8,7 +8,7 @@ import httpx from ..types import policy_list_params, policy_create_params, policy_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr +from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Policy: """ 定义一个新的策略 @@ -101,7 +101,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Policy: """ 获取某个策略 @@ -129,15 +129,15 @@ def update( self, policy_id: str, *, - dataset_config: Optional[policy_update_params.DatasetConfig] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - permission: Optional[Literal["allow", "deny"]] | NotGiven = NOT_GIVEN, + dataset_config: Optional[policy_update_params.DatasetConfig] | Omit = omit, + name: Optional[str] | Omit = omit, + permission: Optional[Literal["allow", "deny"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Policy: """ 更新某个策略 @@ -178,16 +178,16 @@ def update( def list( self, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + policy_ids: Optional[SequenceNotStr[str]] | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Policy]: """ 查询所有策略 @@ -239,7 +239,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 删除某个策略 @@ -296,7 +296,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Policy: """ 定义一个新的策略 @@ -341,7 +341,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Policy: """ 获取某个策略 @@ -369,15 +369,15 @@ async def update( self, policy_id: str, *, - dataset_config: Optional[policy_update_params.DatasetConfig] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - permission: Optional[Literal["allow", "deny"]] | NotGiven = NOT_GIVEN, + dataset_config: Optional[policy_update_params.DatasetConfig] | Omit = omit, + name: Optional[str] | Omit = omit, + permission: Optional[Literal["allow", "deny"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Policy: """ 更新某个策略 @@ -418,16 +418,16 @@ async def update( def list( self, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + policy_ids: Optional[SequenceNotStr[str]] | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Policy, AsyncPage[Policy]]: """ 查询所有策略 @@ -479,7 +479,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 删除某个策略 diff --git a/src/asktable/resources/polish.py b/src/asktable/resources/polish.py index 23df7f15..4cacff21 100644 --- a/src/asktable/resources/polish.py +++ b/src/asktable/resources/polish.py @@ -7,7 +7,7 @@ import httpx from ..types import polish_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -48,13 +48,13 @@ def create( *, max_word_count: int, user_desc: str, - polish_mode: Literal[0] | NotGiven = NOT_GIVEN, + polish_mode: Literal[0] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PolishCreateResponse: """ Polish Table Desc @@ -116,13 +116,13 @@ async def create( *, max_word_count: int, user_desc: str, - polish_mode: Literal[0] | NotGiven = NOT_GIVEN, + polish_mode: Literal[0] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PolishCreateResponse: """ Polish Table Desc diff --git a/src/asktable/resources/preferences.py b/src/asktable/resources/preferences.py index a96452be..69b0313c 100644 --- a/src/asktable/resources/preferences.py +++ b/src/asktable/resources/preferences.py @@ -7,7 +7,7 @@ import httpx from ..types import preference_create_params, preference_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -49,13 +49,13 @@ def create( self, *, general_preference: str, - sql_preference: Optional[str] | NotGiven = NOT_GIVEN, + sql_preference: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PreferenceCreateResponse: """ 创建偏好设置 @@ -96,7 +96,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PreferenceRetrieveResponse: """获取偏好设置""" return self._get( @@ -110,14 +110,14 @@ def retrieve( def update( self, *, - general_preference: Optional[str] | NotGiven = NOT_GIVEN, - sql_preference: Optional[str] | NotGiven = NOT_GIVEN, + general_preference: Optional[str] | Omit = omit, + sql_preference: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PreferenceUpdateResponse: """ 更新偏好设置 @@ -158,7 +158,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """删除偏好设置""" return self._delete( @@ -194,13 +194,13 @@ async def create( self, *, general_preference: str, - sql_preference: Optional[str] | NotGiven = NOT_GIVEN, + sql_preference: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PreferenceCreateResponse: """ 创建偏好设置 @@ -241,7 +241,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PreferenceRetrieveResponse: """获取偏好设置""" return await self._get( @@ -255,14 +255,14 @@ async def retrieve( async def update( self, *, - general_preference: Optional[str] | NotGiven = NOT_GIVEN, - sql_preference: Optional[str] | NotGiven = NOT_GIVEN, + general_preference: Optional[str] | Omit = omit, + sql_preference: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PreferenceUpdateResponse: """ 更新偏好设置 @@ -303,7 +303,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """删除偏好设置""" return await self._delete( diff --git a/src/asktable/resources/project.py b/src/asktable/resources/project.py index 5624ab32..f3033d69 100644 --- a/src/asktable/resources/project.py +++ b/src/asktable/resources/project.py @@ -7,7 +7,7 @@ import httpx from ..types import project_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -52,7 +52,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Get My Project""" return self._get( @@ -66,14 +66,14 @@ def retrieve( def update( self, *, - llm_model_group: Optional[str] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + llm_model_group: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Update My Project @@ -114,7 +114,7 @@ def list_model_groups( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectListModelGroupsResponse: """Get Llm Model Groups""" return self._get( @@ -154,7 +154,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Get My Project""" return await self._get( @@ -168,14 +168,14 @@ async def retrieve( async def update( self, *, - llm_model_group: Optional[str] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + llm_model_group: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Update My Project @@ -216,7 +216,7 @@ async def list_model_groups( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectListModelGroupsResponse: """Get Llm Model Groups""" return await self._get( diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py index ee40c249..44bf5e85 100644 --- a/src/asktable/resources/roles.py +++ b/src/asktable/resources/roles.py @@ -7,7 +7,7 @@ import httpx from ..types import role_list_params, role_create_params, role_update_params, role_get_variables_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -49,13 +49,13 @@ def create( self, *, name: str, - policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Role: """ 创建一个新的角色 @@ -97,7 +97,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Role: """ 获取某个角色 @@ -125,14 +125,14 @@ def update( self, role_id: str, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + policy_ids: Optional[SequenceNotStr[str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Role: """ 更新某个角色 @@ -170,16 +170,16 @@ def update( def list( self, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - role_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + role_ids: Optional[SequenceNotStr[str]] | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Role]: """ 查询所有的角色 @@ -231,7 +231,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除某个角色 @@ -264,7 +264,7 @@ def get_polices( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleGetPolicesResponse: """ 查询某个角色的所有策略 @@ -292,14 +292,14 @@ def get_variables( self, role_id: str, *, - bot_id: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + bot_id: Optional[str] | Omit = omit, + datasource_ids: Optional[SequenceNotStr[str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 查询某个角色的所有变量 @@ -362,13 +362,13 @@ async def create( self, *, name: str, - policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + policy_ids: Optional[SequenceNotStr[str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Role: """ 创建一个新的角色 @@ -410,7 +410,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Role: """ 获取某个角色 @@ -438,14 +438,14 @@ async def update( self, role_id: str, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - policy_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + policy_ids: Optional[SequenceNotStr[str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Role: """ 更新某个角色 @@ -483,16 +483,16 @@ async def update( def list( self, *, - name: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - role_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + name: Optional[str] | Omit = omit, + page: int | Omit = omit, + role_ids: Optional[SequenceNotStr[str]] | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Role, AsyncPage[Role]]: """ 查询所有的角色 @@ -544,7 +544,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 删除某个角色 @@ -577,7 +577,7 @@ async def get_polices( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RoleGetPolicesResponse: """ 查询某个角色的所有策略 @@ -605,14 +605,14 @@ async def get_variables( self, role_id: str, *, - bot_id: Optional[str] | NotGiven = NOT_GIVEN, - datasource_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, + bot_id: Optional[str] | Omit = omit, + datasource_ids: Optional[SequenceNotStr[str]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ 查询某个角色的所有变量 diff --git a/src/asktable/resources/scores.py b/src/asktable/resources/scores.py index 343a17e8..28a7c15b 100644 --- a/src/asktable/resources/scores.py +++ b/src/asktable/resources/scores.py @@ -5,7 +5,7 @@ import httpx from ..types import score_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -52,7 +52,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ScoreCreateResponse: """ Score @@ -123,7 +123,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ScoreCreateResponse: """ Score diff --git a/src/asktable/resources/securetunnels.py b/src/asktable/resources/securetunnels.py index 13476a28..94972d7c 100644 --- a/src/asktable/resources/securetunnels.py +++ b/src/asktable/resources/securetunnels.py @@ -12,7 +12,7 @@ securetunnel_update_params, securetunnel_list_links_params, ) -from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -59,7 +59,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecureTunnel: """ 创建安全隧道 @@ -93,7 +93,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecureTunnel: """ 获取某个 ATST @@ -121,15 +121,15 @@ def update( self, securetunnel_id: str, *, - client_info: Optional[object] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - unique_key: Optional[str] | NotGiven = NOT_GIVEN, + client_info: Optional[object] | Omit = omit, + name: Optional[str] | Omit = omit, + unique_key: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecureTunnel: """ 更新某个 ATST @@ -170,14 +170,14 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[SecureTunnel]: """ 查询安全隧道列表 @@ -223,7 +223,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 删除某个 ATST @@ -252,14 +252,14 @@ def list_links( self, securetunnel_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[SecuretunnelListLinksResponse]: """ 查询安全隧道的所有 Link @@ -328,7 +328,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecureTunnel: """ 创建安全隧道 @@ -362,7 +362,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecureTunnel: """ 获取某个 ATST @@ -390,15 +390,15 @@ async def update( self, securetunnel_id: str, *, - client_info: Optional[object] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, - unique_key: Optional[str] | NotGiven = NOT_GIVEN, + client_info: Optional[object] | Omit = omit, + name: Optional[str] | Omit = omit, + unique_key: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SecureTunnel: """ 更新某个 ATST @@ -439,14 +439,14 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SecureTunnel, AsyncPage[SecureTunnel]]: """ 查询安全隧道列表 @@ -492,7 +492,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ 删除某个 ATST @@ -521,14 +521,14 @@ def list_links( self, securetunnel_id: str, *, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[SecuretunnelListLinksResponse, AsyncPage[SecuretunnelListLinksResponse]]: """ 查询安全隧道的所有 Link diff --git a/src/asktable/resources/sqls.py b/src/asktable/resources/sqls.py index fc871c84..8680b02a 100644 --- a/src/asktable/resources/sqls.py +++ b/src/asktable/resources/sqls.py @@ -7,7 +7,7 @@ import httpx from ..types import sql_list_params, sql_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -49,15 +49,15 @@ def create( *, datasource_id: str, question: str, - parameterize: bool | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, + parameterize: bool | Omit = omit, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QueryResponse: """ 发起生成 sql 的请求 @@ -103,15 +103,15 @@ def create( def list( self, *, - datasource_id: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + datasource_id: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[QueryResponse]: """ 获取所有的 Q2S 记录 @@ -177,15 +177,15 @@ async def create( *, datasource_id: str, question: str, - parameterize: bool | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - role_variables: Optional[object] | NotGiven = NOT_GIVEN, + parameterize: bool | Omit = omit, + role_id: Optional[str] | Omit = omit, + role_variables: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> QueryResponse: """ 发起生成 sql 的请求 @@ -231,15 +231,15 @@ async def create( def list( self, *, - datasource_id: Optional[str] | NotGiven = NOT_GIVEN, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + datasource_id: Optional[str] | Omit = omit, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[QueryResponse, AsyncPage[QueryResponse]]: """ 获取所有的 Q2S 记录 diff --git a/src/asktable/resources/sys/projects/api_keys.py b/src/asktable/resources/sys/projects/api_keys.py index 4b17a377..a95de033 100644 --- a/src/asktable/resources/sys/projects/api_keys.py +++ b/src/asktable/resources/sys/projects/api_keys.py @@ -7,7 +7,7 @@ import httpx -from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -55,7 +55,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIKeyCreateResponse: """ 创建 API Key @@ -91,7 +91,7 @@ def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIKeyListResponse: """ List Api Keys @@ -125,7 +125,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete Api Key View @@ -156,16 +156,16 @@ def create_token( self, project_id: str, *, - ak_role: Literal["sys", "admin", "asker", "visitor"] | NotGiven = NOT_GIVEN, - chat_role: Optional[api_key_create_token_params.ChatRole] | NotGiven = NOT_GIVEN, - token_ttl: int | NotGiven = NOT_GIVEN, - user_profile: Optional[object] | NotGiven = NOT_GIVEN, + ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, + chat_role: Optional[api_key_create_token_params.ChatRole] | Omit = omit, + token_ttl: int | Omit = omit, + user_profile: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Create Token @@ -237,7 +237,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIKeyCreateResponse: """ 创建 API Key @@ -273,7 +273,7 @@ async def list( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> APIKeyListResponse: """ List Api Keys @@ -307,7 +307,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: """ Delete Api Key View @@ -338,16 +338,16 @@ async def create_token( self, project_id: str, *, - ak_role: Literal["sys", "admin", "asker", "visitor"] | NotGiven = NOT_GIVEN, - chat_role: Optional[api_key_create_token_params.ChatRole] | NotGiven = NOT_GIVEN, - token_ttl: int | NotGiven = NOT_GIVEN, - user_profile: Optional[object] | NotGiven = NOT_GIVEN, + ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, + chat_role: Optional[api_key_create_token_params.ChatRole] | Omit = omit, + token_ttl: int | Omit = omit, + user_profile: Optional[object] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Create Token diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index b4a07c78..32b6cc5b 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -14,7 +14,7 @@ APIKeysResourceWithStreamingResponse, AsyncAPIKeysResourceWithStreamingResponse, ) -from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -66,7 +66,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Create New Project @@ -100,7 +100,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Get Project @@ -128,15 +128,15 @@ def update( self, project_id: str, *, - llm_model_group: Optional[str] | NotGiven = NOT_GIVEN, - locked: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + llm_model_group: Optional[str] | Omit = omit, + locked: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Update Project @@ -177,15 +177,15 @@ def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - project_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + project_ids: Optional[SequenceNotStr[str]] | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Project]: """ Get Projects @@ -234,7 +234,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Project @@ -267,7 +267,7 @@ def export( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Export Project @@ -300,7 +300,7 @@ def import_( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Import Project @@ -331,7 +331,7 @@ def model_groups( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectModelGroupsResponse: """Get Llm Model Groups""" return self._get( @@ -376,7 +376,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Create New Project @@ -410,7 +410,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Get Project @@ -438,15 +438,15 @@ async def update( self, project_id: str, *, - llm_model_group: Optional[str] | NotGiven = NOT_GIVEN, - locked: Optional[bool] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + llm_model_group: Optional[str] | Omit = omit, + locked: Optional[bool] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Update Project @@ -487,15 +487,15 @@ async def update( def list( self, *, - page: int | NotGiven = NOT_GIVEN, - project_ids: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + project_ids: Optional[SequenceNotStr[str]] | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Project, AsyncPage[Project]]: """ Get Projects @@ -544,7 +544,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Project @@ -577,7 +577,7 @@ async def export( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Export Project @@ -610,7 +610,7 @@ async def import_( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Import Project @@ -641,7 +641,7 @@ async def model_groups( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectModelGroupsResponse: """Get Llm Model Groups""" return await self._get( diff --git a/src/asktable/resources/sys/sys.py b/src/asktable/resources/sys/sys.py index 3ab1213c..4c0bdafb 100644 --- a/src/asktable/resources/sys/sys.py +++ b/src/asktable/resources/sys/sys.py @@ -7,7 +7,7 @@ import httpx from ...types import sy_update_config_params -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -58,13 +58,13 @@ def with_streaming_response(self) -> SysResourceWithStreamingResponse: def update_config( self, *, - global_table_limit: Optional[int] | NotGiven = NOT_GIVEN, + global_table_limit: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyUpdateConfigResponse: """ Update Config @@ -119,13 +119,13 @@ def with_streaming_response(self) -> AsyncSysResourceWithStreamingResponse: async def update_config( self, *, - global_table_limit: Optional[int] | NotGiven = NOT_GIVEN, + global_table_limit: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyUpdateConfigResponse: """ Update Config diff --git a/src/asktable/resources/trainings.py b/src/asktable/resources/trainings.py index 98882a5c..4037eaf0 100644 --- a/src/asktable/resources/trainings.py +++ b/src/asktable/resources/trainings.py @@ -7,7 +7,7 @@ import httpx from ..types import training_list_params, training_create_params, training_delete_params, training_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -56,7 +56,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TrainingCreateResponse: """ Create Training Pair @@ -90,16 +90,16 @@ def update( id: str, *, datasource_id: str, - active: Optional[bool] | NotGiven = NOT_GIVEN, - question: Optional[str] | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - sql: Optional[str] | NotGiven = NOT_GIVEN, + active: Optional[bool] | Omit = omit, + question: Optional[str] | Omit = omit, + role_id: Optional[str] | Omit = omit, + sql: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TrainingUpdateResponse: """ Update Training Pair @@ -150,14 +150,14 @@ def list( self, *, datasource_id: str, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[TrainingListResponse]: """ Get Training Pairs @@ -207,7 +207,7 @@ def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Training Pair @@ -268,7 +268,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TrainingCreateResponse: """ Create Training Pair @@ -304,16 +304,16 @@ async def update( id: str, *, datasource_id: str, - active: Optional[bool] | NotGiven = NOT_GIVEN, - question: Optional[str] | NotGiven = NOT_GIVEN, - role_id: Optional[str] | NotGiven = NOT_GIVEN, - sql: Optional[str] | NotGiven = NOT_GIVEN, + active: Optional[bool] | Omit = omit, + question: Optional[str] | Omit = omit, + role_id: Optional[str] | Omit = omit, + sql: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> TrainingUpdateResponse: """ Update Training Pair @@ -366,14 +366,14 @@ def list( self, *, datasource_id: str, - page: int | NotGiven = NOT_GIVEN, - size: int | NotGiven = NOT_GIVEN, + page: int | Omit = omit, + size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[TrainingListResponse, AsyncPage[TrainingListResponse]]: """ Get Training Pairs @@ -423,7 +423,7 @@ async def delete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ Delete Training Pair diff --git a/src/asktable/resources/user/projects.py b/src/asktable/resources/user/projects.py index 27ba7426..929f5a70 100644 --- a/src/asktable/resources/user/projects.py +++ b/src/asktable/resources/user/projects.py @@ -6,7 +6,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -52,7 +52,7 @@ def retrieve_model_groups( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectRetrieveModelGroupsResponse: """Get Llm Model Groups""" return self._get( @@ -71,7 +71,7 @@ def retrieve_my_project( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Get My Project""" return self._get( @@ -85,14 +85,14 @@ def retrieve_my_project( def update_my_project( self, *, - llm_model_group: Optional[str] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + llm_model_group: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Update My Project @@ -154,7 +154,7 @@ async def retrieve_model_groups( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProjectRetrieveModelGroupsResponse: """Get Llm Model Groups""" return await self._get( @@ -173,7 +173,7 @@ async def retrieve_my_project( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """Get My Project""" return await self._get( @@ -187,14 +187,14 @@ async def retrieve_my_project( async def update_my_project( self, *, - llm_model_group: Optional[str] | NotGiven = NOT_GIVEN, - name: Optional[str] | NotGiven = NOT_GIVEN, + llm_model_group: Optional[str] | Omit = omit, + name: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Project: """ Update My Project diff --git a/tests/test_transform.py b/tests/test_transform.py index 5955375a..35192dc9 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,7 +8,7 @@ import pytest -from asktable._types import NOT_GIVEN, Base64FileInput +from asktable._types import Base64FileInput, omit, not_given from asktable._utils import ( PropertyInfo, transform as _transform, @@ -450,4 +450,11 @@ async def test_transform_skipping(use_async: bool) -> None: @pytest.mark.asyncio async def test_strips_notgiven(use_async: bool) -> None: assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} - assert await transform({"foo_bar": NOT_GIVEN}, Foo1, use_async) == {} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {} From 689b9c0c7863e30ea3a614607c1aac22f5745b52 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 03:25:38 +0000 Subject: [PATCH 045/130] feat(api): api update --- .stats.yml | 4 ++-- scripts/bootstrap | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1f8cb798..83997c32 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-0242228e003ec6c562e80cd4bb3b5429237f2168f2379ebe5ef9d9c958552482.yml -openapi_spec_hash: 772280fd4316ae74f76e3cba9f48e96d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-22dd7cc28ed94d978939dd45f82d2a12a8533c10aaac76675a61a9f5122b2d27.yml +openapi_spec_hash: ffa1f34afbb7ae20289a23d41aabd3e5 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/scripts/bootstrap b/scripts/bootstrap index e84fe62c..b430fee3 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,10 +4,18 @@ set -e cd "$(dirname "$0")/.." -if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { - echo "==> Installing Homebrew dependencies…" - brew bundle + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo } fi From 47ec4b143cac0136a2e68513063cab9cfb3044c6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:28:55 +0000 Subject: [PATCH 046/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 83997c32..ee6d0d5c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-22dd7cc28ed94d978939dd45f82d2a12a8533c10aaac76675a61a9f5122b2d27.yml -openapi_spec_hash: ffa1f34afbb7ae20289a23d41aabd3e5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f294caa7b3960f143b4188cf344c46857da5cd74c992f53cb23b9579ad1f8726.yml +openapi_spec_hash: 16e13056544a9ef3a1e97804ca585f03 config_hash: acdf4142177ed1932c2d82372693f811 From 100fe70a07e86edf3030879a7eb42d59383f18db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Sep 2025 09:24:34 +0000 Subject: [PATCH 047/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ee6d0d5c..0aaef9c1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f294caa7b3960f143b4188cf344c46857da5cd74c992f53cb23b9579ad1f8726.yml -openapi_spec_hash: 16e13056544a9ef3a1e97804ca585f03 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3d359474cf8920f3e0118848c17314077b94e5eb471453ed449a3d38956fb9b4.yml +openapi_spec_hash: 5e2ca7b599651f2059482d3be20a4588 config_hash: acdf4142177ed1932c2d82372693f811 From 8075ce84a70b999e106188d65ba5988714faf617 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Sep 2025 11:24:34 +0000 Subject: [PATCH 048/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0aaef9c1..5aa6fe91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3d359474cf8920f3e0118848c17314077b94e5eb471453ed449a3d38956fb9b4.yml -openapi_spec_hash: 5e2ca7b599651f2059482d3be20a4588 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1a95315a429783717a29f802758d0c6c7374254fbe88685b77636853382240d8.yml +openapi_spec_hash: 27489f6b39825142797aee6121007db6 config_hash: acdf4142177ed1932c2d82372693f811 From 1d6a595a9365c8976cca04003663ee0c1464b2cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 28 Sep 2025 04:24:31 +0000 Subject: [PATCH 049/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5aa6fe91..0867cd5d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1a95315a429783717a29f802758d0c6c7374254fbe88685b77636853382240d8.yml -openapi_spec_hash: 27489f6b39825142797aee6121007db6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a21c54897dbe702d2a611facfcc45f349e41f8f627536dcd21fe8aa156919ed6.yml +openapi_spec_hash: 03c623a71dfb82c0a4e386a5028b27a5 config_hash: acdf4142177ed1932c2d82372693f811 From 8e94324216695bc96c20ed8b066a342d35b1f377 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 04:25:20 +0000 Subject: [PATCH 050/130] feat(api): api update --- .stats.yml | 4 ++-- pyproject.toml | 4 ++++ src/asktable/types/ats/task_list_response.py | 2 ++ src/asktable/types/ats/task_retrieve_response.py | 2 ++ src/asktable/types/ats/task_run_response.py | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0867cd5d..6fae153e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a21c54897dbe702d2a611facfcc45f349e41f8f627536dcd21fe8aa156919ed6.yml -openapi_spec_hash: 03c623a71dfb82c0a4e386a5028b27a5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-0f348c62b98cf2720ee3067d607cafcd3b7ba1d1af2ef83d7932a2c2895f2248.yml +openapi_spec_hash: 7c840c6f09e5aca5bce65f225bf67414 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/pyproject.toml b/pyproject.toml index 6be44832..cab46ba3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,6 +224,8 @@ select = [ "B", # remove unused imports "F401", + # check for missing future annotations + "FA102", # bare except statements "E722", # unused arguments @@ -246,6 +248,8 @@ unfixable = [ "T203", ] +extend-safe-fixes = ["FA102"] + [tool.ruff.lint.flake8-tidy-imports.banned-api] "functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 17dceee1..326f8ecf 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -19,6 +19,8 @@ class ModelGroup(BaseModel): omni: str + report: str + sql: str diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index 5bf66936..156af9da 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -19,6 +19,8 @@ class ModelGroup(BaseModel): omni: str + report: str + sql: str diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index b3357fe9..dd955976 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -19,6 +19,8 @@ class ModelGroup(BaseModel): omni: str + report: str + sql: str From b48a04d53d5eacc19eebf1889c89a57235bfc9fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 10:25:21 +0000 Subject: [PATCH 051/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6fae153e..556573a3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-0f348c62b98cf2720ee3067d607cafcd3b7ba1d1af2ef83d7932a2c2895f2248.yml -openapi_spec_hash: 7c840c6f09e5aca5bce65f225bf67414 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-6e642a3ad811f8391e0f6f9644177b6d75093111e0b26753ab1be472571e55c1.yml +openapi_spec_hash: fb38fedd6a15285540b1eb45521518a8 config_hash: acdf4142177ed1932c2d82372693f811 From d3cbda00e41261e559ba2111b843b1b10f9fb772 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 08:25:18 +0000 Subject: [PATCH 052/130] feat(api): api update --- .stats.yml | 4 +- pyproject.toml | 2 +- requirements-dev.lock | 2 +- requirements.lock | 2 +- src/asktable/_streaming.py | 10 +- src/asktable/_utils/_utils.py | 2 +- .../resources/datasources/datasources.py | 4 + src/asktable/types/datasource.py | 1 + .../types/datasource_create_params.py | 1 + .../types/datasource_retrieve_response.py | 1 + .../types/datasource_update_params.py | 1 + tests/test_client.py | 362 ++++++++++-------- 12 files changed, 216 insertions(+), 176 deletions(-) diff --git a/.stats.yml b/.stats.yml index 556573a3..23c97f41 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-6e642a3ad811f8391e0f6f9644177b6d75093111e0b26753ab1be472571e55c1.yml -openapi_spec_hash: fb38fedd6a15285540b1eb45521518a8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-18a8c8242c5e5c5886a2a31908480384759e5c2239664797372c109538408917.yml +openapi_spec_hash: a7c5019fc13696353a6a97d4a68cf729 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/pyproject.toml b/pyproject.toml index cab46ba3..8c1155ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ Homepage = "https://github.com/DataMini/asktable-python" Repository = "https://github.com/DataMini/asktable-python" [project.optional-dependencies] -aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"] [tool.rye] managed = true diff --git a/requirements-dev.lock b/requirements-dev.lock index 3364cc9a..8480a541 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -56,7 +56,7 @@ httpx==0.28.1 # via asktable # via httpx-aiohttp # via respx -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via asktable idna==3.4 # via anyio diff --git a/requirements.lock b/requirements.lock index 10e18f0e..522983ef 100644 --- a/requirements.lock +++ b/requirements.lock @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via asktable # via httpx-aiohttp -httpx-aiohttp==0.1.8 +httpx-aiohttp==0.1.9 # via asktable idna==3.4 # via anyio diff --git a/src/asktable/_streaming.py b/src/asktable/_streaming.py index d37e4a40..5f2fef20 100644 --- a/src/asktable/_streaming.py +++ b/src/asktable/_streaming.py @@ -57,9 +57,8 @@ def __stream__(self) -> Iterator[_T]: for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - # Ensure the entire stream is consumed - for _sse in iterator: - ... + # As we might not fully consume the response stream, we need to close it explicitly + response.close() def __enter__(self) -> Self: return self @@ -121,9 +120,8 @@ async def __stream__(self) -> AsyncIterator[_T]: async for sse in iterator: yield process_data(data=sse.json(), cast_to=cast_to, response=response) - # Ensure the entire stream is consumed - async for _sse in iterator: - ... + # As we might not fully consume the response stream, we need to close it explicitly + await response.aclose() async def __aenter__(self) -> Self: return self diff --git a/src/asktable/_utils/_utils.py b/src/asktable/_utils/_utils.py index 50d59269..eec7f4a1 100644 --- a/src/asktable/_utils/_utils.py +++ b/src/asktable/_utils/_utils.py @@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index ab762e2f..e0bf68de 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -116,6 +116,7 @@ def create( "mogdb", "hologres", "maxcompute", + "dap", ], access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, name: Optional[str] | Omit = omit, @@ -224,6 +225,7 @@ def update( "mogdb", "hologres", "maxcompute", + "dap", ] ] | Omit = omit, @@ -614,6 +616,7 @@ async def create( "mogdb", "hologres", "maxcompute", + "dap", ], access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, name: Optional[str] | Omit = omit, @@ -722,6 +725,7 @@ async def update( "mogdb", "hologres", "maxcompute", + "dap", ] ] | Omit = omit, diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py index ac024c00..319103ca 100644 --- a/src/asktable/types/datasource.py +++ b/src/asktable/types/datasource.py @@ -40,6 +40,7 @@ class Datasource(BaseModel): "mogdb", "hologres", "maxcompute", + "dap", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py index c1fb8d06..f92c937f 100644 --- a/src/asktable/types/datasource_create_params.py +++ b/src/asktable/types/datasource_create_params.py @@ -41,6 +41,7 @@ class DatasourceCreateParams(TypedDict, total=False): "mogdb", "hologres", "maxcompute", + "dap", ] ] """数据源引擎""" diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index 9fe27b35..01ad31a3 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -95,6 +95,7 @@ class DatasourceRetrieveResponse(BaseModel): "mogdb", "hologres", "maxcompute", + "dap", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index 11a03ede..3397d6d7 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -46,6 +46,7 @@ class DatasourceUpdateParams(TypedDict, total=False): "mogdb", "hologres", "maxcompute", + "dap", ] ] """数据源引擎""" diff --git a/tests/test_client.py b/tests/test_client.py index e4071ddb..8bd5d5c3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -59,51 +59,49 @@ def _get_open_connections(client: Asktable | AsyncAsktable) -> int: class TestAsktable: - client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - def test_raw_response(self, respx_mock: MockRouter) -> None: + def test_raw_response(self, respx_mock: MockRouter, client: Asktable) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + def test_raw_response_for_binary(self, respx_mock: MockRouter, client: Asktable) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, client: Asktable) -> None: + copied = client.copy() + assert id(copied) != id(client) - copied = self.client.copy(api_key="another My API Key") + copied = client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, client: Asktable) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(client.timeout, httpx.Timeout) + copied = client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: client = Asktable( @@ -138,6 +136,7 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.close() def test_copy_default_query(self) -> None: client = Asktable( @@ -175,13 +174,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + client.close() + + def test_copy_signature(self, client: Asktable) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -192,12 +193,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, client: Asktable) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -254,14 +255,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + def test_request_timeout(self, client: Asktable) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( - FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) - ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0))) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(100.0) @@ -274,6 +273,8 @@ def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + client.close() + def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: @@ -285,6 +286,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + client.close() + # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: client = Asktable( @@ -295,6 +298,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + client.close() + # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = Asktable( @@ -305,6 +310,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + client.close() + async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: @@ -316,14 +323,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = Asktable( + test_client = Asktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = Asktable( + test_client2 = Asktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -332,10 +339,13 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + test_client.close() + test_client2.close() + def test_default_query_option(self) -> None: client = Asktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} @@ -354,8 +364,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + client.close() + + def test_request_extra_json(self, client: Asktable) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -366,7 +378,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -377,7 +389,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -388,8 +400,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Asktable) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -399,7 +411,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -410,8 +422,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Asktable) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -424,7 +436,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -438,7 +450,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -481,7 +493,7 @@ def test_multipart_repeating_array(self, client: Asktable) -> None: ] @pytest.mark.respx(base_url=base_url) - def test_basic_union_response(self, respx_mock: MockRouter) -> None: + def test_basic_union_response(self, respx_mock: MockRouter, client: Asktable) -> None: class Model1(BaseModel): name: str @@ -490,12 +502,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + def test_union_response_different_types(self, respx_mock: MockRouter, client: Asktable) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -506,18 +518,18 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter, client: Asktable) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -533,7 +545,7 @@ class Model(BaseModel): ) ) - response = self.client.get("/foo", cast_to=Model) + response = client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 @@ -545,6 +557,8 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" + client.close() + def test_base_url_env(self) -> None: with update_env(ASKTABLE_BASE_URL="http://localhost:5000/from/env"): client = Asktable(api_key=api_key, _strict_response_validation=True) @@ -572,6 +586,7 @@ def test_base_url_trailing_slash(self, client: Asktable) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -595,6 +610,7 @@ def test_base_url_no_trailing_slash(self, client: Asktable) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -618,35 +634,36 @@ def test_absolute_request_url(self, client: Asktable) -> None: ), ) assert request.url == "https://myapi.com/foo" + client.close() def test_copied_client_does_not_close_http(self) -> None: - client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied - assert not client.is_closed() + assert not test_client.is_closed() def test_client_context_manager(self) -> None: - client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - with client as c2: - assert c2 is client + test_client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) + with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + def test_client_response_validation_error(self, respx_mock: MockRouter, client: Asktable) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - self.client.get("/foo", cast_to=Model) + client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -666,11 +683,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = client.get("/foo", cast_to=Model) + response = non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + strict_client.close() + non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -693,9 +713,9 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = Asktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, client: Asktable + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) @@ -709,7 +729,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien with pytest.raises(APITimeoutError): client.datasources.with_streaming_response.create(engine="mysql").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -718,7 +738,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client with pytest.raises(APIStatusError): client.datasources.with_streaming_response.create(engine="mysql").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -824,83 +844,77 @@ def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - def test_follow_redirects(self, respx_mock: MockRouter) -> None: + def test_follow_redirects(self, respx_mock: MockRouter, client: Asktable) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: Asktable) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - self.client.post( - "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response - ) + client.post("/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response) assert exc_info.value.response.status_code == 302 assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" class TestAsyncAsktable: - client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response(self, respx_mock: MockRouter) -> None: + async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, async_client: AsyncAsktable) -> None: + copied = async_client.copy() + assert id(copied) != id(async_client) - copied = self.client.copy(api_key="another My API Key") + copied = async_client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert async_client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, async_client: AsyncAsktable) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = async_client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert async_client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(async_client.timeout, httpx.Timeout) + copied = async_client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(async_client.timeout, httpx.Timeout) - def test_copy_default_headers(self) -> None: + async def test_copy_default_headers(self) -> None: client = AsyncAsktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) @@ -933,8 +947,9 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + await client.close() - def test_copy_default_query(self) -> None: + async def test_copy_default_query(self) -> None: client = AsyncAsktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) @@ -970,13 +985,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + await client.close() + + def test_copy_signature(self, async_client: AsyncAsktable) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + async_client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(async_client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -987,12 +1004,12 @@ def test_copy_signature(self) -> None: assert copy_param is not None, f"copy() signature is missing the {name} param" @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") - def test_copy_build_request(self) -> None: + def test_copy_build_request(self, async_client: AsyncAsktable) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = async_client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -1049,12 +1066,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - async def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + async def test_request_timeout(self, async_client: AsyncAsktable) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( + request = async_client._build_request( FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) ) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1069,6 +1086,8 @@ async def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + await client.close() + async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: @@ -1080,6 +1099,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + await client.close() + # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: client = AsyncAsktable( @@ -1090,6 +1111,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + await client.close() + # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = AsyncAsktable( @@ -1100,6 +1123,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + await client.close() + def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: @@ -1110,15 +1135,15 @@ def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) - def test_default_headers_option(self) -> None: - client = AsyncAsktable( + async def test_default_headers_option(self) -> None: + test_client = AsyncAsktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = AsyncAsktable( + test_client2 = AsyncAsktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1127,11 +1152,14 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" - def test_default_query_option(self) -> None: + await test_client.close() + await test_client2.close() + + async def test_default_query_option(self) -> None: client = AsyncAsktable( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) @@ -1149,8 +1177,10 @@ def test_default_query_option(self) -> None: url = httpx.URL(request.url) assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + await client.close() + + def test_request_extra_json(self, client: Asktable) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1161,7 +1191,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1172,7 +1202,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1183,8 +1213,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Asktable) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1194,7 +1224,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1205,8 +1235,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Asktable) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1219,7 +1249,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1233,7 +1263,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1276,7 +1306,7 @@ def test_multipart_repeating_array(self, async_client: AsyncAsktable) -> None: ] @pytest.mark.respx(base_url=base_url) - async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: class Model1(BaseModel): name: str @@ -1285,12 +1315,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + async def test_union_response_different_types(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -1301,18 +1331,20 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + async def test_non_application_json_content_type_for_json_data( + self, respx_mock: MockRouter, async_client: AsyncAsktable + ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -1328,11 +1360,11 @@ class Model(BaseModel): ) ) - response = await self.client.get("/foo", cast_to=Model) + response = await async_client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 - def test_base_url_setter(self) -> None: + async def test_base_url_setter(self) -> None: client = AsyncAsktable( base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True ) @@ -1342,7 +1374,9 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" - def test_base_url_env(self) -> None: + await client.close() + + async def test_base_url_env(self) -> None: with update_env(ASKTABLE_BASE_URL="http://localhost:5000/from/env"): client = AsyncAsktable(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @@ -1362,7 +1396,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: AsyncAsktable) -> None: + async def test_base_url_trailing_slash(self, client: AsyncAsktable) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1371,6 +1405,7 @@ def test_base_url_trailing_slash(self, client: AsyncAsktable) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1387,7 +1422,7 @@ def test_base_url_trailing_slash(self, client: AsyncAsktable) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: AsyncAsktable) -> None: + async def test_base_url_no_trailing_slash(self, client: AsyncAsktable) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1396,6 +1431,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncAsktable) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1412,7 +1448,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncAsktable) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: AsyncAsktable) -> None: + async def test_absolute_request_url(self, client: AsyncAsktable) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1421,37 +1457,37 @@ def test_absolute_request_url(self, client: AsyncAsktable) -> None: ), ) assert request.url == "https://myapi.com/foo" + await client.close() async def test_copied_client_does_not_close_http(self) -> None: - client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied await asyncio.sleep(0.2) - assert not client.is_closed() + assert not test_client.is_closed() async def test_client_context_manager(self) -> None: - client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - async with client as c2: - assert c2 is client + test_client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) + async with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + async def test_client_response_validation_error(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - await self.client.get("/foo", cast_to=Model) + await async_client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) @@ -1462,7 +1498,6 @@ async def test_client_max_retries_validation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): name: str @@ -1474,11 +1509,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = await client.get("/foo", cast_to=Model) + response = await non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + await strict_client.close() + await non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -1501,13 +1539,12 @@ class Model(BaseModel): ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - @pytest.mark.asyncio - async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = AsyncAsktable(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + async def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncAsktable + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) - calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @@ -1520,7 +1557,7 @@ async def test_retrying_timeout_errors_doesnt_leak( with pytest.raises(APITimeoutError): await async_client.datasources.with_streaming_response.create(engine="mysql").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) @@ -1531,12 +1568,11 @@ async def test_retrying_status_errors_doesnt_leak( with pytest.raises(APIStatusError): await async_client.datasources.with_streaming_response.create(engine="mysql").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio @pytest.mark.parametrize("failure_mode", ["status", "exception"]) async def test_retries_taken( self, @@ -1568,7 +1604,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_omit_retry_count_header( self, async_client: AsyncAsktable, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1594,7 +1629,6 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) @mock.patch("asktable._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_overwrite_retry_count_header( self, async_client: AsyncAsktable, failures_before_success: int, respx_mock: MockRouter ) -> None: @@ -1644,26 +1678,26 @@ async def test_default_client_creation(self) -> None: ) @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: # Test that the default follow_redirects=True allows following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) - response = await self.client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + response = await async_client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) assert response.status_code == 200 assert response.json() == {"status": "ok"} @pytest.mark.respx(base_url=base_url) - async def test_follow_redirects_disabled(self, respx_mock: MockRouter) -> None: + async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: # Test that follow_redirects=False prevents following redirects respx_mock.post("/redirect").mock( return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) ) with pytest.raises(APIStatusError) as exc_info: - await self.client.post( + await async_client.post( "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response ) From d79fd224c090d22b32cc02776c5fd32ea56d2a7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Nov 2025 13:25:13 +0000 Subject: [PATCH 053/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/types/sys/model_group.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 23c97f41..9ce4b91c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-18a8c8242c5e5c5886a2a31908480384759e5c2239664797372c109538408917.yml -openapi_spec_hash: a7c5019fc13696353a6a97d4a68cf729 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-e9513714b0d3fd53715ea1a78b820e41ef772998c50ce2f77db525e5ae06430b.yml +openapi_spec_hash: 30ced87cff8e18070ff9d274acc1ba6c config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/sys/model_group.py b/src/asktable/types/sys/model_group.py index 8ddd96e3..82382099 100644 --- a/src/asktable/types/sys/model_group.py +++ b/src/asktable/types/sys/model_group.py @@ -21,5 +21,8 @@ class ModelGroup(BaseModel): omni: str """通用模型""" + report: str + """报告模型""" + sql: str """SQL 模型""" From ba7ea07eb7e7641b6a87480d27b43f178dc586ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 8 Nov 2025 03:25:18 +0000 Subject: [PATCH 054/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ce4b91c..dc9b8d51 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-e9513714b0d3fd53715ea1a78b820e41ef772998c50ce2f77db525e5ae06430b.yml -openapi_spec_hash: 30ced87cff8e18070ff9d274acc1ba6c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-cb2a1d4e3fb6dc9c3d069bb29af621d56bdb1a8a8c91b069609b61553a5fe412.yml +openapi_spec_hash: 73c32fb2d77cbe3d929f431908326a8c config_hash: acdf4142177ed1932c2d82372693f811 From 1d758e9c4317d29e552671e52cd1e9d26283ebfc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 8 Nov 2025 10:25:17 +0000 Subject: [PATCH 055/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dc9b8d51..bf1951cc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-cb2a1d4e3fb6dc9c3d069bb29af621d56bdb1a8a8c91b069609b61553a5fe412.yml -openapi_spec_hash: 73c32fb2d77cbe3d929f431908326a8c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-b36f701c04abcf61d3615c533a0ee99776337d65ac04c469a45405c63dd0305c.yml +openapi_spec_hash: cf58600db2d11c0e473db100ff84e486 config_hash: acdf4142177ed1932c2d82372693f811 From 94adaeae5c0a3ab51b8d4f9ef9acba27d87efc06 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Nov 2025 08:24:35 +0000 Subject: [PATCH 056/130] feat(api): api update --- .stats.yml | 4 +-- README.md | 4 +-- pyproject.toml | 5 ++-- src/asktable/_models.py | 52 +++++++++++++++++++++++++----------- src/asktable/_utils/_sync.py | 34 +++-------------------- tests/test_models.py | 8 +++--- 6 files changed, 50 insertions(+), 57 deletions(-) diff --git a/.stats.yml b/.stats.yml index bf1951cc..b34bd061 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-b36f701c04abcf61d3615c533a0ee99776337d65ac04c469a45405c63dd0305c.yml -openapi_spec_hash: cf58600db2d11c0e473db100ff84e486 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-40acbccadc351baeb931b6a1e9bba91dfa83052282f6235bdf7ef3ced6f44952.yml +openapi_spec_hash: 59e26f5aa5ba8d36dc3c03f86cf0bc11 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/README.md b/README.md index cab856b6..8931e720 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![PyPI version](https://img.shields.io/pypi/v/asktable.svg?label=pypi%20(stable))](https://pypi.org/project/asktable/) -The Asktable Python library provides convenient access to the Asktable REST API from any Python 3.8+ +The Asktable Python library provides convenient access to the Asktable REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). @@ -469,7 +469,7 @@ print(asktable.__version__) ## Requirements -Python 3.8 or higher. +Python 3.9 or higher. ## Contributing diff --git a/pyproject.toml b/pyproject.toml index 8c1155ca..9d6bc938 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,11 +15,10 @@ dependencies = [ "distro>=1.7.0, <2", "sniffio", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -141,7 +140,7 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.8" +pythonVersion = "3.9" exclude = [ "_dev", diff --git a/src/asktable/_models.py b/src/asktable/_models.py index 6a3cd1d2..ca9500b2 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -2,6 +2,7 @@ import os import inspect +import weakref from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast from datetime import date, datetime from typing_extensions import ( @@ -256,15 +257,16 @@ def model_dump( mode: Literal["json", "python"] | str = "python", include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, - serialize_as_any: bool = False, fallback: Callable[[Any], Any] | None = None, + serialize_as_any: bool = False, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -272,16 +274,24 @@ def model_dump( Args: mode: The mode in which `to_python` should run. - If mode is 'json', the dictionary will only contain JSON serializable types. - If mode is 'python', the dictionary may contain any Python objects. - include: A list of fields to include in the output. - exclude: A list of fields to exclude from the output. + If mode is 'json', the output will only contain JSON serializable types. + If mode is 'python', the output may contain non-JSON-serializable Python objects. + include: A set of fields to include in the output. + exclude: A set of fields to exclude from the output. + context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. - exclude_unset: Whether to exclude fields that are unset or None from the output. - exclude_defaults: Whether to exclude fields that are set to their default value from the output. - exclude_none: Whether to exclude fields that have a value of `None` from the output. - round_trip: Whether to enable serialization and deserialization round-trip support. - warnings: Whether to log warnings when invalid fields are encountered. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value. + exclude_none: Whether to exclude fields that have a value of `None`. + exclude_computed_fields: Whether to exclude computed fields. + While this can be useful for round-tripping, it is usually recommended to use the dedicated + `round_trip` parameter instead. + round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + fallback: A function to call when an unknown value is encountered. If not provided, + a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. Returns: A dictionary representation of the model. @@ -298,6 +308,8 @@ def model_dump( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, @@ -314,15 +326,17 @@ def model_dump_json( self, *, indent: int | None = None, + ensure_ascii: bool = False, include: IncEx | None = None, exclude: IncEx | None = None, + context: Any | None = None, by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, warnings: bool | Literal["none", "warn", "error"] = True, - context: dict[str, Any] | None = None, fallback: Callable[[Any], Any] | None = None, serialize_as_any: bool = False, ) -> str: @@ -354,6 +368,10 @@ def model_dump_json( raise ValueError("serialize_as_any is only supported in Pydantic v2") if fallback is not None: raise ValueError("fallback is only supported in Pydantic v2") + if ensure_ascii != False: + raise ValueError("ensure_ascii is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, @@ -573,6 +591,9 @@ class CachedDiscriminatorType(Protocol): __discriminator__: DiscriminatorDetails +DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary() + + class DiscriminatorDetails: field_name: str """The name of the discriminator field in the variant class, e.g. @@ -615,8 +636,9 @@ def __init__( def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: - if isinstance(union, CachedDiscriminatorType): - return union.__discriminator__ + cached = DISCRIMINATOR_CACHE.get(union) + if cached is not None: + return cached discriminator_field_name: str | None = None @@ -669,7 +691,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, discriminator_field=discriminator_field_name, discriminator_alias=discriminator_alias, ) - cast(CachedDiscriminatorType, union).__discriminator__ = details + DISCRIMINATOR_CACHE.setdefault(union, details) return details diff --git a/src/asktable/_utils/_sync.py b/src/asktable/_utils/_sync.py index ad7ec71b..f6027c18 100644 --- a/src/asktable/_utils/_sync.py +++ b/src/asktable/_utils/_sync.py @@ -1,10 +1,8 @@ from __future__ import annotations -import sys import asyncio import functools -import contextvars -from typing import Any, TypeVar, Callable, Awaitable +from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio @@ -15,34 +13,11 @@ T_ParamSpec = ParamSpec("T_ParamSpec") -if sys.version_info >= (3, 9): - _asyncio_to_thread = asyncio.to_thread -else: - # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread - # for Python 3.8 support - async def _asyncio_to_thread( - func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs - ) -> Any: - """Asynchronously run function *func* in a separate thread. - - Any *args and **kwargs supplied for this function are directly passed - to *func*. Also, the current :class:`contextvars.Context` is propagated, - allowing context variables from the main thread to be accessed in the - separate thread. - - Returns a coroutine that can be awaited to get the eventual result of *func*. - """ - loop = asyncio.events.get_running_loop() - ctx = contextvars.copy_context() - func_call = functools.partial(ctx.run, func, *args, **kwargs) - return await loop.run_in_executor(None, func_call) - - async def to_thread( func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs ) -> T_Retval: if sniffio.current_async_library() == "asyncio": - return await _asyncio_to_thread(func, *args, **kwargs) + return await asyncio.to_thread(func, *args, **kwargs) return await anyio.to_thread.run_sync( functools.partial(func, *args, **kwargs), @@ -53,10 +28,7 @@ async def to_thread( def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments. For python version 3.9 and above, it uses - asyncio.to_thread to run the function in a separate thread. For python version - 3.8, it uses locally defined copy of the asyncio.to_thread function which was - introduced in python 3.9. + positional and keyword arguments. Usage: diff --git a/tests/test_models.py b/tests/test_models.py index 69c74f2c..e9493521 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -9,7 +9,7 @@ from asktable._utils import PropertyInfo from asktable._compat import PYDANTIC_V1, parse_obj, model_dump, model_json -from asktable._models import BaseModel, construct_type +from asktable._models import DISCRIMINATOR_CACHE, BaseModel, construct_type class BasicModel(BaseModel): @@ -809,7 +809,7 @@ class B(BaseModel): UnionType = cast(Any, Union[A, B]) - assert not hasattr(UnionType, "__discriminator__") + assert not DISCRIMINATOR_CACHE.get(UnionType) m = construct_type( value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) @@ -818,7 +818,7 @@ class B(BaseModel): assert m.type == "b" assert m.data == "foo" # type: ignore[comparison-overlap] - discriminator = UnionType.__discriminator__ + discriminator = DISCRIMINATOR_CACHE.get(UnionType) assert discriminator is not None m = construct_type( @@ -830,7 +830,7 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache - assert UnionType.__discriminator__ is discriminator + assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator @pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") From a62c00ae12cbc0efdbcb4bdf02480ddbb36d693a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:24:37 +0000 Subject: [PATCH 057/130] feat(api): api update --- .stats.yml | 4 ++-- pyproject.toml | 1 + src/asktable/types/ats/task_list_response.py | 4 ++-- src/asktable/types/ats/task_retrieve_response.py | 4 ++-- src/asktable/types/ats/task_run_response.py | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index b34bd061..f442c392 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-40acbccadc351baeb931b6a1e9bba91dfa83052282f6235bdf7ef3ced6f44952.yml -openapi_spec_hash: 59e26f5aa5ba8d36dc3c03f86cf0bc11 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c58a5c220451e713b6321cea20fe7c4427ecf6cc556163c6dbce317b82c5c11d.yml +openapi_spec_hash: 6f6bca0735555e3f6a951fbfd4a3e4d9 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/pyproject.toml b/pyproject.toml index 9d6bc938..81d499b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 326f8ecf..7f9bf509 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -19,10 +19,10 @@ class ModelGroup(BaseModel): omni: str - report: str - sql: str + report: Optional[str] = None + class TaskListResponse(BaseModel): id: str diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index 156af9da..90f91185 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -19,10 +19,10 @@ class ModelGroup(BaseModel): omni: str - report: str - sql: str + report: Optional[str] = None + class TaskRetrieveResponse(BaseModel): id: str diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index dd955976..a38025ea 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -19,10 +19,10 @@ class ModelGroup(BaseModel): omni: str - report: str - sql: str + report: Optional[str] = None + class TaskRunResponse(BaseModel): id: str From 7581b4430410f00958523d1c3dc260de8a37faae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Nov 2025 05:24:30 +0000 Subject: [PATCH 058/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f442c392..34bb5f13 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c58a5c220451e713b6321cea20fe7c4427ecf6cc556163c6dbce317b82c5c11d.yml -openapi_spec_hash: 6f6bca0735555e3f6a951fbfd4a3e4d9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-7b57f6794be964593019ca3c60c32059d92c3c00f53719fecfaf0650c9441774.yml +openapi_spec_hash: 6166f8ce980001824df57e2df47d2ae9 config_hash: acdf4142177ed1932c2d82372693f811 From 3cfd6cec979f7f88ab7e19dba336fef790cba9a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Nov 2025 03:24:29 +0000 Subject: [PATCH 059/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 34bb5f13..7facc9f8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-7b57f6794be964593019ca3c60c32059d92c3c00f53719fecfaf0650c9441774.yml -openapi_spec_hash: 6166f8ce980001824df57e2df47d2ae9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-d3b8e027f6c508c28a20ba5acba561022c4126795849d37444deb9e9c484bd1d.yml +openapi_spec_hash: c01bce9753d98159bbe752a2e4d7a54c config_hash: acdf4142177ed1932c2d82372693f811 From 692c5e4a06ed72d630cae83806a89eb36316e647 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Dec 2025 09:23:50 +0000 Subject: [PATCH 060/130] feat(api): api update --- .stats.yml | 6 +- README.md | 3 +- api.md | 16 - pyproject.toml | 16 +- requirements-dev.lock | 112 +- requirements.lock | 39 +- scripts/lint | 9 +- src/asktable/_base_client.py | 10 +- src/asktable/_client.py | 1047 +++++++++++++---- src/asktable/_streaming.py | 22 +- src/asktable/_types.py | 5 +- src/asktable/resources/__init__.py | 14 - src/asktable/resources/bots.py | 16 - src/asktable/resources/caches.py | 164 --- src/asktable/resources/sys/sys.py | 103 -- src/asktable/types/__init__.py | 2 - src/asktable/types/ai_message.py | 2 +- src/asktable/types/answer_response.py | 3 +- src/asktable/types/ats/task_list_response.py | 2 + .../types/ats/task_retrieve_response.py | 2 + src/asktable/types/ats/task_run_response.py | 2 + .../types/auth_create_token_params.py | 2 + src/asktable/types/bot_create_params.py | 3 - src/asktable/types/bot_update_params.py | 3 - .../types/business_glossary_create_params.py | 2 + src/asktable/types/chatbot.py | 3 - src/asktable/types/entry.py | 2 + src/asktable/types/index.py | 2 + src/asktable/types/policy_create_params.py | 8 + src/asktable/types/policy_update_params.py | 8 + .../types/preference_create_response.py | 2 + .../types/preference_retrieve_response.py | 2 + .../types/preference_update_response.py | 2 + src/asktable/types/shared/policy.py | 6 + src/asktable/types/sy_update_config_params.py | 13 - .../types/sy_update_config_response.py | 12 - .../projects/api_key_create_token_params.py | 2 + src/asktable/types/tool_message.py | 2 +- src/asktable/types/user_message.py | 2 +- tests/api_resources/test_bots.py | 4 - tests/api_resources/test_caches.py | 98 -- tests/api_resources/test_sys.py | 88 -- 42 files changed, 1005 insertions(+), 856 deletions(-) delete mode 100644 src/asktable/resources/caches.py delete mode 100644 src/asktable/types/sy_update_config_params.py delete mode 100644 src/asktable/types/sy_update_config_response.py delete mode 100644 tests/api_resources/test_caches.py delete mode 100644 tests/api_resources/test_sys.py diff --git a/.stats.yml b/.stats.yml index 7facc9f8..68fe8b7c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 107 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-d3b8e027f6c508c28a20ba5acba561022c4126795849d37444deb9e9c484bd1d.yml -openapi_spec_hash: c01bce9753d98159bbe752a2e4d7a54c +configured_endpoints: 105 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-17fd9b9dcf0a4308ba53287517d0f3f82ef6bfb9b6480eae5a37ea450c9cf8c3.yml +openapi_spec_hash: 4fc942f34ec9bffbe29ea62c0491ca99 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/README.md b/README.md index 8931e720..a32428d2 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ pip install asktable[aiohttp] Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python +import os import asyncio from asktable import DefaultAioHttpClient from asktable import AsyncAsktable @@ -90,7 +91,7 @@ from asktable import AsyncAsktable async def main() -> None: async with AsyncAsktable( - api_key="My API Key", + api_key=os.environ.get("ASKTABLE_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: datasource = await client.datasources.create( diff --git a/api.md b/api.md index 4d02c1ed..998db553 100644 --- a/api.md +++ b/api.md @@ -6,16 +6,6 @@ from asktable.types import Policy # Sys -Types: - -```python -from asktable.types import SyUpdateConfigResponse -``` - -Methods: - -- client.sys.update_config(\*\*params) -> SyUpdateConfigResponse - ## Projects Types: @@ -229,12 +219,6 @@ Methods: - client.sqls.create(\*\*params) -> QueryResponse - client.sqls.list(\*\*params) -> SyncPage[QueryResponse] -# Caches - -Methods: - -- client.caches.delete(cache_id) -> None - # Integration Types: diff --git a/pyproject.toml b/pyproject.toml index 81d499b9..18cfc56b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,14 +7,16 @@ license = "Apache-2.0" authors = [ { name = "Asktable", email = "hi@datamini.ai" }, ] + dependencies = [ - "httpx>=0.23.0, <1", - "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", ] + requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", @@ -46,7 +48,7 @@ managed = true # version pins are in requirements-dev.lock dev-dependencies = [ "pyright==1.1.399", - "mypy", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", diff --git a/requirements-dev.lock b/requirements-dev.lock index 8480a541..6ff2ffd0 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,40 +12,45 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via asktable # via httpx-aiohttp -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via asktable # via httpx -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 + # via nox +backports-asyncio-runner==1.2.0 + # via pytest-asyncio +certifi==2025.11.12 # via httpcore # via httpx -colorlog==6.7.0 +colorlog==6.10.1 + # via nox +dependency-groups==1.3.1 # via nox -dirty-equals==0.6.0 -distlib==0.3.7 +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via asktable -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio # via pytest -execnet==2.1.1 +execnet==2.1.2 # via pytest-xdist -filelock==3.12.4 +filelock==3.19.1 # via virtualenv -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -58,80 +63,87 @@ httpx==0.28.1 # via respx httpx-aiohttp==0.1.9 # via asktable -idna==3.4 +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==7.0.0 -iniconfig==2.0.0 +importlib-metadata==8.7.0 +iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -mypy==1.14.1 -mypy-extensions==1.0.0 +mypy==1.17.0 +mypy-extensions==1.1.0 # via mypy -nodeenv==1.8.0 +nodeenv==1.9.1 # via pyright -nox==2023.4.22 -packaging==23.2 +nox==2025.11.12 +packaging==25.0 + # via dependency-groups # via nox # via pytest -platformdirs==3.11.0 +pathspec==0.12.1 + # via mypy +platformdirs==4.4.0 # via virtualenv -pluggy==1.5.0 +pluggy==1.6.0 # via pytest -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via asktable -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -pygments==2.18.0 +pygments==2.19.2 + # via pytest # via rich pyright==1.1.399 -pytest==8.3.3 +pytest==8.4.2 # via pytest-asyncio # via pytest-xdist -pytest-asyncio==0.24.0 -pytest-xdist==3.7.0 -python-dateutil==2.8.2 +pytest-asyncio==1.2.0 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 # via time-machine -pytz==2023.3.post1 - # via dirty-equals respx==0.22.0 -rich==13.7.1 -ruff==0.9.4 -setuptools==68.2.2 - # via nodeenv -six==1.16.0 +rich==14.2.0 +ruff==0.14.7 +six==1.17.0 # via python-dateutil -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via asktable -time-machine==2.9.0 -tomli==2.0.2 +time-machine==2.19.0 +tomli==2.3.0 + # via dependency-groups # via mypy + # via nox # via pytest -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio # via asktable + # via exceptiongroup # via multidict # via mypy # via pydantic # via pydantic-core # via pyright + # via pytest-asyncio # via typing-inspection -typing-inspection==0.4.1 + # via virtualenv +typing-inspection==0.4.2 # via pydantic -virtualenv==20.24.5 +virtualenv==20.35.4 # via nox -yarl==1.20.0 +yarl==1.22.0 # via aiohttp -zipp==3.17.0 +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index 522983ef..ff194072 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,28 +12,28 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via asktable # via httpx-aiohttp -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic -anyio==4.4.0 +anyio==4.12.0 # via asktable # via httpx async-timeout==5.0.1 # via aiohttp -attrs==25.3.0 +attrs==25.4.0 # via aiohttp -certifi==2023.7.22 +certifi==2025.11.12 # via httpcore # via httpx -distro==1.8.0 +distro==1.9.0 # via asktable -exceptiongroup==1.2.2 +exceptiongroup==1.3.1 # via anyio -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal h11==0.16.0 @@ -45,31 +45,32 @@ httpx==0.28.1 # via httpx-aiohttp httpx-aiohttp==0.1.9 # via asktable -idna==3.4 +idna==3.11 # via anyio # via httpx # via yarl -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.11.9 +pydantic==2.12.5 # via asktable -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -sniffio==1.3.0 - # via anyio +sniffio==1.3.1 # via asktable -typing-extensions==4.12.2 +typing-extensions==4.15.0 + # via aiosignal # via anyio # via asktable + # via exceptiongroup # via multidict # via pydantic # via pydantic-core # via typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic -yarl==1.20.0 +yarl==1.22.0 # via aiohttp diff --git a/scripts/lint b/scripts/lint index c49721d9..6d495229 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,8 +4,13 @@ set -e cd "$(dirname "$0")/.." -echo "==> Running lints" -rye run lint +if [ "$1" = "--fix" ]; then + echo "==> Running lints with --fix" + rye run fix:ruff +else + echo "==> Running lints" + rye run lint +fi echo "==> Making sure it imports" rye run python -c 'import asktable' diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py index c2104487..2128dcdf 100644 --- a/src/asktable/_base_client.py +++ b/src/asktable/_base_client.py @@ -1247,9 +1247,12 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + ) return self.request(cast_to, opts) def put( @@ -1767,9 +1770,12 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options + ) return await self.request(cast_to, opts) async def put( diff --git a/src/asktable/_client.py b/src/asktable/_client.py index 3fe572dd..a9923d71 100644 --- a/src/asktable/_client.py +++ b/src/asktable/_client.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Mapping +from typing import TYPE_CHECKING, Any, Mapping from typing_extensions import Self, override import httpx @@ -20,26 +20,8 @@ not_given, ) from ._utils import is_given, get_async_library +from ._compat import cached_property from ._version import __version__ -from .resources import ( - auth, - bots, - sqls, - files, - roles, - caches, - polish, - scores, - answers, - project, - policies, - trainings, - dataframes, - integration, - preferences, - securetunnels, - business_glossary, -) from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import AsktableError, APIStatusError from ._base_client import ( @@ -47,11 +29,52 @@ SyncAPIClient, AsyncAPIClient, ) -from .resources.ats import ats -from .resources.sys import sys -from .resources.user import user -from .resources.chats import chats -from .resources.datasources import datasources + +if TYPE_CHECKING: + from .resources import ( + ats, + sys, + auth, + bots, + sqls, + user, + chats, + files, + roles, + polish, + scores, + answers, + project, + policies, + trainings, + dataframes, + datasources, + integration, + preferences, + securetunnels, + business_glossary, + ) + from .resources.auth import AuthResource, AsyncAuthResource + from .resources.bots import BotsResource, AsyncBotsResource + from .resources.sqls import SqlsResource, AsyncSqlsResource + from .resources.files import FilesResource, AsyncFilesResource + from .resources.roles import RolesResource, AsyncRolesResource + from .resources.polish import PolishResource, AsyncPolishResource + from .resources.scores import ScoresResource, AsyncScoresResource + from .resources.answers import AnswersResource, AsyncAnswersResource + from .resources.ats.ats import ATSResource, AsyncATSResource + from .resources.project import ProjectResource, AsyncProjectResource + from .resources.sys.sys import SysResource, AsyncSysResource + from .resources.policies import PoliciesResource, AsyncPoliciesResource + from .resources.trainings import TrainingsResource, AsyncTrainingsResource + from .resources.user.user import UserResource, AsyncUserResource + from .resources.dataframes import DataframesResource, AsyncDataframesResource + from .resources.chats.chats import ChatsResource, AsyncChatsResource + from .resources.integration import IntegrationResource, AsyncIntegrationResource + from .resources.preferences import PreferencesResource, AsyncPreferencesResource + from .resources.securetunnels import SecuretunnelsResource, AsyncSecuretunnelsResource + from .resources.business_glossary import BusinessGlossaryResource, AsyncBusinessGlossaryResource + from .resources.datasources.datasources import DatasourcesResource, AsyncDatasourcesResource __all__ = [ "Timeout", @@ -66,31 +89,6 @@ class Asktable(SyncAPIClient): - sys: sys.SysResource - securetunnels: securetunnels.SecuretunnelsResource - roles: roles.RolesResource - policies: policies.PoliciesResource - chats: chats.ChatsResource - datasources: datasources.DatasourcesResource - bots: bots.BotsResource - auth: auth.AuthResource - answers: answers.AnswersResource - sqls: sqls.SqlsResource - caches: caches.CachesResource - integration: integration.IntegrationResource - business_glossary: business_glossary.BusinessGlossaryResource - preferences: preferences.PreferencesResource - trainings: trainings.TrainingsResource - project: project.ProjectResource - scores: scores.ScoresResource - files: files.FilesResource - dataframes: dataframes.DataframesResource - polish: polish.PolishResource - user: user.UserResource - ats: ats.ATSResource - with_raw_response: AsktableWithRawResponse - with_streaming_response: AsktableWithStreamedResponse - # client options api_key: str @@ -145,30 +143,139 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.sys = sys.SysResource(self) - self.securetunnels = securetunnels.SecuretunnelsResource(self) - self.roles = roles.RolesResource(self) - self.policies = policies.PoliciesResource(self) - self.chats = chats.ChatsResource(self) - self.datasources = datasources.DatasourcesResource(self) - self.bots = bots.BotsResource(self) - self.auth = auth.AuthResource(self) - self.answers = answers.AnswersResource(self) - self.sqls = sqls.SqlsResource(self) - self.caches = caches.CachesResource(self) - self.integration = integration.IntegrationResource(self) - self.business_glossary = business_glossary.BusinessGlossaryResource(self) - self.preferences = preferences.PreferencesResource(self) - self.trainings = trainings.TrainingsResource(self) - self.project = project.ProjectResource(self) - self.scores = scores.ScoresResource(self) - self.files = files.FilesResource(self) - self.dataframes = dataframes.DataframesResource(self) - self.polish = polish.PolishResource(self) - self.user = user.UserResource(self) - self.ats = ats.ATSResource(self) - self.with_raw_response = AsktableWithRawResponse(self) - self.with_streaming_response = AsktableWithStreamedResponse(self) + @cached_property + def sys(self) -> SysResource: + from .resources.sys import SysResource + + return SysResource(self) + + @cached_property + def securetunnels(self) -> SecuretunnelsResource: + from .resources.securetunnels import SecuretunnelsResource + + return SecuretunnelsResource(self) + + @cached_property + def roles(self) -> RolesResource: + from .resources.roles import RolesResource + + return RolesResource(self) + + @cached_property + def policies(self) -> PoliciesResource: + from .resources.policies import PoliciesResource + + return PoliciesResource(self) + + @cached_property + def chats(self) -> ChatsResource: + from .resources.chats import ChatsResource + + return ChatsResource(self) + + @cached_property + def datasources(self) -> DatasourcesResource: + from .resources.datasources import DatasourcesResource + + return DatasourcesResource(self) + + @cached_property + def bots(self) -> BotsResource: + from .resources.bots import BotsResource + + return BotsResource(self) + + @cached_property + def auth(self) -> AuthResource: + from .resources.auth import AuthResource + + return AuthResource(self) + + @cached_property + def answers(self) -> AnswersResource: + from .resources.answers import AnswersResource + + return AnswersResource(self) + + @cached_property + def sqls(self) -> SqlsResource: + from .resources.sqls import SqlsResource + + return SqlsResource(self) + + @cached_property + def integration(self) -> IntegrationResource: + from .resources.integration import IntegrationResource + + return IntegrationResource(self) + + @cached_property + def business_glossary(self) -> BusinessGlossaryResource: + from .resources.business_glossary import BusinessGlossaryResource + + return BusinessGlossaryResource(self) + + @cached_property + def preferences(self) -> PreferencesResource: + from .resources.preferences import PreferencesResource + + return PreferencesResource(self) + + @cached_property + def trainings(self) -> TrainingsResource: + from .resources.trainings import TrainingsResource + + return TrainingsResource(self) + + @cached_property + def project(self) -> ProjectResource: + from .resources.project import ProjectResource + + return ProjectResource(self) + + @cached_property + def scores(self) -> ScoresResource: + from .resources.scores import ScoresResource + + return ScoresResource(self) + + @cached_property + def files(self) -> FilesResource: + from .resources.files import FilesResource + + return FilesResource(self) + + @cached_property + def dataframes(self) -> DataframesResource: + from .resources.dataframes import DataframesResource + + return DataframesResource(self) + + @cached_property + def polish(self) -> PolishResource: + from .resources.polish import PolishResource + + return PolishResource(self) + + @cached_property + def user(self) -> UserResource: + from .resources.user import UserResource + + return UserResource(self) + + @cached_property + def ats(self) -> ATSResource: + from .resources.ats import ATSResource + + return ATSResource(self) + + @cached_property + def with_raw_response(self) -> AsktableWithRawResponse: + return AsktableWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsktableWithStreamedResponse: + return AsktableWithStreamedResponse(self) @property @override @@ -276,31 +383,6 @@ def _make_status_error( class AsyncAsktable(AsyncAPIClient): - sys: sys.AsyncSysResource - securetunnels: securetunnels.AsyncSecuretunnelsResource - roles: roles.AsyncRolesResource - policies: policies.AsyncPoliciesResource - chats: chats.AsyncChatsResource - datasources: datasources.AsyncDatasourcesResource - bots: bots.AsyncBotsResource - auth: auth.AsyncAuthResource - answers: answers.AsyncAnswersResource - sqls: sqls.AsyncSqlsResource - caches: caches.AsyncCachesResource - integration: integration.AsyncIntegrationResource - business_glossary: business_glossary.AsyncBusinessGlossaryResource - preferences: preferences.AsyncPreferencesResource - trainings: trainings.AsyncTrainingsResource - project: project.AsyncProjectResource - scores: scores.AsyncScoresResource - files: files.AsyncFilesResource - dataframes: dataframes.AsyncDataframesResource - polish: polish.AsyncPolishResource - user: user.AsyncUserResource - ats: ats.AsyncATSResource - with_raw_response: AsyncAsktableWithRawResponse - with_streaming_response: AsyncAsktableWithStreamedResponse - # client options api_key: str @@ -355,30 +437,139 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self.sys = sys.AsyncSysResource(self) - self.securetunnels = securetunnels.AsyncSecuretunnelsResource(self) - self.roles = roles.AsyncRolesResource(self) - self.policies = policies.AsyncPoliciesResource(self) - self.chats = chats.AsyncChatsResource(self) - self.datasources = datasources.AsyncDatasourcesResource(self) - self.bots = bots.AsyncBotsResource(self) - self.auth = auth.AsyncAuthResource(self) - self.answers = answers.AsyncAnswersResource(self) - self.sqls = sqls.AsyncSqlsResource(self) - self.caches = caches.AsyncCachesResource(self) - self.integration = integration.AsyncIntegrationResource(self) - self.business_glossary = business_glossary.AsyncBusinessGlossaryResource(self) - self.preferences = preferences.AsyncPreferencesResource(self) - self.trainings = trainings.AsyncTrainingsResource(self) - self.project = project.AsyncProjectResource(self) - self.scores = scores.AsyncScoresResource(self) - self.files = files.AsyncFilesResource(self) - self.dataframes = dataframes.AsyncDataframesResource(self) - self.polish = polish.AsyncPolishResource(self) - self.user = user.AsyncUserResource(self) - self.ats = ats.AsyncATSResource(self) - self.with_raw_response = AsyncAsktableWithRawResponse(self) - self.with_streaming_response = AsyncAsktableWithStreamedResponse(self) + @cached_property + def sys(self) -> AsyncSysResource: + from .resources.sys import AsyncSysResource + + return AsyncSysResource(self) + + @cached_property + def securetunnels(self) -> AsyncSecuretunnelsResource: + from .resources.securetunnels import AsyncSecuretunnelsResource + + return AsyncSecuretunnelsResource(self) + + @cached_property + def roles(self) -> AsyncRolesResource: + from .resources.roles import AsyncRolesResource + + return AsyncRolesResource(self) + + @cached_property + def policies(self) -> AsyncPoliciesResource: + from .resources.policies import AsyncPoliciesResource + + return AsyncPoliciesResource(self) + + @cached_property + def chats(self) -> AsyncChatsResource: + from .resources.chats import AsyncChatsResource + + return AsyncChatsResource(self) + + @cached_property + def datasources(self) -> AsyncDatasourcesResource: + from .resources.datasources import AsyncDatasourcesResource + + return AsyncDatasourcesResource(self) + + @cached_property + def bots(self) -> AsyncBotsResource: + from .resources.bots import AsyncBotsResource + + return AsyncBotsResource(self) + + @cached_property + def auth(self) -> AsyncAuthResource: + from .resources.auth import AsyncAuthResource + + return AsyncAuthResource(self) + + @cached_property + def answers(self) -> AsyncAnswersResource: + from .resources.answers import AsyncAnswersResource + + return AsyncAnswersResource(self) + + @cached_property + def sqls(self) -> AsyncSqlsResource: + from .resources.sqls import AsyncSqlsResource + + return AsyncSqlsResource(self) + + @cached_property + def integration(self) -> AsyncIntegrationResource: + from .resources.integration import AsyncIntegrationResource + + return AsyncIntegrationResource(self) + + @cached_property + def business_glossary(self) -> AsyncBusinessGlossaryResource: + from .resources.business_glossary import AsyncBusinessGlossaryResource + + return AsyncBusinessGlossaryResource(self) + + @cached_property + def preferences(self) -> AsyncPreferencesResource: + from .resources.preferences import AsyncPreferencesResource + + return AsyncPreferencesResource(self) + + @cached_property + def trainings(self) -> AsyncTrainingsResource: + from .resources.trainings import AsyncTrainingsResource + + return AsyncTrainingsResource(self) + + @cached_property + def project(self) -> AsyncProjectResource: + from .resources.project import AsyncProjectResource + + return AsyncProjectResource(self) + + @cached_property + def scores(self) -> AsyncScoresResource: + from .resources.scores import AsyncScoresResource + + return AsyncScoresResource(self) + + @cached_property + def files(self) -> AsyncFilesResource: + from .resources.files import AsyncFilesResource + + return AsyncFilesResource(self) + + @cached_property + def dataframes(self) -> AsyncDataframesResource: + from .resources.dataframes import AsyncDataframesResource + + return AsyncDataframesResource(self) + + @cached_property + def polish(self) -> AsyncPolishResource: + from .resources.polish import AsyncPolishResource + + return AsyncPolishResource(self) + + @cached_property + def user(self) -> AsyncUserResource: + from .resources.user import AsyncUserResource + + return AsyncUserResource(self) + + @cached_property + def ats(self) -> AsyncATSResource: + from .resources.ats import AsyncATSResource + + return AsyncATSResource(self) + + @cached_property + def with_raw_response(self) -> AsyncAsktableWithRawResponse: + return AsyncAsktableWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncAsktableWithStreamedResponse: + return AsyncAsktableWithStreamedResponse(self) @property @override @@ -486,113 +677,535 @@ def _make_status_error( class AsktableWithRawResponse: + _client: Asktable + def __init__(self, client: Asktable) -> None: - self.sys = sys.SysResourceWithRawResponse(client.sys) - self.securetunnels = securetunnels.SecuretunnelsResourceWithRawResponse(client.securetunnels) - self.roles = roles.RolesResourceWithRawResponse(client.roles) - self.policies = policies.PoliciesResourceWithRawResponse(client.policies) - self.chats = chats.ChatsResourceWithRawResponse(client.chats) - self.datasources = datasources.DatasourcesResourceWithRawResponse(client.datasources) - self.bots = bots.BotsResourceWithRawResponse(client.bots) - self.auth = auth.AuthResourceWithRawResponse(client.auth) - self.answers = answers.AnswersResourceWithRawResponse(client.answers) - self.sqls = sqls.SqlsResourceWithRawResponse(client.sqls) - self.caches = caches.CachesResourceWithRawResponse(client.caches) - self.integration = integration.IntegrationResourceWithRawResponse(client.integration) - self.business_glossary = business_glossary.BusinessGlossaryResourceWithRawResponse(client.business_glossary) - self.preferences = preferences.PreferencesResourceWithRawResponse(client.preferences) - self.trainings = trainings.TrainingsResourceWithRawResponse(client.trainings) - self.project = project.ProjectResourceWithRawResponse(client.project) - self.scores = scores.ScoresResourceWithRawResponse(client.scores) - self.files = files.FilesResourceWithRawResponse(client.files) - self.dataframes = dataframes.DataframesResourceWithRawResponse(client.dataframes) - self.polish = polish.PolishResourceWithRawResponse(client.polish) - self.user = user.UserResourceWithRawResponse(client.user) - self.ats = ats.ATSResourceWithRawResponse(client.ats) + self._client = client + + @cached_property + def sys(self) -> sys.SysResourceWithRawResponse: + from .resources.sys import SysResourceWithRawResponse + + return SysResourceWithRawResponse(self._client.sys) + + @cached_property + def securetunnels(self) -> securetunnels.SecuretunnelsResourceWithRawResponse: + from .resources.securetunnels import SecuretunnelsResourceWithRawResponse + + return SecuretunnelsResourceWithRawResponse(self._client.securetunnels) + + @cached_property + def roles(self) -> roles.RolesResourceWithRawResponse: + from .resources.roles import RolesResourceWithRawResponse + + return RolesResourceWithRawResponse(self._client.roles) + + @cached_property + def policies(self) -> policies.PoliciesResourceWithRawResponse: + from .resources.policies import PoliciesResourceWithRawResponse + + return PoliciesResourceWithRawResponse(self._client.policies) + + @cached_property + def chats(self) -> chats.ChatsResourceWithRawResponse: + from .resources.chats import ChatsResourceWithRawResponse + + return ChatsResourceWithRawResponse(self._client.chats) + + @cached_property + def datasources(self) -> datasources.DatasourcesResourceWithRawResponse: + from .resources.datasources import DatasourcesResourceWithRawResponse + + return DatasourcesResourceWithRawResponse(self._client.datasources) + + @cached_property + def bots(self) -> bots.BotsResourceWithRawResponse: + from .resources.bots import BotsResourceWithRawResponse + + return BotsResourceWithRawResponse(self._client.bots) + + @cached_property + def auth(self) -> auth.AuthResourceWithRawResponse: + from .resources.auth import AuthResourceWithRawResponse + + return AuthResourceWithRawResponse(self._client.auth) + + @cached_property + def answers(self) -> answers.AnswersResourceWithRawResponse: + from .resources.answers import AnswersResourceWithRawResponse + + return AnswersResourceWithRawResponse(self._client.answers) + + @cached_property + def sqls(self) -> sqls.SqlsResourceWithRawResponse: + from .resources.sqls import SqlsResourceWithRawResponse + + return SqlsResourceWithRawResponse(self._client.sqls) + + @cached_property + def integration(self) -> integration.IntegrationResourceWithRawResponse: + from .resources.integration import IntegrationResourceWithRawResponse + + return IntegrationResourceWithRawResponse(self._client.integration) + + @cached_property + def business_glossary(self) -> business_glossary.BusinessGlossaryResourceWithRawResponse: + from .resources.business_glossary import BusinessGlossaryResourceWithRawResponse + + return BusinessGlossaryResourceWithRawResponse(self._client.business_glossary) + + @cached_property + def preferences(self) -> preferences.PreferencesResourceWithRawResponse: + from .resources.preferences import PreferencesResourceWithRawResponse + + return PreferencesResourceWithRawResponse(self._client.preferences) + + @cached_property + def trainings(self) -> trainings.TrainingsResourceWithRawResponse: + from .resources.trainings import TrainingsResourceWithRawResponse + + return TrainingsResourceWithRawResponse(self._client.trainings) + + @cached_property + def project(self) -> project.ProjectResourceWithRawResponse: + from .resources.project import ProjectResourceWithRawResponse + + return ProjectResourceWithRawResponse(self._client.project) + + @cached_property + def scores(self) -> scores.ScoresResourceWithRawResponse: + from .resources.scores import ScoresResourceWithRawResponse + + return ScoresResourceWithRawResponse(self._client.scores) + + @cached_property + def files(self) -> files.FilesResourceWithRawResponse: + from .resources.files import FilesResourceWithRawResponse + + return FilesResourceWithRawResponse(self._client.files) + + @cached_property + def dataframes(self) -> dataframes.DataframesResourceWithRawResponse: + from .resources.dataframes import DataframesResourceWithRawResponse + + return DataframesResourceWithRawResponse(self._client.dataframes) + + @cached_property + def polish(self) -> polish.PolishResourceWithRawResponse: + from .resources.polish import PolishResourceWithRawResponse + + return PolishResourceWithRawResponse(self._client.polish) + + @cached_property + def user(self) -> user.UserResourceWithRawResponse: + from .resources.user import UserResourceWithRawResponse + + return UserResourceWithRawResponse(self._client.user) + + @cached_property + def ats(self) -> ats.ATSResourceWithRawResponse: + from .resources.ats import ATSResourceWithRawResponse + + return ATSResourceWithRawResponse(self._client.ats) class AsyncAsktableWithRawResponse: + _client: AsyncAsktable + def __init__(self, client: AsyncAsktable) -> None: - self.sys = sys.AsyncSysResourceWithRawResponse(client.sys) - self.securetunnels = securetunnels.AsyncSecuretunnelsResourceWithRawResponse(client.securetunnels) - self.roles = roles.AsyncRolesResourceWithRawResponse(client.roles) - self.policies = policies.AsyncPoliciesResourceWithRawResponse(client.policies) - self.chats = chats.AsyncChatsResourceWithRawResponse(client.chats) - self.datasources = datasources.AsyncDatasourcesResourceWithRawResponse(client.datasources) - self.bots = bots.AsyncBotsResourceWithRawResponse(client.bots) - self.auth = auth.AsyncAuthResourceWithRawResponse(client.auth) - self.answers = answers.AsyncAnswersResourceWithRawResponse(client.answers) - self.sqls = sqls.AsyncSqlsResourceWithRawResponse(client.sqls) - self.caches = caches.AsyncCachesResourceWithRawResponse(client.caches) - self.integration = integration.AsyncIntegrationResourceWithRawResponse(client.integration) - self.business_glossary = business_glossary.AsyncBusinessGlossaryResourceWithRawResponse( - client.business_glossary - ) - self.preferences = preferences.AsyncPreferencesResourceWithRawResponse(client.preferences) - self.trainings = trainings.AsyncTrainingsResourceWithRawResponse(client.trainings) - self.project = project.AsyncProjectResourceWithRawResponse(client.project) - self.scores = scores.AsyncScoresResourceWithRawResponse(client.scores) - self.files = files.AsyncFilesResourceWithRawResponse(client.files) - self.dataframes = dataframes.AsyncDataframesResourceWithRawResponse(client.dataframes) - self.polish = polish.AsyncPolishResourceWithRawResponse(client.polish) - self.user = user.AsyncUserResourceWithRawResponse(client.user) - self.ats = ats.AsyncATSResourceWithRawResponse(client.ats) + self._client = client + + @cached_property + def sys(self) -> sys.AsyncSysResourceWithRawResponse: + from .resources.sys import AsyncSysResourceWithRawResponse + + return AsyncSysResourceWithRawResponse(self._client.sys) + + @cached_property + def securetunnels(self) -> securetunnels.AsyncSecuretunnelsResourceWithRawResponse: + from .resources.securetunnels import AsyncSecuretunnelsResourceWithRawResponse + + return AsyncSecuretunnelsResourceWithRawResponse(self._client.securetunnels) + + @cached_property + def roles(self) -> roles.AsyncRolesResourceWithRawResponse: + from .resources.roles import AsyncRolesResourceWithRawResponse + + return AsyncRolesResourceWithRawResponse(self._client.roles) + + @cached_property + def policies(self) -> policies.AsyncPoliciesResourceWithRawResponse: + from .resources.policies import AsyncPoliciesResourceWithRawResponse + + return AsyncPoliciesResourceWithRawResponse(self._client.policies) + + @cached_property + def chats(self) -> chats.AsyncChatsResourceWithRawResponse: + from .resources.chats import AsyncChatsResourceWithRawResponse + + return AsyncChatsResourceWithRawResponse(self._client.chats) + + @cached_property + def datasources(self) -> datasources.AsyncDatasourcesResourceWithRawResponse: + from .resources.datasources import AsyncDatasourcesResourceWithRawResponse + + return AsyncDatasourcesResourceWithRawResponse(self._client.datasources) + + @cached_property + def bots(self) -> bots.AsyncBotsResourceWithRawResponse: + from .resources.bots import AsyncBotsResourceWithRawResponse + + return AsyncBotsResourceWithRawResponse(self._client.bots) + + @cached_property + def auth(self) -> auth.AsyncAuthResourceWithRawResponse: + from .resources.auth import AsyncAuthResourceWithRawResponse + + return AsyncAuthResourceWithRawResponse(self._client.auth) + + @cached_property + def answers(self) -> answers.AsyncAnswersResourceWithRawResponse: + from .resources.answers import AsyncAnswersResourceWithRawResponse + + return AsyncAnswersResourceWithRawResponse(self._client.answers) + + @cached_property + def sqls(self) -> sqls.AsyncSqlsResourceWithRawResponse: + from .resources.sqls import AsyncSqlsResourceWithRawResponse + + return AsyncSqlsResourceWithRawResponse(self._client.sqls) + + @cached_property + def integration(self) -> integration.AsyncIntegrationResourceWithRawResponse: + from .resources.integration import AsyncIntegrationResourceWithRawResponse + + return AsyncIntegrationResourceWithRawResponse(self._client.integration) + + @cached_property + def business_glossary(self) -> business_glossary.AsyncBusinessGlossaryResourceWithRawResponse: + from .resources.business_glossary import AsyncBusinessGlossaryResourceWithRawResponse + + return AsyncBusinessGlossaryResourceWithRawResponse(self._client.business_glossary) + + @cached_property + def preferences(self) -> preferences.AsyncPreferencesResourceWithRawResponse: + from .resources.preferences import AsyncPreferencesResourceWithRawResponse + + return AsyncPreferencesResourceWithRawResponse(self._client.preferences) + + @cached_property + def trainings(self) -> trainings.AsyncTrainingsResourceWithRawResponse: + from .resources.trainings import AsyncTrainingsResourceWithRawResponse + + return AsyncTrainingsResourceWithRawResponse(self._client.trainings) + + @cached_property + def project(self) -> project.AsyncProjectResourceWithRawResponse: + from .resources.project import AsyncProjectResourceWithRawResponse + + return AsyncProjectResourceWithRawResponse(self._client.project) + + @cached_property + def scores(self) -> scores.AsyncScoresResourceWithRawResponse: + from .resources.scores import AsyncScoresResourceWithRawResponse + + return AsyncScoresResourceWithRawResponse(self._client.scores) + + @cached_property + def files(self) -> files.AsyncFilesResourceWithRawResponse: + from .resources.files import AsyncFilesResourceWithRawResponse + + return AsyncFilesResourceWithRawResponse(self._client.files) + + @cached_property + def dataframes(self) -> dataframes.AsyncDataframesResourceWithRawResponse: + from .resources.dataframes import AsyncDataframesResourceWithRawResponse + + return AsyncDataframesResourceWithRawResponse(self._client.dataframes) + + @cached_property + def polish(self) -> polish.AsyncPolishResourceWithRawResponse: + from .resources.polish import AsyncPolishResourceWithRawResponse + + return AsyncPolishResourceWithRawResponse(self._client.polish) + + @cached_property + def user(self) -> user.AsyncUserResourceWithRawResponse: + from .resources.user import AsyncUserResourceWithRawResponse + + return AsyncUserResourceWithRawResponse(self._client.user) + + @cached_property + def ats(self) -> ats.AsyncATSResourceWithRawResponse: + from .resources.ats import AsyncATSResourceWithRawResponse + + return AsyncATSResourceWithRawResponse(self._client.ats) class AsktableWithStreamedResponse: + _client: Asktable + def __init__(self, client: Asktable) -> None: - self.sys = sys.SysResourceWithStreamingResponse(client.sys) - self.securetunnels = securetunnels.SecuretunnelsResourceWithStreamingResponse(client.securetunnels) - self.roles = roles.RolesResourceWithStreamingResponse(client.roles) - self.policies = policies.PoliciesResourceWithStreamingResponse(client.policies) - self.chats = chats.ChatsResourceWithStreamingResponse(client.chats) - self.datasources = datasources.DatasourcesResourceWithStreamingResponse(client.datasources) - self.bots = bots.BotsResourceWithStreamingResponse(client.bots) - self.auth = auth.AuthResourceWithStreamingResponse(client.auth) - self.answers = answers.AnswersResourceWithStreamingResponse(client.answers) - self.sqls = sqls.SqlsResourceWithStreamingResponse(client.sqls) - self.caches = caches.CachesResourceWithStreamingResponse(client.caches) - self.integration = integration.IntegrationResourceWithStreamingResponse(client.integration) - self.business_glossary = business_glossary.BusinessGlossaryResourceWithStreamingResponse( - client.business_glossary - ) - self.preferences = preferences.PreferencesResourceWithStreamingResponse(client.preferences) - self.trainings = trainings.TrainingsResourceWithStreamingResponse(client.trainings) - self.project = project.ProjectResourceWithStreamingResponse(client.project) - self.scores = scores.ScoresResourceWithStreamingResponse(client.scores) - self.files = files.FilesResourceWithStreamingResponse(client.files) - self.dataframes = dataframes.DataframesResourceWithStreamingResponse(client.dataframes) - self.polish = polish.PolishResourceWithStreamingResponse(client.polish) - self.user = user.UserResourceWithStreamingResponse(client.user) - self.ats = ats.ATSResourceWithStreamingResponse(client.ats) + self._client = client + + @cached_property + def sys(self) -> sys.SysResourceWithStreamingResponse: + from .resources.sys import SysResourceWithStreamingResponse + + return SysResourceWithStreamingResponse(self._client.sys) + + @cached_property + def securetunnels(self) -> securetunnels.SecuretunnelsResourceWithStreamingResponse: + from .resources.securetunnels import SecuretunnelsResourceWithStreamingResponse + + return SecuretunnelsResourceWithStreamingResponse(self._client.securetunnels) + + @cached_property + def roles(self) -> roles.RolesResourceWithStreamingResponse: + from .resources.roles import RolesResourceWithStreamingResponse + + return RolesResourceWithStreamingResponse(self._client.roles) + + @cached_property + def policies(self) -> policies.PoliciesResourceWithStreamingResponse: + from .resources.policies import PoliciesResourceWithStreamingResponse + + return PoliciesResourceWithStreamingResponse(self._client.policies) + + @cached_property + def chats(self) -> chats.ChatsResourceWithStreamingResponse: + from .resources.chats import ChatsResourceWithStreamingResponse + + return ChatsResourceWithStreamingResponse(self._client.chats) + + @cached_property + def datasources(self) -> datasources.DatasourcesResourceWithStreamingResponse: + from .resources.datasources import DatasourcesResourceWithStreamingResponse + + return DatasourcesResourceWithStreamingResponse(self._client.datasources) + + @cached_property + def bots(self) -> bots.BotsResourceWithStreamingResponse: + from .resources.bots import BotsResourceWithStreamingResponse + + return BotsResourceWithStreamingResponse(self._client.bots) + + @cached_property + def auth(self) -> auth.AuthResourceWithStreamingResponse: + from .resources.auth import AuthResourceWithStreamingResponse + + return AuthResourceWithStreamingResponse(self._client.auth) + + @cached_property + def answers(self) -> answers.AnswersResourceWithStreamingResponse: + from .resources.answers import AnswersResourceWithStreamingResponse + + return AnswersResourceWithStreamingResponse(self._client.answers) + + @cached_property + def sqls(self) -> sqls.SqlsResourceWithStreamingResponse: + from .resources.sqls import SqlsResourceWithStreamingResponse + + return SqlsResourceWithStreamingResponse(self._client.sqls) + + @cached_property + def integration(self) -> integration.IntegrationResourceWithStreamingResponse: + from .resources.integration import IntegrationResourceWithStreamingResponse + + return IntegrationResourceWithStreamingResponse(self._client.integration) + + @cached_property + def business_glossary(self) -> business_glossary.BusinessGlossaryResourceWithStreamingResponse: + from .resources.business_glossary import BusinessGlossaryResourceWithStreamingResponse + + return BusinessGlossaryResourceWithStreamingResponse(self._client.business_glossary) + + @cached_property + def preferences(self) -> preferences.PreferencesResourceWithStreamingResponse: + from .resources.preferences import PreferencesResourceWithStreamingResponse + + return PreferencesResourceWithStreamingResponse(self._client.preferences) + + @cached_property + def trainings(self) -> trainings.TrainingsResourceWithStreamingResponse: + from .resources.trainings import TrainingsResourceWithStreamingResponse + + return TrainingsResourceWithStreamingResponse(self._client.trainings) + + @cached_property + def project(self) -> project.ProjectResourceWithStreamingResponse: + from .resources.project import ProjectResourceWithStreamingResponse + + return ProjectResourceWithStreamingResponse(self._client.project) + + @cached_property + def scores(self) -> scores.ScoresResourceWithStreamingResponse: + from .resources.scores import ScoresResourceWithStreamingResponse + + return ScoresResourceWithStreamingResponse(self._client.scores) + + @cached_property + def files(self) -> files.FilesResourceWithStreamingResponse: + from .resources.files import FilesResourceWithStreamingResponse + + return FilesResourceWithStreamingResponse(self._client.files) + + @cached_property + def dataframes(self) -> dataframes.DataframesResourceWithStreamingResponse: + from .resources.dataframes import DataframesResourceWithStreamingResponse + + return DataframesResourceWithStreamingResponse(self._client.dataframes) + + @cached_property + def polish(self) -> polish.PolishResourceWithStreamingResponse: + from .resources.polish import PolishResourceWithStreamingResponse + + return PolishResourceWithStreamingResponse(self._client.polish) + + @cached_property + def user(self) -> user.UserResourceWithStreamingResponse: + from .resources.user import UserResourceWithStreamingResponse + + return UserResourceWithStreamingResponse(self._client.user) + + @cached_property + def ats(self) -> ats.ATSResourceWithStreamingResponse: + from .resources.ats import ATSResourceWithStreamingResponse + + return ATSResourceWithStreamingResponse(self._client.ats) class AsyncAsktableWithStreamedResponse: + _client: AsyncAsktable + def __init__(self, client: AsyncAsktable) -> None: - self.sys = sys.AsyncSysResourceWithStreamingResponse(client.sys) - self.securetunnels = securetunnels.AsyncSecuretunnelsResourceWithStreamingResponse(client.securetunnels) - self.roles = roles.AsyncRolesResourceWithStreamingResponse(client.roles) - self.policies = policies.AsyncPoliciesResourceWithStreamingResponse(client.policies) - self.chats = chats.AsyncChatsResourceWithStreamingResponse(client.chats) - self.datasources = datasources.AsyncDatasourcesResourceWithStreamingResponse(client.datasources) - self.bots = bots.AsyncBotsResourceWithStreamingResponse(client.bots) - self.auth = auth.AsyncAuthResourceWithStreamingResponse(client.auth) - self.answers = answers.AsyncAnswersResourceWithStreamingResponse(client.answers) - self.sqls = sqls.AsyncSqlsResourceWithStreamingResponse(client.sqls) - self.caches = caches.AsyncCachesResourceWithStreamingResponse(client.caches) - self.integration = integration.AsyncIntegrationResourceWithStreamingResponse(client.integration) - self.business_glossary = business_glossary.AsyncBusinessGlossaryResourceWithStreamingResponse( - client.business_glossary - ) - self.preferences = preferences.AsyncPreferencesResourceWithStreamingResponse(client.preferences) - self.trainings = trainings.AsyncTrainingsResourceWithStreamingResponse(client.trainings) - self.project = project.AsyncProjectResourceWithStreamingResponse(client.project) - self.scores = scores.AsyncScoresResourceWithStreamingResponse(client.scores) - self.files = files.AsyncFilesResourceWithStreamingResponse(client.files) - self.dataframes = dataframes.AsyncDataframesResourceWithStreamingResponse(client.dataframes) - self.polish = polish.AsyncPolishResourceWithStreamingResponse(client.polish) - self.user = user.AsyncUserResourceWithStreamingResponse(client.user) - self.ats = ats.AsyncATSResourceWithStreamingResponse(client.ats) + self._client = client + + @cached_property + def sys(self) -> sys.AsyncSysResourceWithStreamingResponse: + from .resources.sys import AsyncSysResourceWithStreamingResponse + + return AsyncSysResourceWithStreamingResponse(self._client.sys) + + @cached_property + def securetunnels(self) -> securetunnels.AsyncSecuretunnelsResourceWithStreamingResponse: + from .resources.securetunnels import AsyncSecuretunnelsResourceWithStreamingResponse + + return AsyncSecuretunnelsResourceWithStreamingResponse(self._client.securetunnels) + + @cached_property + def roles(self) -> roles.AsyncRolesResourceWithStreamingResponse: + from .resources.roles import AsyncRolesResourceWithStreamingResponse + + return AsyncRolesResourceWithStreamingResponse(self._client.roles) + + @cached_property + def policies(self) -> policies.AsyncPoliciesResourceWithStreamingResponse: + from .resources.policies import AsyncPoliciesResourceWithStreamingResponse + + return AsyncPoliciesResourceWithStreamingResponse(self._client.policies) + + @cached_property + def chats(self) -> chats.AsyncChatsResourceWithStreamingResponse: + from .resources.chats import AsyncChatsResourceWithStreamingResponse + + return AsyncChatsResourceWithStreamingResponse(self._client.chats) + + @cached_property + def datasources(self) -> datasources.AsyncDatasourcesResourceWithStreamingResponse: + from .resources.datasources import AsyncDatasourcesResourceWithStreamingResponse + + return AsyncDatasourcesResourceWithStreamingResponse(self._client.datasources) + + @cached_property + def bots(self) -> bots.AsyncBotsResourceWithStreamingResponse: + from .resources.bots import AsyncBotsResourceWithStreamingResponse + + return AsyncBotsResourceWithStreamingResponse(self._client.bots) + + @cached_property + def auth(self) -> auth.AsyncAuthResourceWithStreamingResponse: + from .resources.auth import AsyncAuthResourceWithStreamingResponse + + return AsyncAuthResourceWithStreamingResponse(self._client.auth) + + @cached_property + def answers(self) -> answers.AsyncAnswersResourceWithStreamingResponse: + from .resources.answers import AsyncAnswersResourceWithStreamingResponse + + return AsyncAnswersResourceWithStreamingResponse(self._client.answers) + + @cached_property + def sqls(self) -> sqls.AsyncSqlsResourceWithStreamingResponse: + from .resources.sqls import AsyncSqlsResourceWithStreamingResponse + + return AsyncSqlsResourceWithStreamingResponse(self._client.sqls) + + @cached_property + def integration(self) -> integration.AsyncIntegrationResourceWithStreamingResponse: + from .resources.integration import AsyncIntegrationResourceWithStreamingResponse + + return AsyncIntegrationResourceWithStreamingResponse(self._client.integration) + + @cached_property + def business_glossary(self) -> business_glossary.AsyncBusinessGlossaryResourceWithStreamingResponse: + from .resources.business_glossary import AsyncBusinessGlossaryResourceWithStreamingResponse + + return AsyncBusinessGlossaryResourceWithStreamingResponse(self._client.business_glossary) + + @cached_property + def preferences(self) -> preferences.AsyncPreferencesResourceWithStreamingResponse: + from .resources.preferences import AsyncPreferencesResourceWithStreamingResponse + + return AsyncPreferencesResourceWithStreamingResponse(self._client.preferences) + + @cached_property + def trainings(self) -> trainings.AsyncTrainingsResourceWithStreamingResponse: + from .resources.trainings import AsyncTrainingsResourceWithStreamingResponse + + return AsyncTrainingsResourceWithStreamingResponse(self._client.trainings) + + @cached_property + def project(self) -> project.AsyncProjectResourceWithStreamingResponse: + from .resources.project import AsyncProjectResourceWithStreamingResponse + + return AsyncProjectResourceWithStreamingResponse(self._client.project) + + @cached_property + def scores(self) -> scores.AsyncScoresResourceWithStreamingResponse: + from .resources.scores import AsyncScoresResourceWithStreamingResponse + + return AsyncScoresResourceWithStreamingResponse(self._client.scores) + + @cached_property + def files(self) -> files.AsyncFilesResourceWithStreamingResponse: + from .resources.files import AsyncFilesResourceWithStreamingResponse + + return AsyncFilesResourceWithStreamingResponse(self._client.files) + + @cached_property + def dataframes(self) -> dataframes.AsyncDataframesResourceWithStreamingResponse: + from .resources.dataframes import AsyncDataframesResourceWithStreamingResponse + + return AsyncDataframesResourceWithStreamingResponse(self._client.dataframes) + + @cached_property + def polish(self) -> polish.AsyncPolishResourceWithStreamingResponse: + from .resources.polish import AsyncPolishResourceWithStreamingResponse + + return AsyncPolishResourceWithStreamingResponse(self._client.polish) + + @cached_property + def user(self) -> user.AsyncUserResourceWithStreamingResponse: + from .resources.user import AsyncUserResourceWithStreamingResponse + + return AsyncUserResourceWithStreamingResponse(self._client.user) + + @cached_property + def ats(self) -> ats.AsyncATSResourceWithStreamingResponse: + from .resources.ats import AsyncATSResourceWithStreamingResponse + + return AsyncATSResourceWithStreamingResponse(self._client.ats) Client = Asktable diff --git a/src/asktable/_streaming.py b/src/asktable/_streaming.py index 5f2fef20..c26001ef 100644 --- a/src/asktable/_streaming.py +++ b/src/asktable/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self diff --git a/src/asktable/_types.py b/src/asktable/_types.py index 40066be4..2fc8bc04 100644 --- a/src/asktable/_types.py +++ b/src/asktable/_types.py @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False): if TYPE_CHECKING: # This works because str.__contains__ does not accept object (either in typeshed or at runtime) # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. class SequenceNotStr(Protocol[_T_co]): @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T_co]: ... - def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... - def count(self, value: Any, /) -> int: ... def __reversed__(self) -> Iterator[_T_co]: ... else: # just point this to a normal `Sequence` at runtime to avoid having to special case diff --git a/src/asktable/resources/__init__.py b/src/asktable/resources/__init__.py index 14a5d79a..d9f6dab5 100644 --- a/src/asktable/resources/__init__.py +++ b/src/asktable/resources/__init__.py @@ -72,14 +72,6 @@ RolesResourceWithStreamingResponse, AsyncRolesResourceWithStreamingResponse, ) -from .caches import ( - CachesResource, - AsyncCachesResource, - CachesResourceWithRawResponse, - AsyncCachesResourceWithRawResponse, - CachesResourceWithStreamingResponse, - AsyncCachesResourceWithStreamingResponse, -) from .polish import ( PolishResource, AsyncPolishResource, @@ -238,12 +230,6 @@ "AsyncSqlsResourceWithRawResponse", "SqlsResourceWithStreamingResponse", "AsyncSqlsResourceWithStreamingResponse", - "CachesResource", - "AsyncCachesResource", - "CachesResourceWithRawResponse", - "AsyncCachesResourceWithRawResponse", - "CachesResourceWithStreamingResponse", - "AsyncCachesResourceWithStreamingResponse", "IntegrationResource", "AsyncIntegrationResource", "IntegrationResourceWithRawResponse", diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index 266458e4..7f31c95d 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -51,7 +51,6 @@ def create( name: str, color_theme: Optional[str] | Omit = omit, debug: bool | Omit = omit, - extapi_ids: SequenceNotStr[str] | Omit = omit, interaction_rules: Iterable[bot_create_params.InteractionRule] | Omit = omit, magic_input: Optional[str] | Omit = omit, max_rows: int | Omit = omit, @@ -79,8 +78,6 @@ def create( debug: 调试模式 - extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 magic_input: 魔法提示词 @@ -113,7 +110,6 @@ def create( "name": name, "color_theme": color_theme, "debug": debug, - "extapi_ids": extapi_ids, "interaction_rules": interaction_rules, "magic_input": magic_input, "max_rows": max_rows, @@ -172,7 +168,6 @@ def update( color_theme: Optional[str] | Omit = omit, datasource_ids: Optional[SequenceNotStr[str]] | Omit = omit, debug: Optional[bool] | Omit = omit, - extapi_ids: Optional[SequenceNotStr[str]] | Omit = omit, interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | Omit = omit, magic_input: Optional[str] | Omit = omit, max_rows: Optional[int] | Omit = omit, @@ -201,8 +196,6 @@ def update( debug: 调试模式 - extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 magic_input: 魔法提示词 @@ -239,7 +232,6 @@ def update( "color_theme": color_theme, "datasource_ids": datasource_ids, "debug": debug, - "extapi_ids": extapi_ids, "interaction_rules": interaction_rules, "magic_input": magic_input, "max_rows": max_rows, @@ -412,7 +404,6 @@ async def create( name: str, color_theme: Optional[str] | Omit = omit, debug: bool | Omit = omit, - extapi_ids: SequenceNotStr[str] | Omit = omit, interaction_rules: Iterable[bot_create_params.InteractionRule] | Omit = omit, magic_input: Optional[str] | Omit = omit, max_rows: int | Omit = omit, @@ -440,8 +431,6 @@ async def create( debug: 调试模式 - extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 magic_input: 魔法提示词 @@ -474,7 +463,6 @@ async def create( "name": name, "color_theme": color_theme, "debug": debug, - "extapi_ids": extapi_ids, "interaction_rules": interaction_rules, "magic_input": magic_input, "max_rows": max_rows, @@ -533,7 +521,6 @@ async def update( color_theme: Optional[str] | Omit = omit, datasource_ids: Optional[SequenceNotStr[str]] | Omit = omit, debug: Optional[bool] | Omit = omit, - extapi_ids: Optional[SequenceNotStr[str]] | Omit = omit, interaction_rules: Optional[Iterable[bot_update_params.InteractionRule]] | Omit = omit, magic_input: Optional[str] | Omit = omit, max_rows: Optional[int] | Omit = omit, @@ -562,8 +549,6 @@ async def update( debug: 调试模式 - extapi_ids: 扩展 API ID 列表,扩展 API ID 的逗号分隔列表。 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 magic_input: 魔法提示词 @@ -600,7 +585,6 @@ async def update( "color_theme": color_theme, "datasource_ids": datasource_ids, "debug": debug, - "extapi_ids": extapi_ids, "interaction_rules": interaction_rules, "magic_input": magic_input, "max_rows": max_rows, diff --git a/src/asktable/resources/caches.py b/src/asktable/resources/caches.py deleted file mode 100644 index 9c3ffe55..00000000 --- a/src/asktable/resources/caches.py +++ /dev/null @@ -1,164 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .._types import Body, Query, Headers, NoneType, NotGiven, not_given -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from .._base_client import make_request_options - -__all__ = ["CachesResource", "AsyncCachesResource"] - - -class CachesResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CachesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers - """ - return CachesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CachesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response - """ - return CachesResourceWithStreamingResponse(self) - - def delete( - self, - cache_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - 清除缓存 - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not cache_id: - raise ValueError(f"Expected a non-empty value for `cache_id` but received {cache_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/v1/caches/{cache_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncCachesResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCachesResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers - """ - return AsyncCachesResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCachesResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response - """ - return AsyncCachesResourceWithStreamingResponse(self) - - async def delete( - self, - cache_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - 清除缓存 - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not cache_id: - raise ValueError(f"Expected a non-empty value for `cache_id` but received {cache_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/v1/caches/{cache_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class CachesResourceWithRawResponse: - def __init__(self, caches: CachesResource) -> None: - self._caches = caches - - self.delete = to_raw_response_wrapper( - caches.delete, - ) - - -class AsyncCachesResourceWithRawResponse: - def __init__(self, caches: AsyncCachesResource) -> None: - self._caches = caches - - self.delete = async_to_raw_response_wrapper( - caches.delete, - ) - - -class CachesResourceWithStreamingResponse: - def __init__(self, caches: CachesResource) -> None: - self._caches = caches - - self.delete = to_streamed_response_wrapper( - caches.delete, - ) - - -class AsyncCachesResourceWithStreamingResponse: - def __init__(self, caches: AsyncCachesResource) -> None: - self._caches = caches - - self.delete = async_to_streamed_response_wrapper( - caches.delete, - ) diff --git a/src/asktable/resources/sys/sys.py b/src/asktable/resources/sys/sys.py index 4c0bdafb..27f630db 100644 --- a/src/asktable/resources/sys/sys.py +++ b/src/asktable/resources/sys/sys.py @@ -2,22 +2,8 @@ from __future__ import annotations -from typing import Optional - -import httpx - -from ...types import sy_update_config_params -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..._base_client import make_request_options from .projects.projects import ( ProjectsResource, AsyncProjectsResource, @@ -26,7 +12,6 @@ ProjectsResourceWithStreamingResponse, AsyncProjectsResourceWithStreamingResponse, ) -from ...types.sy_update_config_response import SyUpdateConfigResponse __all__ = ["SysResource", "AsyncSysResource"] @@ -55,42 +40,6 @@ def with_streaming_response(self) -> SysResourceWithStreamingResponse: """ return SysResourceWithStreamingResponse(self) - def update_config( - self, - *, - global_table_limit: Optional[int] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyUpdateConfigResponse: - """ - Update Config - - Args: - global_table_limit: 表限制数量 - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._patch( - "/v1/sys/config", - body=maybe_transform( - {"global_table_limit": global_table_limit}, sy_update_config_params.SyUpdateConfigParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SyUpdateConfigResponse, - ) - class AsyncSysResource(AsyncAPIResource): @cached_property @@ -116,51 +65,11 @@ def with_streaming_response(self) -> AsyncSysResourceWithStreamingResponse: """ return AsyncSysResourceWithStreamingResponse(self) - async def update_config( - self, - *, - global_table_limit: Optional[int] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyUpdateConfigResponse: - """ - Update Config - - Args: - global_table_limit: 表限制数量 - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._patch( - "/v1/sys/config", - body=await async_maybe_transform( - {"global_table_limit": global_table_limit}, sy_update_config_params.SyUpdateConfigParams - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SyUpdateConfigResponse, - ) - class SysResourceWithRawResponse: def __init__(self, sys: SysResource) -> None: self._sys = sys - self.update_config = to_raw_response_wrapper( - sys.update_config, - ) - @cached_property def projects(self) -> ProjectsResourceWithRawResponse: return ProjectsResourceWithRawResponse(self._sys.projects) @@ -170,10 +79,6 @@ class AsyncSysResourceWithRawResponse: def __init__(self, sys: AsyncSysResource) -> None: self._sys = sys - self.update_config = async_to_raw_response_wrapper( - sys.update_config, - ) - @cached_property def projects(self) -> AsyncProjectsResourceWithRawResponse: return AsyncProjectsResourceWithRawResponse(self._sys.projects) @@ -183,10 +88,6 @@ class SysResourceWithStreamingResponse: def __init__(self, sys: SysResource) -> None: self._sys = sys - self.update_config = to_streamed_response_wrapper( - sys.update_config, - ) - @cached_property def projects(self) -> ProjectsResourceWithStreamingResponse: return ProjectsResourceWithStreamingResponse(self._sys.projects) @@ -196,10 +97,6 @@ class AsyncSysResourceWithStreamingResponse: def __init__(self, sys: AsyncSysResource) -> None: self._sys = sys - self.update_config = async_to_streamed_response_wrapper( - sys.update_config, - ) - @cached_property def projects(self) -> AsyncProjectsResourceWithStreamingResponse: return AsyncProjectsResourceWithStreamingResponse(self._sys.projects) diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py index 640c9f4b..066786d0 100644 --- a/src/asktable/types/__init__.py +++ b/src/asktable/types/__init__.py @@ -55,7 +55,6 @@ from .training_delete_params import TrainingDeleteParams as TrainingDeleteParams from .training_list_response import TrainingListResponse as TrainingListResponse from .training_update_params import TrainingUpdateParams as TrainingUpdateParams -from .sy_update_config_params import SyUpdateConfigParams as SyUpdateConfigParams from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams from .datasource_create_params import DatasourceCreateParams as DatasourceCreateParams from .datasource_update_params import DatasourceUpdateParams as DatasourceUpdateParams @@ -66,7 +65,6 @@ from .training_update_response import TrainingUpdateResponse as TrainingUpdateResponse from .role_get_polices_response import RoleGetPolicesResponse as RoleGetPolicesResponse from .role_get_variables_params import RoleGetVariablesParams as RoleGetVariablesParams -from .sy_update_config_response import SyUpdateConfigResponse as SyUpdateConfigResponse from .datasource_add_file_params import DatasourceAddFileParams as DatasourceAddFileParams from .preference_create_response import PreferenceCreateResponse as PreferenceCreateResponse from .preference_update_response import PreferenceUpdateResponse as PreferenceUpdateResponse diff --git a/src/asktable/types/ai_message.py b/src/asktable/types/ai_message.py index 986e1827..157a7dcc 100644 --- a/src/asktable/types/ai_message.py +++ b/src/asktable/types/ai_message.py @@ -12,7 +12,7 @@ class ContentAttachment(BaseModel): info: object - type: str + type: Literal["data_json"] """The type of the attachment""" diff --git a/src/asktable/types/answer_response.py b/src/asktable/types/answer_response.py index 04112480..7043de0f 100644 --- a/src/asktable/types/answer_response.py +++ b/src/asktable/types/answer_response.py @@ -2,6 +2,7 @@ from typing import List, Optional from datetime import datetime +from typing_extensions import Literal from .._models import BaseModel @@ -11,7 +12,7 @@ class AnswerAttachment(BaseModel): info: object - type: str + type: Literal["data_json"] """The type of the attachment""" diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 7f9bf509..5a0d599a 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -11,6 +11,8 @@ class ModelGroup(BaseModel): + """运行使用的模型组""" + agent: str fast: str diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index 90f91185..178a9c8f 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -11,6 +11,8 @@ class ModelGroup(BaseModel): + """运行使用的模型组""" + agent: str fast: str diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index a38025ea..3e291d48 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -11,6 +11,8 @@ class ModelGroup(BaseModel): + """运行使用的模型组""" + agent: str fast: str diff --git a/src/asktable/types/auth_create_token_params.py b/src/asktable/types/auth_create_token_params.py index 7764745b..2fea46ba 100644 --- a/src/asktable/types/auth_create_token_params.py +++ b/src/asktable/types/auth_create_token_params.py @@ -23,6 +23,8 @@ class AuthCreateTokenParams(TypedDict, total=False): class ChatRole(TypedDict, total=False): + """The chat role""" + role_id: Optional[str] """The chat role ID""" diff --git a/src/asktable/types/bot_create_params.py b/src/asktable/types/bot_create_params.py index 6c73b116..9cadd984 100644 --- a/src/asktable/types/bot_create_params.py +++ b/src/asktable/types/bot_create_params.py @@ -23,9 +23,6 @@ class BotCreateParams(TypedDict, total=False): debug: bool """调试模式""" - extapi_ids: SequenceNotStr[str] - """扩展 API ID 列表,扩展 API ID 的逗号分隔列表。""" - interaction_rules: Iterable[InteractionRule] """交互规则列表,用于定义 bot 的行为规则""" diff --git a/src/asktable/types/bot_update_params.py b/src/asktable/types/bot_update_params.py index a183a38e..fc5b2ba9 100644 --- a/src/asktable/types/bot_update_params.py +++ b/src/asktable/types/bot_update_params.py @@ -23,9 +23,6 @@ class BotUpdateParams(TypedDict, total=False): debug: Optional[bool] """调试模式""" - extapi_ids: Optional[SequenceNotStr[str]] - """扩展 API ID 列表,扩展 API ID 的逗号分隔列表。""" - interaction_rules: Optional[Iterable[InteractionRule]] """交互规则列表,用于定义 bot 的行为规则""" diff --git a/src/asktable/types/business_glossary_create_params.py b/src/asktable/types/business_glossary_create_params.py index b01bbcd8..e9b8fd0f 100644 --- a/src/asktable/types/business_glossary_create_params.py +++ b/src/asktable/types/business_glossary_create_params.py @@ -15,6 +15,8 @@ class BusinessGlossaryCreateParams(TypedDict, total=False): class Body(TypedDict, total=False): + """Schema for creating a new document""" + definition: Required[str] """业务术语定义""" diff --git a/src/asktable/types/chatbot.py b/src/asktable/types/chatbot.py index 2c37b41b..1bd6bd60 100644 --- a/src/asktable/types/chatbot.py +++ b/src/asktable/types/chatbot.py @@ -45,9 +45,6 @@ class Chatbot(BaseModel): debug: Optional[bool] = None """调试模式""" - extapi_ids: Optional[List[str]] = None - """扩展 API ID 列表,扩展 API ID 的逗号分隔列表。""" - interaction_rules: Optional[List[InteractionRule]] = None """交互规则列表,用于定义 bot 的行为规则""" diff --git a/src/asktable/types/entry.py b/src/asktable/types/entry.py index a4140a5d..16afd695 100644 --- a/src/asktable/types/entry.py +++ b/src/asktable/types/entry.py @@ -9,6 +9,8 @@ class Entry(BaseModel): + """Schema for document response""" + id: str """业务术语 ID""" diff --git a/src/asktable/types/index.py b/src/asktable/types/index.py index a558c037..ea46e49f 100644 --- a/src/asktable/types/index.py +++ b/src/asktable/types/index.py @@ -9,6 +9,8 @@ class Index(BaseModel): + """索引响应模型""" + id: str """索引 ID""" diff --git a/src/asktable/types/policy_create_params.py b/src/asktable/types/policy_create_params.py index 16b8de53..64ca1c7b 100644 --- a/src/asktable/types/policy_create_params.py +++ b/src/asktable/types/policy_create_params.py @@ -22,6 +22,12 @@ class PolicyCreateParams(TypedDict, total=False): class DatasetConfigRegexPatterns(TypedDict, total=False): + """ + 正则表达式。 + - 描述:用于匹配指定数据源中Schema(DB)、Table和Field名称的三个正则表达式,即同时满足这三个正则表达式的DB、Table和Field才被允许访问。 + - 注意:此字段为可选项。如果未提供,则默认包含指定数据源的所有数据。 + """ + fields_regex_pattern: Optional[str] """Field 正则表达式,空值默认全选""" @@ -33,6 +39,8 @@ class DatasetConfigRegexPatterns(TypedDict, total=False): class DatasetConfig(TypedDict, total=False): + """数据集配置""" + datasource_ids: Required[SequenceNotStr[str]] """ 数据源 ID 列表,必填。 - 描述:用于指定策略适用的数据源。可以使用通配符 _ 表示所 diff --git a/src/asktable/types/policy_update_params.py b/src/asktable/types/policy_update_params.py index a50f190c..3aae252d 100644 --- a/src/asktable/types/policy_update_params.py +++ b/src/asktable/types/policy_update_params.py @@ -22,6 +22,12 @@ class PolicyUpdateParams(TypedDict, total=False): class DatasetConfigRegexPatterns(TypedDict, total=False): + """ + 正则表达式。 + - 描述:用于匹配指定数据源中Schema(DB)、Table和Field名称的三个正则表达式,即同时满足这三个正则表达式的DB、Table和Field才被允许访问。 + - 注意:此字段为可选项。如果未提供,则默认包含指定数据源的所有数据。 + """ + fields_regex_pattern: Optional[str] """Field 正则表达式,空值默认全选""" @@ -53,6 +59,8 @@ class DatasetConfigRowsFilter(TypedDict, total=False): class DatasetConfig(TypedDict, total=False): + """数据集配置""" + datasource_ids: Required[SequenceNotStr[str]] """ 数据源 ID 列表,必填。 - 描述:用于指定策略适用的数据源。可以使用通配符 _ 表示所 diff --git a/src/asktable/types/preference_create_response.py b/src/asktable/types/preference_create_response.py index 9016f33f..07844536 100644 --- a/src/asktable/types/preference_create_response.py +++ b/src/asktable/types/preference_create_response.py @@ -8,6 +8,8 @@ class PreferenceCreateResponse(BaseModel): + """Schema for preference response""" + id: str """偏好设置 ID""" diff --git a/src/asktable/types/preference_retrieve_response.py b/src/asktable/types/preference_retrieve_response.py index 36afa791..587c5d14 100644 --- a/src/asktable/types/preference_retrieve_response.py +++ b/src/asktable/types/preference_retrieve_response.py @@ -8,6 +8,8 @@ class PreferenceRetrieveResponse(BaseModel): + """Schema for preference response""" + id: str """偏好设置 ID""" diff --git a/src/asktable/types/preference_update_response.py b/src/asktable/types/preference_update_response.py index a317deae..e5b309bd 100644 --- a/src/asktable/types/preference_update_response.py +++ b/src/asktable/types/preference_update_response.py @@ -8,6 +8,8 @@ class PreferenceUpdateResponse(BaseModel): + """Schema for preference response""" + id: str """偏好设置 ID""" diff --git a/src/asktable/types/shared/policy.py b/src/asktable/types/shared/policy.py index 0fd1b6db..ac3aef11 100644 --- a/src/asktable/types/shared/policy.py +++ b/src/asktable/types/shared/policy.py @@ -10,6 +10,12 @@ class DatasetConfigRegexPatterns(BaseModel): + """ + 正则表达式。 + - 描述:用于匹配指定数据源中Schema(DB)、Table和Field名称的三个正则表达式,即同时满足这三个正则表达式的DB、Table和Field才被允许访问。 + - 注意:此字段为可选项。如果未提供,则默认包含指定数据源的所有数据。 + """ + fields_regex_pattern: Optional[str] = None """Field 正则表达式,空值默认全选""" diff --git a/src/asktable/types/sy_update_config_params.py b/src/asktable/types/sy_update_config_params.py deleted file mode 100644 index fd7c7246..00000000 --- a/src/asktable/types/sy_update_config_params.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import TypedDict - -__all__ = ["SyUpdateConfigParams"] - - -class SyUpdateConfigParams(TypedDict, total=False): - global_table_limit: Optional[int] - """表限制数量""" diff --git a/src/asktable/types/sy_update_config_response.py b/src/asktable/types/sy_update_config_response.py deleted file mode 100644 index 9d77316d..00000000 --- a/src/asktable/types/sy_update_config_response.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional - -from .._models import BaseModel - -__all__ = ["SyUpdateConfigResponse"] - - -class SyUpdateConfigResponse(BaseModel): - global_table_limit: Optional[int] = None - """表限制数量""" diff --git a/src/asktable/types/sys/projects/api_key_create_token_params.py b/src/asktable/types/sys/projects/api_key_create_token_params.py index 212976c8..e65d75c2 100644 --- a/src/asktable/types/sys/projects/api_key_create_token_params.py +++ b/src/asktable/types/sys/projects/api_key_create_token_params.py @@ -23,6 +23,8 @@ class APIKeyCreateTokenParams(TypedDict, total=False): class ChatRole(TypedDict, total=False): + """The chat role""" + role_id: Optional[str] """The chat role ID""" diff --git a/src/asktable/types/tool_message.py b/src/asktable/types/tool_message.py index bbbea211..b2cd5d54 100644 --- a/src/asktable/types/tool_message.py +++ b/src/asktable/types/tool_message.py @@ -12,7 +12,7 @@ class ContentAttachment(BaseModel): info: object - type: str + type: Literal["data_json"] """The type of the attachment""" diff --git a/src/asktable/types/user_message.py b/src/asktable/types/user_message.py index c7ea626b..bb9e2fcd 100644 --- a/src/asktable/types/user_message.py +++ b/src/asktable/types/user_message.py @@ -12,7 +12,7 @@ class ContentAttachment(BaseModel): info: object - type: str + type: Literal["data_json"] """The type of the attachment""" diff --git a/tests/api_resources/test_bots.py b/tests/api_resources/test_bots.py index 09b2a320..abccfcf0 100644 --- a/tests/api_resources/test_bots.py +++ b/tests/api_resources/test_bots.py @@ -33,7 +33,6 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: name="name", color_theme="default", debug=True, - extapi_ids=["string"], interaction_rules=[ { "enabled": True, @@ -132,7 +131,6 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: color_theme="default", datasource_ids=["ds_sJAbnNOUzu3R4DdCCOwe"], debug=True, - extapi_ids=["string"], interaction_rules=[ { "enabled": True, @@ -320,7 +318,6 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) name="name", color_theme="default", debug=True, - extapi_ids=["string"], interaction_rules=[ { "enabled": True, @@ -419,7 +416,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) color_theme="default", datasource_ids=["ds_sJAbnNOUzu3R4DdCCOwe"], debug=True, - extapi_ids=["string"], interaction_rules=[ { "enabled": True, diff --git a/tests/api_resources/test_caches.py b/tests/api_resources/test_caches.py deleted file mode 100644 index 637c192e..00000000 --- a/tests/api_resources/test_caches.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from asktable import Asktable, AsyncAsktable - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCaches: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_delete(self, client: Asktable) -> None: - cach = client.caches.delete( - "cache_id", - ) - assert cach is None - - @parametrize - def test_raw_response_delete(self, client: Asktable) -> None: - response = client.caches.with_raw_response.delete( - "cache_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cach = response.parse() - assert cach is None - - @parametrize - def test_streaming_response_delete(self, client: Asktable) -> None: - with client.caches.with_streaming_response.delete( - "cache_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cach = response.parse() - assert cach is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Asktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cache_id` but received ''"): - client.caches.with_raw_response.delete( - "", - ) - - -class TestAsyncCaches: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncAsktable) -> None: - cach = await async_client.caches.delete( - "cache_id", - ) - assert cach is None - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncAsktable) -> None: - response = await async_client.caches.with_raw_response.delete( - "cache_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - cach = await response.parse() - assert cach is None - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncAsktable) -> None: - async with async_client.caches.with_streaming_response.delete( - "cache_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - cach = await response.parse() - assert cach is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncAsktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `cache_id` but received ''"): - await async_client.caches.with_raw_response.delete( - "", - ) diff --git a/tests/api_resources/test_sys.py b/tests/api_resources/test_sys.py deleted file mode 100644 index 67abf960..00000000 --- a/tests/api_resources/test_sys.py +++ /dev/null @@ -1,88 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from asktable import Asktable, AsyncAsktable -from tests.utils import assert_matches_type -from asktable.types import SyUpdateConfigResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSys: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_update_config(self, client: Asktable) -> None: - sy = client.sys.update_config() - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - @parametrize - def test_method_update_config_with_all_params(self, client: Asktable) -> None: - sy = client.sys.update_config( - global_table_limit=0, - ) - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - @parametrize - def test_raw_response_update_config(self, client: Asktable) -> None: - response = client.sys.with_raw_response.update_config() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sy = response.parse() - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - @parametrize - def test_streaming_response_update_config(self, client: Asktable) -> None: - with client.sys.with_streaming_response.update_config() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sy = response.parse() - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncSys: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_update_config(self, async_client: AsyncAsktable) -> None: - sy = await async_client.sys.update_config() - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - @parametrize - async def test_method_update_config_with_all_params(self, async_client: AsyncAsktable) -> None: - sy = await async_client.sys.update_config( - global_table_limit=0, - ) - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - @parametrize - async def test_raw_response_update_config(self, async_client: AsyncAsktable) -> None: - response = await async_client.sys.with_raw_response.update_config() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - sy = await response.parse() - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - @parametrize - async def test_streaming_response_update_config(self, async_client: AsyncAsktable) -> None: - async with async_client.sys.with_streaming_response.update_config() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - sy = await response.parse() - assert_matches_type(SyUpdateConfigResponse, sy, path=["response"]) - - assert cast(Any, response.is_closed) is True From 8c5fae5d3414be6e73af54ddb971f335e3663f3f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Dec 2025 10:23:38 +0000 Subject: [PATCH 061/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 68fe8b7c..ab8eaef8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-17fd9b9dcf0a4308ba53287517d0f3f82ef6bfb9b6480eae5a37ea450c9cf8c3.yml -openapi_spec_hash: 4fc942f34ec9bffbe29ea62c0491ca99 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dbaebcfe30d4475a300b5c1f9a31b4d8696d9ab59721fc26bd5c2acb23b986f3.yml +openapi_spec_hash: c995fafbb518dcc111ca26144ab6c43f config_hash: acdf4142177ed1932c2d82372693f811 From 8acf45b29334c0c6c42b375f5869510b3f71898f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 20 Dec 2025 12:24:04 +0000 Subject: [PATCH 062/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ab8eaef8..8fe99e0e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dbaebcfe30d4475a300b5c1f9a31b4d8696d9ab59721fc26bd5c2acb23b986f3.yml -openapi_spec_hash: c995fafbb518dcc111ca26144ab6c43f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-66eeaf091c660a38d127ce9f4c8830c0c448f1e8f304cb150e6121b7f805b4d3.yml +openapi_spec_hash: 8a981e720e5570d86504e2548c8884b6 config_hash: acdf4142177ed1932c2d82372693f811 From 22b56f92b19e881392a23dcb2ed81e53ffda766e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Dec 2025 06:23:40 +0000 Subject: [PATCH 063/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8fe99e0e..32fcfa97 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-66eeaf091c660a38d127ce9f4c8830c0c448f1e8f304cb150e6121b7f805b4d3.yml -openapi_spec_hash: 8a981e720e5570d86504e2548c8884b6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1290c68ea0d421910834e059503115eb2541a411eb701b6a6560fdf55c56591e.yml +openapi_spec_hash: 4f634bfc6e58d4755facd29bf4b47b7c config_hash: acdf4142177ed1932c2d82372693f811 From d2a9142aff68a000147078f4e2a490c28d72396b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Dec 2025 13:23:51 +0000 Subject: [PATCH 064/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 32fcfa97..6644993f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1290c68ea0d421910834e059503115eb2541a411eb701b6a6560fdf55c56591e.yml -openapi_spec_hash: 4f634bfc6e58d4755facd29bf4b47b7c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2624ce732d7de7c9f77c01510e8327579b8fa3aad67fc0fc9e32df1fe6b76071.yml +openapi_spec_hash: 306b79f64615a06aa84baa92ff5d3a5a config_hash: acdf4142177ed1932c2d82372693f811 From 71bc9ee1c345158e37e62de335664bede33c2654 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Dec 2025 16:23:37 +0000 Subject: [PATCH 065/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6644993f..1f1ea94a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2624ce732d7de7c9f77c01510e8327579b8fa3aad67fc0fc9e32df1fe6b76071.yml -openapi_spec_hash: 306b79f64615a06aa84baa92ff5d3a5a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-728e94b87ec049a9dbcc41403561ddb9dceefac4155d0b114c140dd85c61ffa6.yml +openapi_spec_hash: b118a8eb49582f840f8dd3b18bbca0a4 config_hash: acdf4142177ed1932c2d82372693f811 From d4c20f933feb80d24a32a5df9cd5178923b1bb60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 07:24:15 +0000 Subject: [PATCH 066/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1f1ea94a..787466e0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-728e94b87ec049a9dbcc41403561ddb9dceefac4155d0b114c140dd85c61ffa6.yml -openapi_spec_hash: b118a8eb49582f840f8dd3b18bbca0a4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-90d808323f07c0cdc8d1068d71d9ee4b91c5563d950f46437408eac54b2e7ad0.yml +openapi_spec_hash: 7846473abea8231529b4712b987b121d config_hash: acdf4142177ed1932c2d82372693f811 From e8e42f76897ccac3c444ef925dccda8b5ed53c4a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 09:23:35 +0000 Subject: [PATCH 067/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 787466e0..a9013345 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-90d808323f07c0cdc8d1068d71d9ee4b91c5563d950f46437408eac54b2e7ad0.yml -openapi_spec_hash: 7846473abea8231529b4712b987b121d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ec1c3a30857b30a5278b4ea9c41638ea467d445ff90511ca079d0bedcc6420fd.yml +openapi_spec_hash: 474fb4f8ff7059ec12275b09f464f244 config_hash: acdf4142177ed1932c2d82372693f811 From 6e071ea92b112ce41dfda41463447c4cec382310 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Dec 2025 07:23:35 +0000 Subject: [PATCH 068/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a9013345..f2896c95 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ec1c3a30857b30a5278b4ea9c41638ea467d445ff90511ca079d0bedcc6420fd.yml -openapi_spec_hash: 474fb4f8ff7059ec12275b09f464f244 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9700b1610662cf5565932faaf0ef502cae2c2a8fc9504381570b8f4780fce757.yml +openapi_spec_hash: 740fbb5e75123194c130ec62b4c2b956 config_hash: acdf4142177ed1932c2d82372693f811 From 9492d823c21d636d68e654e485ef99ab07344b47 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 28 Dec 2025 16:23:27 +0000 Subject: [PATCH 069/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/types/ats/task_get_case_tasks_response.py | 8 ++++---- src/asktable/types/ats/task_list_response.py | 6 +++--- src/asktable/types/ats/task_retrieve_response.py | 6 +++--- src/asktable/types/ats/task_run_response.py | 6 +++--- src/asktable/types/ats/test_case_create_response.py | 6 +++--- src/asktable/types/ats/test_case_list_response.py | 6 +++--- src/asktable/types/ats/test_case_retrieve_response.py | 6 +++--- src/asktable/types/ats/test_case_update_response.py | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.stats.yml b/.stats.yml index f2896c95..e18d72a1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9700b1610662cf5565932faaf0ef502cae2c2a8fc9504381570b8f4780fce757.yml -openapi_spec_hash: 740fbb5e75123194c130ec62b4c2b956 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4b1a8bafe8977574c3712b352790019fdd34a5c374254ffb408b1ab427fdffbf.yml +openapi_spec_hash: b28ae2945c9f5dd6264ed328e8c51b62 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/ats/task_get_case_tasks_response.py b/src/asktable/types/ats/task_get_case_tasks_response.py index 37821e0c..eaaf63b2 100644 --- a/src/asktable/types/ats/task_get_case_tasks_response.py +++ b/src/asktable/types/ats/task_get_case_tasks_response.py @@ -21,9 +21,6 @@ class Item(BaseModel): id: str """测试用例运行记录 ID""" - ats_task_id: str - """对应的测试任务 ID""" - created_at: datetime """创建时间""" @@ -36,10 +33,13 @@ class Item(BaseModel): question: str """提问内容""" + run_id: str + """对应的测试任务 ID""" + status: str """测试状态""" - atc_id: Optional[str] = None + case_id: Optional[str] = None """对应的测试用例 ID""" compare_logs: Optional[List[ItemCompareLog]] = None diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 5a0d599a..8f0156c6 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -33,9 +33,6 @@ class TaskListResponse(BaseModel): accuracy: float """测试正确率""" - ats_id: str - """测试集 ID""" - completed_case_count: int """已完成测试用例数""" @@ -54,6 +51,9 @@ class TaskListResponse(BaseModel): status: str """测试状态""" + suite_id: str + """测试集 ID""" + total_case_count: int """测试用例总数""" diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index 178a9c8f..e1259382 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -33,9 +33,6 @@ class TaskRetrieveResponse(BaseModel): accuracy: float """测试正确率""" - ats_id: str - """测试集 ID""" - completed_case_count: int """已完成测试用例数""" @@ -54,6 +51,9 @@ class TaskRetrieveResponse(BaseModel): status: str """测试状态""" + suite_id: str + """测试集 ID""" + total_case_count: int """测试用例总数""" diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index 3e291d48..97f2788d 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -33,9 +33,6 @@ class TaskRunResponse(BaseModel): accuracy: float """测试正确率""" - ats_id: str - """测试集 ID""" - completed_case_count: int """已完成测试用例数""" @@ -54,6 +51,9 @@ class TaskRunResponse(BaseModel): status: str """测试状态""" + suite_id: str + """测试集 ID""" + total_case_count: int """测试用例总数""" diff --git a/src/asktable/types/ats/test_case_create_response.py b/src/asktable/types/ats/test_case_create_response.py index 0faa6a83..6b54e3ae 100644 --- a/src/asktable/types/ats/test_case_create_response.py +++ b/src/asktable/types/ats/test_case_create_response.py @@ -13,9 +13,6 @@ class TestCaseCreateResponse(BaseModel): id: str """测试样例 ID""" - ats_id: str - """所属的测试集 ID""" - created_at: datetime """创建时间""" @@ -28,6 +25,9 @@ class TestCaseCreateResponse(BaseModel): question: str """用户提问""" + suite_id: str + """所属的测试集 ID""" + role_id: Optional[str] = None """角色 ID""" diff --git a/src/asktable/types/ats/test_case_list_response.py b/src/asktable/types/ats/test_case_list_response.py index 4216c794..80b17c09 100644 --- a/src/asktable/types/ats/test_case_list_response.py +++ b/src/asktable/types/ats/test_case_list_response.py @@ -13,9 +13,6 @@ class TestCaseListResponse(BaseModel): id: str """测试样例 ID""" - ats_id: str - """所属的测试集 ID""" - created_at: datetime """创建时间""" @@ -28,6 +25,9 @@ class TestCaseListResponse(BaseModel): question: str """用户提问""" + suite_id: str + """所属的测试集 ID""" + role_id: Optional[str] = None """角色 ID""" diff --git a/src/asktable/types/ats/test_case_retrieve_response.py b/src/asktable/types/ats/test_case_retrieve_response.py index 951aee1d..6993b494 100644 --- a/src/asktable/types/ats/test_case_retrieve_response.py +++ b/src/asktable/types/ats/test_case_retrieve_response.py @@ -13,9 +13,6 @@ class TestCaseRetrieveResponse(BaseModel): id: str """测试样例 ID""" - ats_id: str - """所属的测试集 ID""" - created_at: datetime """创建时间""" @@ -28,6 +25,9 @@ class TestCaseRetrieveResponse(BaseModel): question: str """用户提问""" + suite_id: str + """所属的测试集 ID""" + role_id: Optional[str] = None """角色 ID""" diff --git a/src/asktable/types/ats/test_case_update_response.py b/src/asktable/types/ats/test_case_update_response.py index 089d55e8..76c30096 100644 --- a/src/asktable/types/ats/test_case_update_response.py +++ b/src/asktable/types/ats/test_case_update_response.py @@ -13,9 +13,6 @@ class TestCaseUpdateResponse(BaseModel): id: str """测试样例 ID""" - ats_id: str - """所属的测试集 ID""" - created_at: datetime """创建时间""" @@ -28,6 +25,9 @@ class TestCaseUpdateResponse(BaseModel): question: str """用户提问""" + suite_id: str + """所属的测试集 ID""" + role_id: Optional[str] = None """角色 ID""" From 61db3dae170190990ff78ceb3416f71a190edac2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Dec 2025 05:23:31 +0000 Subject: [PATCH 070/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e18d72a1..b4ab63f6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4b1a8bafe8977574c3712b352790019fdd34a5c374254ffb408b1ab427fdffbf.yml -openapi_spec_hash: b28ae2945c9f5dd6264ed328e8c51b62 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dc4aafe888ca8ed15a2c598de9babd609321ffdee6769779fa9a281f8fedbc75.yml +openapi_spec_hash: 6c5108efd52162b1868ecfa551d711fc config_hash: acdf4142177ed1932c2d82372693f811 From cec82d5891799967cf171b82c43932e03d33b573 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Dec 2025 07:23:30 +0000 Subject: [PATCH 071/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index b4ab63f6..81d7b025 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dc4aafe888ca8ed15a2c598de9babd609321ffdee6769779fa9a281f8fedbc75.yml -openapi_spec_hash: 6c5108efd52162b1868ecfa551d711fc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-abb6eb626eb1096a680d9d34e111cad501ae8e45bfff140b73718c3215c50653.yml +openapi_spec_hash: d7b6c10de375ee3faeea21682e394e22 config_hash: acdf4142177ed1932c2d82372693f811 From 1b3369d632478c51f704a5c4d82d57649080a563 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Dec 2025 10:23:30 +0000 Subject: [PATCH 072/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 81d7b025..ae2711ce 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-abb6eb626eb1096a680d9d34e111cad501ae8e45bfff140b73718c3215c50653.yml -openapi_spec_hash: d7b6c10de375ee3faeea21682e394e22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-59a4306926df07abf63a4daab6dc4b53e3eb13088ffe14d9d57a6cedf37b3319.yml +openapi_spec_hash: 8acb2f66f18ddde3f93e9c1e143294a9 config_hash: acdf4142177ed1932c2d82372693f811 From f6f6190d4ad377e351a85f58d5c5a47df1e83776 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Dec 2025 13:23:26 +0000 Subject: [PATCH 073/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ae2711ce..92b81d94 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-59a4306926df07abf63a4daab6dc4b53e3eb13088ffe14d9d57a6cedf37b3319.yml -openapi_spec_hash: 8acb2f66f18ddde3f93e9c1e143294a9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-beb3e63a4c2298c9115021b4bf08dbb85a63d990847e853774cbf1091af3066e.yml +openapi_spec_hash: 2bfa9db20999c9ff198389db808158a4 config_hash: acdf4142177ed1932c2d82372693f811 From e431afce137e6013501491da266d6e5502552854 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 31 Dec 2025 08:23:25 +0000 Subject: [PATCH 074/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 92b81d94..58449001 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-beb3e63a4c2298c9115021b4bf08dbb85a63d990847e853774cbf1091af3066e.yml -openapi_spec_hash: 2bfa9db20999c9ff198389db808158a4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1d0c74b9375db676bf531ad9832be1577abf7021896840315789536ed10d6f51.yml +openapi_spec_hash: 0e87a27ac523b9127f1a541fbcbe20db config_hash: acdf4142177ed1932c2d82372693f811 From c5b136000d8771c1b8a9a8b3843316d12c7ba6d9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 17:23:16 +0000 Subject: [PATCH 075/130] feat(api): api update --- .stats.yml | 4 ++-- LICENSE | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 58449001..920969c6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1d0c74b9375db676bf531ad9832be1577abf7021896840315789536ed10d6f51.yml -openapi_spec_hash: 0e87a27ac523b9127f1a541fbcbe20db +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-804fd8eb5aad85fae2f281156908a54f945921f6a2be08dee195d4a69034af37.yml +openapi_spec_hash: 54c94aec671f4ae287a487aca7851b22 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/LICENSE b/LICENSE index fed4ca4d..881cc1fc 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2025 Asktable + Copyright 2026 Asktable Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 578ef636a048a6826b41b0e66efe129169c1f816 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 4 Jan 2026 07:23:14 +0000 Subject: [PATCH 076/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 920969c6..6efa2d83 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-804fd8eb5aad85fae2f281156908a54f945921f6a2be08dee195d4a69034af37.yml -openapi_spec_hash: 54c94aec671f4ae287a487aca7851b22 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-019fdc1019d98c9d15d0e9fee34aaa82213b3467a6b2f9e5874d409343fcfccd.yml +openapi_spec_hash: 9272dd89e5bac45b93ef455d91940469 config_hash: acdf4142177ed1932c2d82372693f811 From 456cb24a9e8b8a1ce4d8a878da6bccbcaa73ca02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 4 Jan 2026 12:23:16 +0000 Subject: [PATCH 077/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6efa2d83..0269f8f3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-019fdc1019d98c9d15d0e9fee34aaa82213b3467a6b2f9e5874d409343fcfccd.yml -openapi_spec_hash: 9272dd89e5bac45b93ef455d91940469 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-39230f0a8dac4f4860de1a819cdf49d76434bbbe813cafdefd53b6f54701a455.yml +openapi_spec_hash: 9fad8ca8a242bbf0061487f7ebf316b4 config_hash: acdf4142177ed1932c2d82372693f811 From a6b8536f7abd2018847dc9e77b3e01ea6f462a7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 Jan 2026 05:23:14 +0000 Subject: [PATCH 078/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0269f8f3..ae6f8f95 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-39230f0a8dac4f4860de1a819cdf49d76434bbbe813cafdefd53b6f54701a455.yml -openapi_spec_hash: 9fad8ca8a242bbf0061487f7ebf316b4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-20f6354d1acc8d000ad9bd08d232772aff326fec68ace682be61121517da5bb2.yml +openapi_spec_hash: d6f05e251c09ddeb6383382cf2217be1 config_hash: acdf4142177ed1932c2d82372693f811 From 343d8d1db4e22208b3d3b335f2d51de166a64a22 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Jan 2026 11:23:28 +0000 Subject: [PATCH 079/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/resources/ats/ats.py | 10 +++++---- src/asktable/types/ats_create_response.py | 7 ++++++ src/asktable/types/ats_list_params.py | 7 +++--- src/asktable/types/ats_list_response.py | 7 ++++++ src/asktable/types/ats_retrieve_response.py | 7 ++++++ src/asktable/types/ats_update_response.py | 7 ++++++ tests/api_resources/test_ats.py | 24 ++++++--------------- 8 files changed, 46 insertions(+), 27 deletions(-) diff --git a/.stats.yml b/.stats.yml index ae6f8f95..423cb6f6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-20f6354d1acc8d000ad9bd08d232772aff326fec68ace682be61121517da5bb2.yml -openapi_spec_hash: d6f05e251c09ddeb6383382cf2217be1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-39e6a02a4b1efbdc298cc690c13278116fc24056874c9d9e67ffa7f716a37689.yml +openapi_spec_hash: 6cd27ccd9e4616130078dcd0d7c95ba4 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/resources/ats/ats.py b/src/asktable/resources/ats/ats.py index 0ef6a647..48869436 100644 --- a/src/asktable/resources/ats/ats.py +++ b/src/asktable/resources/ats/ats.py @@ -2,6 +2,8 @@ from __future__ import annotations +from typing import Optional + import httpx from .task import ( @@ -185,7 +187,7 @@ def update( def list( self, *, - datasource_id: str, + datasource_id: Optional[str] | Omit = omit, page: int | Omit = omit, size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -199,7 +201,7 @@ def list( Get Test Sets Endpoint Args: - datasource_id: 数据源 ID + datasource_id: 数据源 ID,可选过滤条件 page: Page number @@ -418,7 +420,7 @@ async def update( def list( self, *, - datasource_id: str, + datasource_id: Optional[str] | Omit = omit, page: int | Omit = omit, size: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -432,7 +434,7 @@ def list( Get Test Sets Endpoint Args: - datasource_id: 数据源 ID + datasource_id: 数据源 ID,可选过滤条件 page: Page number diff --git a/src/asktable/types/ats_create_response.py b/src/asktable/types/ats_create_response.py index 4ed69a97..f8e41ec9 100644 --- a/src/asktable/types/ats_create_response.py +++ b/src/asktable/types/ats_create_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from .._models import BaseModel @@ -25,3 +26,9 @@ class ATSCreateResponse(BaseModel): project_id: str """项目 ID""" + + case_count: Optional[int] = None + """测试用例数量""" + + datasource_name: Optional[str] = None + """数据源名称""" diff --git a/src/asktable/types/ats_list_params.py b/src/asktable/types/ats_list_params.py index 09110362..7373b365 100644 --- a/src/asktable/types/ats_list_params.py +++ b/src/asktable/types/ats_list_params.py @@ -2,14 +2,15 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import TypedDict __all__ = ["ATSListParams"] class ATSListParams(TypedDict, total=False): - datasource_id: Required[str] - """数据源 ID""" + datasource_id: Optional[str] + """数据源 ID,可选过滤条件""" page: int """Page number""" diff --git a/src/asktable/types/ats_list_response.py b/src/asktable/types/ats_list_response.py index 04206289..c3afd735 100644 --- a/src/asktable/types/ats_list_response.py +++ b/src/asktable/types/ats_list_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from .._models import BaseModel @@ -25,3 +26,9 @@ class ATSListResponse(BaseModel): project_id: str """项目 ID""" + + case_count: Optional[int] = None + """测试用例数量""" + + datasource_name: Optional[str] = None + """数据源名称""" diff --git a/src/asktable/types/ats_retrieve_response.py b/src/asktable/types/ats_retrieve_response.py index 0195c97c..fe010a8c 100644 --- a/src/asktable/types/ats_retrieve_response.py +++ b/src/asktable/types/ats_retrieve_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from .._models import BaseModel @@ -25,3 +26,9 @@ class ATSRetrieveResponse(BaseModel): project_id: str """项目 ID""" + + case_count: Optional[int] = None + """测试用例数量""" + + datasource_name: Optional[str] = None + """数据源名称""" diff --git a/src/asktable/types/ats_update_response.py b/src/asktable/types/ats_update_response.py index 374dfe87..0a27ed2e 100644 --- a/src/asktable/types/ats_update_response.py +++ b/src/asktable/types/ats_update_response.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from .._models import BaseModel @@ -25,3 +26,9 @@ class ATSUpdateResponse(BaseModel): project_id: str """项目 ID""" + + case_count: Optional[int] = None + """测试用例数量""" + + datasource_name: Optional[str] = None + """数据源名称""" diff --git a/tests/api_resources/test_ats.py b/tests/api_resources/test_ats.py index 7dc37e89..f87e088b 100644 --- a/tests/api_resources/test_ats.py +++ b/tests/api_resources/test_ats.py @@ -139,9 +139,7 @@ def test_path_params_update(self, client: Asktable) -> None: @parametrize def test_method_list(self, client: Asktable) -> None: - ats = client.ats.list( - datasource_id="datasource_id", - ) + ats = client.ats.list() assert_matches_type(SyncPage[ATSListResponse], ats, path=["response"]) @parametrize @@ -155,9 +153,7 @@ def test_method_list_with_all_params(self, client: Asktable) -> None: @parametrize def test_raw_response_list(self, client: Asktable) -> None: - response = client.ats.with_raw_response.list( - datasource_id="datasource_id", - ) + response = client.ats.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,9 +162,7 @@ def test_raw_response_list(self, client: Asktable) -> None: @parametrize def test_streaming_response_list(self, client: Asktable) -> None: - with client.ats.with_streaming_response.list( - datasource_id="datasource_id", - ) as response: + with client.ats.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -341,9 +335,7 @@ async def test_path_params_update(self, async_client: AsyncAsktable) -> None: @parametrize async def test_method_list(self, async_client: AsyncAsktable) -> None: - ats = await async_client.ats.list( - datasource_id="datasource_id", - ) + ats = await async_client.ats.list() assert_matches_type(AsyncPage[ATSListResponse], ats, path=["response"]) @parametrize @@ -357,9 +349,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAsktable) -> @parametrize async def test_raw_response_list(self, async_client: AsyncAsktable) -> None: - response = await async_client.ats.with_raw_response.list( - datasource_id="datasource_id", - ) + response = await async_client.ats.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -368,9 +358,7 @@ async def test_raw_response_list(self, async_client: AsyncAsktable) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncAsktable) -> None: - async with async_client.ats.with_streaming_response.list( - datasource_id="datasource_id", - ) as response: + async with async_client.ats.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" From 5516ca4610693746385c29fbeae334d9c0f78792 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 Jan 2026 16:23:35 +0000 Subject: [PATCH 080/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 423cb6f6..48b8ca1e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-39e6a02a4b1efbdc298cc690c13278116fc24056874c9d9e67ffa7f716a37689.yml -openapi_spec_hash: 6cd27ccd9e4616130078dcd0d7c95ba4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-415cb51c38f6411c49c720608f183e898ceedce7cefd84531f7495e4a2036df6.yml +openapi_spec_hash: 168b14f17b844639ed8b5f2eaee6e764 config_hash: acdf4142177ed1932c2d82372693f811 From 44dd397483098c98d2a6dbdbef5e8f435c4e0f34 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 Jan 2026 07:23:35 +0000 Subject: [PATCH 081/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 48b8ca1e..423cb6f6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-415cb51c38f6411c49c720608f183e898ceedce7cefd84531f7495e4a2036df6.yml -openapi_spec_hash: 168b14f17b844639ed8b5f2eaee6e764 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-39e6a02a4b1efbdc298cc690c13278116fc24056874c9d9e67ffa7f716a37689.yml +openapi_spec_hash: 6cd27ccd9e4616130078dcd0d7c95ba4 config_hash: acdf4142177ed1932c2d82372693f811 From 5dbbf4fd77e617963eeaca8fd57054ddb3ebad05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 09:33:28 +0000 Subject: [PATCH 082/130] feat(api): api update --- .github/workflows/ci.yml | 6 +- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- .stats.yml | 4 +- src/asktable/_base_client.py | 145 +++++++++++++++++++-- src/asktable/_models.py | 17 ++- src/asktable/_types.py | 9 ++ src/asktable/types/chatbot.py | 1 - tests/test_client.py | 187 ++++++++++++++++++++++++++- 9 files changed, 351 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb20fc47..ffcf0a7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/asktable-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -44,7 +44,7 @@ jobs: id-token: write runs-on: ${{ github.repository == 'stainless-sdks/asktable-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | @@ -81,7 +81,7 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/asktable-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 188841d6..ddad4e66 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 1800bc5b..54ce1661 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,7 +12,7 @@ jobs: if: github.repository == 'DataMini/asktable-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Check release environment run: | diff --git a/.stats.yml b/.stats.yml index 423cb6f6..af230f8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-39e6a02a4b1efbdc298cc690c13278116fc24056874c9d9e67ffa7f716a37689.yml -openapi_spec_hash: 6cd27ccd9e4616130078dcd0d7c95ba4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f3bda395c29259f9059f182277574a0a665d6fd12a7d4002803cf35d045dedaf.yml +openapi_spec_hash: 351d7b616d2d0cc2fdf8074f51187b87 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py index 2128dcdf..02bd8f84 100644 --- a/src/asktable/_base_client.py +++ b/src/asktable/_base_client.py @@ -9,6 +9,7 @@ import inspect import logging import platform +import warnings import email.utils from types import TracebackType from random import random @@ -51,9 +52,11 @@ ResponseT, AnyMapping, PostParser, + BinaryTypes, RequestFiles, HttpxSendArgs, RequestOptions, + AsyncBinaryTypes, HttpxRequestFiles, ModelBuilderProtocol, not_given, @@ -477,8 +480,19 @@ def _build_request( retries_taken: int = 0, ) -> httpx.Request: if log.isEnabledFor(logging.DEBUG): - log.debug("Request options: %s", model_dump(options, exclude_unset=True)) - + log.debug( + "Request options: %s", + model_dump( + options, + exclude_unset=True, + # Pydantic v1 can't dump every type we support in content, so we exclude it for now. + exclude={ + "content", + } + if PYDANTIC_V1 + else {}, + ), + ) kwargs: dict[str, Any] = {} json_data = options.json_data @@ -532,7 +546,13 @@ def _build_request( is_body_allowed = options.method.lower() != "get" if is_body_allowed: - if isinstance(json_data, bytes): + if options.content is not None and json_data is not None: + raise TypeError("Passing both `content` and `json_data` is not supported") + if options.content is not None and files is not None: + raise TypeError("Passing both `content` and `files` is not supported") + if options.content is not None: + kwargs["content"] = options.content + elif isinstance(json_data, bytes): kwargs["content"] = json_data else: kwargs["json"] = json_data if is_given(json_data) else None @@ -1194,6 +1214,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, @@ -1206,6 +1227,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[True], @@ -1219,6 +1241,7 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool, @@ -1231,13 +1254,25 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) @@ -1247,11 +1282,23 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=to_httpx_files(files), **options + method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1261,11 +1308,23 @@ def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1275,9 +1334,19 @@ def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return self.request(cast_to, opts) def get_api_list( @@ -1717,6 +1786,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, @@ -1729,6 +1799,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[True], @@ -1742,6 +1813,7 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool, @@ -1754,13 +1826,25 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, ) -> ResponseT | _AsyncStreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) @@ -1770,11 +1854,28 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="patch", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="patch", + url=path, + json_data=body, + content=content, + files=await async_to_httpx_files(files), + **options, ) return await self.request(cast_to, opts) @@ -1784,11 +1885,23 @@ async def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) @@ -1798,9 +1911,19 @@ async def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return await self.request(cast_to, opts) def get_api_list( diff --git a/src/asktable/_models.py b/src/asktable/_models.py index ca9500b2..29070e05 100644 --- a/src/asktable/_models.py +++ b/src/asktable/_models.py @@ -3,7 +3,20 @@ import os import inspect import weakref -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast +from typing import ( + IO, + TYPE_CHECKING, + Any, + Type, + Union, + Generic, + TypeVar, + Callable, + Iterable, + Optional, + AsyncIterable, + cast, +) from datetime import date, datetime from typing_extensions import ( List, @@ -787,6 +800,7 @@ class FinalRequestOptionsInput(TypedDict, total=False): timeout: float | Timeout | None files: HttpxRequestFiles | None idempotency_key: str + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] json_data: Body extra_json: AnyMapping follow_redirects: bool @@ -805,6 +819,7 @@ class FinalRequestOptions(pydantic.BaseModel): post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() follow_redirects: Union[bool, None] = None + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. json_data: Union[Body, None] = None diff --git a/src/asktable/_types.py b/src/asktable/_types.py index 2fc8bc04..2cfbd939 100644 --- a/src/asktable/_types.py +++ b/src/asktable/_types.py @@ -13,9 +13,11 @@ Mapping, TypeVar, Callable, + Iterable, Iterator, Optional, Sequence, + AsyncIterable, ) from typing_extensions import ( Set, @@ -56,6 +58,13 @@ else: Base64FileInput = Union[IO[bytes], PathLike] FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. + + +# Used for sending raw binary data / streaming data in request bodies +# e.g. for file uploads without multipart encoding +BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]] +AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]] + FileTypes = Union[ # file (or bytes) FileContent, diff --git a/src/asktable/types/chatbot.py b/src/asktable/types/chatbot.py index 1bd6bd60..228f13d4 100644 --- a/src/asktable/types/chatbot.py +++ b/src/asktable/types/chatbot.py @@ -27,7 +27,6 @@ class Chatbot(BaseModel): created_at: datetime datasource_ids: List[str] - """数据源 ID,目前只支持 1 个数据源。""" modified_at: datetime diff --git a/tests/test_client.py b/tests/test_client.py index 8bd5d5c3..32469194 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -8,10 +8,11 @@ import json import asyncio import inspect +import dataclasses import tracemalloc -from typing import Any, Union, cast +from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock -from typing_extensions import Literal +from typing_extensions import Literal, AsyncIterator, override import httpx import pytest @@ -36,6 +37,7 @@ from .utils import update_env +T = TypeVar("T") base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -50,6 +52,57 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 +def mirror_request_content(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, content=request.content) + + +# note: we can't use the httpx.MockTransport class as it consumes the request +# body itself, which means we can't test that the body is read lazily +class MockTransport(httpx.BaseTransport, httpx.AsyncBaseTransport): + def __init__( + self, + handler: Callable[[httpx.Request], httpx.Response] + | Callable[[httpx.Request], Coroutine[Any, Any, httpx.Response]], + ) -> None: + self.handler = handler + + @override + def handle_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert not inspect.iscoroutinefunction(self.handler), "handler must not be a coroutine function" + assert inspect.isfunction(self.handler), "handler must be a function" + return self.handler(request) + + @override + async def handle_async_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert inspect.iscoroutinefunction(self.handler), "handler must be a coroutine function" + return await self.handler(request) + + +@dataclasses.dataclass +class Counter: + value: int = 0 + + +def _make_sync_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> Iterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + +async def _make_async_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> AsyncIterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + def _get_open_connections(client: Asktable | AsyncAsktable) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -492,6 +545,70 @@ def test_multipart_repeating_array(self, client: Asktable) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload(self, respx_mock: MockRouter, client: Asktable) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + def test_binary_content_upload_with_iterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_sync_iterator([file_content], counter=counter) + + def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=request.read()) + + with Asktable( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(transport=MockTransport(handler=mock_handler)), + ) as client: + response = client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: Asktable) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) def test_basic_union_response(self, respx_mock: MockRouter, client: Asktable) -> None: class Model1(BaseModel): @@ -1305,6 +1422,72 @@ def test_multipart_repeating_array(self, async_client: AsyncAsktable) -> None: b"", ] + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = await async_client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + async def test_binary_content_upload_with_asynciterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_async_iterator([file_content], counter=counter) + + async def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=await request.aread()) + + async with AsyncAsktable( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(transport=MockTransport(handler=mock_handler)), + ) as client: + response = await client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload_with_body_is_deprecated( + self, respx_mock: MockRouter, async_client: AsyncAsktable + ) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = await async_client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + @pytest.mark.respx(base_url=base_url) async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncAsktable) -> None: class Model1(BaseModel): From 9ec8ffda5236139d9241cd8507b7798b9312b3dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Jan 2026 03:23:13 +0000 Subject: [PATCH 083/130] feat(api): api update --- .stats.yml | 4 +- api.md | 13 +++-- src/asktable/resources/chats/chats.py | 23 ++++----- src/asktable/types/__init__.py | 3 +- src/asktable/types/chat_create_response.py | 47 +++++++++++++++++++ .../types/{chat.py => chat_list_response.py} | 4 +- tests/api_resources/test_chats.py | 38 ++++++++------- 7 files changed, 96 insertions(+), 36 deletions(-) create mode 100644 src/asktable/types/chat_create_response.py rename src/asktable/types/{chat.py => chat_list_response.py} (95%) diff --git a/.stats.yml b/.stats.yml index af230f8c..981302d3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f3bda395c29259f9059f182277574a0a665d6fd12a7d4002803cf35d045dedaf.yml -openapi_spec_hash: 351d7b616d2d0cc2fdf8074f51187b87 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5545d4cabf39ad53ab9333c0dbaac64f770a72ef4ea6a39341cfe93cae7641f1.yml +openapi_spec_hash: 25ea98b6cf6b506fbea4011c78c6ff7f config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/api.md b/api.md index 998db553..72465e7a 100644 --- a/api.md +++ b/api.md @@ -90,14 +90,21 @@ Methods: Types: ```python -from asktable.types import AIMessage, Chat, ToolMessage, UserMessage, ChatRetrieveResponse +from asktable.types import ( + AIMessage, + ToolMessage, + UserMessage, + ChatCreateResponse, + ChatRetrieveResponse, + ChatListResponse, +) ``` Methods: -- client.chats.create(\*\*params) -> Chat +- client.chats.create(\*\*params) -> ChatCreateResponse - client.chats.retrieve(chat_id) -> ChatRetrieveResponse -- client.chats.list(\*\*params) -> SyncPage[Chat] +- client.chats.list(\*\*params) -> SyncPage[ChatListResponse] - client.chats.delete(chat_id) -> None ## Messages diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py index 3f7e3591..a1885edb 100644 --- a/src/asktable/resources/chats/chats.py +++ b/src/asktable/resources/chats/chats.py @@ -26,8 +26,9 @@ async_to_streamed_response_wrapper, ) from ...pagination import SyncPage, AsyncPage -from ...types.chat import Chat from ..._base_client import AsyncPaginator, make_request_options +from ...types.chat_list_response import ChatListResponse +from ...types.chat_create_response import ChatCreateResponse from ...types.chat_retrieve_response import ChatRetrieveResponse __all__ = ["ChatsResource", "AsyncChatsResource"] @@ -71,7 +72,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Chat: + ) -> ChatCreateResponse: """ 创建对话 @@ -111,7 +112,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Chat, + cast_to=ChatCreateResponse, ) def retrieve( @@ -158,7 +159,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncPage[Chat]: + ) -> SyncPage[ChatListResponse]: """ 查询对话列表 @@ -177,7 +178,7 @@ def list( """ return self._get_api_list( "/v1/chats", - page=SyncPage[Chat], + page=SyncPage[ChatListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -191,7 +192,7 @@ def list( chat_list_params.ChatListParams, ), ), - model=Chat, + model=ChatListResponse, ) def delete( @@ -267,7 +268,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Chat: + ) -> ChatCreateResponse: """ 创建对话 @@ -307,7 +308,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=Chat, + cast_to=ChatCreateResponse, ) async def retrieve( @@ -354,7 +355,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[Chat, AsyncPage[Chat]]: + ) -> AsyncPaginator[ChatListResponse, AsyncPage[ChatListResponse]]: """ 查询对话列表 @@ -373,7 +374,7 @@ def list( """ return self._get_api_list( "/v1/chats", - page=AsyncPage[Chat], + page=AsyncPage[ChatListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -387,7 +388,7 @@ def list( chat_list_params.ChatListParams, ), ), - model=Chat, + model=ChatListResponse, ) async def delete( diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py index 066786d0..97ad82a1 100644 --- a/src/asktable/types/__init__.py +++ b/src/asktable/types/__init__.py @@ -2,7 +2,6 @@ from __future__ import annotations -from .chat import Chat as Chat from .meta import Meta as Meta from .role import Role as Role from .entry import Entry as Entry @@ -33,6 +32,7 @@ from .sql_create_params import SqlCreateParams as SqlCreateParams from .answer_list_params import AnswerListParams as AnswerListParams from .chat_create_params import ChatCreateParams as ChatCreateParams +from .chat_list_response import ChatListResponse as ChatListResponse from .policy_list_params import PolicyListParams as PolicyListParams from .role_create_params import RoleCreateParams as RoleCreateParams from .role_update_params import RoleUpdateParams as RoleUpdateParams @@ -40,6 +40,7 @@ from .ats_update_response import ATSUpdateResponse as ATSUpdateResponse from .score_create_params import ScoreCreateParams as ScoreCreateParams from .answer_create_params import AnswerCreateParams as AnswerCreateParams +from .chat_create_response import ChatCreateResponse as ChatCreateResponse from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .polish_create_params import PolishCreateParams as PolishCreateParams diff --git a/src/asktable/types/chat_create_response.py b/src/asktable/types/chat_create_response.py new file mode 100644 index 00000000..b989f952 --- /dev/null +++ b/src/asktable/types/chat_create_response.py @@ -0,0 +1,47 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Union, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["ChatCreateResponse"] + + +class ChatCreateResponse(BaseModel): + id: str + """对话 ID""" + + created_at: datetime + """创建时间""" + + modified_at: datetime + """修改时间""" + + project_id: str + + status: Literal["active", "pending", "error", "fatal"] + + status_message: Optional[str] = None + + bot_id: Optional[str] = None + """ + 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 + 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + """ + + name: Optional[str] = None + """New name for the chat""" + + role_id: Optional[str] = None + """ + 角色 ID,将扮演这个角色来执行对话,用于权限控制。若无,则跳过鉴权,即可查询所有 + 数据 + """ + + role_variables: Optional[Dict[str, Union[str, int, bool]]] = None + """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" + + user_profile: Optional[Dict[str, Union[str, int, bool]]] = None + """用户信息,用于在对话中传递用户的信息,用 Key-Value 形式传递""" diff --git a/src/asktable/types/chat.py b/src/asktable/types/chat_list_response.py similarity index 95% rename from src/asktable/types/chat.py rename to src/asktable/types/chat_list_response.py index ff282d79..f9ef78c0 100644 --- a/src/asktable/types/chat.py +++ b/src/asktable/types/chat_list_response.py @@ -6,10 +6,10 @@ from .._models import BaseModel -__all__ = ["Chat"] +__all__ = ["ChatListResponse"] -class Chat(BaseModel): +class ChatListResponse(BaseModel): id: str """对话 ID""" diff --git a/tests/api_resources/test_chats.py b/tests/api_resources/test_chats.py index 9748cf24..de5d05cb 100644 --- a/tests/api_resources/test_chats.py +++ b/tests/api_resources/test_chats.py @@ -9,7 +9,11 @@ from asktable import Asktable, AsyncAsktable from tests.utils import assert_matches_type -from asktable.types import Chat, ChatRetrieveResponse +from asktable.types import ( + ChatListResponse, + ChatCreateResponse, + ChatRetrieveResponse, +) from asktable.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +25,7 @@ class TestChats: @parametrize def test_method_create(self, client: Asktable) -> None: chat = client.chats.create() - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Asktable) -> None: @@ -36,7 +40,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: "name": "张三", }, ) - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) @parametrize def test_raw_response_create(self, client: Asktable) -> None: @@ -45,7 +49,7 @@ def test_raw_response_create(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = response.parse() - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) @parametrize def test_streaming_response_create(self, client: Asktable) -> None: @@ -54,7 +58,7 @@ def test_streaming_response_create(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = response.parse() - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -99,7 +103,7 @@ def test_path_params_retrieve(self, client: Asktable) -> None: @parametrize def test_method_list(self, client: Asktable) -> None: chat = client.chats.list() - assert_matches_type(SyncPage[Chat], chat, path=["response"]) + assert_matches_type(SyncPage[ChatListResponse], chat, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Asktable) -> None: @@ -107,7 +111,7 @@ def test_method_list_with_all_params(self, client: Asktable) -> None: page=1, size=1, ) - assert_matches_type(SyncPage[Chat], chat, path=["response"]) + assert_matches_type(SyncPage[ChatListResponse], chat, path=["response"]) @parametrize def test_raw_response_list(self, client: Asktable) -> None: @@ -116,7 +120,7 @@ def test_raw_response_list(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = response.parse() - assert_matches_type(SyncPage[Chat], chat, path=["response"]) + assert_matches_type(SyncPage[ChatListResponse], chat, path=["response"]) @parametrize def test_streaming_response_list(self, client: Asktable) -> None: @@ -125,7 +129,7 @@ def test_streaming_response_list(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = response.parse() - assert_matches_type(SyncPage[Chat], chat, path=["response"]) + assert_matches_type(SyncPage[ChatListResponse], chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -176,7 +180,7 @@ class TestAsyncChats: @parametrize async def test_method_create(self, async_client: AsyncAsktable) -> None: chat = await async_client.chats.create() - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None: @@ -191,7 +195,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) "name": "张三", }, ) - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: @@ -200,7 +204,7 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = await response.parse() - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None: @@ -209,7 +213,7 @@ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = await response.parse() - assert_matches_type(Chat, chat, path=["response"]) + assert_matches_type(ChatCreateResponse, chat, path=["response"]) assert cast(Any, response.is_closed) is True @@ -254,7 +258,7 @@ async def test_path_params_retrieve(self, async_client: AsyncAsktable) -> None: @parametrize async def test_method_list(self, async_client: AsyncAsktable) -> None: chat = await async_client.chats.list() - assert_matches_type(AsyncPage[Chat], chat, path=["response"]) + assert_matches_type(AsyncPage[ChatListResponse], chat, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAsktable) -> None: @@ -262,7 +266,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAsktable) -> page=1, size=1, ) - assert_matches_type(AsyncPage[Chat], chat, path=["response"]) + assert_matches_type(AsyncPage[ChatListResponse], chat, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncAsktable) -> None: @@ -271,7 +275,7 @@ async def test_raw_response_list(self, async_client: AsyncAsktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = await response.parse() - assert_matches_type(AsyncPage[Chat], chat, path=["response"]) + assert_matches_type(AsyncPage[ChatListResponse], chat, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncAsktable) -> None: @@ -280,7 +284,7 @@ async def test_streaming_response_list(self, async_client: AsyncAsktable) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" chat = await response.parse() - assert_matches_type(AsyncPage[Chat], chat, path=["response"]) + assert_matches_type(AsyncPage[ChatListResponse], chat, path=["response"]) assert cast(Any, response.is_closed) is True From 8add1bf8ed03a6e674c63e405a0cbf3f3d06b104 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 20 Jan 2026 09:23:18 +0000 Subject: [PATCH 084/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/types/chat_create_response.py | 3 +++ src/asktable/types/chat_list_response.py | 3 +++ src/asktable/types/chat_retrieve_response.py | 3 +++ src/asktable/types/meta.py | 24 +++++++++++++++++++- 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 981302d3..a7399ddf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5545d4cabf39ad53ab9333c0dbaac64f770a72ef4ea6a39341cfe93cae7641f1.yml -openapi_spec_hash: 25ea98b6cf6b506fbea4011c78c6ff7f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-14995c7ed1dd7201bddb54ca92f9f45f8686b0697c2ff4dc947878d4f0945f34.yml +openapi_spec_hash: 27db49ba292ae965f4cdd203524da520 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/chat_create_response.py b/src/asktable/types/chat_create_response.py index b989f952..278cf09a 100644 --- a/src/asktable/types/chat_create_response.py +++ b/src/asktable/types/chat_create_response.py @@ -40,6 +40,9 @@ class ChatCreateResponse(BaseModel): 数据 """ + role_name: Optional[str] = None + """角色名称""" + role_variables: Optional[Dict[str, Union[str, int, bool]]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/chat_list_response.py b/src/asktable/types/chat_list_response.py index f9ef78c0..d162b82e 100644 --- a/src/asktable/types/chat_list_response.py +++ b/src/asktable/types/chat_list_response.py @@ -40,6 +40,9 @@ class ChatListResponse(BaseModel): 数据 """ + role_name: Optional[str] = None + """角色名称""" + role_variables: Optional[Dict[str, Union[str, int, bool]]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/chat_retrieve_response.py b/src/asktable/types/chat_retrieve_response.py index 3868c1a8..8813f522 100644 --- a/src/asktable/types/chat_retrieve_response.py +++ b/src/asktable/types/chat_retrieve_response.py @@ -42,6 +42,9 @@ class ChatRetrieveResponse(BaseModel): 数据 """ + role_name: Optional[str] = None + """角色名称""" + role_variables: Optional[Dict[str, Union[str, int, bool]]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/meta.py b/src/asktable/types/meta.py index f94d2037..e75b8282 100644 --- a/src/asktable/types/meta.py +++ b/src/asktable/types/meta.py @@ -6,7 +6,26 @@ from .._models import BaseModel -__all__ = ["Meta", "Schemas", "SchemasTables", "SchemasTablesFields"] +__all__ = ["Meta", "Schemas", "SchemasTables", "SchemasTablesFields", "SchemasTablesFieldsIndex"] + + +class SchemasTablesFieldsIndex(BaseModel): + """索引信息""" + + id: str + """索引 ID""" + + distinct_count: Optional[int] = None + """不同值数量""" + + index_value_count: Optional[int] = None + """索引值总数""" + + status_msg: Optional[str] = None + """状态信息,为空表示成功""" + + value_count: Optional[int] = None + """值总数""" class SchemasTablesFields(BaseModel): @@ -39,6 +58,9 @@ class SchemasTablesFields(BaseModel): ] = None """identifiable type""" + index: Optional[SchemasTablesFieldsIndex] = None + """索引信息""" + sample_data: Optional[str] = None """field sample data""" From 8e426e99178317661c8a85f026e7c6e92bce6c4b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 03:23:16 +0000 Subject: [PATCH 085/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a7399ddf..1b201783 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-14995c7ed1dd7201bddb54ca92f9f45f8686b0697c2ff4dc947878d4f0945f34.yml -openapi_spec_hash: 27db49ba292ae965f4cdd203524da520 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a9516f0c2844beeeddd27e8a19a716996cc12009d342a606678db3bb5f0141c0.yml +openapi_spec_hash: 0e5a25d8d381ab33f9bd92ddaca3d095 config_hash: acdf4142177ed1932c2d82372693f811 From 02a8fff21477f2c32241a09141bb4095c0060d30 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 23 Jan 2026 04:23:13 +0000 Subject: [PATCH 086/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/resources/files.py | 4 ++-- src/asktable/types/chatbot.py | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1b201783..2eb52b42 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-a9516f0c2844beeeddd27e8a19a716996cc12009d342a606678db3bb5f0141c0.yml -openapi_spec_hash: 0e5a25d8d381ab33f9bd92ddaca3d095 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2e8595eb03427473d6d3f3d8554b21985279e40c754e7cdd013e24acf97ee7ef.yml +openapi_spec_hash: 3ac279939f204f114ef05890ffbeafd5 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/resources/files.py b/src/asktable/resources/files.py index 88983f93..1b2feb29 100644 --- a/src/asktable/resources/files.py +++ b/src/asktable/resources/files.py @@ -50,7 +50,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - 获取文件 + 下载文件 Args: extra_headers: Send extra headers @@ -104,7 +104,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - 获取文件 + 下载文件 Args: extra_headers: Send extra headers diff --git a/src/asktable/types/chatbot.py b/src/asktable/types/chatbot.py index 228f13d4..5aa67d7f 100644 --- a/src/asktable/types/chatbot.py +++ b/src/asktable/types/chatbot.py @@ -41,6 +41,9 @@ class Chatbot(BaseModel): color_theme: Optional[str] = None """颜色主题""" + datasource_name: Optional[str] = None + """数据源名称""" + debug: Optional[bool] = None """调试模式""" From 1176beda5149dba11a79fc7e02988f74f6e60aae Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 24 Jan 2026 07:23:10 +0000 Subject: [PATCH 087/130] feat(api): api update --- .github/workflows/ci.yml | 2 +- .stats.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffcf0a7b..cbe5b881 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,7 +63,7 @@ jobs: - name: Get GitHub OIDC Token if: github.repository == 'stainless-sdks/asktable-python' id: github-oidc - uses: actions/github-script@v6 + uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); diff --git a/.stats.yml b/.stats.yml index 2eb52b42..39925f45 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2e8595eb03427473d6d3f3d8554b21985279e40c754e7cdd013e24acf97ee7ef.yml -openapi_spec_hash: 3ac279939f204f114ef05890ffbeafd5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-d8ab024f1dc44cc9c644c8b1fad90fa2d17148cd59bca8a1ced5860dadda2c67.yml +openapi_spec_hash: b368a3206621fee2b2a7fefef8b318f7 config_hash: acdf4142177ed1932c2d82372693f811 From 80f442dc5b24534e7f735107c604e12dcd541ecd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 10:23:05 +0000 Subject: [PATCH 088/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 39925f45..e642054a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-d8ab024f1dc44cc9c644c8b1fad90fa2d17148cd59bca8a1ced5860dadda2c67.yml -openapi_spec_hash: b368a3206621fee2b2a7fefef8b318f7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f33400e8d08d236642b247cb4f7aa6b2e8fce067f594c5e616f7d4d35a33e4d6.yml +openapi_spec_hash: 285c4cec9e524850700423841f8e3be7 config_hash: acdf4142177ed1932c2d82372693f811 From f1d34dd72426e38054da3d9572eb57e71a72fdbe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 13:23:14 +0000 Subject: [PATCH 089/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e642054a..1fd0b070 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f33400e8d08d236642b247cb4f7aa6b2e8fce067f594c5e616f7d4d35a33e4d6.yml -openapi_spec_hash: 285c4cec9e524850700423841f8e3be7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c8ad576f7854aa4ec9d279bcc0958946bdb1318383320bc880791d7548469bff.yml +openapi_spec_hash: f692badea5d05aa494b024dd35eba070 config_hash: acdf4142177ed1932c2d82372693f811 From 4271a76c22284d1b2a1bdd2a0a658afba2bcc181 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:23:12 +0000 Subject: [PATCH 090/130] feat(api): api update --- .stats.yml | 4 +- src/asktable/_base_client.py | 7 +- src/asktable/_compat.py | 6 +- src/asktable/_utils/_json.py | 35 ++++++++++ tests/test_utils/test_json.py | 126 ++++++++++++++++++++++++++++++++++ 5 files changed, 171 insertions(+), 7 deletions(-) create mode 100644 src/asktable/_utils/_json.py create mode 100644 tests/test_utils/test_json.py diff --git a/.stats.yml b/.stats.yml index 1fd0b070..a08dece5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c8ad576f7854aa4ec9d279bcc0958946bdb1318383320bc880791d7548469bff.yml -openapi_spec_hash: f692badea5d05aa494b024dd35eba070 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f6bf2b899adb4399cfd898b662344a58d2e1ab464054bd5e0b93b4833e095152.yml +openapi_spec_hash: 4d712296210dede7ccb0eea311f76a36 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/_base_client.py b/src/asktable/_base_client.py index 02bd8f84..d9e44713 100644 --- a/src/asktable/_base_client.py +++ b/src/asktable/_base_client.py @@ -86,6 +86,7 @@ APIConnectionError, APIResponseValidationError, ) +from ._utils._json import openapi_dumps log: logging.Logger = logging.getLogger(__name__) @@ -554,8 +555,10 @@ def _build_request( kwargs["content"] = options.content elif isinstance(json_data, bytes): kwargs["content"] = json_data - else: - kwargs["json"] = json_data if is_given(json_data) else None + elif not files: + # Don't set content when JSON is sent as multipart/form-data, + # since httpx's content param overrides other body arguments + kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None kwargs["files"] = files else: headers.pop("Content-Type", None) diff --git a/src/asktable/_compat.py b/src/asktable/_compat.py index bdef67f0..786ff42a 100644 --- a/src/asktable/_compat.py +++ b/src/asktable/_compat.py @@ -139,6 +139,7 @@ def model_dump( exclude_defaults: bool = False, warnings: bool = True, mode: Literal["json", "python"] = "python", + by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): return model.model_dump( @@ -148,13 +149,12 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, + by_alias=by_alias, ) return cast( "dict[str, Any]", model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - exclude=exclude, - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias) ), ) diff --git a/src/asktable/_utils/_json.py b/src/asktable/_utils/_json.py new file mode 100644 index 00000000..60584214 --- /dev/null +++ b/src/asktable/_utils/_json.py @@ -0,0 +1,35 @@ +import json +from typing import Any +from datetime import datetime +from typing_extensions import override + +import pydantic + +from .._compat import model_dump + + +def openapi_dumps(obj: Any) -> bytes: + """ + Serialize an object to UTF-8 encoded JSON bytes. + + Extends the standard json.dumps with support for additional types + commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc. + """ + return json.dumps( + obj, + cls=_CustomEncoder, + # Uses the same defaults as httpx's JSON serialization + ensure_ascii=False, + separators=(",", ":"), + allow_nan=False, + ).encode() + + +class _CustomEncoder(json.JSONEncoder): + @override + def default(self, o: Any) -> Any: + if isinstance(o, datetime): + return o.isoformat() + if isinstance(o, pydantic.BaseModel): + return model_dump(o, exclude_unset=True, mode="json", by_alias=True) + return super().default(o) diff --git a/tests/test_utils/test_json.py b/tests/test_utils/test_json.py new file mode 100644 index 00000000..0f447f23 --- /dev/null +++ b/tests/test_utils/test_json.py @@ -0,0 +1,126 @@ +from __future__ import annotations + +import datetime +from typing import Union + +import pydantic + +from asktable import _compat +from asktable._utils._json import openapi_dumps + + +class TestOpenapiDumps: + def test_basic(self) -> None: + data = {"key": "value", "number": 42} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"key":"value","number":42}' + + def test_datetime_serialization(self) -> None: + dt = datetime.datetime(2023, 1, 1, 12, 0, 0) + data = {"datetime": dt} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"datetime":"2023-01-01T12:00:00"}' + + def test_pydantic_model_serialization(self) -> None: + class User(pydantic.BaseModel): + first_name: str + last_name: str + age: int + + model_instance = User(first_name="John", last_name="Kramer", age=83) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"first_name":"John","last_name":"Kramer","age":83}}' + + def test_pydantic_model_with_default_values(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + score: int = 0 + + model_instance = User(name="Alice") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Alice"}}' + + def test_pydantic_model_with_default_values_overridden(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + + model_instance = User(name="Bob", role="admin", active=False) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Bob","role":"admin","active":false}}' + + def test_pydantic_model_with_alias(self) -> None: + class User(pydantic.BaseModel): + first_name: str = pydantic.Field(alias="firstName") + last_name: str = pydantic.Field(alias="lastName") + + model_instance = User(firstName="John", lastName="Doe") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"firstName":"John","lastName":"Doe"}}' + + def test_pydantic_model_with_alias_and_default(self) -> None: + class User(pydantic.BaseModel): + user_name: str = pydantic.Field(alias="userName") + user_role: str = pydantic.Field(default="member", alias="userRole") + is_active: bool = pydantic.Field(default=True, alias="isActive") + + model_instance = User(userName="charlie") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"charlie"}}' + + model_with_overrides = User(userName="diana", userRole="admin", isActive=False) + data = {"model": model_with_overrides} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"diana","userRole":"admin","isActive":false}}' + + def test_pydantic_model_with_nested_models_and_defaults(self) -> None: + class Address(pydantic.BaseModel): + street: str + city: str = "Unknown" + + class User(pydantic.BaseModel): + name: str + address: Address + verified: bool = False + + if _compat.PYDANTIC_V1: + # to handle forward references in Pydantic v1 + User.update_forward_refs(**locals()) # type: ignore[reportDeprecated] + + address = Address(street="123 Main St") + user = User(name="Diana", address=address) + data = {"user": user} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"user":{"name":"Diana","address":{"street":"123 Main St"}}}' + + address_with_city = Address(street="456 Oak Ave", city="Boston") + user_verified = User(name="Eve", address=address_with_city, verified=True) + data = {"user": user_verified} + json_bytes = openapi_dumps(data) + assert ( + json_bytes == b'{"user":{"name":"Eve","address":{"street":"456 Oak Ave","city":"Boston"},"verified":true}}' + ) + + def test_pydantic_model_with_optional_fields(self) -> None: + class User(pydantic.BaseModel): + name: str + email: Union[str, None] + phone: Union[str, None] + + model_with_none = User(name="Eve", email=None, phone=None) + data = {"model": model_with_none} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Eve","email":null,"phone":null}}' + + model_with_values = User(name="Frank", email="frank@example.com", phone=None) + data = {"model": model_with_values} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Frank","email":"frank@example.com","phone":null}}' From dc296f04b1f3bf6f67ba2763974730b2e8292a65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Feb 2026 13:23:20 +0000 Subject: [PATCH 091/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a08dece5..96869adb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f6bf2b899adb4399cfd898b662344a58d2e1ab464054bd5e0b93b4833e095152.yml -openapi_spec_hash: 4d712296210dede7ccb0eea311f76a36 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1be8cc6e7cbd2bb2ee6533ab54e182ef0906822b44b55d36543f32636b80cc48.yml +openapi_spec_hash: 1ee182ac0f0ab61a7f4ef5d73929d199 config_hash: acdf4142177ed1932c2d82372693f811 From 177b579bdcb49f85b65e2083d4c6abd6ad24a007 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Feb 2026 06:23:16 +0000 Subject: [PATCH 092/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 96869adb..1a29c4d5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-1be8cc6e7cbd2bb2ee6533ab54e182ef0906822b44b55d36543f32636b80cc48.yml -openapi_spec_hash: 1ee182ac0f0ab61a7f4ef5d73929d199 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-b25c72c4a91ab1070a303f2cce79e93100b53a3d00e41351705fe2a7c15d68f2.yml +openapi_spec_hash: fbdbfcbe73890179db86505eec3e5132 config_hash: acdf4142177ed1932c2d82372693f811 From b4fe8f6225f6190443c96098dcd368be97ec7e44 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 07:23:17 +0000 Subject: [PATCH 093/130] feat(api): api update --- .stats.yml | 6 +- api.md | 3 +- .../resources/sys/projects/projects.py | 51 ---------------- src/asktable/types/ats/task_list_response.py | 20 +------ .../types/ats/task_retrieve_response.py | 20 +------ src/asktable/types/ats/task_run_response.py | 20 +------ .../project_list_model_groups_response.py | 58 +++++++++++++++++-- src/asktable/types/sys/__init__.py | 2 - src/asktable/types/sys/model_group.py | 28 --------- .../sys/project_model_groups_response.py | 10 ---- .../project_retrieve_model_groups_response.py | 58 +++++++++++++++++-- tests/api_resources/sys/test_projects.py | 51 ---------------- 12 files changed, 118 insertions(+), 209 deletions(-) delete mode 100644 src/asktable/types/sys/model_group.py delete mode 100644 src/asktable/types/sys/project_model_groups_response.py diff --git a/.stats.yml b/.stats.yml index 1a29c4d5..4b3681fa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-b25c72c4a91ab1070a303f2cce79e93100b53a3d00e41351705fe2a7c15d68f2.yml -openapi_spec_hash: fbdbfcbe73890179db86505eec3e5132 +configured_endpoints: 104 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-be088853b629d5c78d717b966da0867667578ed18e43435b52fe3e16031846e3.yml +openapi_spec_hash: 46b296a7de3bda655eb85c5f65cca044 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/api.md b/api.md index 72465e7a..91eb4ce1 100644 --- a/api.md +++ b/api.md @@ -11,7 +11,7 @@ from asktable.types import Policy Types: ```python -from asktable.types.sys import APIKey, ModelGroup, Project, ProjectModelGroupsResponse +from asktable.types.sys import APIKey, Project ``` Methods: @@ -23,7 +23,6 @@ Methods: - client.sys.projects.delete(project_id) -> object - client.sys.projects.export(project_id) -> object - client.sys.projects.import\_(\*\*params) -> object -- client.sys.projects.model_groups() -> ProjectModelGroupsResponse ### APIKeys diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index 32b6cc5b..839c5897 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -28,7 +28,6 @@ from ....pagination import SyncPage, AsyncPage from ...._base_client import AsyncPaginator, make_request_options from ....types.sys.project import Project -from ....types.sys.project_model_groups_response import ProjectModelGroupsResponse __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -323,25 +322,6 @@ def import_( cast_to=object, ) - def model_groups( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ProjectModelGroupsResponse: - """Get Llm Model Groups""" - return self._get( - "/v1/sys/projects/model-groups", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectModelGroupsResponse, - ) - class AsyncProjectsResource(AsyncAPIResource): @cached_property @@ -633,25 +613,6 @@ async def import_( cast_to=object, ) - async def model_groups( - self, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> ProjectModelGroupsResponse: - """Get Llm Model Groups""" - return await self._get( - "/v1/sys/projects/model-groups", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProjectModelGroupsResponse, - ) - class ProjectsResourceWithRawResponse: def __init__(self, projects: ProjectsResource) -> None: @@ -678,9 +639,6 @@ def __init__(self, projects: ProjectsResource) -> None: self.import_ = to_raw_response_wrapper( projects.import_, ) - self.model_groups = to_raw_response_wrapper( - projects.model_groups, - ) @cached_property def api_keys(self) -> APIKeysResourceWithRawResponse: @@ -712,9 +670,6 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.import_ = async_to_raw_response_wrapper( projects.import_, ) - self.model_groups = async_to_raw_response_wrapper( - projects.model_groups, - ) @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse: @@ -746,9 +701,6 @@ def __init__(self, projects: ProjectsResource) -> None: self.import_ = to_streamed_response_wrapper( projects.import_, ) - self.model_groups = to_streamed_response_wrapper( - projects.model_groups, - ) @cached_property def api_keys(self) -> APIKeysResourceWithStreamingResponse: @@ -780,9 +732,6 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.import_ = async_to_streamed_response_wrapper( projects.import_, ) - self.model_groups = async_to_streamed_response_wrapper( - projects.model_groups, - ) @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse: diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 8f0156c6..6d54a88c 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -7,23 +7,7 @@ from ..._models import BaseModel -__all__ = ["TaskListResponse", "ModelGroup"] - - -class ModelGroup(BaseModel): - """运行使用的模型组""" - - agent: str - - fast: str - - name: str - - omni: str - - sql: str - - report: Optional[str] = None +__all__ = ["TaskListResponse"] class TaskListResponse(BaseModel): @@ -63,7 +47,7 @@ class TaskListResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" - api_model_group: Optional[ModelGroup] = FieldInfo(alias="model_group", default=None) + api_model_group: Optional[object] = FieldInfo(alias="model_group", default=None) """运行使用的模型组""" status_message: Optional[str] = None diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index e1259382..28135f5d 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -7,23 +7,7 @@ from ..._models import BaseModel -__all__ = ["TaskRetrieveResponse", "ModelGroup"] - - -class ModelGroup(BaseModel): - """运行使用的模型组""" - - agent: str - - fast: str - - name: str - - omni: str - - sql: str - - report: Optional[str] = None +__all__ = ["TaskRetrieveResponse"] class TaskRetrieveResponse(BaseModel): @@ -63,7 +47,7 @@ class TaskRetrieveResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" - api_model_group: Optional[ModelGroup] = FieldInfo(alias="model_group", default=None) + api_model_group: Optional[object] = FieldInfo(alias="model_group", default=None) """运行使用的模型组""" status_message: Optional[str] = None diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index 97f2788d..74dbc7d9 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -7,23 +7,7 @@ from ..._models import BaseModel -__all__ = ["TaskRunResponse", "ModelGroup"] - - -class ModelGroup(BaseModel): - """运行使用的模型组""" - - agent: str - - fast: str - - name: str - - omni: str - - sql: str - - report: Optional[str] = None +__all__ = ["TaskRunResponse"] class TaskRunResponse(BaseModel): @@ -63,7 +47,7 @@ class TaskRunResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" - api_model_group: Optional[ModelGroup] = FieldInfo(alias="model_group", default=None) + api_model_group: Optional[object] = FieldInfo(alias="model_group", default=None) """运行使用的模型组""" status_message: Optional[str] = None diff --git a/src/asktable/types/project_list_model_groups_response.py b/src/asktable/types/project_list_model_groups_response.py index 21df8bd4..a6b33858 100644 --- a/src/asktable/types/project_list_model_groups_response.py +++ b/src/asktable/types/project_list_model_groups_response.py @@ -1,10 +1,60 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime from typing_extensions import TypeAlias -from .sys.model_group import ModelGroup +from .._models import BaseModel -__all__ = ["ProjectListModelGroupsResponse"] +__all__ = [ + "ProjectListModelGroupsResponse", + "ProjectListModelGroupsResponseItem", + "ProjectListModelGroupsResponseItemModels", +] -ProjectListModelGroupsResponse: TypeAlias = List[ModelGroup] + +class ProjectListModelGroupsResponseItemModels(BaseModel): + """角色→模型映射""" + + agent: Optional[str] = None + + canvas: Optional[str] = None + + fast: Optional[str] = None + + image: Optional[str] = None + + omni: Optional[str] = None + + report: Optional[str] = None + + sql: Optional[str] = None + + +class ProjectListModelGroupsResponseItem(BaseModel): + id: str + """模型组 ID""" + + api_key: str + """解密后的 API 密钥""" + + available_models: List[str] + """可用模型列表""" + + base_url: str + """OpenAI 兼容 API 端点""" + + created_at: datetime + """创建时间""" + + models: ProjectListModelGroupsResponseItemModels + """角色 → 模型映射""" + + modified_at: datetime + """修改时间""" + + name: str + """模型组名称""" + + +ProjectListModelGroupsResponse: TypeAlias = List[ProjectListModelGroupsResponseItem] diff --git a/src/asktable/types/sys/__init__.py b/src/asktable/types/sys/__init__.py index 603cf14d..b2ac6c4d 100644 --- a/src/asktable/types/sys/__init__.py +++ b/src/asktable/types/sys/__init__.py @@ -4,9 +4,7 @@ from .api_key import APIKey as APIKey from .project import Project as Project -from .model_group import ModelGroup as ModelGroup from .project_list_params import ProjectListParams as ProjectListParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_import_params import ProjectImportParams as ProjectImportParams from .project_update_params import ProjectUpdateParams as ProjectUpdateParams -from .project_model_groups_response import ProjectModelGroupsResponse as ProjectModelGroupsResponse diff --git a/src/asktable/types/sys/model_group.py b/src/asktable/types/sys/model_group.py deleted file mode 100644 index 82382099..00000000 --- a/src/asktable/types/sys/model_group.py +++ /dev/null @@ -1,28 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["ModelGroup"] - - -class ModelGroup(BaseModel): - id: str - """模型组 ID""" - - agent: str - """Agent 模型""" - - fast: str - """快速模型""" - - name: str - """模型组名称""" - - omni: str - """通用模型""" - - report: str - """报告模型""" - - sql: str - """SQL 模型""" diff --git a/src/asktable/types/sys/project_model_groups_response.py b/src/asktable/types/sys/project_model_groups_response.py deleted file mode 100644 index 5a4939f3..00000000 --- a/src/asktable/types/sys/project_model_groups_response.py +++ /dev/null @@ -1,10 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from typing_extensions import TypeAlias - -from .model_group import ModelGroup - -__all__ = ["ProjectModelGroupsResponse"] - -ProjectModelGroupsResponse: TypeAlias = List[ModelGroup] diff --git a/src/asktable/types/user/project_retrieve_model_groups_response.py b/src/asktable/types/user/project_retrieve_model_groups_response.py index d2f36279..f0996b30 100644 --- a/src/asktable/types/user/project_retrieve_model_groups_response.py +++ b/src/asktable/types/user/project_retrieve_model_groups_response.py @@ -1,10 +1,60 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional +from datetime import datetime from typing_extensions import TypeAlias -from ..sys.model_group import ModelGroup +from ..._models import BaseModel -__all__ = ["ProjectRetrieveModelGroupsResponse"] +__all__ = [ + "ProjectRetrieveModelGroupsResponse", + "ProjectRetrieveModelGroupsResponseItem", + "ProjectRetrieveModelGroupsResponseItemModels", +] -ProjectRetrieveModelGroupsResponse: TypeAlias = List[ModelGroup] + +class ProjectRetrieveModelGroupsResponseItemModels(BaseModel): + """角色→模型映射""" + + agent: Optional[str] = None + + canvas: Optional[str] = None + + fast: Optional[str] = None + + image: Optional[str] = None + + omni: Optional[str] = None + + report: Optional[str] = None + + sql: Optional[str] = None + + +class ProjectRetrieveModelGroupsResponseItem(BaseModel): + id: str + """模型组 ID""" + + api_key: str + """解密后的 API 密钥""" + + available_models: List[str] + """可用模型列表""" + + base_url: str + """OpenAI 兼容 API 端点""" + + created_at: datetime + """创建时间""" + + models: ProjectRetrieveModelGroupsResponseItemModels + """角色 → 模型映射""" + + modified_at: datetime + """修改时间""" + + name: str + """模型组名称""" + + +ProjectRetrieveModelGroupsResponse: TypeAlias = List[ProjectRetrieveModelGroupsResponseItem] diff --git a/tests/api_resources/sys/test_projects.py b/tests/api_resources/sys/test_projects.py index 8b8d87c3..d13df1c0 100644 --- a/tests/api_resources/sys/test_projects.py +++ b/tests/api_resources/sys/test_projects.py @@ -11,7 +11,6 @@ from tests.utils import assert_matches_type from asktable.types.sys import ( Project, - ProjectModelGroupsResponse, ) from asktable.pagination import SyncPage, AsyncPage @@ -279,31 +278,6 @@ def test_streaming_response_import(self, client: Asktable) -> None: assert cast(Any, response.is_closed) is True - @parametrize - def test_method_model_groups(self, client: Asktable) -> None: - project = client.sys.projects.model_groups() - assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) - - @parametrize - def test_raw_response_model_groups(self, client: Asktable) -> None: - response = client.sys.projects.with_raw_response.model_groups() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = response.parse() - assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) - - @parametrize - def test_streaming_response_model_groups(self, client: Asktable) -> None: - with client.sys.projects.with_streaming_response.model_groups() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = response.parse() - assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncProjects: parametrize = pytest.mark.parametrize( @@ -567,28 +541,3 @@ async def test_streaming_response_import(self, async_client: AsyncAsktable) -> N assert_matches_type(object, project, path=["response"]) assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_model_groups(self, async_client: AsyncAsktable) -> None: - project = await async_client.sys.projects.model_groups() - assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) - - @parametrize - async def test_raw_response_model_groups(self, async_client: AsyncAsktable) -> None: - response = await async_client.sys.projects.with_raw_response.model_groups() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - project = await response.parse() - assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) - - @parametrize - async def test_streaming_response_model_groups(self, async_client: AsyncAsktable) -> None: - async with async_client.sys.projects.with_streaming_response.model_groups() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - project = await response.parse() - assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) - - assert cast(Any, response.is_closed) is True From 8772af20580c052b1ff18cbcb238aabc300e2489 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:23:16 +0000 Subject: [PATCH 094/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4b3681fa..f93982de 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 104 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-be088853b629d5c78d717b966da0867667578ed18e43435b52fe3e16031846e3.yml -openapi_spec_hash: 46b296a7de3bda655eb85c5f65cca044 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-203bdeb9f585ff903476c23f713dd65e8c305933edda07642d21c0d7bf88ac85.yml +openapi_spec_hash: f67353f22a96d5a67d5627a542bbe266 config_hash: acdf4142177ed1932c2d82372693f811 From 7d01e7f372128c6b9bac3e9a000b38234b2e26ff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 13:23:15 +0000 Subject: [PATCH 095/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f93982de..2aba9ed1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 104 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-203bdeb9f585ff903476c23f713dd65e8c305933edda07642d21c0d7bf88ac85.yml -openapi_spec_hash: f67353f22a96d5a67d5627a542bbe266 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-250a910527bcb01b5aed9ab730fcb5e74285759cef68e22b0d32f60b4c22a25e.yml +openapi_spec_hash: fcc7a9bb0e8693599f86a99b169f26d9 config_hash: acdf4142177ed1932c2d82372693f811 From 8a3b7277cb39635bb903e82213438c259aa2f805 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Feb 2026 03:23:18 +0000 Subject: [PATCH 096/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2aba9ed1..858b378e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 104 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-250a910527bcb01b5aed9ab730fcb5e74285759cef68e22b0d32f60b4c22a25e.yml -openapi_spec_hash: fcc7a9bb0e8693599f86a99b169f26d9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9163f5842399579d20b8596b655b2541786e1617518d1f355b1271eaed748957.yml +openapi_spec_hash: d0bf5baef02c8a42196d38d17a0ecb2c config_hash: acdf4142177ed1932c2d82372693f811 From 9a4f19a8ae3655969fd42c89ddce37e344fecd34 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:22:54 +0000 Subject: [PATCH 097/130] feat(api): api update --- .stats.yml | 6 +- api.md | 3 +- .../resources/sys/projects/projects.py | 51 +++++++++++++++ .../project_list_model_groups_response.py | 14 +++-- src/asktable/types/sys/__init__.py | 1 + .../sys/project_model_groups_response.py | 62 +++++++++++++++++++ .../project_retrieve_model_groups_response.py | 14 +++-- tests/api_resources/sys/test_projects.py | 51 +++++++++++++++ 8 files changed, 190 insertions(+), 12 deletions(-) create mode 100644 src/asktable/types/sys/project_model_groups_response.py diff --git a/.stats.yml b/.stats.yml index 858b378e..4b62e2a0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 104 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9163f5842399579d20b8596b655b2541786e1617518d1f355b1271eaed748957.yml -openapi_spec_hash: d0bf5baef02c8a42196d38d17a0ecb2c +configured_endpoints: 105 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-e8e0ca3c2227f7c025606512b4b2fcda710140ce142874bdd589f4d8a0608ec0.yml +openapi_spec_hash: aafc59854d2fce22c22edf404572fcf4 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/api.md b/api.md index 91eb4ce1..e3b753b9 100644 --- a/api.md +++ b/api.md @@ -11,7 +11,7 @@ from asktable.types import Policy Types: ```python -from asktable.types.sys import APIKey, Project +from asktable.types.sys import APIKey, Project, ProjectModelGroupsResponse ``` Methods: @@ -23,6 +23,7 @@ Methods: - client.sys.projects.delete(project_id) -> object - client.sys.projects.export(project_id) -> object - client.sys.projects.import\_(\*\*params) -> object +- client.sys.projects.model_groups() -> ProjectModelGroupsResponse ### APIKeys diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index 839c5897..352655b3 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -28,6 +28,7 @@ from ....pagination import SyncPage, AsyncPage from ...._base_client import AsyncPaginator, make_request_options from ....types.sys.project import Project +from ....types.sys.project_model_groups_response import ProjectModelGroupsResponse __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -322,6 +323,25 @@ def import_( cast_to=object, ) + def model_groups( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ProjectModelGroupsResponse: + """Get Model Groups""" + return self._get( + "/v1/sys/projects/model-groups", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProjectModelGroupsResponse, + ) + class AsyncProjectsResource(AsyncAPIResource): @cached_property @@ -613,6 +633,25 @@ async def import_( cast_to=object, ) + async def model_groups( + self, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ProjectModelGroupsResponse: + """Get Model Groups""" + return await self._get( + "/v1/sys/projects/model-groups", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ProjectModelGroupsResponse, + ) + class ProjectsResourceWithRawResponse: def __init__(self, projects: ProjectsResource) -> None: @@ -639,6 +678,9 @@ def __init__(self, projects: ProjectsResource) -> None: self.import_ = to_raw_response_wrapper( projects.import_, ) + self.model_groups = to_raw_response_wrapper( + projects.model_groups, + ) @cached_property def api_keys(self) -> APIKeysResourceWithRawResponse: @@ -670,6 +712,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.import_ = async_to_raw_response_wrapper( projects.import_, ) + self.model_groups = async_to_raw_response_wrapper( + projects.model_groups, + ) @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse: @@ -701,6 +746,9 @@ def __init__(self, projects: ProjectsResource) -> None: self.import_ = to_streamed_response_wrapper( projects.import_, ) + self.model_groups = to_streamed_response_wrapper( + projects.model_groups, + ) @cached_property def api_keys(self) -> APIKeysResourceWithStreamingResponse: @@ -732,6 +780,9 @@ def __init__(self, projects: AsyncProjectsResource) -> None: self.import_ = async_to_streamed_response_wrapper( projects.import_, ) + self.model_groups = async_to_streamed_response_wrapper( + projects.model_groups, + ) @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse: diff --git a/src/asktable/types/project_list_model_groups_response.py b/src/asktable/types/project_list_model_groups_response.py index a6b33858..3057b493 100644 --- a/src/asktable/types/project_list_model_groups_response.py +++ b/src/asktable/types/project_list_model_groups_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import TypeAlias @@ -35,9 +35,6 @@ class ProjectListModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" - api_key: str - """解密后的 API 密钥""" - available_models: List[str] """可用模型列表""" @@ -47,6 +44,9 @@ class ProjectListModelGroupsResponseItem(BaseModel): created_at: datetime """创建时间""" + extra_headers: Dict[str, str] + """额外请求头""" + models: ProjectListModelGroupsResponseItemModels """角色 → 模型映射""" @@ -56,5 +56,11 @@ class ProjectListModelGroupsResponseItem(BaseModel): name: str """模型组名称""" + display_name: Optional[str] = None + """展示名称""" + + is_default: Optional[bool] = None + """是否为默认组""" + ProjectListModelGroupsResponse: TypeAlias = List[ProjectListModelGroupsResponseItem] diff --git a/src/asktable/types/sys/__init__.py b/src/asktable/types/sys/__init__.py index b2ac6c4d..c45c4f39 100644 --- a/src/asktable/types/sys/__init__.py +++ b/src/asktable/types/sys/__init__.py @@ -8,3 +8,4 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_import_params import ProjectImportParams as ProjectImportParams from .project_update_params import ProjectUpdateParams as ProjectUpdateParams +from .project_model_groups_response import ProjectModelGroupsResponse as ProjectModelGroupsResponse diff --git a/src/asktable/types/sys/project_model_groups_response.py b/src/asktable/types/sys/project_model_groups_response.py new file mode 100644 index 00000000..a6c6e258 --- /dev/null +++ b/src/asktable/types/sys/project_model_groups_response.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, List, Optional +from datetime import datetime +from typing_extensions import TypeAlias + +from ..._models import BaseModel + +__all__ = ["ProjectModelGroupsResponse", "ProjectModelGroupsResponseItem", "ProjectModelGroupsResponseItemModels"] + + +class ProjectModelGroupsResponseItemModels(BaseModel): + """角色→模型映射""" + + agent: Optional[str] = None + + canvas: Optional[str] = None + + fast: Optional[str] = None + + image: Optional[str] = None + + omni: Optional[str] = None + + report: Optional[str] = None + + sql: Optional[str] = None + + +class ProjectModelGroupsResponseItem(BaseModel): + id: str + """模型组 ID""" + + available_models: List[str] + """可用模型列表""" + + base_url: str + """OpenAI 兼容 API 端点""" + + created_at: datetime + """创建时间""" + + extra_headers: Dict[str, str] + """额外请求头""" + + models: ProjectModelGroupsResponseItemModels + """角色 → 模型映射""" + + modified_at: datetime + """修改时间""" + + name: str + """模型组名称""" + + display_name: Optional[str] = None + """展示名称""" + + is_default: Optional[bool] = None + """是否为默认组""" + + +ProjectModelGroupsResponse: TypeAlias = List[ProjectModelGroupsResponseItem] diff --git a/src/asktable/types/user/project_retrieve_model_groups_response.py b/src/asktable/types/user/project_retrieve_model_groups_response.py index f0996b30..f959ea41 100644 --- a/src/asktable/types/user/project_retrieve_model_groups_response.py +++ b/src/asktable/types/user/project_retrieve_model_groups_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import TypeAlias @@ -35,9 +35,6 @@ class ProjectRetrieveModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" - api_key: str - """解密后的 API 密钥""" - available_models: List[str] """可用模型列表""" @@ -47,6 +44,9 @@ class ProjectRetrieveModelGroupsResponseItem(BaseModel): created_at: datetime """创建时间""" + extra_headers: Dict[str, str] + """额外请求头""" + models: ProjectRetrieveModelGroupsResponseItemModels """角色 → 模型映射""" @@ -56,5 +56,11 @@ class ProjectRetrieveModelGroupsResponseItem(BaseModel): name: str """模型组名称""" + display_name: Optional[str] = None + """展示名称""" + + is_default: Optional[bool] = None + """是否为默认组""" + ProjectRetrieveModelGroupsResponse: TypeAlias = List[ProjectRetrieveModelGroupsResponseItem] diff --git a/tests/api_resources/sys/test_projects.py b/tests/api_resources/sys/test_projects.py index d13df1c0..8b8d87c3 100644 --- a/tests/api_resources/sys/test_projects.py +++ b/tests/api_resources/sys/test_projects.py @@ -11,6 +11,7 @@ from tests.utils import assert_matches_type from asktable.types.sys import ( Project, + ProjectModelGroupsResponse, ) from asktable.pagination import SyncPage, AsyncPage @@ -278,6 +279,31 @@ def test_streaming_response_import(self, client: Asktable) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_model_groups(self, client: Asktable) -> None: + project = client.sys.projects.model_groups() + assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) + + @parametrize + def test_raw_response_model_groups(self, client: Asktable) -> None: + response = client.sys.projects.with_raw_response.model_groups() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + project = response.parse() + assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) + + @parametrize + def test_streaming_response_model_groups(self, client: Asktable) -> None: + with client.sys.projects.with_streaming_response.model_groups() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + project = response.parse() + assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) + + assert cast(Any, response.is_closed) is True + class TestAsyncProjects: parametrize = pytest.mark.parametrize( @@ -541,3 +567,28 @@ async def test_streaming_response_import(self, async_client: AsyncAsktable) -> N assert_matches_type(object, project, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_model_groups(self, async_client: AsyncAsktable) -> None: + project = await async_client.sys.projects.model_groups() + assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) + + @parametrize + async def test_raw_response_model_groups(self, async_client: AsyncAsktable) -> None: + response = await async_client.sys.projects.with_raw_response.model_groups() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + project = await response.parse() + assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) + + @parametrize + async def test_streaming_response_model_groups(self, async_client: AsyncAsktable) -> None: + async with async_client.sys.projects.with_streaming_response.model_groups() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + project = await response.parse() + assert_matches_type(ProjectModelGroupsResponse, project, path=["response"]) + + assert cast(Any, response.is_closed) is True From 1f93cc7eb52960ee9b9ab3be2aef7fe0a29a7441 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Feb 2026 07:22:50 +0000 Subject: [PATCH 098/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4b62e2a0..b2bb9a0c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-e8e0ca3c2227f7c025606512b4b2fcda710140ce142874bdd589f4d8a0608ec0.yml -openapi_spec_hash: aafc59854d2fce22c22edf404572fcf4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5202276c7c4f0702d5ad5e1a29f64f69a73431e0ce8ffc0fa3c43d1786b0943f.yml +openapi_spec_hash: 56dd465d441566baf82a7c2995be83c0 config_hash: acdf4142177ed1932c2d82372693f811 From 2acb60fc6c0bbb12713548b388f3289e85efb2fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 12:22:40 +0000 Subject: [PATCH 099/130] feat(api): api update --- .stats.yml | 4 +-- src/asktable/resources/chats/messages.py | 22 ++++++++++--- .../resources/datasources/datasources.py | 32 +++++++++++++++++++ .../types/chats/message_create_params.py | 10 ++++-- .../types/dataframe_retrieve_response.py | 14 ++++---- src/asktable/types/datasource.py | 8 +++++ .../types/datasource_create_params.py | 8 +++++ .../types/datasource_retrieve_response.py | 8 +++++ .../types/datasource_update_params.py | 8 +++++ tests/api_resources/chats/test_messages.py | 26 ++++++++++----- 10 files changed, 116 insertions(+), 24 deletions(-) diff --git a/.stats.yml b/.stats.yml index b2bb9a0c..2f5e35f6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5202276c7c4f0702d5ad5e1a29f64f69a73431e0ce8ffc0fa3c43d1786b0943f.yml -openapi_spec_hash: 56dd465d441566baf82a7c2995be83c0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-bcad499bae337a6750b7a254db7d342713402b90b04cb7fa0eeab514c2179b83.yml +openapi_spec_hash: d6e641529b9e13ff068eae74bc0a1ff9 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/resources/chats/messages.py b/src/asktable/resources/chats/messages.py index 8c891817..d68276ad 100644 --- a/src/asktable/resources/chats/messages.py +++ b/src/asktable/resources/chats/messages.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, cast +from typing import Any, Optional, cast import httpx @@ -50,7 +50,8 @@ def create( self, chat_id: str, *, - question: str, + query_question: Optional[str] | Omit = omit, + body_question: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -62,6 +63,8 @@ def create( Send a message to the chat Args: + body_question: 用户问题 + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -76,12 +79,15 @@ def create( MessageCreateResponse, self._post( f"/v1/chats/{chat_id}/messages", + body=maybe_transform({"body_question": body_question}, message_create_params.MessageCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform({"question": question}, message_create_params.MessageCreateParams), + query=maybe_transform( + {"query_question": query_question}, message_create_params.MessageCreateParams + ), ), cast_to=cast( Any, MessageCreateResponse @@ -205,7 +211,8 @@ async def create( self, chat_id: str, *, - question: str, + query_question: Optional[str] | Omit = omit, + body_question: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -217,6 +224,8 @@ async def create( Send a message to the chat Args: + body_question: 用户问题 + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -231,13 +240,16 @@ async def create( MessageCreateResponse, await self._post( f"/v1/chats/{chat_id}/messages", + body=await async_maybe_transform( + {"body_question": body_question}, message_create_params.MessageCreateParams + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=await async_maybe_transform( - {"question": question}, message_create_params.MessageCreateParams + {"query_question": query_question}, message_create_params.MessageCreateParams ), ), cast_to=cast( diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index e0bf68de..7566cc38 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -116,6 +116,14 @@ def create( "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ], access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, @@ -225,6 +233,14 @@ def update( "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ] ] @@ -616,6 +632,14 @@ async def create( "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ], access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, @@ -725,6 +749,14 @@ async def update( "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ] ] diff --git a/src/asktable/types/chats/message_create_params.py b/src/asktable/types/chats/message_create_params.py index 64600d94..5f29fbec 100644 --- a/src/asktable/types/chats/message_create_params.py +++ b/src/asktable/types/chats/message_create_params.py @@ -2,10 +2,16 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Optional +from typing_extensions import Annotated, TypedDict + +from ..._utils import PropertyInfo __all__ = ["MessageCreateParams"] class MessageCreateParams(TypedDict, total=False): - question: Required[str] + query_question: Annotated[Optional[str], PropertyInfo(alias="question")] + + body_question: Annotated[Optional[str], PropertyInfo(alias="question")] + """用户问题""" diff --git a/src/asktable/types/dataframe_retrieve_response.py b/src/asktable/types/dataframe_retrieve_response.py index 75cdbde6..9df513f9 100644 --- a/src/asktable/types/dataframe_retrieve_response.py +++ b/src/asktable/types/dataframe_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from datetime import datetime from .._models import BaseModel @@ -15,9 +15,6 @@ class DataframeRetrieveResponse(BaseModel): chart_options: object """图表选项""" - content: List[object] - """内容""" - created_at: datetime """创建时间""" @@ -27,9 +24,6 @@ class DataframeRetrieveResponse(BaseModel): modified_at: datetime """更新时间""" - msg_id: str - """消息 ID""" - project_id: str """项目 ID""" @@ -41,3 +35,9 @@ class DataframeRetrieveResponse(BaseModel): title: str """标题""" + + content: Optional[List[object]] = None + """内容""" + + msg_id: Optional[str] = None + """消息 ID""" diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py index 319103ca..c27fffdd 100644 --- a/src/asktable/types/datasource.py +++ b/src/asktable/types/datasource.py @@ -40,6 +40,14 @@ class Datasource(BaseModel): "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py index f92c937f..8deb5bf6 100644 --- a/src/asktable/types/datasource_create_params.py +++ b/src/asktable/types/datasource_create_params.py @@ -41,6 +41,14 @@ class DatasourceCreateParams(TypedDict, total=False): "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ] ] diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index 01ad31a3..45790c95 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -95,6 +95,14 @@ class DatasourceRetrieveResponse(BaseModel): "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index 3397d6d7..911c1637 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -46,6 +46,14 @@ class DatasourceUpdateParams(TypedDict, total=False): "mogdb", "hologres", "maxcompute", + "gaussdb", + "tdsqlmysql", + "tdsqlpg", + "kingbasees", + "gbase8c", + "yashandb", + "gbase8a", + "gaussdbdws", "dap", ] ] diff --git a/tests/api_resources/chats/test_messages.py b/tests/api_resources/chats/test_messages.py index 93280c1b..8bae4adf 100644 --- a/tests/api_resources/chats/test_messages.py +++ b/tests/api_resources/chats/test_messages.py @@ -26,7 +26,15 @@ class TestMessages: def test_method_create(self, client: Asktable) -> None: message = client.chats.messages.create( chat_id="chat_id", - question="question", + ) + assert_matches_type(MessageCreateResponse, message, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Asktable) -> None: + message = client.chats.messages.create( + chat_id="chat_id", + query_question="question", + body_question="question", ) assert_matches_type(MessageCreateResponse, message, path=["response"]) @@ -34,7 +42,6 @@ def test_method_create(self, client: Asktable) -> None: def test_raw_response_create(self, client: Asktable) -> None: response = client.chats.messages.with_raw_response.create( chat_id="chat_id", - question="question", ) assert response.is_closed is True @@ -46,7 +53,6 @@ def test_raw_response_create(self, client: Asktable) -> None: def test_streaming_response_create(self, client: Asktable) -> None: with client.chats.messages.with_streaming_response.create( chat_id="chat_id", - question="question", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -61,7 +67,6 @@ def test_path_params_create(self, client: Asktable) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"): client.chats.messages.with_raw_response.create( chat_id="", - question="question", ) @parametrize @@ -169,7 +174,15 @@ class TestAsyncMessages: async def test_method_create(self, async_client: AsyncAsktable) -> None: message = await async_client.chats.messages.create( chat_id="chat_id", - question="question", + ) + assert_matches_type(MessageCreateResponse, message, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None: + message = await async_client.chats.messages.create( + chat_id="chat_id", + query_question="question", + body_question="question", ) assert_matches_type(MessageCreateResponse, message, path=["response"]) @@ -177,7 +190,6 @@ async def test_method_create(self, async_client: AsyncAsktable) -> None: async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: response = await async_client.chats.messages.with_raw_response.create( chat_id="chat_id", - question="question", ) assert response.is_closed is True @@ -189,7 +201,6 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None: async with async_client.chats.messages.with_streaming_response.create( chat_id="chat_id", - question="question", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -204,7 +215,6 @@ async def test_path_params_create(self, async_client: AsyncAsktable) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"): await async_client.chats.messages.with_raw_response.create( chat_id="", - question="question", ) @parametrize From 9260b13ed921f7ea0f9615999375e92327e6ae98 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 03:20:23 +0000 Subject: [PATCH 100/130] feat(api): api update --- .stats.yml | 4 ++-- requirements-dev.lock | 20 ++++++++++---------- requirements.lock | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2f5e35f6..db029dae 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-bcad499bae337a6750b7a254db7d342713402b90b04cb7fa0eeab514c2179b83.yml -openapi_spec_hash: d6e641529b9e13ff068eae74bc0a1ff9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-b4dd8e58467faa265c45d2b5d59a121a58ab3554563e9625d763a1133ca4b897.yml +openapi_spec_hash: 9caba44aefbc6719f0f4fd0aabde2d6d config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/requirements-dev.lock b/requirements-dev.lock index 6ff2ffd0..55d68a97 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,14 +12,14 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via asktable # via httpx-aiohttp aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via asktable # via httpx argcomplete==3.6.3 @@ -31,7 +31,7 @@ attrs==25.4.0 # via nox backports-asyncio-runner==1.2.0 # via pytest-asyncio -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx colorlog==6.10.1 @@ -61,7 +61,7 @@ httpx==0.28.1 # via asktable # via httpx-aiohttp # via respx -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via asktable humanize==4.13.0 # via nox @@ -69,7 +69,7 @@ idna==3.11 # via anyio # via httpx # via yarl -importlib-metadata==8.7.0 +importlib-metadata==8.7.1 iniconfig==2.1.0 # via pytest markdown-it-py==3.0.0 @@ -82,14 +82,14 @@ multidict==6.7.0 mypy==1.17.0 mypy-extensions==1.1.0 # via mypy -nodeenv==1.9.1 +nodeenv==1.10.0 # via pyright nox==2025.11.12 packaging==25.0 # via dependency-groups # via nox # via pytest -pathspec==0.12.1 +pathspec==1.0.3 # via mypy platformdirs==4.4.0 # via virtualenv @@ -115,13 +115,13 @@ python-dateutil==2.9.0.post0 # via time-machine respx==0.22.0 rich==14.2.0 -ruff==0.14.7 +ruff==0.14.13 six==1.17.0 # via python-dateutil sniffio==1.3.1 # via asktable time-machine==2.19.0 -tomli==2.3.0 +tomli==2.4.0 # via dependency-groups # via mypy # via nox @@ -141,7 +141,7 @@ typing-extensions==4.15.0 # via virtualenv typing-inspection==0.4.2 # via pydantic -virtualenv==20.35.4 +virtualenv==20.36.1 # via nox yarl==1.22.0 # via aiohttp diff --git a/requirements.lock b/requirements.lock index ff194072..7a238212 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,21 +12,21 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via asktable # via httpx-aiohttp aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.12.0 +anyio==4.12.1 # via asktable # via httpx async-timeout==5.0.1 # via aiohttp attrs==25.4.0 # via aiohttp -certifi==2025.11.12 +certifi==2026.1.4 # via httpcore # via httpx distro==1.9.0 @@ -43,7 +43,7 @@ httpcore==1.0.9 httpx==0.28.1 # via asktable # via httpx-aiohttp -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via asktable idna==3.11 # via anyio From 1784353bb71b8c263b54e1e3ad95d7f25f1c5bea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 11:20:18 +0000 Subject: [PATCH 101/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/resources/datasources/datasources.py | 4 ++++ src/asktable/types/datasource.py | 1 + src/asktable/types/datasource_create_params.py | 1 + src/asktable/types/datasource_retrieve_response.py | 1 + src/asktable/types/datasource_update_params.py | 1 + 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index db029dae..dadd7acc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-b4dd8e58467faa265c45d2b5d59a121a58ab3554563e9625d763a1133ca4b897.yml -openapi_spec_hash: 9caba44aefbc6719f0f4fd0aabde2d6d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3569c64d02d83ade05b95d417fdff1b68dc5aa46856ef948e5016c7ba20dd4dc.yml +openapi_spec_hash: 63c4eabd0ead2fac3d9495f0ba2be442 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index 7566cc38..a349d04c 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -124,6 +124,7 @@ def create( "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ], access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, @@ -241,6 +242,7 @@ def update( "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ] ] @@ -640,6 +642,7 @@ async def create( "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ], access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit, @@ -757,6 +760,7 @@ async def update( "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ] ] diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py index c27fffdd..8e1b2989 100644 --- a/src/asktable/types/datasource.py +++ b/src/asktable/types/datasource.py @@ -48,6 +48,7 @@ class Datasource(BaseModel): "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py index 8deb5bf6..cd20b5b5 100644 --- a/src/asktable/types/datasource_create_params.py +++ b/src/asktable/types/datasource_create_params.py @@ -49,6 +49,7 @@ class DatasourceCreateParams(TypedDict, total=False): "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ] ] diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index 45790c95..f39ec09d 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -103,6 +103,7 @@ class DatasourceRetrieveResponse(BaseModel): "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ] """数据源引擎""" diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index 911c1637..64aaa8f4 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -54,6 +54,7 @@ class DatasourceUpdateParams(TypedDict, total=False): "yashandb", "gbase8a", "gaussdbdws", + "bitable", "dap", ] ] From dc5a07103bfc42c3f4e5acba1a61cb06b1c2a714 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 13:20:27 +0000 Subject: [PATCH 102/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/_utils/_compat.py | 2 +- src/asktable/types/project_list_model_groups_response.py | 3 +++ src/asktable/types/sys/project_model_groups_response.py | 3 +++ .../types/user/project_retrieve_model_groups_response.py | 3 +++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index dadd7acc..d0578092 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3569c64d02d83ade05b95d417fdff1b68dc5aa46856ef948e5016c7ba20dd4dc.yml -openapi_spec_hash: 63c4eabd0ead2fac3d9495f0ba2be442 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5b77290ecd8015e20a1f710854d3c4479b5040332c2f2cd193383d90eb537a40.yml +openapi_spec_hash: ea3787a550b214abf906504fc047697e config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/_utils/_compat.py b/src/asktable/_utils/_compat.py index dd703233..2c70b299 100644 --- a/src/asktable/_utils/_compat.py +++ b/src/asktable/_utils/_compat.py @@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool: else: import types - return tp is Union or tp is types.UnionType + return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap] def is_typeddict(tp: Type[Any]) -> bool: diff --git a/src/asktable/types/project_list_model_groups_response.py b/src/asktable/types/project_list_model_groups_response.py index 3057b493..03d6826c 100644 --- a/src/asktable/types/project_list_model_groups_response.py +++ b/src/asktable/types/project_list_model_groups_response.py @@ -35,6 +35,9 @@ class ProjectListModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" + api_key: str + """API 密钥""" + available_models: List[str] """可用模型列表""" diff --git a/src/asktable/types/sys/project_model_groups_response.py b/src/asktable/types/sys/project_model_groups_response.py index a6c6e258..2cd84e64 100644 --- a/src/asktable/types/sys/project_model_groups_response.py +++ b/src/asktable/types/sys/project_model_groups_response.py @@ -31,6 +31,9 @@ class ProjectModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" + api_key: str + """API 密钥""" + available_models: List[str] """可用模型列表""" diff --git a/src/asktable/types/user/project_retrieve_model_groups_response.py b/src/asktable/types/user/project_retrieve_model_groups_response.py index f959ea41..690649df 100644 --- a/src/asktable/types/user/project_retrieve_model_groups_response.py +++ b/src/asktable/types/user/project_retrieve_model_groups_response.py @@ -35,6 +35,9 @@ class ProjectRetrieveModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" + api_key: str + """API 密钥""" + available_models: List[str] """可用模型列表""" From 871a8c7c65874d07e0329f8490df11f2e8daa0fe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 15 Feb 2026 07:20:38 +0000 Subject: [PATCH 103/130] feat(api): api update --- .stats.yml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index d0578092..eb4fc550 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5b77290ecd8015e20a1f710854d3c4479b5040332c2f2cd193383d90eb537a40.yml -openapi_spec_hash: ea3787a550b214abf906504fc047697e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-deba6a4c5b1912e4d2d8c2875077776baf7fed7b06c0adc2ba7454c7ccb5f34c.yml +openapi_spec_hash: 069f40ac62acc6ba93c801abf088df5b config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/pyproject.toml b/pyproject.toml index 18cfc56b..1b477e36 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ format = { chain = [ # run formatting again to fix any inconsistencies when imports are stripped "format:ruff", ]} -"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'" "format:ruff" = "ruff format" "lint" = { chain = [ From 5981a58a11a85d7a1d8341a563f51137719c7850 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 07:20:40 +0000 Subject: [PATCH 104/130] feat(api): api update --- .stats.yml | 4 ++-- CONTRIBUTING.md | 3 +-- src/asktable/_response.py | 3 +++ src/asktable/_streaming.py | 11 ++++++++--- tests/test_client.py | 16 ++++++++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index eb4fc550..7f8f28c0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-deba6a4c5b1912e4d2d8c2875077776baf7fed7b06c0adc2ba7454c7ccb5f34c.yml -openapi_spec_hash: 069f40ac62acc6ba93c801abf088df5b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-330fb5793f8e35033c1f808e50edb169d04f041d1d03a29f82a88c41277d0d08.yml +openapi_spec_hash: f3c6dc87348c94d873eafb1bf4f10bc1 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 58c9d1e9..3ca0ed6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -88,8 +88,7 @@ $ pip install ./path-to-wheel-file.whl Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. ```sh -# you will need npm installed -$ npx prism mock path/to/your/openapi.yml +$ ./scripts/mock ``` ```sh diff --git a/src/asktable/_response.py b/src/asktable/_response.py index 0c91a6f9..de559384 100644 --- a/src/asktable/_response.py +++ b/src/asktable/_response.py @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: ), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=extract_stream_chunk_type(self._stream_cls), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) diff --git a/src/asktable/_streaming.py b/src/asktable/_streaming.py index c26001ef..978574ca 100644 --- a/src/asktable/_streaming.py +++ b/src/asktable/_streaming.py @@ -4,7 +4,7 @@ import json import inspect from types import TracebackType -from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable import httpx @@ -13,6 +13,7 @@ if TYPE_CHECKING: from ._client import Asktable, AsyncAsktable + from ._models import FinalRequestOptions _T = TypeVar("_T") @@ -22,7 +23,7 @@ class Stream(Generic[_T]): """Provides the core interface to iterate over a synchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEBytesDecoder def __init__( @@ -31,10 +32,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: Asktable, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() @@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]): """Provides the core interface to iterate over an asynchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEDecoder | SSEBytesDecoder def __init__( @@ -94,10 +97,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: AsyncAsktable, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() diff --git a/tests/test_client.py b/tests/test_client.py index 32469194..75c3f242 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -941,6 +941,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultHttpxClient() @@ -1841,6 +1849,14 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultAsyncHttpxClient() From 783819b560f7f0b9b26a3177acbd1174de6cd259 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 28 Feb 2026 03:20:44 +0000 Subject: [PATCH 105/130] feat(api): api update --- .stats.yml | 4 +- src/asktable/_client.py | 108 ++++++++++++++++++ src/asktable/resources/answers.py | 4 + src/asktable/resources/ats/ats.py | 16 +++ src/asktable/resources/ats/task.py | 4 + src/asktable/resources/ats/test_case.py | 3 + src/asktable/resources/auth.py | 4 + src/asktable/resources/bots.py | 4 + src/asktable/resources/business_glossary.py | 4 + src/asktable/resources/chats/chats.py | 10 ++ src/asktable/resources/chats/messages.py | 4 + .../resources/datasources/datasources.py | 22 ++++ src/asktable/resources/datasources/indexes.py | 4 + src/asktable/resources/datasources/meta.py | 4 + .../resources/datasources/upload_params.py | 4 + src/asktable/resources/files.py | 4 + src/asktable/resources/integration.py | 4 + src/asktable/resources/policies.py | 4 + src/asktable/resources/polish.py | 4 + src/asktable/resources/preferences.py | 4 + src/asktable/resources/project.py | 4 + src/asktable/resources/roles.py | 4 + src/asktable/resources/scores.py | 4 + src/asktable/resources/securetunnels.py | 4 + src/asktable/resources/sqls.py | 4 + .../resources/sys/projects/api_keys.py | 4 + .../resources/sys/projects/projects.py | 10 ++ src/asktable/resources/sys/sys.py | 6 + src/asktable/resources/trainings.py | 4 + src/asktable/resources/user/projects.py | 4 + src/asktable/resources/user/user.py | 6 + 31 files changed, 271 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7f8f28c0..4be587b2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-330fb5793f8e35033c1f808e50edb169d04f041d1d03a29f82a88c41277d0d08.yml -openapi_spec_hash: f3c6dc87348c94d873eafb1bf4f10bc1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-62931b1d6bd2cf04f9887c2779e09de89d43cf8ea9323dbbe36b52e5fad4472f.yml +openapi_spec_hash: a4508a681714884c7d56077656fef3c4 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/_client.py b/src/asktable/_client.py index a9923d71..2f27f8e0 100644 --- a/src/asktable/_client.py +++ b/src/asktable/_client.py @@ -151,96 +151,112 @@ def sys(self) -> SysResource: @cached_property def securetunnels(self) -> SecuretunnelsResource: + """安全隧道""" from .resources.securetunnels import SecuretunnelsResource return SecuretunnelsResource(self) @cached_property def roles(self) -> RolesResource: + """角色管理""" from .resources.roles import RolesResource return RolesResource(self) @cached_property def policies(self) -> PoliciesResource: + """策略管理""" from .resources.policies import PoliciesResource return PoliciesResource(self) @cached_property def chats(self) -> ChatsResource: + """聊天管理""" from .resources.chats import ChatsResource return ChatsResource(self) @cached_property def datasources(self) -> DatasourcesResource: + """数据源管理""" from .resources.datasources import DatasourcesResource return DatasourcesResource(self) @cached_property def bots(self) -> BotsResource: + """机器人管理""" from .resources.bots import BotsResource return BotsResource(self) @cached_property def auth(self) -> AuthResource: + """AskTable 系统认证管理""" from .resources.auth import AuthResource return AuthResource(self) @cached_property def answers(self) -> AnswersResource: + """单轮对话""" from .resources.answers import AnswersResource return AnswersResource(self) @cached_property def sqls(self) -> SqlsResource: + """单轮对话""" from .resources.sqls import SqlsResource return SqlsResource(self) @cached_property def integration(self) -> IntegrationResource: + """与第三方平台集成""" from .resources.integration import IntegrationResource return IntegrationResource(self) @cached_property def business_glossary(self) -> BusinessGlossaryResource: + """业务术语管理""" from .resources.business_glossary import BusinessGlossaryResource return BusinessGlossaryResource(self) @cached_property def preferences(self) -> PreferencesResource: + """偏好设置""" from .resources.preferences import PreferencesResource return PreferencesResource(self) @cached_property def trainings(self) -> TrainingsResource: + """训练数据管理""" from .resources.trainings import TrainingsResource return TrainingsResource(self) @cached_property def project(self) -> ProjectResource: + """我的项目""" from .resources.project import ProjectResource return ProjectResource(self) @cached_property def scores(self) -> ScoresResource: + """评分""" from .resources.scores import ScoresResource return ScoresResource(self) @cached_property def files(self) -> FilesResource: + """数据源管理""" from .resources.files import FilesResource return FilesResource(self) @@ -253,6 +269,7 @@ def dataframes(self) -> DataframesResource: @cached_property def polish(self) -> PolishResource: + """润色""" from .resources.polish import PolishResource return PolishResource(self) @@ -265,6 +282,7 @@ def user(self) -> UserResource: @cached_property def ats(self) -> ATSResource: + """测试系统""" from .resources.ats import ATSResource return ATSResource(self) @@ -445,96 +463,112 @@ def sys(self) -> AsyncSysResource: @cached_property def securetunnels(self) -> AsyncSecuretunnelsResource: + """安全隧道""" from .resources.securetunnels import AsyncSecuretunnelsResource return AsyncSecuretunnelsResource(self) @cached_property def roles(self) -> AsyncRolesResource: + """角色管理""" from .resources.roles import AsyncRolesResource return AsyncRolesResource(self) @cached_property def policies(self) -> AsyncPoliciesResource: + """策略管理""" from .resources.policies import AsyncPoliciesResource return AsyncPoliciesResource(self) @cached_property def chats(self) -> AsyncChatsResource: + """聊天管理""" from .resources.chats import AsyncChatsResource return AsyncChatsResource(self) @cached_property def datasources(self) -> AsyncDatasourcesResource: + """数据源管理""" from .resources.datasources import AsyncDatasourcesResource return AsyncDatasourcesResource(self) @cached_property def bots(self) -> AsyncBotsResource: + """机器人管理""" from .resources.bots import AsyncBotsResource return AsyncBotsResource(self) @cached_property def auth(self) -> AsyncAuthResource: + """AskTable 系统认证管理""" from .resources.auth import AsyncAuthResource return AsyncAuthResource(self) @cached_property def answers(self) -> AsyncAnswersResource: + """单轮对话""" from .resources.answers import AsyncAnswersResource return AsyncAnswersResource(self) @cached_property def sqls(self) -> AsyncSqlsResource: + """单轮对话""" from .resources.sqls import AsyncSqlsResource return AsyncSqlsResource(self) @cached_property def integration(self) -> AsyncIntegrationResource: + """与第三方平台集成""" from .resources.integration import AsyncIntegrationResource return AsyncIntegrationResource(self) @cached_property def business_glossary(self) -> AsyncBusinessGlossaryResource: + """业务术语管理""" from .resources.business_glossary import AsyncBusinessGlossaryResource return AsyncBusinessGlossaryResource(self) @cached_property def preferences(self) -> AsyncPreferencesResource: + """偏好设置""" from .resources.preferences import AsyncPreferencesResource return AsyncPreferencesResource(self) @cached_property def trainings(self) -> AsyncTrainingsResource: + """训练数据管理""" from .resources.trainings import AsyncTrainingsResource return AsyncTrainingsResource(self) @cached_property def project(self) -> AsyncProjectResource: + """我的项目""" from .resources.project import AsyncProjectResource return AsyncProjectResource(self) @cached_property def scores(self) -> AsyncScoresResource: + """评分""" from .resources.scores import AsyncScoresResource return AsyncScoresResource(self) @cached_property def files(self) -> AsyncFilesResource: + """数据源管理""" from .resources.files import AsyncFilesResource return AsyncFilesResource(self) @@ -547,6 +581,7 @@ def dataframes(self) -> AsyncDataframesResource: @cached_property def polish(self) -> AsyncPolishResource: + """润色""" from .resources.polish import AsyncPolishResource return AsyncPolishResource(self) @@ -559,6 +594,7 @@ def user(self) -> AsyncUserResource: @cached_property def ats(self) -> AsyncATSResource: + """测试系统""" from .resources.ats import AsyncATSResource return AsyncATSResource(self) @@ -690,96 +726,112 @@ def sys(self) -> sys.SysResourceWithRawResponse: @cached_property def securetunnels(self) -> securetunnels.SecuretunnelsResourceWithRawResponse: + """安全隧道""" from .resources.securetunnels import SecuretunnelsResourceWithRawResponse return SecuretunnelsResourceWithRawResponse(self._client.securetunnels) @cached_property def roles(self) -> roles.RolesResourceWithRawResponse: + """角色管理""" from .resources.roles import RolesResourceWithRawResponse return RolesResourceWithRawResponse(self._client.roles) @cached_property def policies(self) -> policies.PoliciesResourceWithRawResponse: + """策略管理""" from .resources.policies import PoliciesResourceWithRawResponse return PoliciesResourceWithRawResponse(self._client.policies) @cached_property def chats(self) -> chats.ChatsResourceWithRawResponse: + """聊天管理""" from .resources.chats import ChatsResourceWithRawResponse return ChatsResourceWithRawResponse(self._client.chats) @cached_property def datasources(self) -> datasources.DatasourcesResourceWithRawResponse: + """数据源管理""" from .resources.datasources import DatasourcesResourceWithRawResponse return DatasourcesResourceWithRawResponse(self._client.datasources) @cached_property def bots(self) -> bots.BotsResourceWithRawResponse: + """机器人管理""" from .resources.bots import BotsResourceWithRawResponse return BotsResourceWithRawResponse(self._client.bots) @cached_property def auth(self) -> auth.AuthResourceWithRawResponse: + """AskTable 系统认证管理""" from .resources.auth import AuthResourceWithRawResponse return AuthResourceWithRawResponse(self._client.auth) @cached_property def answers(self) -> answers.AnswersResourceWithRawResponse: + """单轮对话""" from .resources.answers import AnswersResourceWithRawResponse return AnswersResourceWithRawResponse(self._client.answers) @cached_property def sqls(self) -> sqls.SqlsResourceWithRawResponse: + """单轮对话""" from .resources.sqls import SqlsResourceWithRawResponse return SqlsResourceWithRawResponse(self._client.sqls) @cached_property def integration(self) -> integration.IntegrationResourceWithRawResponse: + """与第三方平台集成""" from .resources.integration import IntegrationResourceWithRawResponse return IntegrationResourceWithRawResponse(self._client.integration) @cached_property def business_glossary(self) -> business_glossary.BusinessGlossaryResourceWithRawResponse: + """业务术语管理""" from .resources.business_glossary import BusinessGlossaryResourceWithRawResponse return BusinessGlossaryResourceWithRawResponse(self._client.business_glossary) @cached_property def preferences(self) -> preferences.PreferencesResourceWithRawResponse: + """偏好设置""" from .resources.preferences import PreferencesResourceWithRawResponse return PreferencesResourceWithRawResponse(self._client.preferences) @cached_property def trainings(self) -> trainings.TrainingsResourceWithRawResponse: + """训练数据管理""" from .resources.trainings import TrainingsResourceWithRawResponse return TrainingsResourceWithRawResponse(self._client.trainings) @cached_property def project(self) -> project.ProjectResourceWithRawResponse: + """我的项目""" from .resources.project import ProjectResourceWithRawResponse return ProjectResourceWithRawResponse(self._client.project) @cached_property def scores(self) -> scores.ScoresResourceWithRawResponse: + """评分""" from .resources.scores import ScoresResourceWithRawResponse return ScoresResourceWithRawResponse(self._client.scores) @cached_property def files(self) -> files.FilesResourceWithRawResponse: + """数据源管理""" from .resources.files import FilesResourceWithRawResponse return FilesResourceWithRawResponse(self._client.files) @@ -792,6 +844,7 @@ def dataframes(self) -> dataframes.DataframesResourceWithRawResponse: @cached_property def polish(self) -> polish.PolishResourceWithRawResponse: + """润色""" from .resources.polish import PolishResourceWithRawResponse return PolishResourceWithRawResponse(self._client.polish) @@ -804,6 +857,7 @@ def user(self) -> user.UserResourceWithRawResponse: @cached_property def ats(self) -> ats.ATSResourceWithRawResponse: + """测试系统""" from .resources.ats import ATSResourceWithRawResponse return ATSResourceWithRawResponse(self._client.ats) @@ -823,96 +877,112 @@ def sys(self) -> sys.AsyncSysResourceWithRawResponse: @cached_property def securetunnels(self) -> securetunnels.AsyncSecuretunnelsResourceWithRawResponse: + """安全隧道""" from .resources.securetunnels import AsyncSecuretunnelsResourceWithRawResponse return AsyncSecuretunnelsResourceWithRawResponse(self._client.securetunnels) @cached_property def roles(self) -> roles.AsyncRolesResourceWithRawResponse: + """角色管理""" from .resources.roles import AsyncRolesResourceWithRawResponse return AsyncRolesResourceWithRawResponse(self._client.roles) @cached_property def policies(self) -> policies.AsyncPoliciesResourceWithRawResponse: + """策略管理""" from .resources.policies import AsyncPoliciesResourceWithRawResponse return AsyncPoliciesResourceWithRawResponse(self._client.policies) @cached_property def chats(self) -> chats.AsyncChatsResourceWithRawResponse: + """聊天管理""" from .resources.chats import AsyncChatsResourceWithRawResponse return AsyncChatsResourceWithRawResponse(self._client.chats) @cached_property def datasources(self) -> datasources.AsyncDatasourcesResourceWithRawResponse: + """数据源管理""" from .resources.datasources import AsyncDatasourcesResourceWithRawResponse return AsyncDatasourcesResourceWithRawResponse(self._client.datasources) @cached_property def bots(self) -> bots.AsyncBotsResourceWithRawResponse: + """机器人管理""" from .resources.bots import AsyncBotsResourceWithRawResponse return AsyncBotsResourceWithRawResponse(self._client.bots) @cached_property def auth(self) -> auth.AsyncAuthResourceWithRawResponse: + """AskTable 系统认证管理""" from .resources.auth import AsyncAuthResourceWithRawResponse return AsyncAuthResourceWithRawResponse(self._client.auth) @cached_property def answers(self) -> answers.AsyncAnswersResourceWithRawResponse: + """单轮对话""" from .resources.answers import AsyncAnswersResourceWithRawResponse return AsyncAnswersResourceWithRawResponse(self._client.answers) @cached_property def sqls(self) -> sqls.AsyncSqlsResourceWithRawResponse: + """单轮对话""" from .resources.sqls import AsyncSqlsResourceWithRawResponse return AsyncSqlsResourceWithRawResponse(self._client.sqls) @cached_property def integration(self) -> integration.AsyncIntegrationResourceWithRawResponse: + """与第三方平台集成""" from .resources.integration import AsyncIntegrationResourceWithRawResponse return AsyncIntegrationResourceWithRawResponse(self._client.integration) @cached_property def business_glossary(self) -> business_glossary.AsyncBusinessGlossaryResourceWithRawResponse: + """业务术语管理""" from .resources.business_glossary import AsyncBusinessGlossaryResourceWithRawResponse return AsyncBusinessGlossaryResourceWithRawResponse(self._client.business_glossary) @cached_property def preferences(self) -> preferences.AsyncPreferencesResourceWithRawResponse: + """偏好设置""" from .resources.preferences import AsyncPreferencesResourceWithRawResponse return AsyncPreferencesResourceWithRawResponse(self._client.preferences) @cached_property def trainings(self) -> trainings.AsyncTrainingsResourceWithRawResponse: + """训练数据管理""" from .resources.trainings import AsyncTrainingsResourceWithRawResponse return AsyncTrainingsResourceWithRawResponse(self._client.trainings) @cached_property def project(self) -> project.AsyncProjectResourceWithRawResponse: + """我的项目""" from .resources.project import AsyncProjectResourceWithRawResponse return AsyncProjectResourceWithRawResponse(self._client.project) @cached_property def scores(self) -> scores.AsyncScoresResourceWithRawResponse: + """评分""" from .resources.scores import AsyncScoresResourceWithRawResponse return AsyncScoresResourceWithRawResponse(self._client.scores) @cached_property def files(self) -> files.AsyncFilesResourceWithRawResponse: + """数据源管理""" from .resources.files import AsyncFilesResourceWithRawResponse return AsyncFilesResourceWithRawResponse(self._client.files) @@ -925,6 +995,7 @@ def dataframes(self) -> dataframes.AsyncDataframesResourceWithRawResponse: @cached_property def polish(self) -> polish.AsyncPolishResourceWithRawResponse: + """润色""" from .resources.polish import AsyncPolishResourceWithRawResponse return AsyncPolishResourceWithRawResponse(self._client.polish) @@ -937,6 +1008,7 @@ def user(self) -> user.AsyncUserResourceWithRawResponse: @cached_property def ats(self) -> ats.AsyncATSResourceWithRawResponse: + """测试系统""" from .resources.ats import AsyncATSResourceWithRawResponse return AsyncATSResourceWithRawResponse(self._client.ats) @@ -956,96 +1028,112 @@ def sys(self) -> sys.SysResourceWithStreamingResponse: @cached_property def securetunnels(self) -> securetunnels.SecuretunnelsResourceWithStreamingResponse: + """安全隧道""" from .resources.securetunnels import SecuretunnelsResourceWithStreamingResponse return SecuretunnelsResourceWithStreamingResponse(self._client.securetunnels) @cached_property def roles(self) -> roles.RolesResourceWithStreamingResponse: + """角色管理""" from .resources.roles import RolesResourceWithStreamingResponse return RolesResourceWithStreamingResponse(self._client.roles) @cached_property def policies(self) -> policies.PoliciesResourceWithStreamingResponse: + """策略管理""" from .resources.policies import PoliciesResourceWithStreamingResponse return PoliciesResourceWithStreamingResponse(self._client.policies) @cached_property def chats(self) -> chats.ChatsResourceWithStreamingResponse: + """聊天管理""" from .resources.chats import ChatsResourceWithStreamingResponse return ChatsResourceWithStreamingResponse(self._client.chats) @cached_property def datasources(self) -> datasources.DatasourcesResourceWithStreamingResponse: + """数据源管理""" from .resources.datasources import DatasourcesResourceWithStreamingResponse return DatasourcesResourceWithStreamingResponse(self._client.datasources) @cached_property def bots(self) -> bots.BotsResourceWithStreamingResponse: + """机器人管理""" from .resources.bots import BotsResourceWithStreamingResponse return BotsResourceWithStreamingResponse(self._client.bots) @cached_property def auth(self) -> auth.AuthResourceWithStreamingResponse: + """AskTable 系统认证管理""" from .resources.auth import AuthResourceWithStreamingResponse return AuthResourceWithStreamingResponse(self._client.auth) @cached_property def answers(self) -> answers.AnswersResourceWithStreamingResponse: + """单轮对话""" from .resources.answers import AnswersResourceWithStreamingResponse return AnswersResourceWithStreamingResponse(self._client.answers) @cached_property def sqls(self) -> sqls.SqlsResourceWithStreamingResponse: + """单轮对话""" from .resources.sqls import SqlsResourceWithStreamingResponse return SqlsResourceWithStreamingResponse(self._client.sqls) @cached_property def integration(self) -> integration.IntegrationResourceWithStreamingResponse: + """与第三方平台集成""" from .resources.integration import IntegrationResourceWithStreamingResponse return IntegrationResourceWithStreamingResponse(self._client.integration) @cached_property def business_glossary(self) -> business_glossary.BusinessGlossaryResourceWithStreamingResponse: + """业务术语管理""" from .resources.business_glossary import BusinessGlossaryResourceWithStreamingResponse return BusinessGlossaryResourceWithStreamingResponse(self._client.business_glossary) @cached_property def preferences(self) -> preferences.PreferencesResourceWithStreamingResponse: + """偏好设置""" from .resources.preferences import PreferencesResourceWithStreamingResponse return PreferencesResourceWithStreamingResponse(self._client.preferences) @cached_property def trainings(self) -> trainings.TrainingsResourceWithStreamingResponse: + """训练数据管理""" from .resources.trainings import TrainingsResourceWithStreamingResponse return TrainingsResourceWithStreamingResponse(self._client.trainings) @cached_property def project(self) -> project.ProjectResourceWithStreamingResponse: + """我的项目""" from .resources.project import ProjectResourceWithStreamingResponse return ProjectResourceWithStreamingResponse(self._client.project) @cached_property def scores(self) -> scores.ScoresResourceWithStreamingResponse: + """评分""" from .resources.scores import ScoresResourceWithStreamingResponse return ScoresResourceWithStreamingResponse(self._client.scores) @cached_property def files(self) -> files.FilesResourceWithStreamingResponse: + """数据源管理""" from .resources.files import FilesResourceWithStreamingResponse return FilesResourceWithStreamingResponse(self._client.files) @@ -1058,6 +1146,7 @@ def dataframes(self) -> dataframes.DataframesResourceWithStreamingResponse: @cached_property def polish(self) -> polish.PolishResourceWithStreamingResponse: + """润色""" from .resources.polish import PolishResourceWithStreamingResponse return PolishResourceWithStreamingResponse(self._client.polish) @@ -1070,6 +1159,7 @@ def user(self) -> user.UserResourceWithStreamingResponse: @cached_property def ats(self) -> ats.ATSResourceWithStreamingResponse: + """测试系统""" from .resources.ats import ATSResourceWithStreamingResponse return ATSResourceWithStreamingResponse(self._client.ats) @@ -1089,96 +1179,112 @@ def sys(self) -> sys.AsyncSysResourceWithStreamingResponse: @cached_property def securetunnels(self) -> securetunnels.AsyncSecuretunnelsResourceWithStreamingResponse: + """安全隧道""" from .resources.securetunnels import AsyncSecuretunnelsResourceWithStreamingResponse return AsyncSecuretunnelsResourceWithStreamingResponse(self._client.securetunnels) @cached_property def roles(self) -> roles.AsyncRolesResourceWithStreamingResponse: + """角色管理""" from .resources.roles import AsyncRolesResourceWithStreamingResponse return AsyncRolesResourceWithStreamingResponse(self._client.roles) @cached_property def policies(self) -> policies.AsyncPoliciesResourceWithStreamingResponse: + """策略管理""" from .resources.policies import AsyncPoliciesResourceWithStreamingResponse return AsyncPoliciesResourceWithStreamingResponse(self._client.policies) @cached_property def chats(self) -> chats.AsyncChatsResourceWithStreamingResponse: + """聊天管理""" from .resources.chats import AsyncChatsResourceWithStreamingResponse return AsyncChatsResourceWithStreamingResponse(self._client.chats) @cached_property def datasources(self) -> datasources.AsyncDatasourcesResourceWithStreamingResponse: + """数据源管理""" from .resources.datasources import AsyncDatasourcesResourceWithStreamingResponse return AsyncDatasourcesResourceWithStreamingResponse(self._client.datasources) @cached_property def bots(self) -> bots.AsyncBotsResourceWithStreamingResponse: + """机器人管理""" from .resources.bots import AsyncBotsResourceWithStreamingResponse return AsyncBotsResourceWithStreamingResponse(self._client.bots) @cached_property def auth(self) -> auth.AsyncAuthResourceWithStreamingResponse: + """AskTable 系统认证管理""" from .resources.auth import AsyncAuthResourceWithStreamingResponse return AsyncAuthResourceWithStreamingResponse(self._client.auth) @cached_property def answers(self) -> answers.AsyncAnswersResourceWithStreamingResponse: + """单轮对话""" from .resources.answers import AsyncAnswersResourceWithStreamingResponse return AsyncAnswersResourceWithStreamingResponse(self._client.answers) @cached_property def sqls(self) -> sqls.AsyncSqlsResourceWithStreamingResponse: + """单轮对话""" from .resources.sqls import AsyncSqlsResourceWithStreamingResponse return AsyncSqlsResourceWithStreamingResponse(self._client.sqls) @cached_property def integration(self) -> integration.AsyncIntegrationResourceWithStreamingResponse: + """与第三方平台集成""" from .resources.integration import AsyncIntegrationResourceWithStreamingResponse return AsyncIntegrationResourceWithStreamingResponse(self._client.integration) @cached_property def business_glossary(self) -> business_glossary.AsyncBusinessGlossaryResourceWithStreamingResponse: + """业务术语管理""" from .resources.business_glossary import AsyncBusinessGlossaryResourceWithStreamingResponse return AsyncBusinessGlossaryResourceWithStreamingResponse(self._client.business_glossary) @cached_property def preferences(self) -> preferences.AsyncPreferencesResourceWithStreamingResponse: + """偏好设置""" from .resources.preferences import AsyncPreferencesResourceWithStreamingResponse return AsyncPreferencesResourceWithStreamingResponse(self._client.preferences) @cached_property def trainings(self) -> trainings.AsyncTrainingsResourceWithStreamingResponse: + """训练数据管理""" from .resources.trainings import AsyncTrainingsResourceWithStreamingResponse return AsyncTrainingsResourceWithStreamingResponse(self._client.trainings) @cached_property def project(self) -> project.AsyncProjectResourceWithStreamingResponse: + """我的项目""" from .resources.project import AsyncProjectResourceWithStreamingResponse return AsyncProjectResourceWithStreamingResponse(self._client.project) @cached_property def scores(self) -> scores.AsyncScoresResourceWithStreamingResponse: + """评分""" from .resources.scores import AsyncScoresResourceWithStreamingResponse return AsyncScoresResourceWithStreamingResponse(self._client.scores) @cached_property def files(self) -> files.AsyncFilesResourceWithStreamingResponse: + """数据源管理""" from .resources.files import AsyncFilesResourceWithStreamingResponse return AsyncFilesResourceWithStreamingResponse(self._client.files) @@ -1191,6 +1297,7 @@ def dataframes(self) -> dataframes.AsyncDataframesResourceWithStreamingResponse: @cached_property def polish(self) -> polish.AsyncPolishResourceWithStreamingResponse: + """润色""" from .resources.polish import AsyncPolishResourceWithStreamingResponse return AsyncPolishResourceWithStreamingResponse(self._client.polish) @@ -1203,6 +1310,7 @@ def user(self) -> user.AsyncUserResourceWithStreamingResponse: @cached_property def ats(self) -> ats.AsyncATSResourceWithStreamingResponse: + """测试系统""" from .resources.ats import AsyncATSResourceWithStreamingResponse return AsyncATSResourceWithStreamingResponse(self._client.ats) diff --git a/src/asktable/resources/answers.py b/src/asktable/resources/answers.py index 9d9e5f4a..8ddbca21 100644 --- a/src/asktable/resources/answers.py +++ b/src/asktable/resources/answers.py @@ -25,6 +25,8 @@ class AnswersResource(SyncAPIResource): + """单轮对话""" + @cached_property def with_raw_response(self) -> AnswersResourceWithRawResponse: """ @@ -157,6 +159,8 @@ def list( class AsyncAnswersResource(AsyncAPIResource): + """单轮对话""" + @cached_property def with_raw_response(self) -> AsyncAnswersResourceWithRawResponse: """ diff --git a/src/asktable/resources/ats/ats.py b/src/asktable/resources/ats/ats.py index 48869436..fbcc91ba 100644 --- a/src/asktable/resources/ats/ats.py +++ b/src/asktable/resources/ats/ats.py @@ -44,12 +44,16 @@ class ATSResource(SyncAPIResource): + """测试系统""" + @cached_property def test_case(self) -> TestCaseResource: + """测试系统""" return TestCaseResource(self._client) @cached_property def task(self) -> TaskResource: + """测试系统""" return TaskResource(self._client) @cached_property @@ -277,12 +281,16 @@ def delete( class AsyncATSResource(AsyncAPIResource): + """测试系统""" + @cached_property def test_case(self) -> AsyncTestCaseResource: + """测试系统""" return AsyncTestCaseResource(self._client) @cached_property def task(self) -> AsyncTaskResource: + """测试系统""" return AsyncTaskResource(self._client) @cached_property @@ -531,10 +539,12 @@ def __init__(self, ats: ATSResource) -> None: @cached_property def test_case(self) -> TestCaseResourceWithRawResponse: + """测试系统""" return TestCaseResourceWithRawResponse(self._ats.test_case) @cached_property def task(self) -> TaskResourceWithRawResponse: + """测试系统""" return TaskResourceWithRawResponse(self._ats.task) @@ -560,10 +570,12 @@ def __init__(self, ats: AsyncATSResource) -> None: @cached_property def test_case(self) -> AsyncTestCaseResourceWithRawResponse: + """测试系统""" return AsyncTestCaseResourceWithRawResponse(self._ats.test_case) @cached_property def task(self) -> AsyncTaskResourceWithRawResponse: + """测试系统""" return AsyncTaskResourceWithRawResponse(self._ats.task) @@ -589,10 +601,12 @@ def __init__(self, ats: ATSResource) -> None: @cached_property def test_case(self) -> TestCaseResourceWithStreamingResponse: + """测试系统""" return TestCaseResourceWithStreamingResponse(self._ats.test_case) @cached_property def task(self) -> TaskResourceWithStreamingResponse: + """测试系统""" return TaskResourceWithStreamingResponse(self._ats.task) @@ -618,8 +632,10 @@ def __init__(self, ats: AsyncATSResource) -> None: @cached_property def test_case(self) -> AsyncTestCaseResourceWithStreamingResponse: + """测试系统""" return AsyncTestCaseResourceWithStreamingResponse(self._ats.test_case) @cached_property def task(self) -> AsyncTaskResourceWithStreamingResponse: + """测试系统""" return AsyncTaskResourceWithStreamingResponse(self._ats.task) diff --git a/src/asktable/resources/ats/task.py b/src/asktable/resources/ats/task.py index 8c384687..9006c4eb 100644 --- a/src/asktable/resources/ats/task.py +++ b/src/asktable/resources/ats/task.py @@ -26,6 +26,8 @@ class TaskResource(SyncAPIResource): + """测试系统""" + @cached_property def with_raw_response(self) -> TaskResourceWithRawResponse: """ @@ -231,6 +233,8 @@ def run( class AsyncTaskResource(AsyncAPIResource): + """测试系统""" + @cached_property def with_raw_response(self) -> AsyncTaskResourceWithRawResponse: """ diff --git a/src/asktable/resources/ats/test_case.py b/src/asktable/resources/ats/test_case.py index a08fa3c9..0f4ae5cc 100644 --- a/src/asktable/resources/ats/test_case.py +++ b/src/asktable/resources/ats/test_case.py @@ -29,6 +29,7 @@ class TestCaseResource(SyncAPIResource): __test__ = False + """测试系统""" @cached_property def with_raw_response(self) -> TestCaseResourceWithRawResponse: @@ -284,6 +285,8 @@ def delete( class AsyncTestCaseResource(AsyncAPIResource): + """测试系统""" + @cached_property def with_raw_response(self) -> AsyncTestCaseResourceWithRawResponse: """ diff --git a/src/asktable/resources/auth.py b/src/asktable/resources/auth.py index 75b3433f..cc4e2c24 100644 --- a/src/asktable/resources/auth.py +++ b/src/asktable/resources/auth.py @@ -25,6 +25,8 @@ class AuthResource(SyncAPIResource): + """AskTable 系统认证管理""" + @cached_property def with_raw_response(self) -> AuthResourceWithRawResponse: """ @@ -116,6 +118,8 @@ def me( class AsyncAuthResource(AsyncAPIResource): + """AskTable 系统认证管理""" + @cached_property def with_raw_response(self) -> AsyncAuthResourceWithRawResponse: """ diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index 7f31c95d..789401a0 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -25,6 +25,8 @@ class BotsResource(SyncAPIResource): + """机器人管理""" + @cached_property def with_raw_response(self) -> BotsResourceWithRawResponse: """ @@ -378,6 +380,8 @@ def invite( class AsyncBotsResource(AsyncAPIResource): + """机器人管理""" + @cached_property def with_raw_response(self) -> AsyncBotsResourceWithRawResponse: """ diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py index a65ad951..f6be9cd7 100644 --- a/src/asktable/resources/business_glossary.py +++ b/src/asktable/resources/business_glossary.py @@ -27,6 +27,8 @@ class BusinessGlossaryResource(SyncAPIResource): + """业务术语管理""" + @cached_property def with_raw_response(self) -> BusinessGlossaryResourceWithRawResponse: """ @@ -255,6 +257,8 @@ def delete( class AsyncBusinessGlossaryResource(AsyncAPIResource): + """业务术语管理""" + @cached_property def with_raw_response(self) -> AsyncBusinessGlossaryResourceWithRawResponse: """ diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py index a1885edb..ae2bad2a 100644 --- a/src/asktable/resources/chats/chats.py +++ b/src/asktable/resources/chats/chats.py @@ -35,8 +35,11 @@ class ChatsResource(SyncAPIResource): + """聊天管理""" + @cached_property def messages(self) -> MessagesResource: + """聊天管理""" return MessagesResource(self._client) @cached_property @@ -231,8 +234,11 @@ def delete( class AsyncChatsResource(AsyncAPIResource): + """聊天管理""" + @cached_property def messages(self) -> AsyncMessagesResource: + """聊天管理""" return AsyncMessagesResource(self._client) @cached_property @@ -445,6 +451,7 @@ def __init__(self, chats: ChatsResource) -> None: @cached_property def messages(self) -> MessagesResourceWithRawResponse: + """聊天管理""" return MessagesResourceWithRawResponse(self._chats.messages) @@ -467,6 +474,7 @@ def __init__(self, chats: AsyncChatsResource) -> None: @cached_property def messages(self) -> AsyncMessagesResourceWithRawResponse: + """聊天管理""" return AsyncMessagesResourceWithRawResponse(self._chats.messages) @@ -489,6 +497,7 @@ def __init__(self, chats: ChatsResource) -> None: @cached_property def messages(self) -> MessagesResourceWithStreamingResponse: + """聊天管理""" return MessagesResourceWithStreamingResponse(self._chats.messages) @@ -511,4 +520,5 @@ def __init__(self, chats: AsyncChatsResource) -> None: @cached_property def messages(self) -> AsyncMessagesResourceWithStreamingResponse: + """聊天管理""" return AsyncMessagesResourceWithStreamingResponse(self._chats.messages) diff --git a/src/asktable/resources/chats/messages.py b/src/asktable/resources/chats/messages.py index d68276ad..3fb8ec3d 100644 --- a/src/asktable/resources/chats/messages.py +++ b/src/asktable/resources/chats/messages.py @@ -27,6 +27,8 @@ class MessagesResource(SyncAPIResource): + """聊天管理""" + @cached_property def with_raw_response(self) -> MessagesResourceWithRawResponse: """ @@ -188,6 +190,8 @@ def list( class AsyncMessagesResource(AsyncAPIResource): + """聊天管理""" + @cached_property def with_raw_response(self) -> AsyncMessagesResourceWithRawResponse: """ diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index a349d04c..7ccdcbae 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -58,16 +58,21 @@ class DatasourcesResource(SyncAPIResource): + """数据源管理""" + @cached_property def meta(self) -> MetaResource: + """数据源管理""" return MetaResource(self._client) @cached_property def upload_params(self) -> UploadParamsResource: + """数据源管理""" return UploadParamsResource(self._client) @cached_property def indexes(self) -> IndexesResource: + """索引管理""" return IndexesResource(self._client) @cached_property @@ -576,16 +581,21 @@ def update_field( class AsyncDatasourcesResource(AsyncAPIResource): + """数据源管理""" + @cached_property def meta(self) -> AsyncMetaResource: + """数据源管理""" return AsyncMetaResource(self._client) @cached_property def upload_params(self) -> AsyncUploadParamsResource: + """数据源管理""" return AsyncUploadParamsResource(self._client) @cached_property def indexes(self) -> AsyncIndexesResource: + """索引管理""" return AsyncIndexesResource(self._client) @cached_property @@ -1127,14 +1137,17 @@ def __init__(self, datasources: DatasourcesResource) -> None: @cached_property def meta(self) -> MetaResourceWithRawResponse: + """数据源管理""" return MetaResourceWithRawResponse(self._datasources.meta) @cached_property def upload_params(self) -> UploadParamsResourceWithRawResponse: + """数据源管理""" return UploadParamsResourceWithRawResponse(self._datasources.upload_params) @cached_property def indexes(self) -> IndexesResourceWithRawResponse: + """索引管理""" return IndexesResourceWithRawResponse(self._datasources.indexes) @@ -1172,14 +1185,17 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None: @cached_property def meta(self) -> AsyncMetaResourceWithRawResponse: + """数据源管理""" return AsyncMetaResourceWithRawResponse(self._datasources.meta) @cached_property def upload_params(self) -> AsyncUploadParamsResourceWithRawResponse: + """数据源管理""" return AsyncUploadParamsResourceWithRawResponse(self._datasources.upload_params) @cached_property def indexes(self) -> AsyncIndexesResourceWithRawResponse: + """索引管理""" return AsyncIndexesResourceWithRawResponse(self._datasources.indexes) @@ -1217,14 +1233,17 @@ def __init__(self, datasources: DatasourcesResource) -> None: @cached_property def meta(self) -> MetaResourceWithStreamingResponse: + """数据源管理""" return MetaResourceWithStreamingResponse(self._datasources.meta) @cached_property def upload_params(self) -> UploadParamsResourceWithStreamingResponse: + """数据源管理""" return UploadParamsResourceWithStreamingResponse(self._datasources.upload_params) @cached_property def indexes(self) -> IndexesResourceWithStreamingResponse: + """索引管理""" return IndexesResourceWithStreamingResponse(self._datasources.indexes) @@ -1262,12 +1281,15 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None: @cached_property def meta(self) -> AsyncMetaResourceWithStreamingResponse: + """数据源管理""" return AsyncMetaResourceWithStreamingResponse(self._datasources.meta) @cached_property def upload_params(self) -> AsyncUploadParamsResourceWithStreamingResponse: + """数据源管理""" return AsyncUploadParamsResourceWithStreamingResponse(self._datasources.upload_params) @cached_property def indexes(self) -> AsyncIndexesResourceWithStreamingResponse: + """索引管理""" return AsyncIndexesResourceWithStreamingResponse(self._datasources.indexes) diff --git a/src/asktable/resources/datasources/indexes.py b/src/asktable/resources/datasources/indexes.py index 64148b70..f50564a1 100644 --- a/src/asktable/resources/datasources/indexes.py +++ b/src/asktable/resources/datasources/indexes.py @@ -23,6 +23,8 @@ class IndexesResource(SyncAPIResource): + """索引管理""" + @cached_property def with_raw_response(self) -> IndexesResourceWithRawResponse: """ @@ -187,6 +189,8 @@ def delete( class AsyncIndexesResource(AsyncAPIResource): + """索引管理""" + @cached_property def with_raw_response(self) -> AsyncIndexesResourceWithRawResponse: """ diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py index 3c5ddde1..20e7f8b1 100644 --- a/src/asktable/resources/datasources/meta.py +++ b/src/asktable/resources/datasources/meta.py @@ -24,6 +24,8 @@ class MetaResource(SyncAPIResource): + """数据源管理""" + @cached_property def with_raw_response(self) -> MetaResourceWithRawResponse: """ @@ -218,6 +220,8 @@ def annotate( class AsyncMetaResource(AsyncAPIResource): + """数据源管理""" + @cached_property def with_raw_response(self) -> AsyncMetaResourceWithRawResponse: """ diff --git a/src/asktable/resources/datasources/upload_params.py b/src/asktable/resources/datasources/upload_params.py index bb5637e0..b8f8f474 100644 --- a/src/asktable/resources/datasources/upload_params.py +++ b/src/asktable/resources/datasources/upload_params.py @@ -23,6 +23,8 @@ class UploadParamsResource(SyncAPIResource): + """数据源管理""" + @cached_property def with_raw_response(self) -> UploadParamsResourceWithRawResponse: """ @@ -87,6 +89,8 @@ def create( class AsyncUploadParamsResource(AsyncAPIResource): + """数据源管理""" + @cached_property def with_raw_response(self) -> AsyncUploadParamsResourceWithRawResponse: """ diff --git a/src/asktable/resources/files.py b/src/asktable/resources/files.py index 1b2feb29..bbea850f 100644 --- a/src/asktable/resources/files.py +++ b/src/asktable/resources/files.py @@ -19,6 +19,8 @@ class FilesResource(SyncAPIResource): + """数据源管理""" + @cached_property def with_raw_response(self) -> FilesResourceWithRawResponse: """ @@ -73,6 +75,8 @@ def retrieve( class AsyncFilesResource(AsyncAPIResource): + """数据源管理""" + @cached_property def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: """ diff --git a/src/asktable/resources/integration.py b/src/asktable/resources/integration.py index b3dbb640..46354ff3 100644 --- a/src/asktable/resources/integration.py +++ b/src/asktable/resources/integration.py @@ -25,6 +25,8 @@ class IntegrationResource(SyncAPIResource): + """与第三方平台集成""" + @cached_property def with_raw_response(self) -> IntegrationResourceWithRawResponse: """ @@ -135,6 +137,8 @@ def excel_csv_ask( class AsyncIntegrationResource(AsyncAPIResource): + """与第三方平台集成""" + @cached_property def with_raw_response(self) -> AsyncIntegrationResourceWithRawResponse: """ diff --git a/src/asktable/resources/policies.py b/src/asktable/resources/policies.py index ba28635e..55618d39 100644 --- a/src/asktable/resources/policies.py +++ b/src/asktable/resources/policies.py @@ -26,6 +26,8 @@ class PoliciesResource(SyncAPIResource): + """策略管理""" + @cached_property def with_raw_response(self) -> PoliciesResourceWithRawResponse: """ @@ -266,6 +268,8 @@ def delete( class AsyncPoliciesResource(AsyncAPIResource): + """策略管理""" + @cached_property def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: """ diff --git a/src/asktable/resources/polish.py b/src/asktable/resources/polish.py index 4cacff21..5a51a4c6 100644 --- a/src/asktable/resources/polish.py +++ b/src/asktable/resources/polish.py @@ -24,6 +24,8 @@ class PolishResource(SyncAPIResource): + """润色""" + @cached_property def with_raw_response(self) -> PolishResourceWithRawResponse: """ @@ -92,6 +94,8 @@ def create( class AsyncPolishResource(AsyncAPIResource): + """润色""" + @cached_property def with_raw_response(self) -> AsyncPolishResourceWithRawResponse: """ diff --git a/src/asktable/resources/preferences.py b/src/asktable/resources/preferences.py index 69b0313c..6543b65c 100644 --- a/src/asktable/resources/preferences.py +++ b/src/asktable/resources/preferences.py @@ -26,6 +26,8 @@ class PreferencesResource(SyncAPIResource): + """偏好设置""" + @cached_property def with_raw_response(self) -> PreferencesResourceWithRawResponse: """ @@ -171,6 +173,8 @@ def delete( class AsyncPreferencesResource(AsyncAPIResource): + """偏好设置""" + @cached_property def with_raw_response(self) -> AsyncPreferencesResourceWithRawResponse: """ diff --git a/src/asktable/resources/project.py b/src/asktable/resources/project.py index f3033d69..920f2d1c 100644 --- a/src/asktable/resources/project.py +++ b/src/asktable/resources/project.py @@ -25,6 +25,8 @@ class ProjectResource(SyncAPIResource): + """我的项目""" + @cached_property def with_raw_response(self) -> ProjectResourceWithRawResponse: """ @@ -127,6 +129,8 @@ def list_model_groups( class AsyncProjectResource(AsyncAPIResource): + """我的项目""" + @cached_property def with_raw_response(self) -> AsyncProjectResourceWithRawResponse: """ diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py index 44bf5e85..2b5386fc 100644 --- a/src/asktable/resources/roles.py +++ b/src/asktable/resources/roles.py @@ -26,6 +26,8 @@ class RolesResource(SyncAPIResource): + """角色管理""" + @cached_property def with_raw_response(self) -> RolesResourceWithRawResponse: """ @@ -339,6 +341,8 @@ def get_variables( class AsyncRolesResource(AsyncAPIResource): + """角色管理""" + @cached_property def with_raw_response(self) -> AsyncRolesResourceWithRawResponse: """ diff --git a/src/asktable/resources/scores.py b/src/asktable/resources/scores.py index 28a7c15b..8c62c017 100644 --- a/src/asktable/resources/scores.py +++ b/src/asktable/resources/scores.py @@ -22,6 +22,8 @@ class ScoresResource(SyncAPIResource): + """评分""" + @cached_property def with_raw_response(self) -> ScoresResourceWithRawResponse: """ @@ -93,6 +95,8 @@ def create( class AsyncScoresResource(AsyncAPIResource): + """评分""" + @cached_property def with_raw_response(self) -> AsyncScoresResourceWithRawResponse: """ diff --git a/src/asktable/resources/securetunnels.py b/src/asktable/resources/securetunnels.py index 94972d7c..0f821840 100644 --- a/src/asktable/resources/securetunnels.py +++ b/src/asktable/resources/securetunnels.py @@ -31,6 +31,8 @@ class SecuretunnelsResource(SyncAPIResource): + """安全隧道""" + @cached_property def with_raw_response(self) -> SecuretunnelsResourceWithRawResponse: """ @@ -300,6 +302,8 @@ def list_links( class AsyncSecuretunnelsResource(AsyncAPIResource): + """安全隧道""" + @cached_property def with_raw_response(self) -> AsyncSecuretunnelsResourceWithRawResponse: """ diff --git a/src/asktable/resources/sqls.py b/src/asktable/resources/sqls.py index 8680b02a..c41b2c98 100644 --- a/src/asktable/resources/sqls.py +++ b/src/asktable/resources/sqls.py @@ -25,6 +25,8 @@ class SqlsResource(SyncAPIResource): + """单轮对话""" + @cached_property def with_raw_response(self) -> SqlsResourceWithRawResponse: """ @@ -153,6 +155,8 @@ def list( class AsyncSqlsResource(AsyncAPIResource): + """单轮对话""" + @cached_property def with_raw_response(self) -> AsyncSqlsResourceWithRawResponse: """ diff --git a/src/asktable/resources/sys/projects/api_keys.py b/src/asktable/resources/sys/projects/api_keys.py index a95de033..39be7526 100644 --- a/src/asktable/resources/sys/projects/api_keys.py +++ b/src/asktable/resources/sys/projects/api_keys.py @@ -26,6 +26,8 @@ class APIKeysResource(SyncAPIResource): + """系统管理""" + @cached_property def with_raw_response(self) -> APIKeysResourceWithRawResponse: """ @@ -208,6 +210,8 @@ def create_token( class AsyncAPIKeysResource(AsyncAPIResource): + """系统管理""" + @cached_property def with_raw_response(self) -> AsyncAPIKeysResourceWithRawResponse: """ diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index 352655b3..8876c895 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -34,8 +34,11 @@ class ProjectsResource(SyncAPIResource): + """系统管理""" + @cached_property def api_keys(self) -> APIKeysResource: + """系统管理""" return APIKeysResource(self._client) @cached_property @@ -344,8 +347,11 @@ def model_groups( class AsyncProjectsResource(AsyncAPIResource): + """系统管理""" + @cached_property def api_keys(self) -> AsyncAPIKeysResource: + """系统管理""" return AsyncAPIKeysResource(self._client) @cached_property @@ -684,6 +690,7 @@ def __init__(self, projects: ProjectsResource) -> None: @cached_property def api_keys(self) -> APIKeysResourceWithRawResponse: + """系统管理""" return APIKeysResourceWithRawResponse(self._projects.api_keys) @@ -718,6 +725,7 @@ def __init__(self, projects: AsyncProjectsResource) -> None: @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse: + """系统管理""" return AsyncAPIKeysResourceWithRawResponse(self._projects.api_keys) @@ -752,6 +760,7 @@ def __init__(self, projects: ProjectsResource) -> None: @cached_property def api_keys(self) -> APIKeysResourceWithStreamingResponse: + """系统管理""" return APIKeysResourceWithStreamingResponse(self._projects.api_keys) @@ -786,4 +795,5 @@ def __init__(self, projects: AsyncProjectsResource) -> None: @cached_property def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse: + """系统管理""" return AsyncAPIKeysResourceWithStreamingResponse(self._projects.api_keys) diff --git a/src/asktable/resources/sys/sys.py b/src/asktable/resources/sys/sys.py index 27f630db..9352d837 100644 --- a/src/asktable/resources/sys/sys.py +++ b/src/asktable/resources/sys/sys.py @@ -19,6 +19,7 @@ class SysResource(SyncAPIResource): @cached_property def projects(self) -> ProjectsResource: + """系统管理""" return ProjectsResource(self._client) @cached_property @@ -44,6 +45,7 @@ def with_streaming_response(self) -> SysResourceWithStreamingResponse: class AsyncSysResource(AsyncAPIResource): @cached_property def projects(self) -> AsyncProjectsResource: + """系统管理""" return AsyncProjectsResource(self._client) @cached_property @@ -72,6 +74,7 @@ def __init__(self, sys: SysResource) -> None: @cached_property def projects(self) -> ProjectsResourceWithRawResponse: + """系统管理""" return ProjectsResourceWithRawResponse(self._sys.projects) @@ -81,6 +84,7 @@ def __init__(self, sys: AsyncSysResource) -> None: @cached_property def projects(self) -> AsyncProjectsResourceWithRawResponse: + """系统管理""" return AsyncProjectsResourceWithRawResponse(self._sys.projects) @@ -90,6 +94,7 @@ def __init__(self, sys: SysResource) -> None: @cached_property def projects(self) -> ProjectsResourceWithStreamingResponse: + """系统管理""" return ProjectsResourceWithStreamingResponse(self._sys.projects) @@ -99,4 +104,5 @@ def __init__(self, sys: AsyncSysResource) -> None: @cached_property def projects(self) -> AsyncProjectsResourceWithStreamingResponse: + """系统管理""" return AsyncProjectsResourceWithStreamingResponse(self._sys.projects) diff --git a/src/asktable/resources/trainings.py b/src/asktable/resources/trainings.py index 4037eaf0..b8d6d31c 100644 --- a/src/asktable/resources/trainings.py +++ b/src/asktable/resources/trainings.py @@ -27,6 +27,8 @@ class TrainingsResource(SyncAPIResource): + """训练数据管理""" + @cached_property def with_raw_response(self) -> TrainingsResourceWithRawResponse: """ @@ -239,6 +241,8 @@ def delete( class AsyncTrainingsResource(AsyncAPIResource): + """训练数据管理""" + @cached_property def with_raw_response(self) -> AsyncTrainingsResourceWithRawResponse: """ diff --git a/src/asktable/resources/user/projects.py b/src/asktable/resources/user/projects.py index 929f5a70..324dd9ac 100644 --- a/src/asktable/resources/user/projects.py +++ b/src/asktable/resources/user/projects.py @@ -25,6 +25,8 @@ class ProjectsResource(SyncAPIResource): + """我的项目""" + @cached_property def with_raw_response(self) -> ProjectsResourceWithRawResponse: """ @@ -127,6 +129,8 @@ def update_my_project( class AsyncProjectsResource(AsyncAPIResource): + """我的项目""" + @cached_property def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse: """ diff --git a/src/asktable/resources/user/user.py b/src/asktable/resources/user/user.py index 981d0969..970be13c 100644 --- a/src/asktable/resources/user/user.py +++ b/src/asktable/resources/user/user.py @@ -19,6 +19,7 @@ class UserResource(SyncAPIResource): @cached_property def projects(self) -> ProjectsResource: + """我的项目""" return ProjectsResource(self._client) @cached_property @@ -44,6 +45,7 @@ def with_streaming_response(self) -> UserResourceWithStreamingResponse: class AsyncUserResource(AsyncAPIResource): @cached_property def projects(self) -> AsyncProjectsResource: + """我的项目""" return AsyncProjectsResource(self._client) @cached_property @@ -72,6 +74,7 @@ def __init__(self, user: UserResource) -> None: @cached_property def projects(self) -> ProjectsResourceWithRawResponse: + """我的项目""" return ProjectsResourceWithRawResponse(self._user.projects) @@ -81,6 +84,7 @@ def __init__(self, user: AsyncUserResource) -> None: @cached_property def projects(self) -> AsyncProjectsResourceWithRawResponse: + """我的项目""" return AsyncProjectsResourceWithRawResponse(self._user.projects) @@ -90,6 +94,7 @@ def __init__(self, user: UserResource) -> None: @cached_property def projects(self) -> ProjectsResourceWithStreamingResponse: + """我的项目""" return ProjectsResourceWithStreamingResponse(self._user.projects) @@ -99,4 +104,5 @@ def __init__(self, user: AsyncUserResource) -> None: @cached_property def projects(self) -> AsyncProjectsResourceWithStreamingResponse: + """我的项目""" return AsyncProjectsResourceWithStreamingResponse(self._user.projects) From 6d705b07546e449d03e5e0f70f859a49c8db14ec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 03:20:34 +0000 Subject: [PATCH 106/130] feat(api): api update --- .stats.yml | 4 +- README.md | 18 --------- api.md | 40 +++++++++++++------ src/asktable/_files.py | 2 +- src/asktable/resources/answers.py | 6 +-- src/asktable/resources/ats/test_case.py | 10 ++--- src/asktable/resources/auth.py | 15 +++---- src/asktable/resources/bots.py | 9 +++-- src/asktable/resources/business_glossary.py | 6 +-- .../resources/datasources/datasources.py | 20 ++++------ .../resources/datasources/upload_params.py | 9 +++-- src/asktable/resources/roles.py | 9 +++-- src/asktable/resources/securetunnels.py | 6 +-- src/asktable/resources/sqls.py | 6 +-- .../resources/sys/projects/api_keys.py | 15 +++---- .../resources/sys/projects/projects.py | 24 ++++++----- src/asktable/types/__init__.py | 3 ++ src/asktable/types/ai_message.py | 6 +-- src/asktable/types/answer_create_params.py | 4 +- src/asktable/types/answer_response.py | 6 +-- .../types/ats/task_get_case_tasks_response.py | 16 ++++---- src/asktable/types/ats/task_list_response.py | 4 +- .../types/ats/task_retrieve_response.py | 4 +- src/asktable/types/ats/task_run_response.py | 4 +- .../types/ats/test_case_create_params.py | 4 +- .../types/ats/test_case_create_response.py | 4 +- .../types/ats/test_case_list_response.py | 4 +- .../types/ats/test_case_retrieve_response.py | 4 +- .../types/ats/test_case_update_params.py | 4 +- .../types/ats/test_case_update_response.py | 4 +- .../types/auth_create_token_params.py | 6 +-- .../types/auth_create_token_response.py | 8 ++++ src/asktable/types/auth_me_response.py | 6 +-- src/asktable/types/bot_invite_response.py | 8 ++++ .../types/business_glossary_create_params.py | 4 +- .../types/business_glossary_update_params.py | 4 +- .../types/dataframe_retrieve_response.py | 8 ++-- .../types/datasource_add_file_params.py | 4 +- .../types/datasource_create_params.py | 4 +- .../types/datasource_retrieve_response.py | 6 +-- .../types/datasource_update_params.py | 6 +-- src/asktable/types/datasources/__init__.py | 1 + .../types/datasources/meta_create_params.py | 2 +- .../types/datasources/meta_update_params.py | 2 +- .../upload_param_create_response.py | 8 ++++ src/asktable/types/entry.py | 4 +- src/asktable/types/entry_with_definition.py | 4 +- src/asktable/types/meta.py | 2 +- src/asktable/types/query_response.py | 6 +-- .../types/role_get_variables_response.py | 8 ++++ src/asktable/types/secure_tunnel.py | 4 +- .../types/securetunnel_update_params.py | 4 +- src/asktable/types/sql_create_params.py | 4 +- src/asktable/types/sys/__init__.py | 2 + .../types/sys/project_export_response.py | 8 ++++ .../types/sys/project_import_params.py | 3 +- .../types/sys/project_import_response.py | 8 ++++ src/asktable/types/sys/projects/__init__.py | 1 + .../projects/api_key_create_token_params.py | 6 +-- .../projects/api_key_create_token_response.py | 8 ++++ src/asktable/types/tool_message.py | 4 +- src/asktable/types/user_message.py | 4 +- tests/api_resources/ats/test_test_case.py | 8 ++-- tests/api_resources/datasources/test_meta.py | 8 ++-- .../datasources/test_upload_params.py | 17 ++++---- .../sys/projects/test_api_keys.py | 25 ++++++------ tests/api_resources/sys/test_projects.py | 38 +++++++++--------- tests/api_resources/test_answers.py | 4 +- tests/api_resources/test_auth.py | 26 ++++++------ tests/api_resources/test_bots.py | 17 ++++---- tests/api_resources/test_business_glossary.py | 4 +- tests/api_resources/test_datasources.py | 24 +++++------ tests/api_resources/test_roles.py | 17 ++++---- tests/api_resources/test_securetunnels.py | 4 +- tests/api_resources/test_sqls.py | 4 +- 75 files changed, 346 insertions(+), 277 deletions(-) create mode 100644 src/asktable/types/auth_create_token_response.py create mode 100644 src/asktable/types/bot_invite_response.py create mode 100644 src/asktable/types/datasources/upload_param_create_response.py create mode 100644 src/asktable/types/role_get_variables_response.py create mode 100644 src/asktable/types/sys/project_export_response.py create mode 100644 src/asktable/types/sys/project_import_response.py create mode 100644 src/asktable/types/sys/projects/api_key_create_token_response.py diff --git a/.stats.yml b/.stats.yml index 4be587b2..a7b8eaba 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-62931b1d6bd2cf04f9887c2779e09de89d43cf8ea9323dbbe36b52e5fad4472f.yml -openapi_spec_hash: a4508a681714884c7d56077656fef3c4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9b3127f357a8502fba6b108515b97e5acb04e50cb2f933c654c05532b6a5ab19.yml +openapi_spec_hash: aa447a038dd69ccbad1eadad7204d5ad config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/README.md b/README.md index a32428d2..aa944739 100644 --- a/README.md +++ b/README.md @@ -191,24 +191,6 @@ response = client.sys.projects.api_keys.create_token( print(response.chat_role) ``` -## File uploads - -Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. - -```python -from pathlib import Path -from asktable import Asktable - -client = Asktable() - -client.datasources.add_file( - datasource_id="datasource_id", - file=Path("/path/to/file"), -) -``` - -The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. - ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `asktable.APIConnectionError` is raised. diff --git a/api.md b/api.md index e3b753b9..73aaa5a2 100644 --- a/api.md +++ b/api.md @@ -11,7 +11,13 @@ from asktable.types import Policy Types: ```python -from asktable.types.sys import APIKey, Project, ProjectModelGroupsResponse +from asktable.types.sys import ( + APIKey, + Project, + ProjectExportResponse, + ProjectImportResponse, + ProjectModelGroupsResponse, +) ``` Methods: @@ -21,8 +27,8 @@ Methods: - client.sys.projects.update(project_id, \*\*params) -> Project - client.sys.projects.list(\*\*params) -> SyncPage[Project] - client.sys.projects.delete(project_id) -> object -- client.sys.projects.export(project_id) -> object -- client.sys.projects.import\_(\*\*params) -> object +- client.sys.projects.export(project_id) -> ProjectExportResponse +- client.sys.projects.import\_(\*\*params) -> ProjectImportResponse - client.sys.projects.model_groups() -> ProjectModelGroupsResponse ### APIKeys @@ -30,7 +36,11 @@ Methods: Types: ```python -from asktable.types.sys.projects import APIKeyCreateResponse, APIKeyListResponse +from asktable.types.sys.projects import ( + APIKeyCreateResponse, + APIKeyListResponse, + APIKeyCreateTokenResponse, +) ``` Methods: @@ -38,7 +48,7 @@ Methods: - client.sys.projects.api_keys.create(project_id, \*\*params) -> APIKeyCreateResponse - client.sys.projects.api_keys.list(project_id) -> APIKeyListResponse - client.sys.projects.api_keys.delete(key_id, \*, project_id) -> None -- client.sys.projects.api_keys.create_token(project_id, \*\*params) -> object +- client.sys.projects.api_keys.create_token(project_id, \*\*params) -> APIKeyCreateTokenResponse # Securetunnels @@ -62,7 +72,7 @@ Methods: Types: ```python -from asktable.types import Role, RoleGetPolicesResponse +from asktable.types import Role, RoleGetPolicesResponse, RoleGetVariablesResponse ``` Methods: @@ -73,7 +83,7 @@ Methods: - client.roles.list(\*\*params) -> SyncPage[Role] - client.roles.delete(role_id) -> object - client.roles.get_polices(role_id) -> RoleGetPolicesResponse -- client.roles.get_variables(role_id, \*\*params) -> object +- client.roles.get_variables(role_id, \*\*params) -> RoleGetVariablesResponse # Policies @@ -158,9 +168,15 @@ Methods: ## UploadParams +Types: + +```python +from asktable.types.datasources import UploadParamCreateResponse +``` + Methods: -- client.datasources.upload_params.create(\*\*params) -> object +- client.datasources.upload_params.create(\*\*params) -> UploadParamCreateResponse ## Indexes @@ -175,7 +191,7 @@ Methods: Types: ```python -from asktable.types import Chatbot +from asktable.types import Chatbot, BotInviteResponse ``` Methods: @@ -185,19 +201,19 @@ Methods: - client.bots.update(bot_id, \*\*params) -> Chatbot - client.bots.list(\*\*params) -> SyncPage[Chatbot] - client.bots.delete(bot_id) -> object -- client.bots.invite(bot_id, \*\*params) -> object +- client.bots.invite(bot_id, \*\*params) -> BotInviteResponse # Auth Types: ```python -from asktable.types import AuthMeResponse +from asktable.types import AuthCreateTokenResponse, AuthMeResponse ``` Methods: -- client.auth.create_token(\*\*params) -> object +- client.auth.create_token(\*\*params) -> AuthCreateTokenResponse - client.auth.me() -> AuthMeResponse # Answers diff --git a/src/asktable/_files.py b/src/asktable/_files.py index 978df31d..cc14c14f 100644 --- a/src/asktable/_files.py +++ b/src/asktable/_files.py @@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: if not is_file_content(obj): prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" raise RuntimeError( - f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/DataMini/asktable-python/tree/main#file-uploads" + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead." ) from None diff --git a/src/asktable/resources/answers.py b/src/asktable/resources/answers.py index 8ddbca21..80c04567 100644 --- a/src/asktable/resources/answers.py +++ b/src/asktable/resources/answers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx @@ -53,7 +53,7 @@ def create( question: str, max_rows: Optional[int] | Omit = omit, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, with_json: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -187,7 +187,7 @@ async def create( question: str, max_rows: Optional[int] | Omit = omit, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, with_json: Optional[bool] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/asktable/resources/ats/test_case.py b/src/asktable/resources/ats/test_case.py index 0f4ae5cc..8ed2eb13 100644 --- a/src/asktable/resources/ats/test_case.py +++ b/src/asktable/resources/ats/test_case.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx @@ -57,7 +57,7 @@ def create( expected_sql: str, question: str, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -148,7 +148,7 @@ def update( expected_sql: str, question: str, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -313,7 +313,7 @@ async def create( expected_sql: str, question: str, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -404,7 +404,7 @@ async def update( expected_sql: str, question: str, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/asktable/resources/auth.py b/src/asktable/resources/auth.py index cc4e2c24..c293a396 100644 --- a/src/asktable/resources/auth.py +++ b/src/asktable/resources/auth.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -20,6 +20,7 @@ ) from .._base_client import make_request_options from ..types.auth_me_response import AuthMeResponse +from ..types.auth_create_token_response import AuthCreateTokenResponse __all__ = ["AuthResource", "AsyncAuthResource"] @@ -52,14 +53,14 @@ def create_token( ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, chat_role: Optional[auth_create_token_params.ChatRole] | Omit = omit, token_ttl: int | Omit = omit, - user_profile: Optional[object] | Omit = omit, + user_profile: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> AuthCreateTokenResponse: """ Create Token @@ -94,7 +95,7 @@ def create_token( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AuthCreateTokenResponse, ) def me( @@ -145,14 +146,14 @@ async def create_token( ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, chat_role: Optional[auth_create_token_params.ChatRole] | Omit = omit, token_ttl: int | Omit = omit, - user_profile: Optional[object] | Omit = omit, + user_profile: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> AuthCreateTokenResponse: """ Create Token @@ -187,7 +188,7 @@ async def create_token( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=AuthCreateTokenResponse, ) async def me( diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index 789401a0..e3eb5748 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -20,6 +20,7 @@ from ..pagination import SyncPage, AsyncPage from .._base_client import AsyncPaginator, make_request_options from ..types.chatbot import Chatbot +from ..types.bot_invite_response import BotInviteResponse __all__ = ["BotsResource", "AsyncBotsResource"] @@ -351,7 +352,7 @@ def invite( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> BotInviteResponse: """ 邀请用户加入对话 @@ -375,7 +376,7 @@ def invite( timeout=timeout, query=maybe_transform({"project_id": project_id}, bot_invite_params.BotInviteParams), ), - cast_to=object, + cast_to=BotInviteResponse, ) @@ -706,7 +707,7 @@ async def invite( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> BotInviteResponse: """ 邀请用户加入对话 @@ -730,7 +731,7 @@ async def invite( timeout=timeout, query=await async_maybe_transform({"project_id": project_id}, bot_invite_params.BotInviteParams), ), - cast_to=object, + cast_to=BotInviteResponse, ) diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py index f6be9cd7..1ae35d5f 100644 --- a/src/asktable/resources/business_glossary.py +++ b/src/asktable/resources/business_glossary.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional import httpx @@ -120,7 +120,7 @@ def update( active: Optional[bool] | Omit = omit, aliases: Optional[SequenceNotStr[str]] | Omit = omit, definition: Optional[str] | Omit = omit, - payload: Optional[object] | Omit = omit, + payload: Optional[Dict[str, object]] | Omit = omit, term: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -350,7 +350,7 @@ async def update( active: Optional[bool] | Omit = omit, aliases: Optional[SequenceNotStr[str]] | Omit = omit, definition: Optional[str] | Omit = omit, - payload: Optional[object] | Omit = omit, + payload: Optional[Dict[str, object]] | Omit = omit, term: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index 7ccdcbae..e48a0e4d 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Mapping, Optional, cast +from typing import Optional from typing_extensions import Literal import httpx @@ -30,8 +30,8 @@ IndexesResourceWithStreamingResponse, AsyncIndexesResourceWithStreamingResponse, ) -from ..._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given -from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -409,7 +409,7 @@ def add_file( self, datasource_id: str, *, - file: FileTypes, + file: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -431,16 +431,13 @@ def add_file( """ if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") - body = deepcopy_minimal({"file": file}) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._post( f"/v1/datasources/{datasource_id}/files", - body=maybe_transform(body, datasource_add_file_params.DatasourceAddFileParams), - files=files, + body=maybe_transform({"file": file}, datasource_add_file_params.DatasourceAddFileParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -932,7 +929,7 @@ async def add_file( self, datasource_id: str, *, - file: FileTypes, + file: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -954,16 +951,13 @@ async def add_file( """ if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") - body = deepcopy_minimal({"file": file}) - files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) # It should be noted that the actual Content-Type header that will be # sent to the server will contain a `boundary` parameter, e.g. # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._post( f"/v1/datasources/{datasource_id}/files", - body=await async_maybe_transform(body, datasource_add_file_params.DatasourceAddFileParams), - files=files, + body=await async_maybe_transform({"file": file}, datasource_add_file_params.DatasourceAddFileParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/datasources/upload_params.py b/src/asktable/resources/datasources/upload_params.py index b8f8f474..7cea2f29 100644 --- a/src/asktable/resources/datasources/upload_params.py +++ b/src/asktable/resources/datasources/upload_params.py @@ -18,6 +18,7 @@ ) from ..._base_client import make_request_options from ...types.datasources import upload_param_create_params +from ...types.datasources.upload_param_create_response import UploadParamCreateResponse __all__ = ["UploadParamsResource", "AsyncUploadParamsResource"] @@ -55,7 +56,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> UploadParamCreateResponse: """ 获取 OSS 签名参数 @@ -84,7 +85,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=UploadParamCreateResponse, ) @@ -121,7 +122,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> UploadParamCreateResponse: """ 获取 OSS 签名参数 @@ -150,7 +151,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=UploadParamCreateResponse, ) diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py index 2b5386fc..bef896ed 100644 --- a/src/asktable/resources/roles.py +++ b/src/asktable/resources/roles.py @@ -21,6 +21,7 @@ from ..types.role import Role from .._base_client import AsyncPaginator, make_request_options from ..types.role_get_polices_response import RoleGetPolicesResponse +from ..types.role_get_variables_response import RoleGetVariablesResponse __all__ = ["RolesResource", "AsyncRolesResource"] @@ -302,7 +303,7 @@ def get_variables( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> RoleGetVariablesResponse: """ 查询某个角色的所有变量 @@ -336,7 +337,7 @@ def get_variables( role_get_variables_params.RoleGetVariablesParams, ), ), - cast_to=object, + cast_to=RoleGetVariablesResponse, ) @@ -617,7 +618,7 @@ async def get_variables( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> RoleGetVariablesResponse: """ 查询某个角色的所有变量 @@ -651,7 +652,7 @@ async def get_variables( role_get_variables_params.RoleGetVariablesParams, ), ), - cast_to=object, + cast_to=RoleGetVariablesResponse, ) diff --git a/src/asktable/resources/securetunnels.py b/src/asktable/resources/securetunnels.py index 0f821840..efd0e24a 100644 --- a/src/asktable/resources/securetunnels.py +++ b/src/asktable/resources/securetunnels.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx @@ -123,7 +123,7 @@ def update( self, securetunnel_id: str, *, - client_info: Optional[object] | Omit = omit, + client_info: Optional[Dict[str, object]] | Omit = omit, name: Optional[str] | Omit = omit, unique_key: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -394,7 +394,7 @@ async def update( self, securetunnel_id: str, *, - client_info: Optional[object] | Omit = omit, + client_info: Optional[Dict[str, object]] | Omit = omit, name: Optional[str] | Omit = omit, unique_key: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/asktable/resources/sqls.py b/src/asktable/resources/sqls.py index c41b2c98..502e47d2 100644 --- a/src/asktable/resources/sqls.py +++ b/src/asktable/resources/sqls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx @@ -53,7 +53,7 @@ def create( question: str, parameterize: bool | Omit = omit, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -183,7 +183,7 @@ async def create( question: str, parameterize: bool | Omit = omit, role_id: Optional[str] | Omit = omit, - role_variables: Optional[object] | Omit = omit, + role_variables: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, diff --git a/src/asktable/resources/sys/projects/api_keys.py b/src/asktable/resources/sys/projects/api_keys.py index 39be7526..269ae626 100644 --- a/src/asktable/resources/sys/projects/api_keys.py +++ b/src/asktable/resources/sys/projects/api_keys.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -21,6 +21,7 @@ from ....types.sys.projects import api_key_create_params, api_key_create_token_params from ....types.sys.projects.api_key_list_response import APIKeyListResponse from ....types.sys.projects.api_key_create_response import APIKeyCreateResponse +from ....types.sys.projects.api_key_create_token_response import APIKeyCreateTokenResponse __all__ = ["APIKeysResource", "AsyncAPIKeysResource"] @@ -161,14 +162,14 @@ def create_token( ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, chat_role: Optional[api_key_create_token_params.ChatRole] | Omit = omit, token_ttl: int | Omit = omit, - user_profile: Optional[object] | Omit = omit, + user_profile: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> APIKeyCreateTokenResponse: """ Create Token @@ -205,7 +206,7 @@ def create_token( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=APIKeyCreateTokenResponse, ) @@ -345,14 +346,14 @@ async def create_token( ak_role: Literal["sys", "admin", "asker", "visitor"] | Omit = omit, chat_role: Optional[api_key_create_token_params.ChatRole] | Omit = omit, token_ttl: int | Omit = omit, - user_profile: Optional[object] | Omit = omit, + user_profile: Optional[Dict[str, object]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> APIKeyCreateTokenResponse: """ Create Token @@ -389,7 +390,7 @@ async def create_token( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=APIKeyCreateTokenResponse, ) diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index 8876c895..9ac77ca8 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional import httpx @@ -28,6 +28,8 @@ from ....pagination import SyncPage, AsyncPage from ...._base_client import AsyncPaginator, make_request_options from ....types.sys.project import Project +from ....types.sys.project_export_response import ProjectExportResponse +from ....types.sys.project_import_response import ProjectImportResponse from ....types.sys.project_model_groups_response import ProjectModelGroupsResponse __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -271,7 +273,7 @@ def export( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> ProjectExportResponse: """ Export Project @@ -291,20 +293,20 @@ def export( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=ProjectExportResponse, ) def import_( self, *, - body: object, + body: Dict[str, object], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> ProjectImportResponse: """ Import Project @@ -323,7 +325,7 @@ def import_( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=ProjectImportResponse, ) def model_groups( @@ -584,7 +586,7 @@ async def export( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> ProjectExportResponse: """ Export Project @@ -604,20 +606,20 @@ async def export( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=ProjectExportResponse, ) async def import_( self, *, - body: object, + body: Dict[str, object], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: + ) -> ProjectImportResponse: """ Import Project @@ -636,7 +638,7 @@ async def import_( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=object, + cast_to=ProjectImportResponse, ) async def model_groups( diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py index 97ad82a1..6b482293 100644 --- a/src/asktable/types/__init__.py +++ b/src/asktable/types/__init__.py @@ -38,6 +38,7 @@ from .role_update_params import RoleUpdateParams as RoleUpdateParams from .ats_create_response import ATSCreateResponse as ATSCreateResponse from .ats_update_response import ATSUpdateResponse as ATSUpdateResponse +from .bot_invite_response import BotInviteResponse as BotInviteResponse from .score_create_params import ScoreCreateParams as ScoreCreateParams from .answer_create_params import AnswerCreateParams as AnswerCreateParams from .chat_create_response import ChatCreateResponse as ChatCreateResponse @@ -66,12 +67,14 @@ from .training_update_response import TrainingUpdateResponse as TrainingUpdateResponse from .role_get_polices_response import RoleGetPolicesResponse as RoleGetPolicesResponse from .role_get_variables_params import RoleGetVariablesParams as RoleGetVariablesParams +from .auth_create_token_response import AuthCreateTokenResponse as AuthCreateTokenResponse from .datasource_add_file_params import DatasourceAddFileParams as DatasourceAddFileParams from .preference_create_response import PreferenceCreateResponse as PreferenceCreateResponse from .preference_update_response import PreferenceUpdateResponse as PreferenceUpdateResponse from .securetunnel_create_params import SecuretunnelCreateParams as SecuretunnelCreateParams from .securetunnel_update_params import SecuretunnelUpdateParams as SecuretunnelUpdateParams from .dataframe_retrieve_response import DataframeRetrieveResponse as DataframeRetrieveResponse +from .role_get_variables_response import RoleGetVariablesResponse as RoleGetVariablesResponse from .datasource_retrieve_response import DatasourceRetrieveResponse as DatasourceRetrieveResponse from .preference_retrieve_response import PreferenceRetrieveResponse as PreferenceRetrieveResponse from .business_glossary_list_params import BusinessGlossaryListParams as BusinessGlossaryListParams diff --git a/src/asktable/types/ai_message.py b/src/asktable/types/ai_message.py index 157a7dcc..11f0d3a7 100644 --- a/src/asktable/types/ai_message.py +++ b/src/asktable/types/ai_message.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -10,7 +10,7 @@ class ContentAttachment(BaseModel): - info: object + info: Dict[str, object] type: Literal["data_json"] """The type of the attachment""" @@ -48,7 +48,7 @@ class AIMessage(BaseModel): end_turn: Optional[bool] = None - metadata: Optional[object] = None + metadata: Optional[Dict[str, object]] = None name: Optional[str] = None diff --git a/src/asktable/types/answer_create_params.py b/src/asktable/types/answer_create_params.py index b4fcd62f..c5adf1db 100644 --- a/src/asktable/types/answer_create_params.py +++ b/src/asktable/types/answer_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["AnswerCreateParams"] @@ -24,7 +24,7 @@ class AnswerCreateParams(TypedDict, total=False): 数据 """ - role_variables: Optional[object] + role_variables: Optional[Dict[str, object]] """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" with_json: Optional[bool] diff --git a/src/asktable/types/answer_response.py b/src/asktable/types/answer_response.py index 7043de0f..0f217892 100644 --- a/src/asktable/types/answer_response.py +++ b/src/asktable/types/answer_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -10,7 +10,7 @@ class AnswerAttachment(BaseModel): - info: object + info: Dict[str, object] type: Literal["data_json"] """The type of the attachment""" @@ -38,7 +38,7 @@ class Request(BaseModel): 数据 """ - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" with_json: Optional[bool] = None diff --git a/src/asktable/types/ats/task_get_case_tasks_response.py b/src/asktable/types/ats/task_get_case_tasks_response.py index eaaf63b2..6f81b7f9 100644 --- a/src/asktable/types/ats/task_get_case_tasks_response.py +++ b/src/asktable/types/ats/task_get_case_tasks_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Dict, List, Union, Optional from datetime import datetime from typing_extensions import Literal @@ -48,13 +48,13 @@ class Item(BaseModel): duration: Optional[float] = None """测试用例执行时间,单位为秒""" - expected_query_result: Union[List[object], object, None] = None + expected_query_result: Union[Dict[str, object], List[Dict[str, object]], None] = None """预期查询出来的数据""" generated_sql: Optional[str] = None """生成的 sql""" - generated_sql_query_result: Union[List[object], object, None] = None + generated_sql_query_result: Union[Dict[str, object], List[Dict[str, object]], None] = None """测试样本生成的 sql 查询结果""" last_run: Optional[datetime] = None @@ -63,7 +63,7 @@ class Item(BaseModel): role_id: Optional[str] = None """角色 ID""" - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """扮演角色需要传递的值""" status_message: Optional[str] = None @@ -79,10 +79,10 @@ class Item(BaseModel): class TaskGetCaseTasksResponse(BaseModel): items: List[Item] - page: Optional[int] = None + page: int - size: Optional[int] = None + pages: int - total: Optional[int] = None + size: int - pages: Optional[int] = None + total: int diff --git a/src/asktable/types/ats/task_list_response.py b/src/asktable/types/ats/task_list_response.py index 6d54a88c..e3428566 100644 --- a/src/asktable/types/ats/task_list_response.py +++ b/src/asktable/types/ats/task_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from pydantic import Field as FieldInfo @@ -47,7 +47,7 @@ class TaskListResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" - api_model_group: Optional[object] = FieldInfo(alias="model_group", default=None) + api_model_group: Optional[Dict[str, object]] = FieldInfo(alias="model_group", default=None) """运行使用的模型组""" status_message: Optional[str] = None diff --git a/src/asktable/types/ats/task_retrieve_response.py b/src/asktable/types/ats/task_retrieve_response.py index 28135f5d..0d1101a8 100644 --- a/src/asktable/types/ats/task_retrieve_response.py +++ b/src/asktable/types/ats/task_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from pydantic import Field as FieldInfo @@ -47,7 +47,7 @@ class TaskRetrieveResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" - api_model_group: Optional[object] = FieldInfo(alias="model_group", default=None) + api_model_group: Optional[Dict[str, object]] = FieldInfo(alias="model_group", default=None) """运行使用的模型组""" status_message: Optional[str] = None diff --git a/src/asktable/types/ats/task_run_response.py b/src/asktable/types/ats/task_run_response.py index 74dbc7d9..e74587a6 100644 --- a/src/asktable/types/ats/task_run_response.py +++ b/src/asktable/types/ats/task_run_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from pydantic import Field as FieldInfo @@ -47,7 +47,7 @@ class TaskRunResponse(BaseModel): last_run: Optional[datetime] = None """上次测试运行时间""" - api_model_group: Optional[object] = FieldInfo(alias="model_group", default=None) + api_model_group: Optional[Dict[str, object]] = FieldInfo(alias="model_group", default=None) """运行使用的模型组""" status_message: Optional[str] = None diff --git a/src/asktable/types/ats/test_case_create_params.py b/src/asktable/types/ats/test_case_create_params.py index 229132b2..02ecaca0 100644 --- a/src/asktable/types/ats/test_case_create_params.py +++ b/src/asktable/types/ats/test_case_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["TestCaseCreateParams"] @@ -18,5 +18,5 @@ class TestCaseCreateParams(TypedDict, total=False): role_id: Optional[str] """角色 ID""" - role_variables: Optional[object] + role_variables: Optional[Dict[str, object]] """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/ats/test_case_create_response.py b/src/asktable/types/ats/test_case_create_response.py index 6b54e3ae..79862611 100644 --- a/src/asktable/types/ats/test_case_create_response.py +++ b/src/asktable/types/ats/test_case_create_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from ..._models import BaseModel @@ -31,5 +31,5 @@ class TestCaseCreateResponse(BaseModel): role_id: Optional[str] = None """角色 ID""" - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/ats/test_case_list_response.py b/src/asktable/types/ats/test_case_list_response.py index 80b17c09..b6318136 100644 --- a/src/asktable/types/ats/test_case_list_response.py +++ b/src/asktable/types/ats/test_case_list_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from ..._models import BaseModel @@ -31,5 +31,5 @@ class TestCaseListResponse(BaseModel): role_id: Optional[str] = None """角色 ID""" - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/ats/test_case_retrieve_response.py b/src/asktable/types/ats/test_case_retrieve_response.py index 6993b494..e0b2328a 100644 --- a/src/asktable/types/ats/test_case_retrieve_response.py +++ b/src/asktable/types/ats/test_case_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from ..._models import BaseModel @@ -31,5 +31,5 @@ class TestCaseRetrieveResponse(BaseModel): role_id: Optional[str] = None """角色 ID""" - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/ats/test_case_update_params.py b/src/asktable/types/ats/test_case_update_params.py index 020118e0..1b5124a7 100644 --- a/src/asktable/types/ats/test_case_update_params.py +++ b/src/asktable/types/ats/test_case_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["TestCaseUpdateParams"] @@ -20,5 +20,5 @@ class TestCaseUpdateParams(TypedDict, total=False): role_id: Optional[str] """角色 ID""" - role_variables: Optional[object] + role_variables: Optional[Dict[str, object]] """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/ats/test_case_update_response.py b/src/asktable/types/ats/test_case_update_response.py index 76c30096..17577368 100644 --- a/src/asktable/types/ats/test_case_update_response.py +++ b/src/asktable/types/ats/test_case_update_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from ..._models import BaseModel @@ -31,5 +31,5 @@ class TestCaseUpdateResponse(BaseModel): role_id: Optional[str] = None """角色 ID""" - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/auth_create_token_params.py b/src/asktable/types/auth_create_token_params.py index 2fea46ba..2b245f32 100644 --- a/src/asktable/types/auth_create_token_params.py +++ b/src/asktable/types/auth_create_token_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, TypedDict __all__ = ["AuthCreateTokenParams", "ChatRole"] @@ -18,7 +18,7 @@ class AuthCreateTokenParams(TypedDict, total=False): token_ttl: int """The time-to-live for the token in seconds""" - user_profile: Optional[object] + user_profile: Optional[Dict[str, object]] """Optional user profile data""" @@ -28,5 +28,5 @@ class ChatRole(TypedDict, total=False): role_id: Optional[str] """The chat role ID""" - role_variables: Optional[object] + role_variables: Optional[Dict[str, object]] """The chat role variables""" diff --git a/src/asktable/types/auth_create_token_response.py b/src/asktable/types/auth_create_token_response.py new file mode 100644 index 00000000..0ff7ae33 --- /dev/null +++ b/src/asktable/types/auth_create_token_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["AuthCreateTokenResponse"] + +AuthCreateTokenResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/auth_me_response.py b/src/asktable/types/auth_me_response.py index 0db427fa..94307134 100644 --- a/src/asktable/types/auth_me_response.py +++ b/src/asktable/types/auth_me_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal from .._models import BaseModel @@ -15,10 +15,10 @@ class AuthMeResponse(BaseModel): ak_id: Optional[str] = None - chat_role: Optional[object] = None + chat_role: Optional[Dict[str, object]] = None exp: Optional[int] = None locked: Optional[bool] = None - user_profile: Optional[object] = None + user_profile: Optional[Dict[str, object]] = None diff --git a/src/asktable/types/bot_invite_response.py b/src/asktable/types/bot_invite_response.py new file mode 100644 index 00000000..25c02623 --- /dev/null +++ b/src/asktable/types/bot_invite_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["BotInviteResponse"] + +BotInviteResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/business_glossary_create_params.py b/src/asktable/types/business_glossary_create_params.py index e9b8fd0f..c3ba76dc 100644 --- a/src/asktable/types/business_glossary_create_params.py +++ b/src/asktable/types/business_glossary_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Iterable, Optional +from typing import Dict, Iterable, Optional from typing_extensions import Required, TypedDict from .._types import SequenceNotStr @@ -29,5 +29,5 @@ class Body(TypedDict, total=False): aliases: Optional[SequenceNotStr[str]] """业务术语同义词""" - payload: Optional[object] + payload: Optional[Dict[str, object]] """业务术语元数据""" diff --git a/src/asktable/types/business_glossary_update_params.py b/src/asktable/types/business_glossary_update_params.py index 092cebe8..8b65f387 100644 --- a/src/asktable/types/business_glossary_update_params.py +++ b/src/asktable/types/business_glossary_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import TypedDict from .._types import SequenceNotStr @@ -20,7 +20,7 @@ class BusinessGlossaryUpdateParams(TypedDict, total=False): definition: Optional[str] """业务术语定义""" - payload: Optional[object] + payload: Optional[Dict[str, object]] """业务术语元数据""" term: Optional[str] diff --git a/src/asktable/types/dataframe_retrieve_response.py b/src/asktable/types/dataframe_retrieve_response.py index 9df513f9..1a243028 100644 --- a/src/asktable/types/dataframe_retrieve_response.py +++ b/src/asktable/types/dataframe_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from .._models import BaseModel @@ -12,13 +12,13 @@ class DataframeRetrieveResponse(BaseModel): id: str """ID""" - chart_options: object + chart_options: Dict[str, object] """图表选项""" created_at: datetime """创建时间""" - header: List[object] + header: List[Dict[str, object]] """表头""" modified_at: datetime @@ -36,7 +36,7 @@ class DataframeRetrieveResponse(BaseModel): title: str """标题""" - content: Optional[List[object]] = None + content: Optional[List[Dict[str, object]]] = None """内容""" msg_id: Optional[str] = None diff --git a/src/asktable/types/datasource_add_file_params.py b/src/asktable/types/datasource_add_file_params.py index fa03fb7a..39418d4a 100644 --- a/src/asktable/types/datasource_add_file_params.py +++ b/src/asktable/types/datasource_add_file_params.py @@ -4,10 +4,8 @@ from typing_extensions import Required, TypedDict -from .._types import FileTypes - __all__ = ["DatasourceAddFileParams"] class DatasourceAddFileParams(TypedDict, total=False): - file: Required[FileTypes] + file: Required[str] diff --git a/src/asktable/types/datasource_create_params.py b/src/asktable/types/datasource_create_params.py index cd20b5b5..eb6d87b7 100644 --- a/src/asktable/types/datasource_create_params.py +++ b/src/asktable/types/datasource_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Optional +from typing import Dict, Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .._types import SequenceNotStr @@ -72,7 +72,7 @@ class AccessConfigAccessConfigConnectionCreate(TypedDict, total=False): db_version: Optional[str] """数据库版本""" - extra_config: Optional[object] + extra_config: Optional[Dict[str, object]] """额外配置""" password: Optional[str] diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index f39ec09d..06849714 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Dict, List, Union, Optional from datetime import datetime from typing_extensions import Literal, TypeAlias @@ -28,7 +28,7 @@ class AccessConfigAccessConfigConnectionResponse(BaseModel): db_version: Optional[str] = None """数据库版本""" - extra_config: Optional[object] = None + extra_config: Optional[Dict[str, object]] = None """额外配置""" port: Optional[int] = None @@ -52,7 +52,7 @@ class AccessConfigAccessConfigFileResponseFile(BaseModel): filename: str - custom_config: Optional[object] = None + custom_config: Optional[Dict[str, object]] = None """文件自定义配置""" diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index 64aaa8f4..d379fb31 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Union, Iterable, Optional +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ @@ -89,7 +89,7 @@ class AccessConfigAccessConfigConnectionUpdate(TypedDict, total=False): db_version: Optional[str] """数据库版本""" - extra_config: Optional[object] + extra_config: Optional[Dict[str, object]] """额外配置""" host: Optional[str] @@ -113,7 +113,7 @@ class AccessConfigAccessConfigFileUpdateFile(TypedDict, total=False): filename: Required[str] - custom_config: Optional[object] + custom_config: Optional[Dict[str, object]] """文件自定义配置""" diff --git a/src/asktable/types/datasources/__init__.py b/src/asktable/types/datasources/__init__.py index b015a299..a36de7e7 100644 --- a/src/asktable/types/datasources/__init__.py +++ b/src/asktable/types/datasources/__init__.py @@ -8,3 +8,4 @@ from .index_create_params import IndexCreateParams as IndexCreateParams from .meta_annotate_params import MetaAnnotateParams as MetaAnnotateParams from .upload_param_create_params import UploadParamCreateParams as UploadParamCreateParams +from .upload_param_create_response import UploadParamCreateResponse as UploadParamCreateResponse diff --git a/src/asktable/types/datasources/meta_create_params.py b/src/asktable/types/datasources/meta_create_params.py index caebf645..10f3ac13 100644 --- a/src/asktable/types/datasources/meta_create_params.py +++ b/src/asktable/types/datasources/meta_create_params.py @@ -60,7 +60,7 @@ class MetaSchemas(TypedDict, total=False): origin_desc: Required[str] """schema description from database""" - custom_configs: Optional[object] + custom_configs: Optional[Dict[str, object]] """custom configs""" tables: Dict[str, MetaSchemasTables] diff --git a/src/asktable/types/datasources/meta_update_params.py b/src/asktable/types/datasources/meta_update_params.py index bf1938eb..dc0d45fa 100644 --- a/src/asktable/types/datasources/meta_update_params.py +++ b/src/asktable/types/datasources/meta_update_params.py @@ -58,7 +58,7 @@ class MetaSchemas(TypedDict, total=False): origin_desc: Required[str] """schema description from database""" - custom_configs: Optional[object] + custom_configs: Optional[Dict[str, object]] """custom configs""" tables: Dict[str, MetaSchemasTables] diff --git a/src/asktable/types/datasources/upload_param_create_response.py b/src/asktable/types/datasources/upload_param_create_response.py new file mode 100644 index 00000000..eec09f23 --- /dev/null +++ b/src/asktable/types/datasources/upload_param_create_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["UploadParamCreateResponse"] + +UploadParamCreateResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/entry.py b/src/asktable/types/entry.py index 16afd695..70775b84 100644 --- a/src/asktable/types/entry.py +++ b/src/asktable/types/entry.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from .._models import BaseModel @@ -32,5 +32,5 @@ class Entry(BaseModel): aliases: Optional[List[str]] = None """业务术语同义词""" - payload: Optional[object] = None + payload: Optional[Dict[str, object]] = None """业务术语元数据""" diff --git a/src/asktable/types/entry_with_definition.py b/src/asktable/types/entry_with_definition.py index 9b76baff..74ac03d7 100644 --- a/src/asktable/types/entry_with_definition.py +++ b/src/asktable/types/entry_with_definition.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from .._models import BaseModel @@ -33,5 +33,5 @@ class EntryWithDefinition(BaseModel): aliases: Optional[List[str]] = None """业务术语同义词""" - payload: Optional[object] = None + payload: Optional[Dict[str, object]] = None """业务术语元数据""" diff --git a/src/asktable/types/meta.py b/src/asktable/types/meta.py index e75b8282..b3442c15 100644 --- a/src/asktable/types/meta.py +++ b/src/asktable/types/meta.py @@ -105,7 +105,7 @@ class Schemas(BaseModel): tables: Dict[str, SchemasTables] - custom_configs: Optional[object] = None + custom_configs: Optional[Dict[str, object]] = None """custom configs""" diff --git a/src/asktable/types/query_response.py b/src/asktable/types/query_response.py index f57289fb..1e4451fc 100644 --- a/src/asktable/types/query_response.py +++ b/src/asktable/types/query_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from .._models import BaseModel @@ -15,7 +15,7 @@ class Query(BaseModel): parameterized_sql: Optional[str] = None """参数化后的 SQL 语句""" - params: Optional[object] = None + params: Optional[Dict[str, object]] = None """参数""" @@ -35,7 +35,7 @@ class Request(BaseModel): 数据 """ - role_variables: Optional[object] = None + role_variables: Optional[Dict[str, object]] = None """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/role_get_variables_response.py b/src/asktable/types/role_get_variables_response.py new file mode 100644 index 00000000..54b74d57 --- /dev/null +++ b/src/asktable/types/role_get_variables_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["RoleGetVariablesResponse"] + +RoleGetVariablesResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/secure_tunnel.py b/src/asktable/types/secure_tunnel.py index c6223b4e..6a9cb647 100644 --- a/src/asktable/types/secure_tunnel.py +++ b/src/asktable/types/secure_tunnel.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from .._models import BaseModel @@ -26,7 +26,7 @@ class SecureTunnel(BaseModel): atst_server_port: Optional[int] = None - info: Optional[object] = None + info: Optional[Dict[str, object]] = None links_count: Optional[int] = None diff --git a/src/asktable/types/securetunnel_update_params.py b/src/asktable/types/securetunnel_update_params.py index 6322936a..d558a6c3 100644 --- a/src/asktable/types/securetunnel_update_params.py +++ b/src/asktable/types/securetunnel_update_params.py @@ -2,14 +2,14 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import TypedDict __all__ = ["SecuretunnelUpdateParams"] class SecuretunnelUpdateParams(TypedDict, total=False): - client_info: Optional[object] + client_info: Optional[Dict[str, object]] """客户端信息""" name: Optional[str] diff --git a/src/asktable/types/sql_create_params.py b/src/asktable/types/sql_create_params.py index 515dbd47..8ddf89f7 100644 --- a/src/asktable/types/sql_create_params.py +++ b/src/asktable/types/sql_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["SqlCreateParams"] @@ -24,5 +24,5 @@ class SqlCreateParams(TypedDict, total=False): 数据 """ - role_variables: Optional[object] + role_variables: Optional[Dict[str, object]] """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" diff --git a/src/asktable/types/sys/__init__.py b/src/asktable/types/sys/__init__.py index c45c4f39..088f68ea 100644 --- a/src/asktable/types/sys/__init__.py +++ b/src/asktable/types/sys/__init__.py @@ -8,4 +8,6 @@ from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_import_params import ProjectImportParams as ProjectImportParams from .project_update_params import ProjectUpdateParams as ProjectUpdateParams +from .project_export_response import ProjectExportResponse as ProjectExportResponse +from .project_import_response import ProjectImportResponse as ProjectImportResponse from .project_model_groups_response import ProjectModelGroupsResponse as ProjectModelGroupsResponse diff --git a/src/asktable/types/sys/project_export_response.py b/src/asktable/types/sys/project_export_response.py new file mode 100644 index 00000000..30135eed --- /dev/null +++ b/src/asktable/types/sys/project_export_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["ProjectExportResponse"] + +ProjectExportResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/sys/project_import_params.py b/src/asktable/types/sys/project_import_params.py index d244232a..52b5fdb6 100644 --- a/src/asktable/types/sys/project_import_params.py +++ b/src/asktable/types/sys/project_import_params.py @@ -2,10 +2,11 @@ from __future__ import annotations +from typing import Dict from typing_extensions import Required, TypedDict __all__ = ["ProjectImportParams"] class ProjectImportParams(TypedDict, total=False): - body: Required[object] + body: Required[Dict[str, object]] diff --git a/src/asktable/types/sys/project_import_response.py b/src/asktable/types/sys/project_import_response.py new file mode 100644 index 00000000..e98dcd60 --- /dev/null +++ b/src/asktable/types/sys/project_import_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["ProjectImportResponse"] + +ProjectImportResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/sys/projects/__init__.py b/src/asktable/types/sys/projects/__init__.py index 6fd494c1..baa4c7fc 100644 --- a/src/asktable/types/sys/projects/__init__.py +++ b/src/asktable/types/sys/projects/__init__.py @@ -6,3 +6,4 @@ from .api_key_list_response import APIKeyListResponse as APIKeyListResponse from .api_key_create_response import APIKeyCreateResponse as APIKeyCreateResponse from .api_key_create_token_params import APIKeyCreateTokenParams as APIKeyCreateTokenParams +from .api_key_create_token_response import APIKeyCreateTokenResponse as APIKeyCreateTokenResponse diff --git a/src/asktable/types/sys/projects/api_key_create_token_params.py b/src/asktable/types/sys/projects/api_key_create_token_params.py index e65d75c2..a98751a9 100644 --- a/src/asktable/types/sys/projects/api_key_create_token_params.py +++ b/src/asktable/types/sys/projects/api_key_create_token_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal, TypedDict __all__ = ["APIKeyCreateTokenParams", "ChatRole"] @@ -18,7 +18,7 @@ class APIKeyCreateTokenParams(TypedDict, total=False): token_ttl: int """The time-to-live for the token in seconds""" - user_profile: Optional[object] + user_profile: Optional[Dict[str, object]] """Optional user profile data""" @@ -28,5 +28,5 @@ class ChatRole(TypedDict, total=False): role_id: Optional[str] """The chat role ID""" - role_variables: Optional[object] + role_variables: Optional[Dict[str, object]] """The chat role variables""" diff --git a/src/asktable/types/sys/projects/api_key_create_token_response.py b/src/asktable/types/sys/projects/api_key_create_token_response.py new file mode 100644 index 00000000..106eedb6 --- /dev/null +++ b/src/asktable/types/sys/projects/api_key_create_token_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["APIKeyCreateTokenResponse"] + +APIKeyCreateTokenResponse: TypeAlias = Dict[str, object] diff --git a/src/asktable/types/tool_message.py b/src/asktable/types/tool_message.py index b2cd5d54..ea939080 100644 --- a/src/asktable/types/tool_message.py +++ b/src/asktable/types/tool_message.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -10,7 +10,7 @@ class ContentAttachment(BaseModel): - info: object + info: Dict[str, object] type: Literal["data_json"] """The type of the attachment""" diff --git a/src/asktable/types/user_message.py b/src/asktable/types/user_message.py index bb9e2fcd..5660431a 100644 --- a/src/asktable/types/user_message.py +++ b/src/asktable/types/user_message.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -10,7 +10,7 @@ class ContentAttachment(BaseModel): - info: object + info: Dict[str, object] type: Literal["data_json"] """The type of the attachment""" diff --git a/tests/api_resources/ats/test_test_case.py b/tests/api_resources/ats/test_test_case.py index 7a9a1281..fbb3d808 100644 --- a/tests/api_resources/ats/test_test_case.py +++ b/tests/api_resources/ats/test_test_case.py @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: expected_sql="expected_sql", question="question", role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, ) assert_matches_type(TestCaseCreateResponse, test_case, path=["response"]) @@ -146,7 +146,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: expected_sql="expected_sql", question="question", role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, ) assert_matches_type(TestCaseUpdateResponse, test_case, path=["response"]) @@ -315,7 +315,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) expected_sql="expected_sql", question="question", role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, ) assert_matches_type(TestCaseCreateResponse, test_case, path=["response"]) @@ -422,7 +422,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) expected_sql="expected_sql", question="question", role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, ) assert_matches_type(TestCaseUpdateResponse, test_case, path=["response"]) diff --git a/tests/api_resources/datasources/test_meta.py b/tests/api_resources/datasources/test_meta.py index ae7a8f6e..2dc54671 100644 --- a/tests/api_resources/datasources/test_meta.py +++ b/tests/api_resources/datasources/test_meta.py @@ -35,7 +35,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: "foo": { "name": "name", "origin_desc": "origin_desc", - "custom_configs": {}, + "custom_configs": {"foo": "bar"}, "tables": { "foo": { "name": "name", @@ -146,7 +146,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: "foo": { "name": "name", "origin_desc": "origin_desc", - "custom_configs": {}, + "custom_configs": {"foo": "bar"}, "tables": { "foo": { "name": "name", @@ -268,7 +268,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) "foo": { "name": "name", "origin_desc": "origin_desc", - "custom_configs": {}, + "custom_configs": {"foo": "bar"}, "tables": { "foo": { "name": "name", @@ -379,7 +379,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) "foo": { "name": "name", "origin_desc": "origin_desc", - "custom_configs": {}, + "custom_configs": {"foo": "bar"}, "tables": { "foo": { "name": "name", diff --git a/tests/api_resources/datasources/test_upload_params.py b/tests/api_resources/datasources/test_upload_params.py index cb22379f..6b3dad48 100644 --- a/tests/api_resources/datasources/test_upload_params.py +++ b/tests/api_resources/datasources/test_upload_params.py @@ -9,6 +9,7 @@ from asktable import Asktable, AsyncAsktable from tests.utils import assert_matches_type +from asktable.types.datasources import UploadParamCreateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,7 +20,7 @@ class TestUploadParams: @parametrize def test_method_create(self, client: Asktable) -> None: upload_param = client.datasources.upload_params.create() - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Asktable) -> None: @@ -27,7 +28,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: expiration=60, file_max_size=524288000, ) - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) @parametrize def test_raw_response_create(self, client: Asktable) -> None: @@ -36,7 +37,7 @@ def test_raw_response_create(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload_param = response.parse() - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) @parametrize def test_streaming_response_create(self, client: Asktable) -> None: @@ -45,7 +46,7 @@ def test_streaming_response_create(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload_param = response.parse() - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) assert cast(Any, response.is_closed) is True @@ -58,7 +59,7 @@ class TestAsyncUploadParams: @parametrize async def test_method_create(self, async_client: AsyncAsktable) -> None: upload_param = await async_client.datasources.upload_params.create() - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None: @@ -66,7 +67,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) expiration=60, file_max_size=524288000, ) - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: @@ -75,7 +76,7 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload_param = await response.parse() - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None: @@ -84,6 +85,6 @@ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" upload_param = await response.parse() - assert_matches_type(object, upload_param, path=["response"]) + assert_matches_type(UploadParamCreateResponse, upload_param, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/sys/projects/test_api_keys.py b/tests/api_resources/sys/projects/test_api_keys.py index 51966f80..79be98a6 100644 --- a/tests/api_resources/sys/projects/test_api_keys.py +++ b/tests/api_resources/sys/projects/test_api_keys.py @@ -12,6 +12,7 @@ from asktable.types.sys.projects import ( APIKeyListResponse, APIKeyCreateResponse, + APIKeyCreateTokenResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -153,7 +154,7 @@ def test_method_create_token(self, client: Asktable) -> None: api_key = client.sys.projects.api_keys.create_token( project_id="project_id", ) - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) @parametrize def test_method_create_token_with_all_params(self, client: Asktable) -> None: @@ -162,12 +163,12 @@ def test_method_create_token_with_all_params(self, client: Asktable) -> None: ak_role="asker", chat_role={ "role_id": "1", - "role_variables": {"id": "42"}, + "role_variables": {"id": "bar"}, }, token_ttl=900, - user_profile={"name": "张三"}, + user_profile={"name": "bar"}, ) - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) @parametrize def test_raw_response_create_token(self, client: Asktable) -> None: @@ -178,7 +179,7 @@ def test_raw_response_create_token(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_key = response.parse() - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) @parametrize def test_streaming_response_create_token(self, client: Asktable) -> None: @@ -189,7 +190,7 @@ def test_streaming_response_create_token(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_key = response.parse() - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) assert cast(Any, response.is_closed) is True @@ -339,7 +340,7 @@ async def test_method_create_token(self, async_client: AsyncAsktable) -> None: api_key = await async_client.sys.projects.api_keys.create_token( project_id="project_id", ) - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) @parametrize async def test_method_create_token_with_all_params(self, async_client: AsyncAsktable) -> None: @@ -348,12 +349,12 @@ async def test_method_create_token_with_all_params(self, async_client: AsyncAskt ak_role="asker", chat_role={ "role_id": "1", - "role_variables": {"id": "42"}, + "role_variables": {"id": "bar"}, }, token_ttl=900, - user_profile={"name": "张三"}, + user_profile={"name": "bar"}, ) - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) @parametrize async def test_raw_response_create_token(self, async_client: AsyncAsktable) -> None: @@ -364,7 +365,7 @@ async def test_raw_response_create_token(self, async_client: AsyncAsktable) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_key = await response.parse() - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) @parametrize async def test_streaming_response_create_token(self, async_client: AsyncAsktable) -> None: @@ -375,7 +376,7 @@ async def test_streaming_response_create_token(self, async_client: AsyncAsktable assert response.http_request.headers.get("X-Stainless-Lang") == "python" api_key = await response.parse() - assert_matches_type(object, api_key, path=["response"]) + assert_matches_type(APIKeyCreateTokenResponse, api_key, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/sys/test_projects.py b/tests/api_resources/sys/test_projects.py index 8b8d87c3..26007a3a 100644 --- a/tests/api_resources/sys/test_projects.py +++ b/tests/api_resources/sys/test_projects.py @@ -11,6 +11,8 @@ from tests.utils import assert_matches_type from asktable.types.sys import ( Project, + ProjectExportResponse, + ProjectImportResponse, ProjectModelGroupsResponse, ) from asktable.pagination import SyncPage, AsyncPage @@ -215,7 +217,7 @@ def test_method_export(self, client: Asktable) -> None: project = client.sys.projects.export( "project_id", ) - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectExportResponse, project, path=["response"]) @parametrize def test_raw_response_export(self, client: Asktable) -> None: @@ -226,7 +228,7 @@ def test_raw_response_export(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectExportResponse, project, path=["response"]) @parametrize def test_streaming_response_export(self, client: Asktable) -> None: @@ -237,7 +239,7 @@ def test_streaming_response_export(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectExportResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -251,31 +253,31 @@ def test_path_params_export(self, client: Asktable) -> None: @parametrize def test_method_import(self, client: Asktable) -> None: project = client.sys.projects.import_( - body={}, + body={"foo": "bar"}, ) - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectImportResponse, project, path=["response"]) @parametrize def test_raw_response_import(self, client: Asktable) -> None: response = client.sys.projects.with_raw_response.import_( - body={}, + body={"foo": "bar"}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectImportResponse, project, path=["response"]) @parametrize def test_streaming_response_import(self, client: Asktable) -> None: with client.sys.projects.with_streaming_response.import_( - body={}, + body={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectImportResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -504,7 +506,7 @@ async def test_method_export(self, async_client: AsyncAsktable) -> None: project = await async_client.sys.projects.export( "project_id", ) - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectExportResponse, project, path=["response"]) @parametrize async def test_raw_response_export(self, async_client: AsyncAsktable) -> None: @@ -515,7 +517,7 @@ async def test_raw_response_export(self, async_client: AsyncAsktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectExportResponse, project, path=["response"]) @parametrize async def test_streaming_response_export(self, async_client: AsyncAsktable) -> None: @@ -526,7 +528,7 @@ async def test_streaming_response_export(self, async_client: AsyncAsktable) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectExportResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -540,31 +542,31 @@ async def test_path_params_export(self, async_client: AsyncAsktable) -> None: @parametrize async def test_method_import(self, async_client: AsyncAsktable) -> None: project = await async_client.sys.projects.import_( - body={}, + body={"foo": "bar"}, ) - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectImportResponse, project, path=["response"]) @parametrize async def test_raw_response_import(self, async_client: AsyncAsktable) -> None: response = await async_client.sys.projects.with_raw_response.import_( - body={}, + body={"foo": "bar"}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectImportResponse, project, path=["response"]) @parametrize async def test_streaming_response_import(self, async_client: AsyncAsktable) -> None: async with async_client.sys.projects.with_streaming_response.import_( - body={}, + body={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(object, project, path=["response"]) + assert_matches_type(ProjectImportResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_answers.py b/tests/api_resources/test_answers.py index dc2260f5..cb0f6de6 100644 --- a/tests/api_resources/test_answers.py +++ b/tests/api_resources/test_answers.py @@ -33,7 +33,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: question="question", max_rows=0, role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, with_json=True, ) assert_matches_type(AnswerResponse, answer, path=["response"]) @@ -119,7 +119,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) question="question", max_rows=0, role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, with_json=True, ) assert_matches_type(AnswerResponse, answer, path=["response"]) diff --git a/tests/api_resources/test_auth.py b/tests/api_resources/test_auth.py index e08b155e..0b637b87 100644 --- a/tests/api_resources/test_auth.py +++ b/tests/api_resources/test_auth.py @@ -9,7 +9,7 @@ from asktable import Asktable, AsyncAsktable from tests.utils import assert_matches_type -from asktable.types import AuthMeResponse +from asktable.types import AuthMeResponse, AuthCreateTokenResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -20,7 +20,7 @@ class TestAuth: @parametrize def test_method_create_token(self, client: Asktable) -> None: auth = client.auth.create_token() - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) @parametrize def test_method_create_token_with_all_params(self, client: Asktable) -> None: @@ -28,12 +28,12 @@ def test_method_create_token_with_all_params(self, client: Asktable) -> None: ak_role="asker", chat_role={ "role_id": "1", - "role_variables": {"id": "42"}, + "role_variables": {"id": "bar"}, }, token_ttl=900, - user_profile={"name": "张三"}, + user_profile={"name": "bar"}, ) - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) @parametrize def test_raw_response_create_token(self, client: Asktable) -> None: @@ -42,7 +42,7 @@ def test_raw_response_create_token(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" auth = response.parse() - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) @parametrize def test_streaming_response_create_token(self, client: Asktable) -> None: @@ -51,7 +51,7 @@ def test_streaming_response_create_token(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" auth = response.parse() - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) assert cast(Any, response.is_closed) is True @@ -89,7 +89,7 @@ class TestAsyncAuth: @parametrize async def test_method_create_token(self, async_client: AsyncAsktable) -> None: auth = await async_client.auth.create_token() - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) @parametrize async def test_method_create_token_with_all_params(self, async_client: AsyncAsktable) -> None: @@ -97,12 +97,12 @@ async def test_method_create_token_with_all_params(self, async_client: AsyncAskt ak_role="asker", chat_role={ "role_id": "1", - "role_variables": {"id": "42"}, + "role_variables": {"id": "bar"}, }, token_ttl=900, - user_profile={"name": "张三"}, + user_profile={"name": "bar"}, ) - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) @parametrize async def test_raw_response_create_token(self, async_client: AsyncAsktable) -> None: @@ -111,7 +111,7 @@ async def test_raw_response_create_token(self, async_client: AsyncAsktable) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" auth = await response.parse() - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) @parametrize async def test_streaming_response_create_token(self, async_client: AsyncAsktable) -> None: @@ -120,7 +120,7 @@ async def test_streaming_response_create_token(self, async_client: AsyncAsktable assert response.http_request.headers.get("X-Stainless-Lang") == "python" auth = await response.parse() - assert_matches_type(object, auth, path=["response"]) + assert_matches_type(AuthCreateTokenResponse, auth, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_bots.py b/tests/api_resources/test_bots.py index abccfcf0..70627696 100644 --- a/tests/api_resources/test_bots.py +++ b/tests/api_resources/test_bots.py @@ -9,7 +9,10 @@ from asktable import Asktable, AsyncAsktable from tests.utils import assert_matches_type -from asktable.types import Chatbot +from asktable.types import ( + Chatbot, + BotInviteResponse, +) from asktable.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -261,7 +264,7 @@ def test_method_invite(self, client: Asktable) -> None: bot_id="bot_id", project_id="project_id", ) - assert_matches_type(object, bot, path=["response"]) + assert_matches_type(BotInviteResponse, bot, path=["response"]) @parametrize def test_raw_response_invite(self, client: Asktable) -> None: @@ -273,7 +276,7 @@ def test_raw_response_invite(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bot = response.parse() - assert_matches_type(object, bot, path=["response"]) + assert_matches_type(BotInviteResponse, bot, path=["response"]) @parametrize def test_streaming_response_invite(self, client: Asktable) -> None: @@ -285,7 +288,7 @@ def test_streaming_response_invite(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bot = response.parse() - assert_matches_type(object, bot, path=["response"]) + assert_matches_type(BotInviteResponse, bot, path=["response"]) assert cast(Any, response.is_closed) is True @@ -546,7 +549,7 @@ async def test_method_invite(self, async_client: AsyncAsktable) -> None: bot_id="bot_id", project_id="project_id", ) - assert_matches_type(object, bot, path=["response"]) + assert_matches_type(BotInviteResponse, bot, path=["response"]) @parametrize async def test_raw_response_invite(self, async_client: AsyncAsktable) -> None: @@ -558,7 +561,7 @@ async def test_raw_response_invite(self, async_client: AsyncAsktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bot = await response.parse() - assert_matches_type(object, bot, path=["response"]) + assert_matches_type(BotInviteResponse, bot, path=["response"]) @parametrize async def test_streaming_response_invite(self, async_client: AsyncAsktable) -> None: @@ -570,7 +573,7 @@ async def test_streaming_response_invite(self, async_client: AsyncAsktable) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" bot = await response.parse() - assert_matches_type(object, bot, path=["response"]) + assert_matches_type(BotInviteResponse, bot, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_business_glossary.py b/tests/api_resources/test_business_glossary.py index 5016bd69..03172958 100644 --- a/tests/api_resources/test_business_glossary.py +++ b/tests/api_resources/test_business_glossary.py @@ -120,7 +120,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: active=True, aliases=["string"], definition="definition", - payload={}, + payload={"foo": "bar"}, term="term", ) assert_matches_type(Entry, business_glossary, path=["response"]) @@ -332,7 +332,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) active=True, aliases=["string"], definition="definition", - payload={}, + payload={"foo": "bar"}, term="term", ) assert_matches_type(Entry, business_glossary, path=["response"]) diff --git a/tests/api_resources/test_datasources.py b/tests/api_resources/test_datasources.py index ba4d2ab1..1d668053 100644 --- a/tests/api_resources/test_datasources.py +++ b/tests/api_resources/test_datasources.py @@ -37,7 +37,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: "host": "192.168.0.10", "db": "at_test", "db_version": "5.7", - "extra_config": {"ssl_mode": "require"}, + "extra_config": {"ssl_mode": "bar"}, "password": "root", "port": 3306, "securetunnel_id": "atst_123456", @@ -123,7 +123,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: access_config={ "db": "at_test", "db_version": "5.7", - "extra_config": {"ssl_mode": "require"}, + "extra_config": {"ssl_mode": "bar"}, "host": "192.168.0.10", "password": "root", "port": 3306, @@ -249,7 +249,7 @@ def test_path_params_delete(self, client: Asktable) -> None: def test_method_add_file(self, client: Asktable) -> None: datasource = client.datasources.add_file( datasource_id="datasource_id", - file=b"raw file contents", + file="file", ) assert_matches_type(object, datasource, path=["response"]) @@ -257,7 +257,7 @@ def test_method_add_file(self, client: Asktable) -> None: def test_raw_response_add_file(self, client: Asktable) -> None: response = client.datasources.with_raw_response.add_file( datasource_id="datasource_id", - file=b"raw file contents", + file="file", ) assert response.is_closed is True @@ -269,7 +269,7 @@ def test_raw_response_add_file(self, client: Asktable) -> None: def test_streaming_response_add_file(self, client: Asktable) -> None: with client.datasources.with_streaming_response.add_file( datasource_id="datasource_id", - file=b"raw file contents", + file="file", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,7 +284,7 @@ def test_path_params_add_file(self, client: Asktable) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"): client.datasources.with_raw_response.add_file( datasource_id="", - file=b"raw file contents", + file="file", ) @parametrize @@ -456,7 +456,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) "host": "192.168.0.10", "db": "at_test", "db_version": "5.7", - "extra_config": {"ssl_mode": "require"}, + "extra_config": {"ssl_mode": "bar"}, "password": "root", "port": 3306, "securetunnel_id": "atst_123456", @@ -542,7 +542,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) access_config={ "db": "at_test", "db_version": "5.7", - "extra_config": {"ssl_mode": "require"}, + "extra_config": {"ssl_mode": "bar"}, "host": "192.168.0.10", "password": "root", "port": 3306, @@ -668,7 +668,7 @@ async def test_path_params_delete(self, async_client: AsyncAsktable) -> None: async def test_method_add_file(self, async_client: AsyncAsktable) -> None: datasource = await async_client.datasources.add_file( datasource_id="datasource_id", - file=b"raw file contents", + file="file", ) assert_matches_type(object, datasource, path=["response"]) @@ -676,7 +676,7 @@ async def test_method_add_file(self, async_client: AsyncAsktable) -> None: async def test_raw_response_add_file(self, async_client: AsyncAsktable) -> None: response = await async_client.datasources.with_raw_response.add_file( datasource_id="datasource_id", - file=b"raw file contents", + file="file", ) assert response.is_closed is True @@ -688,7 +688,7 @@ async def test_raw_response_add_file(self, async_client: AsyncAsktable) -> None: async def test_streaming_response_add_file(self, async_client: AsyncAsktable) -> None: async with async_client.datasources.with_streaming_response.add_file( datasource_id="datasource_id", - file=b"raw file contents", + file="file", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -703,7 +703,7 @@ async def test_path_params_add_file(self, async_client: AsyncAsktable) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `datasource_id` but received ''"): await async_client.datasources.with_raw_response.add_file( datasource_id="", - file=b"raw file contents", + file="file", ) @parametrize diff --git a/tests/api_resources/test_roles.py b/tests/api_resources/test_roles.py index b14375ad..86aa2051 100644 --- a/tests/api_resources/test_roles.py +++ b/tests/api_resources/test_roles.py @@ -12,6 +12,7 @@ from asktable.types import ( Role, RoleGetPolicesResponse, + RoleGetVariablesResponse, ) from asktable.pagination import SyncPage, AsyncPage @@ -261,7 +262,7 @@ def test_method_get_variables(self, client: Asktable) -> None: role = client.roles.get_variables( role_id="role_id", ) - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) @parametrize def test_method_get_variables_with_all_params(self, client: Asktable) -> None: @@ -270,7 +271,7 @@ def test_method_get_variables_with_all_params(self, client: Asktable) -> None: bot_id="bot_id", datasource_ids=["string", "string"], ) - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) @parametrize def test_raw_response_get_variables(self, client: Asktable) -> None: @@ -281,7 +282,7 @@ def test_raw_response_get_variables(self, client: Asktable) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) @parametrize def test_streaming_response_get_variables(self, client: Asktable) -> None: @@ -292,7 +293,7 @@ def test_streaming_response_get_variables(self, client: Asktable) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -549,7 +550,7 @@ async def test_method_get_variables(self, async_client: AsyncAsktable) -> None: role = await async_client.roles.get_variables( role_id="role_id", ) - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) @parametrize async def test_method_get_variables_with_all_params(self, async_client: AsyncAsktable) -> None: @@ -558,7 +559,7 @@ async def test_method_get_variables_with_all_params(self, async_client: AsyncAsk bot_id="bot_id", datasource_ids=["string", "string"], ) - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) @parametrize async def test_raw_response_get_variables(self, async_client: AsyncAsktable) -> None: @@ -569,7 +570,7 @@ async def test_raw_response_get_variables(self, async_client: AsyncAsktable) -> assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) @parametrize async def test_streaming_response_get_variables(self, async_client: AsyncAsktable) -> None: @@ -580,7 +581,7 @@ async def test_streaming_response_get_variables(self, async_client: AsyncAsktabl assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(object, role, path=["response"]) + assert_matches_type(RoleGetVariablesResponse, role, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_securetunnels.py b/tests/api_resources/test_securetunnels.py index 8ab246ed..e2a8b25e 100644 --- a/tests/api_resources/test_securetunnels.py +++ b/tests/api_resources/test_securetunnels.py @@ -101,7 +101,7 @@ def test_method_update(self, client: Asktable) -> None: def test_method_update_with_all_params(self, client: Asktable) -> None: securetunnel = client.securetunnels.update( securetunnel_id="securetunnel_id", - client_info={}, + client_info={"foo": "bar"}, name="我的测试机", unique_key="unique_key", ) @@ -342,7 +342,7 @@ async def test_method_update(self, async_client: AsyncAsktable) -> None: async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None: securetunnel = await async_client.securetunnels.update( securetunnel_id="securetunnel_id", - client_info={}, + client_info={"foo": "bar"}, name="我的测试机", unique_key="unique_key", ) diff --git a/tests/api_resources/test_sqls.py b/tests/api_resources/test_sqls.py index b1f756dc..c7eaf50c 100644 --- a/tests/api_resources/test_sqls.py +++ b/tests/api_resources/test_sqls.py @@ -33,7 +33,7 @@ def test_method_create_with_all_params(self, client: Asktable) -> None: question="question", parameterize=True, role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, ) assert_matches_type(QueryResponse, sql, path=["response"]) @@ -118,7 +118,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) question="question", parameterize=True, role_id="role_id", - role_variables={}, + role_variables={"foo": "bar"}, ) assert_matches_type(QueryResponse, sql, path=["response"]) From ce7ea607390bdba99eddde547b0d26086f01e8e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 07:20:34 +0000 Subject: [PATCH 107/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a7b8eaba..a0819897 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-9b3127f357a8502fba6b108515b97e5acb04e50cb2f933c654c05532b6a5ab19.yml -openapi_spec_hash: aa447a038dd69ccbad1eadad7204d5ad +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ed62f3146ecded3abdc0516037fc1582de7f91ed96ef29d9e36f5d92f25780c1.yml +openapi_spec_hash: 6de1359e14433d1110b8ea1ebe46514a config_hash: acdf4142177ed1932c2d82372693f811 From d1ef26f8728272e1be6c1f82012ec15bf3fda39f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 03:20:58 +0000 Subject: [PATCH 108/130] feat(api): api update --- .stats.yml | 4 ++-- scripts/mock | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index a0819897..acfa1361 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ed62f3146ecded3abdc0516037fc1582de7f91ed96ef29d9e36f5d92f25780c1.yml -openapi_spec_hash: 6de1359e14433d1110b8ea1ebe46514a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-7997d2aebc04c657a434b6b1114b61de06f0d873868ee376ac82f5c50d20884f.yml +openapi_spec_hash: 08977f6ad1332cbeb03d95dad748f20a config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/scripts/mock b/scripts/mock index 0b28f6ea..bcf3b392 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done From e5b4763c4be305b5e8eb00bfc4ccce4ac21b0859 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Mar 2026 12:20:23 +0000 Subject: [PATCH 109/130] feat(api): api update --- .stats.yml | 6 +- api.md | 15 - src/asktable/_client.py | 44 -- src/asktable/resources/__init__.py | 14 - .../resources/datasources/datasources.py | 34 +- src/asktable/resources/datasources/meta.py | 12 +- src/asktable/resources/trainings.py | 532 ------------------ src/asktable/types/__init__.py | 7 - src/asktable/types/chat_create_response.py | 6 +- src/asktable/types/chat_list_response.py | 6 +- src/asktable/types/chat_retrieve_response.py | 6 +- src/asktable/types/datasource.py | 18 +- .../types/datasource_retrieve_response.py | 16 +- .../types/datasource_update_params.py | 13 +- src/asktable/types/training_create_params.py | 35 -- .../types/training_create_response.py | 50 -- src/asktable/types/training_delete_params.py | 12 - src/asktable/types/training_list_params.py | 18 - src/asktable/types/training_list_response.py | 47 -- src/asktable/types/training_update_params.py | 25 - .../types/training_update_response.py | 47 -- tests/api_resources/test_datasources.py | 10 +- tests/api_resources/test_trainings.py | 399 ------------- 23 files changed, 72 insertions(+), 1300 deletions(-) delete mode 100644 src/asktable/resources/trainings.py delete mode 100644 src/asktable/types/training_create_params.py delete mode 100644 src/asktable/types/training_create_response.py delete mode 100644 src/asktable/types/training_delete_params.py delete mode 100644 src/asktable/types/training_list_params.py delete mode 100644 src/asktable/types/training_list_response.py delete mode 100644 src/asktable/types/training_update_params.py delete mode 100644 src/asktable/types/training_update_response.py delete mode 100644 tests/api_resources/test_trainings.py diff --git a/.stats.yml b/.stats.yml index acfa1361..949da43c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 105 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-7997d2aebc04c657a434b6b1114b61de06f0d873868ee376ac82f5c50d20884f.yml -openapi_spec_hash: 08977f6ad1332cbeb03d95dad748f20a +configured_endpoints: 101 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-09c2a1858834d1a4a69bf9c6ac04c236bdc0763873aa14eae4553222afa08ab2.yml +openapi_spec_hash: aab62076e3b4591fa2def5485c7ddeca config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/api.md b/api.md index 73aaa5a2..011dc2e3 100644 --- a/api.md +++ b/api.md @@ -290,21 +290,6 @@ Methods: - client.preferences.update(\*\*params) -> PreferenceUpdateResponse - client.preferences.delete() -> object -# Trainings - -Types: - -```python -from asktable.types import TrainingCreateResponse, TrainingUpdateResponse, TrainingListResponse -``` - -Methods: - -- client.trainings.create(\*\*params) -> TrainingCreateResponse -- client.trainings.update(id, \*\*params) -> TrainingUpdateResponse -- client.trainings.list(\*\*params) -> SyncPage[TrainingListResponse] -- client.trainings.delete(id, \*\*params) -> object - # Project Types: diff --git a/src/asktable/_client.py b/src/asktable/_client.py index 2f27f8e0..caee0bea 100644 --- a/src/asktable/_client.py +++ b/src/asktable/_client.py @@ -46,7 +46,6 @@ answers, project, policies, - trainings, dataframes, datasources, integration, @@ -66,7 +65,6 @@ from .resources.project import ProjectResource, AsyncProjectResource from .resources.sys.sys import SysResource, AsyncSysResource from .resources.policies import PoliciesResource, AsyncPoliciesResource - from .resources.trainings import TrainingsResource, AsyncTrainingsResource from .resources.user.user import UserResource, AsyncUserResource from .resources.dataframes import DataframesResource, AsyncDataframesResource from .resources.chats.chats import ChatsResource, AsyncChatsResource @@ -233,13 +231,6 @@ def preferences(self) -> PreferencesResource: return PreferencesResource(self) - @cached_property - def trainings(self) -> TrainingsResource: - """训练数据管理""" - from .resources.trainings import TrainingsResource - - return TrainingsResource(self) - @cached_property def project(self) -> ProjectResource: """我的项目""" @@ -545,13 +536,6 @@ def preferences(self) -> AsyncPreferencesResource: return AsyncPreferencesResource(self) - @cached_property - def trainings(self) -> AsyncTrainingsResource: - """训练数据管理""" - from .resources.trainings import AsyncTrainingsResource - - return AsyncTrainingsResource(self) - @cached_property def project(self) -> AsyncProjectResource: """我的项目""" @@ -808,13 +792,6 @@ def preferences(self) -> preferences.PreferencesResourceWithRawResponse: return PreferencesResourceWithRawResponse(self._client.preferences) - @cached_property - def trainings(self) -> trainings.TrainingsResourceWithRawResponse: - """训练数据管理""" - from .resources.trainings import TrainingsResourceWithRawResponse - - return TrainingsResourceWithRawResponse(self._client.trainings) - @cached_property def project(self) -> project.ProjectResourceWithRawResponse: """我的项目""" @@ -959,13 +936,6 @@ def preferences(self) -> preferences.AsyncPreferencesResourceWithRawResponse: return AsyncPreferencesResourceWithRawResponse(self._client.preferences) - @cached_property - def trainings(self) -> trainings.AsyncTrainingsResourceWithRawResponse: - """训练数据管理""" - from .resources.trainings import AsyncTrainingsResourceWithRawResponse - - return AsyncTrainingsResourceWithRawResponse(self._client.trainings) - @cached_property def project(self) -> project.AsyncProjectResourceWithRawResponse: """我的项目""" @@ -1110,13 +1080,6 @@ def preferences(self) -> preferences.PreferencesResourceWithStreamingResponse: return PreferencesResourceWithStreamingResponse(self._client.preferences) - @cached_property - def trainings(self) -> trainings.TrainingsResourceWithStreamingResponse: - """训练数据管理""" - from .resources.trainings import TrainingsResourceWithStreamingResponse - - return TrainingsResourceWithStreamingResponse(self._client.trainings) - @cached_property def project(self) -> project.ProjectResourceWithStreamingResponse: """我的项目""" @@ -1261,13 +1224,6 @@ def preferences(self) -> preferences.AsyncPreferencesResourceWithStreamingRespon return AsyncPreferencesResourceWithStreamingResponse(self._client.preferences) - @cached_property - def trainings(self) -> trainings.AsyncTrainingsResourceWithStreamingResponse: - """训练数据管理""" - from .resources.trainings import AsyncTrainingsResourceWithStreamingResponse - - return AsyncTrainingsResourceWithStreamingResponse(self._client.trainings) - @cached_property def project(self) -> project.AsyncProjectResourceWithStreamingResponse: """我的项目""" diff --git a/src/asktable/resources/__init__.py b/src/asktable/resources/__init__.py index d9f6dab5..75a4ac13 100644 --- a/src/asktable/resources/__init__.py +++ b/src/asktable/resources/__init__.py @@ -112,14 +112,6 @@ PoliciesResourceWithStreamingResponse, AsyncPoliciesResourceWithStreamingResponse, ) -from .trainings import ( - TrainingsResource, - AsyncTrainingsResource, - TrainingsResourceWithRawResponse, - AsyncTrainingsResourceWithRawResponse, - TrainingsResourceWithStreamingResponse, - AsyncTrainingsResourceWithStreamingResponse, -) from .dataframes import ( DataframesResource, AsyncDataframesResource, @@ -248,12 +240,6 @@ "AsyncPreferencesResourceWithRawResponse", "PreferencesResourceWithStreamingResponse", "AsyncPreferencesResourceWithStreamingResponse", - "TrainingsResource", - "AsyncTrainingsResource", - "TrainingsResourceWithRawResponse", - "AsyncTrainingsResourceWithRawResponse", - "TrainingsResourceWithStreamingResponse", - "AsyncTrainingsResourceWithStreamingResponse", "ProjectResource", "AsyncProjectResource", "ProjectResourceWithRawResponse", diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index e48a0e4d..b5a70458 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -253,11 +253,12 @@ def update( ] | Omit = omit, field_count: Optional[int] | Omit = omit, - meta_error: Optional[str] | Omit = omit, - meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | Omit = omit, + meta_status: Optional[Literal["unavailable", "available"]] | Omit = omit, name: Optional[str] | Omit = omit, sample_questions: Optional[str] | Omit = omit, schema_count: Optional[int] | Omit = omit, + sync_error: Optional[Dict[str, object]] | Omit = omit, + sync_status: Optional[Literal["processing", "success", "failed", "warning"]] | Omit = omit, table_count: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -278,9 +279,7 @@ def update( field_count: 字段数量 - meta_error: 元数据处理错误 - - meta_status: 元数据处理状态 + meta_status: 数据源可用性 name: 数据源的名称 @@ -288,6 +287,10 @@ def update( schema_count: 库数量 + sync_error: 同步错误信息 + + sync_status: 同步状态 + table_count: 表数量 extra_headers: Send extra headers @@ -308,11 +311,12 @@ def update( "desc": desc, "engine": engine, "field_count": field_count, - "meta_error": meta_error, "meta_status": meta_status, "name": name, "sample_questions": sample_questions, "schema_count": schema_count, + "sync_error": sync_error, + "sync_status": sync_status, "table_count": table_count, }, datasource_update_params.DatasourceUpdateParams, @@ -773,11 +777,12 @@ async def update( ] | Omit = omit, field_count: Optional[int] | Omit = omit, - meta_error: Optional[str] | Omit = omit, - meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] | Omit = omit, + meta_status: Optional[Literal["unavailable", "available"]] | Omit = omit, name: Optional[str] | Omit = omit, sample_questions: Optional[str] | Omit = omit, schema_count: Optional[int] | Omit = omit, + sync_error: Optional[Dict[str, object]] | Omit = omit, + sync_status: Optional[Literal["processing", "success", "failed", "warning"]] | Omit = omit, table_count: Optional[int] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -798,9 +803,7 @@ async def update( field_count: 字段数量 - meta_error: 元数据处理错误 - - meta_status: 元数据处理状态 + meta_status: 数据源可用性 name: 数据源的名称 @@ -808,6 +811,10 @@ async def update( schema_count: 库数量 + sync_error: 同步错误信息 + + sync_status: 同步状态 + table_count: 表数量 extra_headers: Send extra headers @@ -828,11 +835,12 @@ async def update( "desc": desc, "engine": engine, "field_count": field_count, - "meta_error": meta_error, "meta_status": meta_status, "name": name, "sample_questions": sample_questions, "schema_count": schema_count, + "sync_error": sync_error, + "sync_status": sync_status, "table_count": table_count, }, datasource_update_params.DatasourceUpdateParams, diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py index 20e7f8b1..4eadeaf7 100644 --- a/src/asktable/resources/datasources/meta.py +++ b/src/asktable/resources/datasources/meta.py @@ -61,11 +61,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - 创建数据源的 meta,如果已经存在,则删除旧的 - - 如果上传了 meta,则使用用户上传的数据创建。 - - 否则从数据源中自动获取。 + 初始化数据源的 meta。不允许覆盖已成功初始化的 meta,需使用 PUT 更新。 Args: extra_headers: Send extra headers @@ -257,11 +253,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - 创建数据源的 meta,如果已经存在,则删除旧的 - - 如果上传了 meta,则使用用户上传的数据创建。 - - 否则从数据源中自动获取。 + 初始化数据源的 meta。不允许覆盖已成功初始化的 meta,需使用 PUT 更新。 Args: extra_headers: Send extra headers diff --git a/src/asktable/resources/trainings.py b/src/asktable/resources/trainings.py deleted file mode 100644 index b8d6d31c..00000000 --- a/src/asktable/resources/trainings.py +++ /dev/null @@ -1,532 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional - -import httpx - -from ..types import training_list_params, training_create_params, training_delete_params, training_update_params -from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ..pagination import SyncPage, AsyncPage -from .._base_client import AsyncPaginator, make_request_options -from ..types.training_list_response import TrainingListResponse -from ..types.training_create_response import TrainingCreateResponse -from ..types.training_update_response import TrainingUpdateResponse - -__all__ = ["TrainingsResource", "AsyncTrainingsResource"] - - -class TrainingsResource(SyncAPIResource): - """训练数据管理""" - - @cached_property - def with_raw_response(self) -> TrainingsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers - """ - return TrainingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TrainingsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response - """ - return TrainingsResourceWithStreamingResponse(self) - - def create( - self, - *, - datasource_id: str, - body: Iterable[training_create_params.Body], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TrainingCreateResponse: - """ - Create Training Pair - - Args: - datasource_id: 数据源 ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/v1/training", - body=maybe_transform(body, Iterable[training_create_params.Body]), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"datasource_id": datasource_id}, training_create_params.TrainingCreateParams), - ), - cast_to=TrainingCreateResponse, - ) - - def update( - self, - id: str, - *, - datasource_id: str, - active: Optional[bool] | Omit = omit, - question: Optional[str] | Omit = omit, - role_id: Optional[str] | Omit = omit, - sql: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TrainingUpdateResponse: - """ - Update Training Pair - - Args: - datasource_id: 数据源 ID - - active: 是否启用 - - question: 用户问题 - - role_id: 角色 ID - - sql: 用户问题对应的 SQL - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._patch( - f"/v1/training/{id}", - body=maybe_transform( - { - "active": active, - "question": question, - "role_id": role_id, - "sql": sql, - }, - training_update_params.TrainingUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"datasource_id": datasource_id}, training_update_params.TrainingUpdateParams), - ), - cast_to=TrainingUpdateResponse, - ) - - def list( - self, - *, - datasource_id: str, - page: int | Omit = omit, - size: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SyncPage[TrainingListResponse]: - """ - Get Training Pairs - - Args: - datasource_id: 数据源 ID - - page: Page number - - size: Page size - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/v1/training", - page=SyncPage[TrainingListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "datasource_id": datasource_id, - "page": page, - "size": size, - }, - training_list_params.TrainingListParams, - ), - ), - model=TrainingListResponse, - ) - - def delete( - self, - id: str, - *, - datasource_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """ - Delete Training Pair - - Args: - datasource_id: 数据源 ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._delete( - f"/v1/training/{id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"datasource_id": datasource_id}, training_delete_params.TrainingDeleteParams), - ), - cast_to=object, - ) - - -class AsyncTrainingsResource(AsyncAPIResource): - """训练数据管理""" - - @cached_property - def with_raw_response(self) -> AsyncTrainingsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/DataMini/asktable-python#accessing-raw-response-data-eg-headers - """ - return AsyncTrainingsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTrainingsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/DataMini/asktable-python#with_streaming_response - """ - return AsyncTrainingsResourceWithStreamingResponse(self) - - async def create( - self, - *, - datasource_id: str, - body: Iterable[training_create_params.Body], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TrainingCreateResponse: - """ - Create Training Pair - - Args: - datasource_id: 数据源 ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/v1/training", - body=await async_maybe_transform(body, Iterable[training_create_params.Body]), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"datasource_id": datasource_id}, training_create_params.TrainingCreateParams - ), - ), - cast_to=TrainingCreateResponse, - ) - - async def update( - self, - id: str, - *, - datasource_id: str, - active: Optional[bool] | Omit = omit, - question: Optional[str] | Omit = omit, - role_id: Optional[str] | Omit = omit, - sql: Optional[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> TrainingUpdateResponse: - """ - Update Training Pair - - Args: - datasource_id: 数据源 ID - - active: 是否启用 - - question: 用户问题 - - role_id: 角色 ID - - sql: 用户问题对应的 SQL - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._patch( - f"/v1/training/{id}", - body=await async_maybe_transform( - { - "active": active, - "question": question, - "role_id": role_id, - "sql": sql, - }, - training_update_params.TrainingUpdateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"datasource_id": datasource_id}, training_update_params.TrainingUpdateParams - ), - ), - cast_to=TrainingUpdateResponse, - ) - - def list( - self, - *, - datasource_id: str, - page: int | Omit = omit, - size: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncPaginator[TrainingListResponse, AsyncPage[TrainingListResponse]]: - """ - Get Training Pairs - - Args: - datasource_id: 数据源 ID - - page: Page number - - size: Page size - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/v1/training", - page=AsyncPage[TrainingListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "datasource_id": datasource_id, - "page": page, - "size": size, - }, - training_list_params.TrainingListParams, - ), - ), - model=TrainingListResponse, - ) - - async def delete( - self, - id: str, - *, - datasource_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> object: - """ - Delete Training Pair - - Args: - datasource_id: 数据源 ID - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._delete( - f"/v1/training/{id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"datasource_id": datasource_id}, training_delete_params.TrainingDeleteParams - ), - ), - cast_to=object, - ) - - -class TrainingsResourceWithRawResponse: - def __init__(self, trainings: TrainingsResource) -> None: - self._trainings = trainings - - self.create = to_raw_response_wrapper( - trainings.create, - ) - self.update = to_raw_response_wrapper( - trainings.update, - ) - self.list = to_raw_response_wrapper( - trainings.list, - ) - self.delete = to_raw_response_wrapper( - trainings.delete, - ) - - -class AsyncTrainingsResourceWithRawResponse: - def __init__(self, trainings: AsyncTrainingsResource) -> None: - self._trainings = trainings - - self.create = async_to_raw_response_wrapper( - trainings.create, - ) - self.update = async_to_raw_response_wrapper( - trainings.update, - ) - self.list = async_to_raw_response_wrapper( - trainings.list, - ) - self.delete = async_to_raw_response_wrapper( - trainings.delete, - ) - - -class TrainingsResourceWithStreamingResponse: - def __init__(self, trainings: TrainingsResource) -> None: - self._trainings = trainings - - self.create = to_streamed_response_wrapper( - trainings.create, - ) - self.update = to_streamed_response_wrapper( - trainings.update, - ) - self.list = to_streamed_response_wrapper( - trainings.list, - ) - self.delete = to_streamed_response_wrapper( - trainings.delete, - ) - - -class AsyncTrainingsResourceWithStreamingResponse: - def __init__(self, trainings: AsyncTrainingsResource) -> None: - self._trainings = trainings - - self.create = async_to_streamed_response_wrapper( - trainings.create, - ) - self.update = async_to_streamed_response_wrapper( - trainings.update, - ) - self.list = async_to_streamed_response_wrapper( - trainings.list, - ) - self.delete = async_to_streamed_response_wrapper( - trainings.delete, - ) diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py index 6b482293..6b42fdbb 100644 --- a/src/asktable/types/__init__.py +++ b/src/asktable/types/__init__.py @@ -45,7 +45,6 @@ from .policy_create_params import PolicyCreateParams as PolicyCreateParams from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .polish_create_params import PolishCreateParams as PolishCreateParams -from .training_list_params import TrainingListParams as TrainingListParams from .ats_retrieve_response import ATSRetrieveResponse as ATSRetrieveResponse from .entry_with_definition import EntryWithDefinition as EntryWithDefinition from .project_update_params import ProjectUpdateParams as ProjectUpdateParams @@ -53,18 +52,12 @@ from .chat_retrieve_response import ChatRetrieveResponse as ChatRetrieveResponse from .datasource_list_params import DatasourceListParams as DatasourceListParams from .polish_create_response import PolishCreateResponse as PolishCreateResponse -from .training_create_params import TrainingCreateParams as TrainingCreateParams -from .training_delete_params import TrainingDeleteParams as TrainingDeleteParams -from .training_list_response import TrainingListResponse as TrainingListResponse -from .training_update_params import TrainingUpdateParams as TrainingUpdateParams from .auth_create_token_params import AuthCreateTokenParams as AuthCreateTokenParams from .datasource_create_params import DatasourceCreateParams as DatasourceCreateParams from .datasource_update_params import DatasourceUpdateParams as DatasourceUpdateParams from .preference_create_params import PreferenceCreateParams as PreferenceCreateParams from .preference_update_params import PreferenceUpdateParams as PreferenceUpdateParams from .securetunnel_list_params import SecuretunnelListParams as SecuretunnelListParams -from .training_create_response import TrainingCreateResponse as TrainingCreateResponse -from .training_update_response import TrainingUpdateResponse as TrainingUpdateResponse from .role_get_polices_response import RoleGetPolicesResponse as RoleGetPolicesResponse from .role_get_variables_params import RoleGetVariablesParams as RoleGetVariablesParams from .auth_create_token_response import AuthCreateTokenResponse as AuthCreateTokenResponse diff --git a/src/asktable/types/chat_create_response.py b/src/asktable/types/chat_create_response.py index 278cf09a..d0ce3ddb 100644 --- a/src/asktable/types/chat_create_response.py +++ b/src/asktable/types/chat_create_response.py @@ -21,9 +21,7 @@ class ChatCreateResponse(BaseModel): project_id: str - status: Literal["active", "pending", "error", "fatal"] - - status_message: Optional[str] = None + status: Literal["active", "pending", "warning", "error"] bot_id: Optional[str] = None """ @@ -31,6 +29,8 @@ class ChatCreateResponse(BaseModel): 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 """ + error_detail: Optional[Dict[str, object]] = None + name: Optional[str] = None """New name for the chat""" diff --git a/src/asktable/types/chat_list_response.py b/src/asktable/types/chat_list_response.py index d162b82e..40c8b310 100644 --- a/src/asktable/types/chat_list_response.py +++ b/src/asktable/types/chat_list_response.py @@ -21,9 +21,7 @@ class ChatListResponse(BaseModel): project_id: str - status: Literal["active", "pending", "error", "fatal"] - - status_message: Optional[str] = None + status: Literal["active", "pending", "warning", "error"] bot_id: Optional[str] = None """ @@ -31,6 +29,8 @@ class ChatListResponse(BaseModel): 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 """ + error_detail: Optional[Dict[str, object]] = None + name: Optional[str] = None """New name for the chat""" diff --git a/src/asktable/types/chat_retrieve_response.py b/src/asktable/types/chat_retrieve_response.py index 8813f522..ba261401 100644 --- a/src/asktable/types/chat_retrieve_response.py +++ b/src/asktable/types/chat_retrieve_response.py @@ -21,9 +21,7 @@ class ChatRetrieveResponse(BaseModel): project_id: str - status: Literal["active", "pending", "error", "fatal"] - - status_message: Optional[str] = None + status: Literal["active", "pending", "warning", "error"] bot_id: Optional[str] = None """ @@ -33,6 +31,8 @@ class ChatRetrieveResponse(BaseModel): datasource_ids: Optional[List[str]] = None + error_detail: Optional[Dict[str, object]] = None + name: Optional[str] = None """New name for the chat""" diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py index 8e1b2989..b1cee691 100644 --- a/src/asktable/types/datasource.py +++ b/src/asktable/types/datasource.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import Dict, Optional from datetime import datetime from typing_extensions import Literal @@ -53,8 +53,8 @@ class Datasource(BaseModel): ] """数据源引擎""" - meta_status: Literal["processing", "failed", "success", "unprocessed"] - """元数据处理状态""" + meta_status: Literal["unavailable", "available"] + """数据源可用性""" modified_at: datetime """修改时间""" @@ -62,15 +62,15 @@ class Datasource(BaseModel): project_id: str """项目 ID""" + sync_status: Literal["processing", "success", "failed", "warning"] + """同步状态""" + desc: Optional[str] = None """数据源描述""" field_count: Optional[int] = None """字段数量""" - meta_error: Optional[str] = None - """元数据处理错误""" - name: Optional[str] = None """数据源的名称""" @@ -80,5 +80,11 @@ class Datasource(BaseModel): schema_count: Optional[int] = None """库数量""" + sync_error: Optional[Dict[str, object]] = None + """同步错误信息""" + + synced_at: Optional[datetime] = None + """上次同步完成时间""" + table_count: Optional[int] = None """表数量""" diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index 06849714..904b12b1 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -108,8 +108,8 @@ class DatasourceRetrieveResponse(BaseModel): ] """数据源引擎""" - meta_status: Literal["processing", "failed", "success", "unprocessed"] - """元数据处理状态""" + meta_status: Literal["unavailable", "available"] + """数据源可用性""" modified_at: datetime """修改时间""" @@ -117,6 +117,9 @@ class DatasourceRetrieveResponse(BaseModel): project_id: str """项目 ID""" + sync_status: Literal["processing", "success", "failed", "warning"] + """同步状态""" + access_config: Optional[AccessConfig] = None """访问数据源的配置信息""" @@ -126,9 +129,6 @@ class DatasourceRetrieveResponse(BaseModel): field_count: Optional[int] = None """字段数量""" - meta_error: Optional[str] = None - """元数据处理错误""" - name: Optional[str] = None """数据源的名称""" @@ -138,5 +138,11 @@ class DatasourceRetrieveResponse(BaseModel): schema_count: Optional[int] = None """库数量""" + sync_error: Optional[Dict[str, object]] = None + """同步错误信息""" + + synced_at: Optional[datetime] = None + """上次同步完成时间""" + table_count: Optional[int] = None """表数量""" diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index d379fb31..2943b8ee 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -63,11 +63,8 @@ class DatasourceUpdateParams(TypedDict, total=False): field_count: Optional[int] """字段数量""" - meta_error: Optional[str] - """元数据处理错误""" - - meta_status: Optional[Literal["processing", "failed", "success", "unprocessed"]] - """元数据处理状态""" + meta_status: Optional[Literal["unavailable", "available"]] + """数据源可用性""" name: Optional[str] """数据源的名称""" @@ -78,6 +75,12 @@ class DatasourceUpdateParams(TypedDict, total=False): schema_count: Optional[int] """库数量""" + sync_error: Optional[Dict[str, object]] + """同步错误信息""" + + sync_status: Optional[Literal["processing", "success", "failed", "warning"]] + """同步状态""" + table_count: Optional[int] """表数量""" diff --git a/src/asktable/types/training_create_params.py b/src/asktable/types/training_create_params.py deleted file mode 100644 index f8dec4df..00000000 --- a/src/asktable/types/training_create_params.py +++ /dev/null @@ -1,35 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable, Optional -from typing_extensions import Required, TypedDict - -__all__ = ["TrainingCreateParams", "Body"] - - -class TrainingCreateParams(TypedDict, total=False): - datasource_id: Required[str] - """数据源 ID""" - - body: Required[Iterable[Body]] - - -class Body(TypedDict, total=False): - question: Required[str] - """用户问题""" - - sql: Required[str] - """用户问题对应的 SQL""" - - active: bool - """是否启用""" - - chat_id: Optional[str] - """聊天 ID""" - - msg_id: Optional[str] - """消息 ID""" - - role_id: Optional[str] - """角色 ID""" diff --git a/src/asktable/types/training_create_response.py b/src/asktable/types/training_create_response.py deleted file mode 100644 index 278021f5..00000000 --- a/src/asktable/types/training_create_response.py +++ /dev/null @@ -1,50 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal, TypeAlias - -from .._models import BaseModel - -__all__ = ["TrainingCreateResponse", "TrainingCreateResponseItem"] - - -class TrainingCreateResponseItem(BaseModel): - id: str - """训练数据 ID""" - - created_at: datetime - """创建时间""" - - datasource_id: str - """数据源 ID""" - - modified_at: datetime - """更新时间""" - - project_id: str - """项目 ID""" - - question: str - """用户问题""" - - source: Literal["import", "auto"] - """训练数据来源""" - - sql: str - """用户问题对应的 SQL""" - - active: Optional[bool] = None - """是否启用""" - - chat_id: Optional[str] = None - """聊天 ID""" - - msg_id: Optional[str] = None - """消息 ID""" - - role_id: Optional[str] = None - """角色 ID""" - - -TrainingCreateResponse: TypeAlias = List[TrainingCreateResponseItem] diff --git a/src/asktable/types/training_delete_params.py b/src/asktable/types/training_delete_params.py deleted file mode 100644 index e7325e7f..00000000 --- a/src/asktable/types/training_delete_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["TrainingDeleteParams"] - - -class TrainingDeleteParams(TypedDict, total=False): - datasource_id: Required[str] - """数据源 ID""" diff --git a/src/asktable/types/training_list_params.py b/src/asktable/types/training_list_params.py deleted file mode 100644 index bdf03a57..00000000 --- a/src/asktable/types/training_list_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["TrainingListParams"] - - -class TrainingListParams(TypedDict, total=False): - datasource_id: Required[str] - """数据源 ID""" - - page: int - """Page number""" - - size: int - """Page size""" diff --git a/src/asktable/types/training_list_response.py b/src/asktable/types/training_list_response.py deleted file mode 100644 index bc22d53a..00000000 --- a/src/asktable/types/training_list_response.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["TrainingListResponse"] - - -class TrainingListResponse(BaseModel): - id: str - """训练数据 ID""" - - created_at: datetime - """创建时间""" - - datasource_id: str - """数据源 ID""" - - modified_at: datetime - """更新时间""" - - project_id: str - """项目 ID""" - - question: str - """用户问题""" - - source: Literal["import", "auto"] - """训练数据来源""" - - sql: str - """用户问题对应的 SQL""" - - active: Optional[bool] = None - """是否启用""" - - chat_id: Optional[str] = None - """聊天 ID""" - - msg_id: Optional[str] = None - """消息 ID""" - - role_id: Optional[str] = None - """角色 ID""" diff --git a/src/asktable/types/training_update_params.py b/src/asktable/types/training_update_params.py deleted file mode 100644 index 82d56a3f..00000000 --- a/src/asktable/types/training_update_params.py +++ /dev/null @@ -1,25 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Optional -from typing_extensions import Required, TypedDict - -__all__ = ["TrainingUpdateParams"] - - -class TrainingUpdateParams(TypedDict, total=False): - datasource_id: Required[str] - """数据源 ID""" - - active: Optional[bool] - """是否启用""" - - question: Optional[str] - """用户问题""" - - role_id: Optional[str] - """角色 ID""" - - sql: Optional[str] - """用户问题对应的 SQL""" diff --git a/src/asktable/types/training_update_response.py b/src/asktable/types/training_update_response.py deleted file mode 100644 index 3817394d..00000000 --- a/src/asktable/types/training_update_response.py +++ /dev/null @@ -1,47 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["TrainingUpdateResponse"] - - -class TrainingUpdateResponse(BaseModel): - id: str - """训练数据 ID""" - - created_at: datetime - """创建时间""" - - datasource_id: str - """数据源 ID""" - - modified_at: datetime - """更新时间""" - - project_id: str - """项目 ID""" - - question: str - """用户问题""" - - source: Literal["import", "auto"] - """训练数据来源""" - - sql: str - """用户问题对应的 SQL""" - - active: Optional[bool] = None - """是否启用""" - - chat_id: Optional[str] = None - """聊天 ID""" - - msg_id: Optional[str] = None - """消息 ID""" - - role_id: Optional[str] = None - """角色 ID""" diff --git a/tests/api_resources/test_datasources.py b/tests/api_resources/test_datasources.py index 1d668053..225de5da 100644 --- a/tests/api_resources/test_datasources.py +++ b/tests/api_resources/test_datasources.py @@ -133,11 +133,12 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: desc="数据源描述", engine="mysql", field_count=1, - meta_error="error message", - meta_status="success", + meta_status="available", name="用户库", sample_questions="示例问题", schema_count=1, + sync_error={"message": "bar"}, + sync_status="success", table_count=1, ) assert_matches_type(Datasource, datasource, path=["response"]) @@ -552,11 +553,12 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) desc="数据源描述", engine="mysql", field_count=1, - meta_error="error message", - meta_status="success", + meta_status="available", name="用户库", sample_questions="示例问题", schema_count=1, + sync_error={"message": "bar"}, + sync_status="success", table_count=1, ) assert_matches_type(Datasource, datasource, path=["response"]) diff --git a/tests/api_resources/test_trainings.py b/tests/api_resources/test_trainings.py deleted file mode 100644 index 33452ed1..00000000 --- a/tests/api_resources/test_trainings.py +++ /dev/null @@ -1,399 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from asktable import Asktable, AsyncAsktable -from tests.utils import assert_matches_type -from asktable.types import ( - TrainingListResponse, - TrainingCreateResponse, - TrainingUpdateResponse, -) -from asktable.pagination import SyncPage, AsyncPage - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTrainings: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Asktable) -> None: - training = client.trainings.create( - datasource_id="datasource_id", - body=[ - { - "question": "question", - "sql": "sql", - } - ], - ) - assert_matches_type(TrainingCreateResponse, training, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Asktable) -> None: - response = client.trainings.with_raw_response.create( - datasource_id="datasource_id", - body=[ - { - "question": "question", - "sql": "sql", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = response.parse() - assert_matches_type(TrainingCreateResponse, training, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Asktable) -> None: - with client.trainings.with_streaming_response.create( - datasource_id="datasource_id", - body=[ - { - "question": "question", - "sql": "sql", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = response.parse() - assert_matches_type(TrainingCreateResponse, training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_update(self, client: Asktable) -> None: - training = client.trainings.update( - id="id", - datasource_id="datasource_id", - ) - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - @parametrize - def test_method_update_with_all_params(self, client: Asktable) -> None: - training = client.trainings.update( - id="id", - datasource_id="datasource_id", - active=True, - question="question", - role_id="role_id", - sql="sql", - ) - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - @parametrize - def test_raw_response_update(self, client: Asktable) -> None: - response = client.trainings.with_raw_response.update( - id="id", - datasource_id="datasource_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = response.parse() - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - @parametrize - def test_streaming_response_update(self, client: Asktable) -> None: - with client.trainings.with_streaming_response.update( - id="id", - datasource_id="datasource_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = response.parse() - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_update(self, client: Asktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.trainings.with_raw_response.update( - id="", - datasource_id="datasource_id", - ) - - @parametrize - def test_method_list(self, client: Asktable) -> None: - training = client.trainings.list( - datasource_id="datasource_id", - ) - assert_matches_type(SyncPage[TrainingListResponse], training, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Asktable) -> None: - training = client.trainings.list( - datasource_id="datasource_id", - page=1, - size=1, - ) - assert_matches_type(SyncPage[TrainingListResponse], training, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Asktable) -> None: - response = client.trainings.with_raw_response.list( - datasource_id="datasource_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = response.parse() - assert_matches_type(SyncPage[TrainingListResponse], training, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: Asktable) -> None: - with client.trainings.with_streaming_response.list( - datasource_id="datasource_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = response.parse() - assert_matches_type(SyncPage[TrainingListResponse], training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: Asktable) -> None: - training = client.trainings.delete( - id="id", - datasource_id="datasource_id", - ) - assert_matches_type(object, training, path=["response"]) - - @parametrize - def test_raw_response_delete(self, client: Asktable) -> None: - response = client.trainings.with_raw_response.delete( - id="id", - datasource_id="datasource_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = response.parse() - assert_matches_type(object, training, path=["response"]) - - @parametrize - def test_streaming_response_delete(self, client: Asktable) -> None: - with client.trainings.with_streaming_response.delete( - id="id", - datasource_id="datasource_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = response.parse() - assert_matches_type(object, training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: Asktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.trainings.with_raw_response.delete( - id="", - datasource_id="datasource_id", - ) - - -class TestAsyncTrainings: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncAsktable) -> None: - training = await async_client.trainings.create( - datasource_id="datasource_id", - body=[ - { - "question": "question", - "sql": "sql", - } - ], - ) - assert_matches_type(TrainingCreateResponse, training, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncAsktable) -> None: - response = await async_client.trainings.with_raw_response.create( - datasource_id="datasource_id", - body=[ - { - "question": "question", - "sql": "sql", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = await response.parse() - assert_matches_type(TrainingCreateResponse, training, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None: - async with async_client.trainings.with_streaming_response.create( - datasource_id="datasource_id", - body=[ - { - "question": "question", - "sql": "sql", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = await response.parse() - assert_matches_type(TrainingCreateResponse, training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_update(self, async_client: AsyncAsktable) -> None: - training = await async_client.trainings.update( - id="id", - datasource_id="datasource_id", - ) - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - @parametrize - async def test_method_update_with_all_params(self, async_client: AsyncAsktable) -> None: - training = await async_client.trainings.update( - id="id", - datasource_id="datasource_id", - active=True, - question="question", - role_id="role_id", - sql="sql", - ) - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - @parametrize - async def test_raw_response_update(self, async_client: AsyncAsktable) -> None: - response = await async_client.trainings.with_raw_response.update( - id="id", - datasource_id="datasource_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = await response.parse() - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - @parametrize - async def test_streaming_response_update(self, async_client: AsyncAsktable) -> None: - async with async_client.trainings.with_streaming_response.update( - id="id", - datasource_id="datasource_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = await response.parse() - assert_matches_type(TrainingUpdateResponse, training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_update(self, async_client: AsyncAsktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.trainings.with_raw_response.update( - id="", - datasource_id="datasource_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncAsktable) -> None: - training = await async_client.trainings.list( - datasource_id="datasource_id", - ) - assert_matches_type(AsyncPage[TrainingListResponse], training, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncAsktable) -> None: - training = await async_client.trainings.list( - datasource_id="datasource_id", - page=1, - size=1, - ) - assert_matches_type(AsyncPage[TrainingListResponse], training, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncAsktable) -> None: - response = await async_client.trainings.with_raw_response.list( - datasource_id="datasource_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = await response.parse() - assert_matches_type(AsyncPage[TrainingListResponse], training, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncAsktable) -> None: - async with async_client.trainings.with_streaming_response.list( - datasource_id="datasource_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = await response.parse() - assert_matches_type(AsyncPage[TrainingListResponse], training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncAsktable) -> None: - training = await async_client.trainings.delete( - id="id", - datasource_id="datasource_id", - ) - assert_matches_type(object, training, path=["response"]) - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncAsktable) -> None: - response = await async_client.trainings.with_raw_response.delete( - id="id", - datasource_id="datasource_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - training = await response.parse() - assert_matches_type(object, training, path=["response"]) - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncAsktable) -> None: - async with async_client.trainings.with_streaming_response.delete( - id="id", - datasource_id="datasource_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - training = await response.parse() - assert_matches_type(object, training, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncAsktable) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.trainings.with_raw_response.delete( - id="", - datasource_id="datasource_id", - ) From 86b895bc21b209f651ab062637ca506a34e96992 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 7 Mar 2026 18:45:19 +0000 Subject: [PATCH 110/130] chore(internal): codegen related update --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbe5b881..db7bac48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,14 +61,18 @@ jobs: run: rye build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/asktable-python' + if: |- + github.repository == 'stainless-sdks/asktable-python' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball - if: github.repository == 'stainless-sdks/asktable-python' + if: |- + github.repository == 'stainless-sdks/asktable-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} From cfd2a2cc06b3ec273dbef068bfe6a1273bbaf858 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 8 Mar 2026 10:20:20 +0000 Subject: [PATCH 111/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 949da43c..578aaabd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-09c2a1858834d1a4a69bf9c6ac04c236bdc0763873aa14eae4553222afa08ab2.yml -openapi_spec_hash: aab62076e3b4591fa2def5485c7ddeca +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dc8a00c9eb653987d2babaf772fc95e056adf024d9e44a557949a2f6399ec429.yml +openapi_spec_hash: e8a896005f70839197f9ad8b457461de config_hash: acdf4142177ed1932c2d82372693f811 From 8f315ae44dd5f63bb6ee94eeb8a05db4be061185 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 14 Mar 2026 03:24:22 +0000 Subject: [PATCH 112/130] feat(api): api update --- .stats.yml | 4 ++-- src/asktable/resources/datasources/datasources.py | 6 +++--- src/asktable/types/datasource.py | 4 ++-- src/asktable/types/datasource_retrieve_response.py | 2 +- src/asktable/types/datasource_update_params.py | 4 +++- tests/api_resources/test_datasources.py | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 578aaabd..67d59f44 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dc8a00c9eb653987d2babaf772fc95e056adf024d9e44a557949a2f6399ec429.yml -openapi_spec_hash: e8a896005f70839197f9ad8b457461de +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ca84b742a00e0db30a96175a2a6b07d40f3700c491dc05b5002508510348072f.yml +openapi_spec_hash: 9e5a63cba55ad2b416ba2fbba6bd5958 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index b5a70458..006c5f4b 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -30,7 +30,7 @@ IndexesResourceWithStreamingResponse, AsyncIndexesResourceWithStreamingResponse, ) -from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource @@ -255,7 +255,7 @@ def update( field_count: Optional[int] | Omit = omit, meta_status: Optional[Literal["unavailable", "available"]] | Omit = omit, name: Optional[str] | Omit = omit, - sample_questions: Optional[str] | Omit = omit, + sample_questions: Optional[SequenceNotStr[str]] | Omit = omit, schema_count: Optional[int] | Omit = omit, sync_error: Optional[Dict[str, object]] | Omit = omit, sync_status: Optional[Literal["processing", "success", "failed", "warning"]] | Omit = omit, @@ -779,7 +779,7 @@ async def update( field_count: Optional[int] | Omit = omit, meta_status: Optional[Literal["unavailable", "available"]] | Omit = omit, name: Optional[str] | Omit = omit, - sample_questions: Optional[str] | Omit = omit, + sample_questions: Optional[SequenceNotStr[str]] | Omit = omit, schema_count: Optional[int] | Omit = omit, sync_error: Optional[Dict[str, object]] | Omit = omit, sync_status: Optional[Literal["processing", "success", "failed", "warning"]] | Omit = omit, diff --git a/src/asktable/types/datasource.py b/src/asktable/types/datasource.py index b1cee691..403b9b37 100644 --- a/src/asktable/types/datasource.py +++ b/src/asktable/types/datasource.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -74,7 +74,7 @@ class Datasource(BaseModel): name: Optional[str] = None """数据源的名称""" - sample_questions: Optional[str] = None + sample_questions: Optional[List[str]] = None """示例问题""" schema_count: Optional[int] = None diff --git a/src/asktable/types/datasource_retrieve_response.py b/src/asktable/types/datasource_retrieve_response.py index 904b12b1..27cca6a5 100644 --- a/src/asktable/types/datasource_retrieve_response.py +++ b/src/asktable/types/datasource_retrieve_response.py @@ -132,7 +132,7 @@ class DatasourceRetrieveResponse(BaseModel): name: Optional[str] = None """数据源的名称""" - sample_questions: Optional[str] = None + sample_questions: Optional[List[str]] = None """示例问题""" schema_count: Optional[int] = None diff --git a/src/asktable/types/datasource_update_params.py b/src/asktable/types/datasource_update_params.py index 2943b8ee..d6b75aa8 100644 --- a/src/asktable/types/datasource_update_params.py +++ b/src/asktable/types/datasource_update_params.py @@ -5,6 +5,8 @@ from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .._types import SequenceNotStr + __all__ = [ "DatasourceUpdateParams", "AccessConfig", @@ -69,7 +71,7 @@ class DatasourceUpdateParams(TypedDict, total=False): name: Optional[str] """数据源的名称""" - sample_questions: Optional[str] + sample_questions: Optional[SequenceNotStr[str]] """示例问题""" schema_count: Optional[int] diff --git a/tests/api_resources/test_datasources.py b/tests/api_resources/test_datasources.py index 225de5da..2ab4c033 100644 --- a/tests/api_resources/test_datasources.py +++ b/tests/api_resources/test_datasources.py @@ -135,7 +135,7 @@ def test_method_update_with_all_params(self, client: Asktable) -> None: field_count=1, meta_status="available", name="用户库", - sample_questions="示例问题", + sample_questions=["示例问题1", "示例问题2"], schema_count=1, sync_error={"message": "bar"}, sync_status="success", @@ -555,7 +555,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAsktable) field_count=1, meta_status="available", name="用户库", - sample_questions="示例问题", + sample_questions=["示例问题1", "示例问题2"], schema_count=1, sync_error={"message": "bar"}, sync_status="success", From 272c031c8a87e63307018822d3e6b36eae492f1b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Mar 2026 10:24:30 +0000 Subject: [PATCH 113/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 67d59f44..89085987 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-ca84b742a00e0db30a96175a2a6b07d40f3700c491dc05b5002508510348072f.yml -openapi_spec_hash: 9e5a63cba55ad2b416ba2fbba6bd5958 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-88f2dadd0818932d90b89c15313f2c91886108e7b2be786ffb9eb797602311fa.yml +openapi_spec_hash: ce8a0389847e29f44c5cad2e75dadef4 config_hash: acdf4142177ed1932c2d82372693f811 From 2ad193d7d26f51f8e2080b2c7018865eec6346b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 03:30:47 +0000 Subject: [PATCH 114/130] feat(api): api update --- .github/workflows/ci.yml | 14 ++++++++------ .stats.yml | 4 ++-- pyproject.toml | 2 +- src/asktable/_compat.py | 11 +++++++++-- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db7bac48..5faf1f2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' diff --git a/.stats.yml b/.stats.yml index 89085987..fe38c5ba 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-88f2dadd0818932d90b89c15313f2c91886108e7b2be786ffb9eb797602311fa.yml -openapi_spec_hash: ce8a0389847e29f44c5cad2e75dadef4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-8e509ba7294e5eed01fda6d3fbaf8bb3da6a7c081bfcb583e7ee6e034f18df7b.yml +openapi_spec_hash: 0ed9dc4972f92e814e7c37d83548058f config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/pyproject.toml b/pyproject.toml index 1b477e36..162c6b43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ authors = [ dependencies = [ "httpx>=0.23.0, <1", "pydantic>=1.9.0, <3", - "typing-extensions>=4.10, <5", + "typing-extensions>=4.14, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", diff --git a/src/asktable/_compat.py b/src/asktable/_compat.py index 786ff42a..e6690a4f 100644 --- a/src/asktable/_compat.py +++ b/src/asktable/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -142,6 +146,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -149,7 +156,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", From 0c6162b65b8b1034dd6f9c65aff9020f41fd6af9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 03:35:29 +0000 Subject: [PATCH 115/130] chore(internal): codegen related update --- CONTRIBUTING.md | 2 +- scripts/mock | 26 ++-- scripts/test | 16 +-- src/asktable/_utils/__init__.py | 1 + src/asktable/_utils/_path.py | 127 ++++++++++++++++++ src/asktable/resources/ats/ats.py | 14 +- src/asktable/resources/ats/task.py | 18 +-- src/asktable/resources/ats/test_case.py | 22 +-- src/asktable/resources/bots.py | 18 +-- src/asktable/resources/business_glossary.py | 14 +- src/asktable/resources/chats/chats.py | 10 +- src/asktable/resources/chats/messages.py | 14 +- src/asktable/resources/dataframes.py | 5 +- .../resources/datasources/datasources.py | 34 ++--- src/asktable/resources/datasources/indexes.py | 14 +- src/asktable/resources/datasources/meta.py | 18 +-- src/asktable/resources/files.py | 5 +- src/asktable/resources/policies.py | 14 +- src/asktable/resources/roles.py | 22 +-- src/asktable/resources/securetunnels.py | 18 +-- .../resources/sys/projects/api_keys.py | 18 +-- .../resources/sys/projects/projects.py | 18 +-- tests/test_utils/test_path.py | 89 ++++++++++++ 23 files changed, 380 insertions(+), 157 deletions(-) create mode 100644 src/asktable/_utils/_path.py create mode 100644 tests/test_utils/test_path.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ca0ed6e..0c4ed922 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,7 +85,7 @@ $ pip install ./path-to-wheel-file.whl ## Running tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. +Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests. ```sh $ ./scripts/mock diff --git a/scripts/mock b/scripts/mock index bcf3b392..00b490b5 100755 --- a/scripts/mock +++ b/scripts/mock @@ -19,34 +19,34 @@ fi echo "==> Starting mock server with URL ${URL}" -# Run prism mock on the given spec +# Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stdy/cli@0.19.3 -- steady --version - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" &> .stdy.log & - # Wait for server to come online (max 30s) + # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" attempts=0 - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + if ! kill -0 $! 2>/dev/null; then + echo + cat .stdy.log + exit 1 + fi attempts=$((attempts + 1)) if [ "$attempts" -ge 300 ]; then echo - echo "Timed out waiting for Prism server to start" - cat .prism.log + echo "Timed out waiting for Steady server to start" + cat .stdy.log exit 1 fi echo -n "." sleep 0.1 done - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - echo else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" + npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index dbeda2d2..d0fe9be5 100755 --- a/scripts/test +++ b/scripts/test @@ -9,8 +9,8 @@ GREEN='\033[0;32m' YELLOW='\033[0;33m' NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 +function steady_is_running() { + curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 } kill_server_on_port() { @@ -25,7 +25,7 @@ function is_overriding_api_base_url() { [ -n "$TEST_API_BASE_URL" ] } -if ! is_overriding_api_base_url && ! prism_is_running ; then +if ! is_overriding_api_base_url && ! steady_is_running ; then # When we exit this script, make sure to kill the background mock server process trap 'kill_server_on_port 4010' EXIT @@ -36,19 +36,19 @@ fi if is_overriding_api_base_url ; then echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" +elif ! steady_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server" echo -e "running against your OpenAPI spec." echo echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" + echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets${NC}" echo exit 1 else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" + echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}" echo fi diff --git a/src/asktable/_utils/__init__.py b/src/asktable/_utils/__init__.py index dc64e29a..10cb66d2 100644 --- a/src/asktable/_utils/__init__.py +++ b/src/asktable/_utils/__init__.py @@ -1,3 +1,4 @@ +from ._path import path_template as path_template from ._sync import asyncify as asyncify from ._proxy import LazyProxy as LazyProxy from ._utils import ( diff --git a/src/asktable/_utils/_path.py b/src/asktable/_utils/_path.py new file mode 100644 index 00000000..4d6e1e4c --- /dev/null +++ b/src/asktable/_utils/_path.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from typing import ( + Any, + Mapping, + Callable, +) +from urllib.parse import quote + +# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). +_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") + +_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}") + + +def _quote_path_segment_part(value: str) -> str: + """Percent-encode `value` for use in a URI path segment. + + Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + """ + # quote() already treats unreserved characters (letters, digits, and -._~) + # as safe, so we only need to add sub-delims, ':', and '@'. + # Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted. + return quote(value, safe="!$&'()*+,;=:@") + + +def _quote_query_part(value: str) -> str: + """Percent-encode `value` for use in a URI query string. + + Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + """ + return quote(value, safe="!$'()*+,;:@/?") + + +def _quote_fragment_part(value: str) -> str: + """Percent-encode `value` for use in a URI fragment. + + Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.5 + """ + return quote(value, safe="!$&'()*+,;=:@/?") + + +def _interpolate( + template: str, + values: Mapping[str, Any], + quoter: Callable[[str], str], +) -> str: + """Replace {name} placeholders in `template`, quoting each value with `quoter`. + + Placeholder names are looked up in `values`. + + Raises: + KeyError: If a placeholder is not found in `values`. + """ + # re.split with a capturing group returns alternating + # [text, name, text, name, ..., text] elements. + parts = _PLACEHOLDER_RE.split(template) + + for i in range(1, len(parts), 2): + name = parts[i] + if name not in values: + raise KeyError(f"a value for placeholder {{{name}}} was not provided") + val = values[name] + if val is None: + parts[i] = "null" + elif isinstance(val, bool): + parts[i] = "true" if val else "false" + else: + parts[i] = quoter(str(values[name])) + + return "".join(parts) + + +def path_template(template: str, /, **kwargs: Any) -> str: + """Interpolate {name} placeholders in `template` from keyword arguments. + + Args: + template: The template string containing {name} placeholders. + **kwargs: Keyword arguments to interpolate into the template. + + Returns: + The template with placeholders interpolated and percent-encoded. + + Safe characters for percent-encoding are dependent on the URI component. + Placeholders in path and fragment portions are percent-encoded where the `segment` + and `fragment` sets from RFC 3986 respectively are considered safe. + Placeholders in the query portion are percent-encoded where the `query` set from + RFC 3986 §3.3 is considered safe except for = and & characters. + + Raises: + KeyError: If a placeholder is not found in `kwargs`. + ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments). + """ + # Split the template into path, query, and fragment portions. + fragment_template: str | None = None + query_template: str | None = None + + rest = template + if "#" in rest: + rest, fragment_template = rest.split("#", 1) + if "?" in rest: + rest, query_template = rest.split("?", 1) + path_template = rest + + # Interpolate each portion with the appropriate quoting rules. + path_result = _interpolate(path_template, kwargs, _quote_path_segment_part) + + # Reject dot-segments (. and ..) in the final assembled path. The check + # runs after interpolation so that adjacent placeholders or a mix of static + # text and placeholders that together form a dot-segment are caught. + # Also reject percent-encoded dot-segments to protect against incorrectly + # implemented normalization in servers/proxies. + for segment in path_result.split("/"): + if _DOT_SEGMENT_RE.match(segment): + raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed") + + result = path_result + if query_template is not None: + result += "?" + _interpolate(query_template, kwargs, _quote_query_part) + if fragment_template is not None: + result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part) + + return result diff --git a/src/asktable/resources/ats/ats.py b/src/asktable/resources/ats/ats.py index fbcc91ba..45f3ffb6 100644 --- a/src/asktable/resources/ats/ats.py +++ b/src/asktable/resources/ats/ats.py @@ -16,7 +16,7 @@ ) from ...types import ats_list_params, ats_create_params, ats_delete_params, ats_update_params from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from .test_case import ( TestCaseResource, @@ -144,7 +144,7 @@ def retrieve( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._get( - f"/v1/ats/{ats_id}", + path_template("/v1/ats/{ats_id}", ats_id=ats_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -180,7 +180,7 @@ def update( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._patch( - f"/v1/ats/{ats_id}", + path_template("/v1/ats/{ats_id}", ats_id=ats_id), body=maybe_transform({"name": name}, ats_update_params.ATSUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -268,7 +268,7 @@ def delete( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._delete( - f"/v1/ats/{ats_id}", + path_template("/v1/ats/{ats_id}", ats_id=ats_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -381,7 +381,7 @@ async def retrieve( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return await self._get( - f"/v1/ats/{ats_id}", + path_template("/v1/ats/{ats_id}", ats_id=ats_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -417,7 +417,7 @@ async def update( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return await self._patch( - f"/v1/ats/{ats_id}", + path_template("/v1/ats/{ats_id}", ats_id=ats_id), body=await async_maybe_transform({"name": name}, ats_update_params.ATSUpdateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -505,7 +505,7 @@ async def delete( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return await self._delete( - f"/v1/ats/{ats_id}", + path_template("/v1/ats/{ats_id}", ats_id=ats_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/asktable/resources/ats/task.py b/src/asktable/resources/ats/task.py index 9006c4eb..ef412058 100644 --- a/src/asktable/resources/ats/task.py +++ b/src/asktable/resources/ats/task.py @@ -5,7 +5,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -76,7 +76,7 @@ def retrieve( if not ats_task_id: raise ValueError(f"Expected a non-empty value for `ats_task_id` but received {ats_task_id!r}") return self._get( - f"/v1/ats/{ats_id}/task/{ats_task_id}", + path_template("/v1/ats/{ats_id}/task/{ats_task_id}", ats_id=ats_id, ats_task_id=ats_task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -115,7 +115,7 @@ def list( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._get_api_list( - f"/v1/ats/{ats_id}/task", + path_template("/v1/ats/{ats_id}/task", ats_id=ats_id), page=SyncPage[TaskListResponse], options=make_request_options( extra_headers=extra_headers, @@ -168,7 +168,7 @@ def get_case_tasks( if not ats_task_id: raise ValueError(f"Expected a non-empty value for `ats_task_id` but received {ats_task_id!r}") return self._get( - f"/v1/ats/{ats_id}/task/{ats_task_id}/case", + path_template("/v1/ats/{ats_id}/task/{ats_task_id}/case", ats_id=ats_id, ats_task_id=ats_task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -217,7 +217,7 @@ def run( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._post( - f"/v1/ats/{ats_id}/task", + path_template("/v1/ats/{ats_id}/task", ats_id=ats_id), body=maybe_transform( { "datasource_id": datasource_id, @@ -283,7 +283,7 @@ async def retrieve( if not ats_task_id: raise ValueError(f"Expected a non-empty value for `ats_task_id` but received {ats_task_id!r}") return await self._get( - f"/v1/ats/{ats_id}/task/{ats_task_id}", + path_template("/v1/ats/{ats_id}/task/{ats_task_id}", ats_id=ats_id, ats_task_id=ats_task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -322,7 +322,7 @@ def list( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._get_api_list( - f"/v1/ats/{ats_id}/task", + path_template("/v1/ats/{ats_id}/task", ats_id=ats_id), page=AsyncPage[TaskListResponse], options=make_request_options( extra_headers=extra_headers, @@ -375,7 +375,7 @@ async def get_case_tasks( if not ats_task_id: raise ValueError(f"Expected a non-empty value for `ats_task_id` but received {ats_task_id!r}") return await self._get( - f"/v1/ats/{ats_id}/task/{ats_task_id}/case", + path_template("/v1/ats/{ats_id}/task/{ats_task_id}/case", ats_id=ats_id, ats_task_id=ats_task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -424,7 +424,7 @@ async def run( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return await self._post( - f"/v1/ats/{ats_id}/task", + path_template("/v1/ats/{ats_id}/task", ats_id=ats_id), body=await async_maybe_transform( { "datasource_id": datasource_id, diff --git a/src/asktable/resources/ats/test_case.py b/src/asktable/resources/ats/test_case.py index 8ed2eb13..15e89424 100644 --- a/src/asktable/resources/ats/test_case.py +++ b/src/asktable/resources/ats/test_case.py @@ -7,7 +7,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -88,7 +88,7 @@ def create( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._post( - f"/v1/ats/{ats_id}/test-case", + path_template("/v1/ats/{ats_id}/test-case", ats_id=ats_id), body=maybe_transform( { "expected_sql": expected_sql, @@ -133,7 +133,7 @@ def retrieve( if not atc_id: raise ValueError(f"Expected a non-empty value for `atc_id` but received {atc_id!r}") return self._get( - f"/v1/ats/{ats_id}/test-case/{atc_id}", + path_template("/v1/ats/{ats_id}/test-case/{atc_id}", ats_id=ats_id, atc_id=atc_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,7 +181,7 @@ def update( if not atc_id: raise ValueError(f"Expected a non-empty value for `atc_id` but received {atc_id!r}") return self._patch( - f"/v1/ats/{ats_id}/test-case/{atc_id}", + path_template("/v1/ats/{ats_id}/test-case/{atc_id}", ats_id=ats_id, atc_id=atc_id), body=maybe_transform( { "expected_sql": expected_sql, @@ -229,7 +229,7 @@ def list( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._get_api_list( - f"/v1/ats/{ats_id}/test-case", + path_template("/v1/ats/{ats_id}/test-case", ats_id=ats_id), page=SyncPage[TestCaseListResponse], options=make_request_options( extra_headers=extra_headers, @@ -276,7 +276,7 @@ def delete( if not atc_id: raise ValueError(f"Expected a non-empty value for `atc_id` but received {atc_id!r}") return self._delete( - f"/v1/ats/{ats_id}/test-case/{atc_id}", + path_template("/v1/ats/{ats_id}/test-case/{atc_id}", ats_id=ats_id, atc_id=atc_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -344,7 +344,7 @@ async def create( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return await self._post( - f"/v1/ats/{ats_id}/test-case", + path_template("/v1/ats/{ats_id}/test-case", ats_id=ats_id), body=await async_maybe_transform( { "expected_sql": expected_sql, @@ -389,7 +389,7 @@ async def retrieve( if not atc_id: raise ValueError(f"Expected a non-empty value for `atc_id` but received {atc_id!r}") return await self._get( - f"/v1/ats/{ats_id}/test-case/{atc_id}", + path_template("/v1/ats/{ats_id}/test-case/{atc_id}", ats_id=ats_id, atc_id=atc_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -437,7 +437,7 @@ async def update( if not atc_id: raise ValueError(f"Expected a non-empty value for `atc_id` but received {atc_id!r}") return await self._patch( - f"/v1/ats/{ats_id}/test-case/{atc_id}", + path_template("/v1/ats/{ats_id}/test-case/{atc_id}", ats_id=ats_id, atc_id=atc_id), body=await async_maybe_transform( { "expected_sql": expected_sql, @@ -485,7 +485,7 @@ def list( if not ats_id: raise ValueError(f"Expected a non-empty value for `ats_id` but received {ats_id!r}") return self._get_api_list( - f"/v1/ats/{ats_id}/test-case", + path_template("/v1/ats/{ats_id}/test-case", ats_id=ats_id), page=AsyncPage[TestCaseListResponse], options=make_request_options( extra_headers=extra_headers, @@ -532,7 +532,7 @@ async def delete( if not atc_id: raise ValueError(f"Expected a non-empty value for `atc_id` but received {atc_id!r}") return await self._delete( - f"/v1/ats/{ats_id}/test-case/{atc_id}", + path_template("/v1/ats/{ats_id}/test-case/{atc_id}", ats_id=ats_id, atc_id=atc_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index e3eb5748..d9de1f91 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -8,7 +8,7 @@ from ..types import bot_list_params, bot_create_params, bot_invite_params, bot_update_params from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -156,7 +156,7 @@ def retrieve( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return self._get( - f"/v1/bots/{bot_id}", + path_template("/v1/bots/{bot_id}", bot_id=bot_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -228,7 +228,7 @@ def update( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return self._patch( - f"/v1/bots/{bot_id}", + path_template("/v1/bots/{bot_id}", bot_id=bot_id), body=maybe_transform( { "avatar_url": avatar_url, @@ -334,7 +334,7 @@ def delete( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return self._delete( - f"/v1/bots/{bot_id}", + path_template("/v1/bots/{bot_id}", bot_id=bot_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -368,7 +368,7 @@ def invite( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return self._post( - f"/v1/bots/{bot_id}/invite", + path_template("/v1/bots/{bot_id}/invite", bot_id=bot_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -511,7 +511,7 @@ async def retrieve( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return await self._get( - f"/v1/bots/{bot_id}", + path_template("/v1/bots/{bot_id}", bot_id=bot_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -583,7 +583,7 @@ async def update( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return await self._patch( - f"/v1/bots/{bot_id}", + path_template("/v1/bots/{bot_id}", bot_id=bot_id), body=await async_maybe_transform( { "avatar_url": avatar_url, @@ -689,7 +689,7 @@ async def delete( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return await self._delete( - f"/v1/bots/{bot_id}", + path_template("/v1/bots/{bot_id}", bot_id=bot_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -723,7 +723,7 @@ async def invite( if not bot_id: raise ValueError(f"Expected a non-empty value for `bot_id` but received {bot_id!r}") return await self._post( - f"/v1/bots/{bot_id}/invite", + path_template("/v1/bots/{bot_id}/invite", bot_id=bot_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/asktable/resources/business_glossary.py b/src/asktable/resources/business_glossary.py index 1ae35d5f..20d753fc 100644 --- a/src/asktable/resources/business_glossary.py +++ b/src/asktable/resources/business_glossary.py @@ -8,7 +8,7 @@ from ..types import business_glossary_list_params, business_glossary_create_params, business_glossary_update_params from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -106,7 +106,7 @@ def retrieve( if not entry_id: raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}") return self._get( - f"/v1/business-glossary/{entry_id}", + path_template("/v1/business-glossary/{entry_id}", entry_id=entry_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -154,7 +154,7 @@ def update( if not entry_id: raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}") return self._patch( - f"/v1/business-glossary/{entry_id}", + path_template("/v1/business-glossary/{entry_id}", entry_id=entry_id), body=maybe_transform( { "active": active, @@ -248,7 +248,7 @@ def delete( if not entry_id: raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}") return self._delete( - f"/v1/business-glossary/{entry_id}", + path_template("/v1/business-glossary/{entry_id}", entry_id=entry_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -336,7 +336,7 @@ async def retrieve( if not entry_id: raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}") return await self._get( - f"/v1/business-glossary/{entry_id}", + path_template("/v1/business-glossary/{entry_id}", entry_id=entry_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -384,7 +384,7 @@ async def update( if not entry_id: raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}") return await self._patch( - f"/v1/business-glossary/{entry_id}", + path_template("/v1/business-glossary/{entry_id}", entry_id=entry_id), body=await async_maybe_transform( { "active": active, @@ -478,7 +478,7 @@ async def delete( if not entry_id: raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}") return await self._delete( - f"/v1/business-glossary/{entry_id}", + path_template("/v1/business-glossary/{entry_id}", entry_id=entry_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py index ae2bad2a..2f44101f 100644 --- a/src/asktable/resources/chats/chats.py +++ b/src/asktable/resources/chats/chats.py @@ -8,7 +8,7 @@ from ...types import chat_list_params, chat_create_params from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from .messages import ( MessagesResource, AsyncMessagesResource, @@ -144,7 +144,7 @@ def retrieve( if not chat_id: raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") return self._get( - f"/v1/chats/{chat_id}", + path_template("/v1/chats/{chat_id}", chat_id=chat_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -225,7 +225,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/v1/chats/{chat_id}", + path_template("/v1/chats/{chat_id}", chat_id=chat_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -343,7 +343,7 @@ async def retrieve( if not chat_id: raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") return await self._get( - f"/v1/chats/{chat_id}", + path_template("/v1/chats/{chat_id}", chat_id=chat_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -424,7 +424,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/v1/chats/{chat_id}", + path_template("/v1/chats/{chat_id}", chat_id=chat_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/chats/messages.py b/src/asktable/resources/chats/messages.py index 3fb8ec3d..3820b7b3 100644 --- a/src/asktable/resources/chats/messages.py +++ b/src/asktable/resources/chats/messages.py @@ -7,7 +7,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -80,7 +80,7 @@ def create( return cast( MessageCreateResponse, self._post( - f"/v1/chats/{chat_id}/messages", + path_template("/v1/chats/{chat_id}/messages", chat_id=chat_id), body=maybe_transform({"body_question": body_question}, message_create_params.MessageCreateParams), options=make_request_options( extra_headers=extra_headers, @@ -128,7 +128,7 @@ def retrieve( return cast( MessageRetrieveResponse, self._get( - f"/v1/chats/{chat_id}/messages/{message_id}", + path_template("/v1/chats/{chat_id}/messages/{message_id}", chat_id=chat_id, message_id=message_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,7 +170,7 @@ def list( if not chat_id: raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") return self._get_api_list( - f"/v1/chats/{chat_id}/messages", + path_template("/v1/chats/{chat_id}/messages", chat_id=chat_id), page=SyncPage[MessageListResponse], options=make_request_options( extra_headers=extra_headers, @@ -243,7 +243,7 @@ async def create( return cast( MessageCreateResponse, await self._post( - f"/v1/chats/{chat_id}/messages", + path_template("/v1/chats/{chat_id}/messages", chat_id=chat_id), body=await async_maybe_transform( {"body_question": body_question}, message_create_params.MessageCreateParams ), @@ -293,7 +293,7 @@ async def retrieve( return cast( MessageRetrieveResponse, await self._get( - f"/v1/chats/{chat_id}/messages/{message_id}", + path_template("/v1/chats/{chat_id}/messages/{message_id}", chat_id=chat_id, message_id=message_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -335,7 +335,7 @@ def list( if not chat_id: raise ValueError(f"Expected a non-empty value for `chat_id` but received {chat_id!r}") return self._get_api_list( - f"/v1/chats/{chat_id}/messages", + path_template("/v1/chats/{chat_id}/messages", chat_id=chat_id), page=AsyncPage[MessageListResponse], options=make_request_options( extra_headers=extra_headers, diff --git a/src/asktable/resources/dataframes.py b/src/asktable/resources/dataframes.py index 43a49cea..36cee9e9 100644 --- a/src/asktable/resources/dataframes.py +++ b/src/asktable/resources/dataframes.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -65,7 +66,7 @@ def retrieve( if not dataframe_id: raise ValueError(f"Expected a non-empty value for `dataframe_id` but received {dataframe_id!r}") return self._get( - f"/v1/dataframes/{dataframe_id}", + path_template("/v1/dataframes/{dataframe_id}", dataframe_id=dataframe_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -119,7 +120,7 @@ async def retrieve( if not dataframe_id: raise ValueError(f"Expected a non-empty value for `dataframe_id` but received {dataframe_id!r}") return await self._get( - f"/v1/dataframes/{dataframe_id}", + path_template("/v1/dataframes/{dataframe_id}", dataframe_id=dataframe_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py index 006c5f4b..556b6231 100644 --- a/src/asktable/resources/datasources/datasources.py +++ b/src/asktable/resources/datasources/datasources.py @@ -31,7 +31,7 @@ AsyncIndexesResourceWithStreamingResponse, ) from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -201,7 +201,7 @@ def retrieve( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._get( - f"/v1/datasources/{datasource_id}", + path_template("/v1/datasources/{datasource_id}", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -304,7 +304,7 @@ def update( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._patch( - f"/v1/datasources/{datasource_id}", + path_template("/v1/datasources/{datasource_id}", datasource_id=datasource_id), body=maybe_transform( { "access_config": access_config, @@ -402,7 +402,7 @@ def delete( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._delete( - f"/v1/datasources/{datasource_id}", + path_template("/v1/datasources/{datasource_id}", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -440,7 +440,7 @@ def add_file( # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._post( - f"/v1/datasources/{datasource_id}/files", + path_template("/v1/datasources/{datasource_id}/files", datasource_id=datasource_id), body=maybe_transform({"file": file}, datasource_add_file_params.DatasourceAddFileParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -477,7 +477,9 @@ def delete_file( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") return self._delete( - f"/v1/datasources/{datasource_id}/files/{file_id}", + path_template( + "/v1/datasources/{datasource_id}/files/{file_id}", datasource_id=datasource_id, file_id=file_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -510,7 +512,7 @@ def retrieve_runtime_meta( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._get( - f"/v1/datasources/{datasource_id}/runtime-meta", + path_template("/v1/datasources/{datasource_id}/runtime-meta", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -555,7 +557,7 @@ def update_field( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._patch( - f"/v1/datasources/{datasource_id}/field", + path_template("/v1/datasources/{datasource_id}/field", datasource_id=datasource_id), body=maybe_transform( { "identifiable_type": identifiable_type, @@ -725,7 +727,7 @@ async def retrieve( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._get( - f"/v1/datasources/{datasource_id}", + path_template("/v1/datasources/{datasource_id}", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -828,7 +830,7 @@ async def update( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._patch( - f"/v1/datasources/{datasource_id}", + path_template("/v1/datasources/{datasource_id}", datasource_id=datasource_id), body=await async_maybe_transform( { "access_config": access_config, @@ -926,7 +928,7 @@ async def delete( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._delete( - f"/v1/datasources/{datasource_id}", + path_template("/v1/datasources/{datasource_id}", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -964,7 +966,7 @@ async def add_file( # multipart/form-data; boundary=---abc-- extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._post( - f"/v1/datasources/{datasource_id}/files", + path_template("/v1/datasources/{datasource_id}/files", datasource_id=datasource_id), body=await async_maybe_transform({"file": file}, datasource_add_file_params.DatasourceAddFileParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -1001,7 +1003,9 @@ async def delete_file( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") return await self._delete( - f"/v1/datasources/{datasource_id}/files/{file_id}", + path_template( + "/v1/datasources/{datasource_id}/files/{file_id}", datasource_id=datasource_id, file_id=file_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1034,7 +1038,7 @@ async def retrieve_runtime_meta( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._get( - f"/v1/datasources/{datasource_id}/runtime-meta", + path_template("/v1/datasources/{datasource_id}/runtime-meta", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1079,7 +1083,7 @@ async def update_field( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._patch( - f"/v1/datasources/{datasource_id}/field", + path_template("/v1/datasources/{datasource_id}/field", datasource_id=datasource_id), body=await async_maybe_transform( { "identifiable_type": identifiable_type, diff --git a/src/asktable/resources/datasources/indexes.py b/src/asktable/resources/datasources/indexes.py index f50564a1..3d618757 100644 --- a/src/asktable/resources/datasources/indexes.py +++ b/src/asktable/resources/datasources/indexes.py @@ -5,7 +5,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -81,7 +81,7 @@ def create( if not ds_id: raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}") return self._post( - f"/v1/datasources/{ds_id}/indexes", + path_template("/v1/datasources/{ds_id}/indexes", ds_id=ds_id), body=maybe_transform( { "field_name": field_name, @@ -133,7 +133,7 @@ def list( if not ds_id: raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}") return self._get_api_list( - f"/v1/datasources/{ds_id}/indexes", + path_template("/v1/datasources/{ds_id}/indexes", ds_id=ds_id), page=SyncPage[Index], options=make_request_options( extra_headers=extra_headers, @@ -180,7 +180,7 @@ def delete( if not index_id: raise ValueError(f"Expected a non-empty value for `index_id` but received {index_id!r}") return self._delete( - f"/v1/datasources/{ds_id}/indexes/{index_id}", + path_template("/v1/datasources/{ds_id}/indexes/{index_id}", ds_id=ds_id, index_id=index_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -247,7 +247,7 @@ async def create( if not ds_id: raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}") return await self._post( - f"/v1/datasources/{ds_id}/indexes", + path_template("/v1/datasources/{ds_id}/indexes", ds_id=ds_id), body=await async_maybe_transform( { "field_name": field_name, @@ -301,7 +301,7 @@ def list( if not ds_id: raise ValueError(f"Expected a non-empty value for `ds_id` but received {ds_id!r}") return self._get_api_list( - f"/v1/datasources/{ds_id}/indexes", + path_template("/v1/datasources/{ds_id}/indexes", ds_id=ds_id), page=AsyncPage[Index], options=make_request_options( extra_headers=extra_headers, @@ -348,7 +348,7 @@ async def delete( if not index_id: raise ValueError(f"Expected a non-empty value for `index_id` but received {index_id!r}") return await self._delete( - f"/v1/datasources/{ds_id}/indexes/{index_id}", + path_template("/v1/datasources/{ds_id}/indexes/{index_id}", ds_id=ds_id, index_id=index_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/datasources/meta.py b/src/asktable/resources/datasources/meta.py index 4eadeaf7..2ec3655e 100644 --- a/src/asktable/resources/datasources/meta.py +++ b/src/asktable/resources/datasources/meta.py @@ -7,7 +7,7 @@ import httpx from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -75,7 +75,7 @@ def create( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._post( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), body=maybe_transform( { "meta": meta, @@ -125,7 +125,7 @@ def retrieve( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._get( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -161,7 +161,7 @@ def update( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._put( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), body=maybe_transform( { "meta": meta, @@ -206,7 +206,7 @@ def annotate( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return self._patch( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), body=maybe_transform({"schemas": schemas}, meta_annotate_params.MetaAnnotateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -267,7 +267,7 @@ async def create( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._post( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), body=await async_maybe_transform( { "meta": meta, @@ -317,7 +317,7 @@ async def retrieve( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._get( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -353,7 +353,7 @@ async def update( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._put( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), body=await async_maybe_transform( { "meta": meta, @@ -400,7 +400,7 @@ async def annotate( if not datasource_id: raise ValueError(f"Expected a non-empty value for `datasource_id` but received {datasource_id!r}") return await self._patch( - f"/v1/datasources/{datasource_id}/meta", + path_template("/v1/datasources/{datasource_id}/meta", datasource_id=datasource_id), body=await async_maybe_transform({"schemas": schemas}, meta_annotate_params.MetaAnnotateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/asktable/resources/files.py b/src/asktable/resources/files.py index bbea850f..9c2262d6 100644 --- a/src/asktable/resources/files.py +++ b/src/asktable/resources/files.py @@ -5,6 +5,7 @@ import httpx from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -66,7 +67,7 @@ def retrieve( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") return self._get( - f"/v1/files/{file_id}", + path_template("/v1/files/{file_id}", file_id=file_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -122,7 +123,7 @@ async def retrieve( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") return await self._get( - f"/v1/files/{file_id}", + path_template("/v1/files/{file_id}", file_id=file_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/policies.py b/src/asktable/resources/policies.py index 55618d39..04ffce4f 100644 --- a/src/asktable/resources/policies.py +++ b/src/asktable/resources/policies.py @@ -9,7 +9,7 @@ from ..types import policy_list_params, policy_create_params, policy_update_params from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -120,7 +120,7 @@ def retrieve( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._get( - f"/v1/policies/{policy_id}", + path_template("/v1/policies/{policy_id}", policy_id=policy_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -162,7 +162,7 @@ def update( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return self._patch( - f"/v1/policies/{policy_id}", + path_template("/v1/policies/{policy_id}", policy_id=policy_id), body=maybe_transform( { "dataset_config": dataset_config, @@ -259,7 +259,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/v1/policies/{policy_id}", + path_template("/v1/policies/{policy_id}", policy_id=policy_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -362,7 +362,7 @@ async def retrieve( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._get( - f"/v1/policies/{policy_id}", + path_template("/v1/policies/{policy_id}", policy_id=policy_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -404,7 +404,7 @@ async def update( if not policy_id: raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") return await self._patch( - f"/v1/policies/{policy_id}", + path_template("/v1/policies/{policy_id}", policy_id=policy_id), body=await async_maybe_transform( { "dataset_config": dataset_config, @@ -501,7 +501,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `policy_id` but received {policy_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/v1/policies/{policy_id}", + path_template("/v1/policies/{policy_id}", policy_id=policy_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/asktable/resources/roles.py b/src/asktable/resources/roles.py index bef896ed..fa4754bc 100644 --- a/src/asktable/resources/roles.py +++ b/src/asktable/resources/roles.py @@ -8,7 +8,7 @@ from ..types import role_list_params, role_create_params, role_update_params, role_get_variables_params from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -117,7 +117,7 @@ def retrieve( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return self._get( - f"/v1/roles/{role_id}", + path_template("/v1/roles/{role_id}", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -156,7 +156,7 @@ def update( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return self._patch( - f"/v1/roles/{role_id}", + path_template("/v1/roles/{role_id}", role_id=role_id), body=maybe_transform( { "name": name, @@ -251,7 +251,7 @@ def delete( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return self._delete( - f"/v1/roles/{role_id}", + path_template("/v1/roles/{role_id}", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -284,7 +284,7 @@ def get_polices( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return self._get( - f"/v1/roles/{role_id}/policies", + path_template("/v1/roles/{role_id}/policies", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -323,7 +323,7 @@ def get_variables( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return self._get( - f"/v1/roles/{role_id}/variables", + path_template("/v1/roles/{role_id}/variables", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -432,7 +432,7 @@ async def retrieve( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return await self._get( - f"/v1/roles/{role_id}", + path_template("/v1/roles/{role_id}", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -471,7 +471,7 @@ async def update( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return await self._patch( - f"/v1/roles/{role_id}", + path_template("/v1/roles/{role_id}", role_id=role_id), body=await async_maybe_transform( { "name": name, @@ -566,7 +566,7 @@ async def delete( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return await self._delete( - f"/v1/roles/{role_id}", + path_template("/v1/roles/{role_id}", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -599,7 +599,7 @@ async def get_polices( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return await self._get( - f"/v1/roles/{role_id}/policies", + path_template("/v1/roles/{role_id}/policies", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -638,7 +638,7 @@ async def get_variables( if not role_id: raise ValueError(f"Expected a non-empty value for `role_id` but received {role_id!r}") return await self._get( - f"/v1/roles/{role_id}/variables", + path_template("/v1/roles/{role_id}/variables", role_id=role_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/asktable/resources/securetunnels.py b/src/asktable/resources/securetunnels.py index efd0e24a..42ecaf08 100644 --- a/src/asktable/resources/securetunnels.py +++ b/src/asktable/resources/securetunnels.py @@ -13,7 +13,7 @@ securetunnel_list_links_params, ) from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -112,7 +112,7 @@ def retrieve( if not securetunnel_id: raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") return self._get( - f"/v1/securetunnels/{securetunnel_id}", + path_template("/v1/securetunnels/{securetunnel_id}", securetunnel_id=securetunnel_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -154,7 +154,7 @@ def update( if not securetunnel_id: raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") return self._patch( - f"/v1/securetunnels/{securetunnel_id}", + path_template("/v1/securetunnels/{securetunnel_id}", securetunnel_id=securetunnel_id), body=maybe_transform( { "client_info": client_info, @@ -243,7 +243,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/v1/securetunnels/{securetunnel_id}", + path_template("/v1/securetunnels/{securetunnel_id}", securetunnel_id=securetunnel_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -282,7 +282,7 @@ def list_links( if not securetunnel_id: raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") return self._get_api_list( - f"/v1/securetunnels/{securetunnel_id}/links", + path_template("/v1/securetunnels/{securetunnel_id}/links", securetunnel_id=securetunnel_id), page=SyncPage[SecuretunnelListLinksResponse], options=make_request_options( extra_headers=extra_headers, @@ -383,7 +383,7 @@ async def retrieve( if not securetunnel_id: raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") return await self._get( - f"/v1/securetunnels/{securetunnel_id}", + path_template("/v1/securetunnels/{securetunnel_id}", securetunnel_id=securetunnel_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -425,7 +425,7 @@ async def update( if not securetunnel_id: raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") return await self._patch( - f"/v1/securetunnels/{securetunnel_id}", + path_template("/v1/securetunnels/{securetunnel_id}", securetunnel_id=securetunnel_id), body=await async_maybe_transform( { "client_info": client_info, @@ -514,7 +514,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/v1/securetunnels/{securetunnel_id}", + path_template("/v1/securetunnels/{securetunnel_id}", securetunnel_id=securetunnel_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -553,7 +553,7 @@ def list_links( if not securetunnel_id: raise ValueError(f"Expected a non-empty value for `securetunnel_id` but received {securetunnel_id!r}") return self._get_api_list( - f"/v1/securetunnels/{securetunnel_id}/links", + path_template("/v1/securetunnels/{securetunnel_id}/links", securetunnel_id=securetunnel_id), page=AsyncPage[SecuretunnelListLinksResponse], options=make_request_options( extra_headers=extra_headers, diff --git a/src/asktable/resources/sys/projects/api_keys.py b/src/asktable/resources/sys/projects/api_keys.py index 269ae626..f0f75750 100644 --- a/src/asktable/resources/sys/projects/api_keys.py +++ b/src/asktable/resources/sys/projects/api_keys.py @@ -8,7 +8,7 @@ import httpx from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform +from ...._utils import path_template, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -77,7 +77,7 @@ def create( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._post( - f"/v1/sys/projects/{project_id}/api-keys", + path_template("/v1/sys/projects/{project_id}/api-keys", project_id=project_id), body=maybe_transform({"ak_role": ak_role}, api_key_create_params.APIKeyCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -111,7 +111,7 @@ def list( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._get( - f"/v1/sys/projects/{project_id}/api-keys", + path_template("/v1/sys/projects/{project_id}/api-keys", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -148,7 +148,7 @@ def delete( raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - f"/v1/sys/projects/{project_id}/api-keys/{key_id}", + path_template("/v1/sys/projects/{project_id}/api-keys/{key_id}", project_id=project_id, key_id=key_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -193,7 +193,7 @@ def create_token( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._post( - f"/v1/sys/projects/{project_id}/tokens", + path_template("/v1/sys/projects/{project_id}/tokens", project_id=project_id), body=maybe_transform( { "ak_role": ak_role, @@ -261,7 +261,7 @@ async def create( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._post( - f"/v1/sys/projects/{project_id}/api-keys", + path_template("/v1/sys/projects/{project_id}/api-keys", project_id=project_id), body=await async_maybe_transform({"ak_role": ak_role}, api_key_create_params.APIKeyCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -295,7 +295,7 @@ async def list( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._get( - f"/v1/sys/projects/{project_id}/api-keys", + path_template("/v1/sys/projects/{project_id}/api-keys", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,7 +332,7 @@ async def delete( raise ValueError(f"Expected a non-empty value for `key_id` but received {key_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - f"/v1/sys/projects/{project_id}/api-keys/{key_id}", + path_template("/v1/sys/projects/{project_id}/api-keys/{key_id}", project_id=project_id, key_id=key_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -377,7 +377,7 @@ async def create_token( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._post( - f"/v1/sys/projects/{project_id}/tokens", + path_template("/v1/sys/projects/{project_id}/tokens", project_id=project_id), body=await async_maybe_transform( { "ak_role": ak_role, diff --git a/src/asktable/resources/sys/projects/projects.py b/src/asktable/resources/sys/projects/projects.py index 9ac77ca8..c948a0e3 100644 --- a/src/asktable/resources/sys/projects/projects.py +++ b/src/asktable/resources/sys/projects/projects.py @@ -15,7 +15,7 @@ AsyncAPIKeysResourceWithStreamingResponse, ) from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform +from ...._utils import path_template, maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -122,7 +122,7 @@ def retrieve( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._get( - f"/v1/sys/projects/{project_id}", + path_template("/v1/sys/projects/{project_id}", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,7 +164,7 @@ def update( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._patch( - f"/v1/sys/projects/{project_id}", + path_template("/v1/sys/projects/{project_id}", project_id=project_id), body=maybe_transform( { "llm_model_group": llm_model_group, @@ -256,7 +256,7 @@ def delete( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._delete( - f"/v1/sys/projects/{project_id}", + path_template("/v1/sys/projects/{project_id}", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -289,7 +289,7 @@ def export( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return self._post( - f"/v1/sys/projects/{project_id}/export", + path_template("/v1/sys/projects/{project_id}/export", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -435,7 +435,7 @@ async def retrieve( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._get( - f"/v1/sys/projects/{project_id}", + path_template("/v1/sys/projects/{project_id}", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -477,7 +477,7 @@ async def update( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._patch( - f"/v1/sys/projects/{project_id}", + path_template("/v1/sys/projects/{project_id}", project_id=project_id), body=await async_maybe_transform( { "llm_model_group": llm_model_group, @@ -569,7 +569,7 @@ async def delete( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._delete( - f"/v1/sys/projects/{project_id}", + path_template("/v1/sys/projects/{project_id}", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -602,7 +602,7 @@ async def export( if not project_id: raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}") return await self._post( - f"/v1/sys/projects/{project_id}/export", + path_template("/v1/sys/projects/{project_id}/export", project_id=project_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 00000000..1c6c154b --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from asktable._utils._path import path_template + + +@pytest.mark.parametrize( + "template, kwargs, expected", + [ + ("/v1/{id}", dict(id="abc"), "/v1/abc"), + ("/v1/{a}/{b}", dict(a="x", b="y"), "/v1/x/y"), + ("/v1/{a}{b}/path/{c}?val={d}#{e}", dict(a="x", b="y", c="z", d="u", e="v"), "/v1/xy/path/z?val=u#v"), + ("/{w}/{w}", dict(w="echo"), "/echo/echo"), + ("/v1/static", {}, "/v1/static"), + ("", {}, ""), + ("/v1/?q={n}&count=10", dict(n=42), "/v1/?q=42&count=10"), + ("/v1/{v}", dict(v=None), "/v1/null"), + ("/v1/{v}", dict(v=True), "/v1/true"), + ("/v1/{v}", dict(v=False), "/v1/false"), + ("/v1/{v}", dict(v=".hidden"), "/v1/.hidden"), # dot prefix ok + ("/v1/{v}", dict(v="file.txt"), "/v1/file.txt"), # dot in middle ok + ("/v1/{v}", dict(v="..."), "/v1/..."), # triple dot ok + ("/v1/{a}{b}", dict(a=".", b="txt"), "/v1/.txt"), # dot var combining with adjacent to be ok + ("/items?q={v}#{f}", dict(v=".", f=".."), "/items?q=.#.."), # dots in query/fragment are fine + ( + "/v1/{a}?query={b}", + dict(a="../../other/endpoint", b="a&bad=true"), + "/v1/..%2F..%2Fother%2Fendpoint?query=a%26bad%3Dtrue", + ), + ("/v1/{val}", dict(val="a/b/c"), "/v1/a%2Fb%2Fc"), + ("/v1/{val}", dict(val="a/b/c?query=value"), "/v1/a%2Fb%2Fc%3Fquery=value"), + ("/v1/{val}", dict(val="a/b/c?query=value&bad=true"), "/v1/a%2Fb%2Fc%3Fquery=value&bad=true"), + ("/v1/{val}", dict(val="%20"), "/v1/%2520"), # escapes escape sequences in input + # Query: slash and ? are safe, # is not + ("/items?q={v}", dict(v="a/b"), "/items?q=a/b"), + ("/items?q={v}", dict(v="a?b"), "/items?q=a?b"), + ("/items?q={v}", dict(v="a#b"), "/items?q=a%23b"), + ("/items?q={v}", dict(v="a b"), "/items?q=a%20b"), + # Fragment: slash and ? are safe + ("/docs#{v}", dict(v="a/b"), "/docs#a/b"), + ("/docs#{v}", dict(v="a?b"), "/docs#a?b"), + # Path: slash, ? and # are all encoded + ("/v1/{v}", dict(v="a/b"), "/v1/a%2Fb"), + ("/v1/{v}", dict(v="a?b"), "/v1/a%3Fb"), + ("/v1/{v}", dict(v="a#b"), "/v1/a%23b"), + # same var encoded differently by component + ( + "/v1/{v}?q={v}#{v}", + dict(v="a/b?c#d"), + "/v1/a%2Fb%3Fc%23d?q=a/b?c%23d#a/b?c%23d", + ), + ("/v1/{val}", dict(val="x?admin=true"), "/v1/x%3Fadmin=true"), # query injection + ("/v1/{val}", dict(val="x#admin"), "/v1/x%23admin"), # fragment injection + ], +) +def test_interpolation(template: str, kwargs: dict[str, Any], expected: str) -> None: + assert path_template(template, **kwargs) == expected + + +def test_missing_kwarg_raises_key_error() -> None: + with pytest.raises(KeyError, match="org_id"): + path_template("/v1/{org_id}") + + +@pytest.mark.parametrize( + "template, kwargs", + [ + ("{a}/path", dict(a=".")), + ("{a}/path", dict(a="..")), + ("/v1/{a}", dict(a=".")), + ("/v1/{a}", dict(a="..")), + ("/v1/{a}/path", dict(a=".")), + ("/v1/{a}/path", dict(a="..")), + ("/v1/{a}{b}", dict(a=".", b=".")), # adjacent vars → ".." + ("/v1/{a}.", dict(a=".")), # var + static → ".." + ("/v1/{a}{b}", dict(a="", b=".")), # empty + dot → "." + ("/v1/%2e/{x}", dict(x="ok")), # encoded dot in static text + ("/v1/%2e./{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/.%2E/{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/{v}?q=1", dict(v="..")), + ("/v1/{v}#frag", dict(v="..")), + ], +) +def test_dot_segment_rejected(template: str, kwargs: dict[str, Any]) -> None: + with pytest.raises(ValueError, match="dot-segment"): + path_template(template, **kwargs) From 312c86bbe2bb5e70800e5ae0712caa46c4cf627b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 04:24:38 +0000 Subject: [PATCH 116/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index fe38c5ba..14e222af 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-8e509ba7294e5eed01fda6d3fbaf8bb3da6a7c081bfcb583e7ee6e034f18df7b.yml -openapi_spec_hash: 0ed9dc4972f92e814e7c37d83548058f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-19546db54db4d5fe31d84567ab15607ca8640a790512d8e018fa515775e76cce.yml +openapi_spec_hash: bd19efe5301965c58bb6a40c0dd98067 config_hash: acdf4142177ed1932c2d82372693f811 From 42770122e37df0e03d7f5643da5aef8ab61e8a55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Mar 2026 04:44:25 +0000 Subject: [PATCH 117/130] chore(internal): codegen related update --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 00b490b5..54fc7911 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.3 -- steady --version + npm exec --package=@stdy/cli@0.19.5 -- steady --version - npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.3 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index d0fe9be5..4153738f 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.3 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From f1cea4d395932285e627b2695d2b95b3cc880296 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 04:49:46 +0000 Subject: [PATCH 118/130] chore(internal): codegen related update --- .gitignore | 1 + scripts/mock | 6 +++--- scripts/test | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 95ceb189..3824f4c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .prism.log +.stdy.log _dev __pycache__ diff --git a/scripts/mock b/scripts/mock index 54fc7911..0f82c957 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.5 -- steady --version + npm exec --package=@stdy/cli@0.19.6 -- steady --version - npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.5 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 4153738f..4f9eef95 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.5 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From 2ac50023a3cf7a9ce750e6f74a5b2b0b1ca58f05 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 15:24:46 +0000 Subject: [PATCH 119/130] feat(api): api update --- .github/workflows/ci.yml | 4 ++-- .stats.yml | 4 ++-- src/asktable/types/answer_response.py | 12 +----------- src/asktable/types/query_response.py | 10 +--------- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5faf1f2c..25c51a78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/asktable-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 @@ -38,7 +38,7 @@ jobs: run: ./scripts/lint build: - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') timeout-minutes: 10 name: build permissions: diff --git a/.stats.yml b/.stats.yml index 14e222af..d644adda 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-19546db54db4d5fe31d84567ab15607ca8640a790512d8e018fa515775e76cce.yml -openapi_spec_hash: bd19efe5301965c58bb6a40c0dd98067 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3d14223aff5b36054429657d79df4f842b934d05a970de387b4e34fbbe6bbbe3.yml +openapi_spec_hash: f5e2bb7eafad08b801936a4bfc7abf4f config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/types/answer_response.py b/src/asktable/types/answer_response.py index 0f217892..2aa376c1 100644 --- a/src/asktable/types/answer_response.py +++ b/src/asktable/types/answer_response.py @@ -6,7 +6,7 @@ from .._models import BaseModel -__all__ = ["AnswerResponse", "Answer", "AnswerAttachment", "Request", "Timing"] +__all__ = ["AnswerResponse", "Answer", "AnswerAttachment", "Request"] class AnswerAttachment(BaseModel): @@ -45,14 +45,6 @@ class Request(BaseModel): """是否同时将数据,作为 json 格式的附件一起返回""" -class Timing(BaseModel): - accessor_duration: Optional[float] = None - - llm_duration: Optional[float] = None - - total_duration: Optional[float] = None - - class AnswerResponse(BaseModel): id: str @@ -72,6 +64,4 @@ class AnswerResponse(BaseModel): err_msg: Optional[str] = None - timing: Optional[Timing] = None - trace_id: Optional[str] = None diff --git a/src/asktable/types/query_response.py b/src/asktable/types/query_response.py index 1e4451fc..089357bc 100644 --- a/src/asktable/types/query_response.py +++ b/src/asktable/types/query_response.py @@ -5,7 +5,7 @@ from .._models import BaseModel -__all__ = ["QueryResponse", "Query", "Request", "Timing"] +__all__ = ["QueryResponse", "Query", "Request"] class Query(BaseModel): @@ -39,12 +39,6 @@ class Request(BaseModel): """在扮演这个角色时需要传递的变量值,用 Key-Value 形式传递""" -class Timing(BaseModel): - llm_duration: Optional[float] = None - - total_duration: Optional[float] = None - - class QueryResponse(BaseModel): id: str @@ -64,6 +58,4 @@ class QueryResponse(BaseModel): err_msg: Optional[str] = None - timing: Optional[Timing] = None - trace_id: Optional[str] = None From 7887929ff15541ebb8120765c55f84a6c3bd39d3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 03:16:06 +0000 Subject: [PATCH 120/130] chore(tests): bump steady to v0.19.7 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 0f82c957..3732f8e6 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.6 -- steady --version + npm exec --package=@stdy/cli@0.19.7 -- steady --version - npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.6 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 4f9eef95..e642cea2 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.6 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" echo exit 1 From f1d25c16c32e1520afcf147078a6ccde0ac26e35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Mar 2026 09:24:48 +0000 Subject: [PATCH 121/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index d644adda..c0b1d912 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-3d14223aff5b36054429657d79df4f842b934d05a970de387b4e34fbbe6bbbe3.yml -openapi_spec_hash: f5e2bb7eafad08b801936a4bfc7abf4f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-44a8ac001bd449f1e8108a53215dc584ff746e97a6f9850c7e09216336d18488.yml +openapi_spec_hash: f2d8ab7f1cc7723a4af9e31e5d20a512 config_hash: acdf4142177ed1932c2d82372693f811 From dbab641983789bdeab6e5d53ebe4478fbeeb47f6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Mar 2026 03:24:44 +0000 Subject: [PATCH 122/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c0b1d912..3e5ae0a0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-44a8ac001bd449f1e8108a53215dc584ff746e97a6f9850c7e09216336d18488.yml -openapi_spec_hash: f2d8ab7f1cc7723a4af9e31e5d20a512 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-fe84e8eb2f41baeec783d2aaac71100fa5404ae6b4da86f8b2a906e6cd87c2ae.yml +openapi_spec_hash: 8a180d3f138f323ca7a48130c7806f44 config_hash: acdf4142177ed1932c2d82372693f811 From d60ba627627abf7310d0464d679d332ef9ba6e65 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 06:05:44 +0000 Subject: [PATCH 123/130] chore(internal): codegen related update --- scripts/mock | 4 ++-- scripts/test | 2 +- src/asktable/_qs.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 3732f8e6..58e46285 100755 --- a/scripts/mock +++ b/scripts/mock @@ -24,7 +24,7 @@ if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout npm exec --package=@stdy/cli@0.19.7 -- steady --version - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index e642cea2..39704647 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-form-array-format=repeat --validator-query-array-format=repeat --validator-form-object-format=brackets --validator-query-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 diff --git a/src/asktable/_qs.py b/src/asktable/_qs.py index ada6fd3f..de8c99bc 100644 --- a/src/asktable/_qs.py +++ b/src/asktable/_qs.py @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" From 5a4459db1b4bf749a120fd8365d6755b98a6849c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 07:24:53 +0000 Subject: [PATCH 124/130] feat(api): api update --- .stats.yml | 4 +- src/asktable/_client.py | 12 +++--- src/asktable/resources/bots.py | 40 +++++++++---------- src/asktable/resources/chats/chats.py | 8 ++-- src/asktable/types/bot_create_params.py | 4 +- src/asktable/types/bot_update_params.py | 4 +- src/asktable/types/chat_create_params.py | 4 +- src/asktable/types/chat_create_response.py | 4 +- src/asktable/types/chat_list_response.py | 4 +- src/asktable/types/chat_retrieve_response.py | 4 +- src/asktable/types/chatbot.py | 4 +- .../types/dataframe_retrieve_response.py | 3 ++ .../project_list_model_groups_response.py | 27 ++++++++++++- .../sys/project_model_groups_response.py | 33 ++++++++++++++- .../project_retrieve_model_groups_response.py | 27 ++++++++++++- 15 files changed, 132 insertions(+), 50 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3e5ae0a0..a83cf53a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-fe84e8eb2f41baeec783d2aaac71100fa5404ae6b4da86f8b2a906e6cd87c2ae.yml -openapi_spec_hash: 8a180d3f138f323ca7a48130c7806f44 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dddc0f4169fb9502273cea24a5d58bee34807f1d73ce70c757fea2e468dffbf1.yml +openapi_spec_hash: 20ff10ac5c651f39f70c091a1b64b9a1 config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/src/asktable/_client.py b/src/asktable/_client.py index caee0bea..554f1c03 100644 --- a/src/asktable/_client.py +++ b/src/asktable/_client.py @@ -184,7 +184,7 @@ def datasources(self) -> DatasourcesResource: @cached_property def bots(self) -> BotsResource: - """机器人管理""" + """AI 数据助手""" from .resources.bots import BotsResource return BotsResource(self) @@ -489,7 +489,7 @@ def datasources(self) -> AsyncDatasourcesResource: @cached_property def bots(self) -> AsyncBotsResource: - """机器人管理""" + """AI 数据助手""" from .resources.bots import AsyncBotsResource return AsyncBotsResource(self) @@ -745,7 +745,7 @@ def datasources(self) -> datasources.DatasourcesResourceWithRawResponse: @cached_property def bots(self) -> bots.BotsResourceWithRawResponse: - """机器人管理""" + """AI 数据助手""" from .resources.bots import BotsResourceWithRawResponse return BotsResourceWithRawResponse(self._client.bots) @@ -889,7 +889,7 @@ def datasources(self) -> datasources.AsyncDatasourcesResourceWithRawResponse: @cached_property def bots(self) -> bots.AsyncBotsResourceWithRawResponse: - """机器人管理""" + """AI 数据助手""" from .resources.bots import AsyncBotsResourceWithRawResponse return AsyncBotsResourceWithRawResponse(self._client.bots) @@ -1033,7 +1033,7 @@ def datasources(self) -> datasources.DatasourcesResourceWithStreamingResponse: @cached_property def bots(self) -> bots.BotsResourceWithStreamingResponse: - """机器人管理""" + """AI 数据助手""" from .resources.bots import BotsResourceWithStreamingResponse return BotsResourceWithStreamingResponse(self._client.bots) @@ -1177,7 +1177,7 @@ def datasources(self) -> datasources.AsyncDatasourcesResourceWithStreamingRespon @cached_property def bots(self) -> bots.AsyncBotsResourceWithStreamingResponse: - """机器人管理""" + """AI 数据助手""" from .resources.bots import AsyncBotsResourceWithStreamingResponse return AsyncBotsResourceWithStreamingResponse(self._client.bots) diff --git a/src/asktable/resources/bots.py b/src/asktable/resources/bots.py index d9de1f91..d62ff428 100644 --- a/src/asktable/resources/bots.py +++ b/src/asktable/resources/bots.py @@ -26,7 +26,7 @@ class BotsResource(SyncAPIResource): - """机器人管理""" + """AI 数据助手""" @cached_property def with_raw_response(self) -> BotsResourceWithRawResponse: @@ -70,7 +70,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ - 创建一个新的 Bot + 创建一个新的 AI 数据助手 Args: datasource_ids: 数据源 ID,目前只支持 1 个数据源。 @@ -81,7 +81,7 @@ def create( debug: 调试模式 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 + interaction_rules: 交互规则列表,用于定义 AI 数据助手的行为规则 magic_input: 魔法提示词 @@ -89,7 +89,7 @@ def create( publish: 是否公开 - query_balance: bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 + query_balance: AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 sample_questions: 示例问题列表 @@ -142,7 +142,7 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ - 获取某个 Bot + 获取某个 AI 数据助手 Args: extra_headers: Send extra headers @@ -188,7 +188,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ - 更新某个 Bot + 更新某个 AI 数据助手 Args: avatar_url: 头像 URL @@ -199,7 +199,7 @@ def update( debug: 调试模式 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 + interaction_rules: 交互规则列表,用于定义 AI 数据助手的行为规则 magic_input: 魔法提示词 @@ -209,7 +209,7 @@ def update( publish: 是否公开 - query_balance: bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 + query_balance: AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 sample_questions: 示例问题列表 @@ -268,7 +268,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Chatbot]: """ - 查询所有 Bot + 查询所有 AI 数据助手 Args: bot_ids: Bot ID @@ -320,7 +320,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - 删除某个 Bot + 删除某个 AI 数据助手 Args: extra_headers: Send extra headers @@ -381,7 +381,7 @@ def invite( class AsyncBotsResource(AsyncAPIResource): - """机器人管理""" + """AI 数据助手""" @cached_property def with_raw_response(self) -> AsyncBotsResourceWithRawResponse: @@ -425,7 +425,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ - 创建一个新的 Bot + 创建一个新的 AI 数据助手 Args: datasource_ids: 数据源 ID,目前只支持 1 个数据源。 @@ -436,7 +436,7 @@ async def create( debug: 调试模式 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 + interaction_rules: 交互规则列表,用于定义 AI 数据助手的行为规则 magic_input: 魔法提示词 @@ -444,7 +444,7 @@ async def create( publish: 是否公开 - query_balance: bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 + query_balance: AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 sample_questions: 示例问题列表 @@ -497,7 +497,7 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ - 获取某个 Bot + 获取某个 AI 数据助手 Args: extra_headers: Send extra headers @@ -543,7 +543,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Chatbot: """ - 更新某个 Bot + 更新某个 AI 数据助手 Args: avatar_url: 头像 URL @@ -554,7 +554,7 @@ async def update( debug: 调试模式 - interaction_rules: 交互规则列表,用于定义 bot 的行为规则 + interaction_rules: 交互规则列表,用于定义 AI 数据助手的行为规则 magic_input: 魔法提示词 @@ -564,7 +564,7 @@ async def update( publish: 是否公开 - query_balance: bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 + query_balance: AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数 sample_questions: 示例问题列表 @@ -623,7 +623,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Chatbot, AsyncPage[Chatbot]]: """ - 查询所有 Bot + 查询所有 AI 数据助手 Args: bot_ids: Bot ID @@ -675,7 +675,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - 删除某个 Bot + 删除某个 AI 数据助手 Args: extra_headers: Send extra headers diff --git a/src/asktable/resources/chats/chats.py b/src/asktable/resources/chats/chats.py index 2f44101f..d177f703 100644 --- a/src/asktable/resources/chats/chats.py +++ b/src/asktable/resources/chats/chats.py @@ -80,8 +80,8 @@ def create( 创建对话 Args: - bot_id: 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 - 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + bot_id: AI 数据助手 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在 AI 数据助手中 + 你可以定义可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 name: New name for the chat @@ -279,8 +279,8 @@ async def create( 创建对话 Args: - bot_id: 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 - 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + bot_id: AI 数据助手 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在 AI 数据助手中 + 你可以定义可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 name: New name for the chat diff --git a/src/asktable/types/bot_create_params.py b/src/asktable/types/bot_create_params.py index 9cadd984..8b323b30 100644 --- a/src/asktable/types/bot_create_params.py +++ b/src/asktable/types/bot_create_params.py @@ -24,7 +24,7 @@ class BotCreateParams(TypedDict, total=False): """调试模式""" interaction_rules: Iterable[InteractionRule] - """交互规则列表,用于定义 bot 的行为规则""" + """交互规则列表,用于定义 AI 数据助手的行为规则""" magic_input: Optional[str] """魔法提示词""" @@ -36,7 +36,7 @@ class BotCreateParams(TypedDict, total=False): """是否公开""" query_balance: Optional[int] - """bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数""" + """AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数""" sample_questions: Optional[SequenceNotStr[str]] """示例问题列表""" diff --git a/src/asktable/types/bot_update_params.py b/src/asktable/types/bot_update_params.py index fc5b2ba9..34731704 100644 --- a/src/asktable/types/bot_update_params.py +++ b/src/asktable/types/bot_update_params.py @@ -24,7 +24,7 @@ class BotUpdateParams(TypedDict, total=False): """调试模式""" interaction_rules: Optional[Iterable[InteractionRule]] - """交互规则列表,用于定义 bot 的行为规则""" + """交互规则列表,用于定义 AI 数据助手的行为规则""" magic_input: Optional[str] """魔法提示词""" @@ -39,7 +39,7 @@ class BotUpdateParams(TypedDict, total=False): """是否公开""" query_balance: Optional[int] - """bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数""" + """AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 0 的整数""" sample_questions: Optional[SequenceNotStr[str]] """示例问题列表""" diff --git a/src/asktable/types/chat_create_params.py b/src/asktable/types/chat_create_params.py index ca697335..7d42c04b 100644 --- a/src/asktable/types/chat_create_params.py +++ b/src/asktable/types/chat_create_params.py @@ -11,8 +11,8 @@ class ChatCreateParams(TypedDict, total=False): bot_id: Optional[str] """ - 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 - 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + AI 数据助手 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在 AI 数据助手中 + 你可以定义可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 """ name: Optional[str] diff --git a/src/asktable/types/chat_create_response.py b/src/asktable/types/chat_create_response.py index d0ce3ddb..0e31823f 100644 --- a/src/asktable/types/chat_create_response.py +++ b/src/asktable/types/chat_create_response.py @@ -25,8 +25,8 @@ class ChatCreateResponse(BaseModel): bot_id: Optional[str] = None """ - 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 - 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + AI 数据助手 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在 AI 数据助手中 + 你可以定义可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 """ error_detail: Optional[Dict[str, object]] = None diff --git a/src/asktable/types/chat_list_response.py b/src/asktable/types/chat_list_response.py index 40c8b310..e2b1c503 100644 --- a/src/asktable/types/chat_list_response.py +++ b/src/asktable/types/chat_list_response.py @@ -25,8 +25,8 @@ class ChatListResponse(BaseModel): bot_id: Optional[str] = None """ - 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 - 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + AI 数据助手 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在 AI 数据助手中 + 你可以定义可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 """ error_detail: Optional[Dict[str, object]] = None diff --git a/src/asktable/types/chat_retrieve_response.py b/src/asktable/types/chat_retrieve_response.py index ba261401..91c241f2 100644 --- a/src/asktable/types/chat_retrieve_response.py +++ b/src/asktable/types/chat_retrieve_response.py @@ -25,8 +25,8 @@ class ChatRetrieveResponse(BaseModel): bot_id: Optional[str] = None """ - 机器人 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在机器人中你可以定义 - 可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 + AI 数据助手 ID,如果需要使用高级功能,请使用 bot_id 来创建对话。在 AI 数据助手中 + 你可以定义可以访问的数据、可以执行的任务以及是否开启调试模式等设置。 """ datasource_ids: Optional[List[str]] = None diff --git a/src/asktable/types/chatbot.py b/src/asktable/types/chatbot.py index 5aa67d7f..c48283c6 100644 --- a/src/asktable/types/chatbot.py +++ b/src/asktable/types/chatbot.py @@ -48,7 +48,7 @@ class Chatbot(BaseModel): """调试模式""" interaction_rules: Optional[List[InteractionRule]] = None - """交互规则列表,用于定义 bot 的行为规则""" + """交互规则列表,用于定义 AI 数据助手的行为规则""" magic_input: Optional[str] = None """魔法提示词""" @@ -60,7 +60,7 @@ class Chatbot(BaseModel): """是否公开""" query_balance: Optional[int] = None - """bot 的查询次数,默认是 None,表示无限次查询,入参为大于等于 1 的整数""" + """AI 数据助手的查询次数,默认是 None,表示无限次查询,入参为大于等于 1 的整数""" sample_questions: Optional[List[str]] = None """示例问题列表""" diff --git a/src/asktable/types/dataframe_retrieve_response.py b/src/asktable/types/dataframe_retrieve_response.py index 1a243028..56619d43 100644 --- a/src/asktable/types/dataframe_retrieve_response.py +++ b/src/asktable/types/dataframe_retrieve_response.py @@ -36,6 +36,9 @@ class DataframeRetrieveResponse(BaseModel): title: str """标题""" + chart_config: Optional[Dict[str, object]] = None + """ChartSpec 图表配置""" + content: Optional[List[Dict[str, object]]] = None """内容""" diff --git a/src/asktable/types/project_list_model_groups_response.py b/src/asktable/types/project_list_model_groups_response.py index 03d6826c..a0edd01b 100644 --- a/src/asktable/types/project_list_model_groups_response.py +++ b/src/asktable/types/project_list_model_groups_response.py @@ -2,7 +2,9 @@ from typing import Dict, List, Optional from datetime import datetime -from typing_extensions import TypeAlias +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo from .._models import BaseModel @@ -10,6 +12,7 @@ "ProjectListModelGroupsResponse", "ProjectListModelGroupsResponseItem", "ProjectListModelGroupsResponseItemModels", + "ProjectListModelGroupsResponseItemModelConfigs", ] @@ -31,6 +34,20 @@ class ProjectListModelGroupsResponseItemModels(BaseModel): sql: Optional[str] = None +class ProjectListModelGroupsResponseItemModelConfigs(BaseModel): + """Per-model 配置,key 为 model ID""" + + capabilities: Optional[Dict[str, object]] = None + + context_window: Optional[int] = None + + display_name: Optional[str] = None + + enabled: Optional[bool] = None + + provider_options: Optional[Dict[str, object]] = None + + class ProjectListModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" @@ -59,11 +76,19 @@ class ProjectListModelGroupsResponseItem(BaseModel): name: str """模型组名称""" + api_format: Optional[Literal["openai_chat", "anthropic"]] = None + """API 协议格式""" + display_name: Optional[str] = None """展示名称""" is_default: Optional[bool] = None """是否为默认组""" + api_model_configs: Optional[Dict[str, ProjectListModelGroupsResponseItemModelConfigs]] = FieldInfo( + alias="model_configs", default=None + ) + """Per-model 配置""" + ProjectListModelGroupsResponse: TypeAlias = List[ProjectListModelGroupsResponseItem] diff --git a/src/asktable/types/sys/project_model_groups_response.py b/src/asktable/types/sys/project_model_groups_response.py index 2cd84e64..b9a3c55a 100644 --- a/src/asktable/types/sys/project_model_groups_response.py +++ b/src/asktable/types/sys/project_model_groups_response.py @@ -2,11 +2,18 @@ from typing import Dict, List, Optional from datetime import datetime -from typing_extensions import TypeAlias +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo from ..._models import BaseModel -__all__ = ["ProjectModelGroupsResponse", "ProjectModelGroupsResponseItem", "ProjectModelGroupsResponseItemModels"] +__all__ = [ + "ProjectModelGroupsResponse", + "ProjectModelGroupsResponseItem", + "ProjectModelGroupsResponseItemModels", + "ProjectModelGroupsResponseItemModelConfigs", +] class ProjectModelGroupsResponseItemModels(BaseModel): @@ -27,6 +34,20 @@ class ProjectModelGroupsResponseItemModels(BaseModel): sql: Optional[str] = None +class ProjectModelGroupsResponseItemModelConfigs(BaseModel): + """Per-model 配置,key 为 model ID""" + + capabilities: Optional[Dict[str, object]] = None + + context_window: Optional[int] = None + + display_name: Optional[str] = None + + enabled: Optional[bool] = None + + provider_options: Optional[Dict[str, object]] = None + + class ProjectModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" @@ -55,11 +76,19 @@ class ProjectModelGroupsResponseItem(BaseModel): name: str """模型组名称""" + api_format: Optional[Literal["openai_chat", "anthropic"]] = None + """API 协议格式""" + display_name: Optional[str] = None """展示名称""" is_default: Optional[bool] = None """是否为默认组""" + api_model_configs: Optional[Dict[str, ProjectModelGroupsResponseItemModelConfigs]] = FieldInfo( + alias="model_configs", default=None + ) + """Per-model 配置""" + ProjectModelGroupsResponse: TypeAlias = List[ProjectModelGroupsResponseItem] diff --git a/src/asktable/types/user/project_retrieve_model_groups_response.py b/src/asktable/types/user/project_retrieve_model_groups_response.py index 690649df..2f32a335 100644 --- a/src/asktable/types/user/project_retrieve_model_groups_response.py +++ b/src/asktable/types/user/project_retrieve_model_groups_response.py @@ -2,7 +2,9 @@ from typing import Dict, List, Optional from datetime import datetime -from typing_extensions import TypeAlias +from typing_extensions import Literal, TypeAlias + +from pydantic import Field as FieldInfo from ..._models import BaseModel @@ -10,6 +12,7 @@ "ProjectRetrieveModelGroupsResponse", "ProjectRetrieveModelGroupsResponseItem", "ProjectRetrieveModelGroupsResponseItemModels", + "ProjectRetrieveModelGroupsResponseItemModelConfigs", ] @@ -31,6 +34,20 @@ class ProjectRetrieveModelGroupsResponseItemModels(BaseModel): sql: Optional[str] = None +class ProjectRetrieveModelGroupsResponseItemModelConfigs(BaseModel): + """Per-model 配置,key 为 model ID""" + + capabilities: Optional[Dict[str, object]] = None + + context_window: Optional[int] = None + + display_name: Optional[str] = None + + enabled: Optional[bool] = None + + provider_options: Optional[Dict[str, object]] = None + + class ProjectRetrieveModelGroupsResponseItem(BaseModel): id: str """模型组 ID""" @@ -59,11 +76,19 @@ class ProjectRetrieveModelGroupsResponseItem(BaseModel): name: str """模型组名称""" + api_format: Optional[Literal["openai_chat", "anthropic"]] = None + """API 协议格式""" + display_name: Optional[str] = None """展示名称""" is_default: Optional[bool] = None """是否为默认组""" + api_model_configs: Optional[Dict[str, ProjectRetrieveModelGroupsResponseItemModelConfigs]] = FieldInfo( + alias="model_configs", default=None + ) + """Per-model 配置""" + ProjectRetrieveModelGroupsResponse: TypeAlias = List[ProjectRetrieveModelGroupsResponseItem] From cc0f76386ca9766e03c47000b712b40827af8ac1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 13:24:54 +0000 Subject: [PATCH 125/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index a83cf53a..4a4cd412 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-dddc0f4169fb9502273cea24a5d58bee34807f1d73ce70c757fea2e468dffbf1.yml -openapi_spec_hash: 20ff10ac5c651f39f70c091a1b64b9a1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f6ab5a85a23eb9a5ba220fb22943a8fdfd634e078d58c4989b057b1f4d25b7b9.yml +openapi_spec_hash: 6d16e19c3751d972317be2d974279bb2 config_hash: acdf4142177ed1932c2d82372693f811 From 342cf461989e5c4969a8f4a1b7a52550de0bd4bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:25:04 +0000 Subject: [PATCH 126/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4a4cd412..666f12be 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f6ab5a85a23eb9a5ba220fb22943a8fdfd634e078d58c4989b057b1f4d25b7b9.yml -openapi_spec_hash: 6d16e19c3751d972317be2d974279bb2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c1f9f4a0eb61f295f63a8e245af39f09c5d9ac69091aec48d22f68579cf6feb9.yml +openapi_spec_hash: 10b5ffdc7ab06dcfe57a2ff462908528 config_hash: acdf4142177ed1932c2d82372693f811 From cbf5c8baec50e7040b3661ebac4109d3e7a0c974 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 31 Mar 2026 18:25:00 +0000 Subject: [PATCH 127/130] feat(api): api update --- .stats.yml | 4 ++-- scripts/mock | 6 +++--- scripts/test | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index 666f12be..ba0dd455 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-c1f9f4a0eb61f295f63a8e245af39f09c5d9ac69091aec48d22f68579cf6feb9.yml -openapi_spec_hash: 10b5ffdc7ab06dcfe57a2ff462908528 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5c5449a0eaad6a089351c0a5af25eaa22c041c8c98f075854a3b9f5dbacec21d.yml +openapi_spec_hash: 5fe4116588a5e75d787b332425b31d7f config_hash: acdf4142177ed1932c2d82372693f811 diff --git a/scripts/mock b/scripts/mock index 58e46285..5ea72a2e 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.19.7 -- steady --version + npm exec --package=@stdy/cli@0.20.1 -- steady --version - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.19.7 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 39704647..3fdac803 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.19.7 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 From c48a104834af9699b011fa5891cb4c1941a5bb27 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:05:11 +0000 Subject: [PATCH 128/130] chore(tests): bump steady to v0.20.2 --- scripts/mock | 6 +++--- scripts/test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/mock b/scripts/mock index 5ea72a2e..7c58865f 100755 --- a/scripts/mock +++ b/scripts/mock @@ -22,9 +22,9 @@ echo "==> Starting mock server with URL ${URL}" # Run steady mock on the given spec if [ "$1" == "--daemon" ]; then # Pre-install the package so the download doesn't eat into the startup timeout - npm exec --package=@stdy/cli@0.20.1 -- steady --version + npm exec --package=@stdy/cli@0.20.2 -- steady --version - npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log & # Wait for server to come online via health endpoint (max 30s) echo -n "Waiting for server" @@ -48,5 +48,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stdy/cli@0.20.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" fi diff --git a/scripts/test b/scripts/test index 3fdac803..87cdeac2 100755 --- a/scripts/test +++ b/scripts/test @@ -43,7 +43,7 @@ elif ! steady_is_running ; then echo -e "To run the server, pass in the path or url of your OpenAPI" echo -e "spec to the steady command:" echo - echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=repeat --validator-form-array-format=repeat --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}" echo exit 1 From 10068c435458d0d20881dfe855867dec8429741c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:26:22 +0000 Subject: [PATCH 129/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ba0dd455..73a42028 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5c5449a0eaad6a089351c0a5af25eaa22c041c8c98f075854a3b9f5dbacec21d.yml -openapi_spec_hash: 5fe4116588a5e75d787b332425b31d7f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-0bdad9406cb0b164ac74e5ccf8a11eb97212f97814c1c2b961af8d3b4e690665.yml +openapi_spec_hash: 2df6d34240afb9f4e4028574fff176d7 config_hash: acdf4142177ed1932c2d82372693f811 From 379d8a90ae5af75cbf6d9eaec9523a15f8b03fdb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:27:30 +0000 Subject: [PATCH 130/130] release: 5.6.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 77 +++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- src/asktable/_version.py | 2 +- 4 files changed, 80 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f425d970..8d050425 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.5.0" + ".": "5.6.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 320a4033..d3e77319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,82 @@ # Changelog +## 5.6.0 (2026-04-01) + +Full Changelog: [v5.5.0...v5.6.0](https://github.com/DataMini/asktable-python/compare/v5.5.0...v5.6.0) + +### Features + +* **api:** api update ([cbf5c8b](https://github.com/DataMini/asktable-python/commit/cbf5c8baec50e7040b3661ebac4109d3e7a0c974)) +* **api:** api update ([5a4459d](https://github.com/DataMini/asktable-python/commit/5a4459db1b4bf749a120fd8365d6755b98a6849c)) +* **api:** api update ([2ac5002](https://github.com/DataMini/asktable-python/commit/2ac50023a3cf7a9ce750e6f74a5b2b0b1ca58f05)) +* **api:** api update ([2ad193d](https://github.com/DataMini/asktable-python/commit/2ad193d7d26f51f8e2080b2c7018865eec6346b5)) +* **api:** api update ([8f315ae](https://github.com/DataMini/asktable-python/commit/8f315ae44dd5f63bb6ee94eeb8a05db4be061185)) +* **api:** api update ([e5b4763](https://github.com/DataMini/asktable-python/commit/e5b4763c4be305b5e8eb00bfc4ccce4ac21b0859)) +* **api:** api update ([d1ef26f](https://github.com/DataMini/asktable-python/commit/d1ef26f8728272e1be6c1f82012ec15bf3fda39f)) +* **api:** api update ([6d705b0](https://github.com/DataMini/asktable-python/commit/6d705b07546e449d03e5e0f70f859a49c8db14ec)) +* **api:** api update ([783819b](https://github.com/DataMini/asktable-python/commit/783819b560f7f0b9b26a3177acbd1174de6cd259)) +* **api:** api update ([5981a58](https://github.com/DataMini/asktable-python/commit/5981a58a11a85d7a1d8341a563f51137719c7850)) +* **api:** api update ([871a8c7](https://github.com/DataMini/asktable-python/commit/871a8c7c65874d07e0329f8490df11f2e8daa0fe)) +* **api:** api update ([dc5a071](https://github.com/DataMini/asktable-python/commit/dc5a07103bfc42c3f4e5acba1a61cb06b1c2a714)) +* **api:** api update ([1784353](https://github.com/DataMini/asktable-python/commit/1784353bb71b8c263b54e1e3ad95d7f25f1c5bea)) +* **api:** api update ([9260b13](https://github.com/DataMini/asktable-python/commit/9260b13ed921f7ea0f9615999375e92327e6ae98)) +* **api:** api update ([2acb60f](https://github.com/DataMini/asktable-python/commit/2acb60fc6c0bbb12713548b388f3289e85efb2fb)) +* **api:** api update ([9a4f19a](https://github.com/DataMini/asktable-python/commit/9a4f19a8ae3655969fd42c89ddce37e344fecd34)) +* **api:** api update ([b4fe8f6](https://github.com/DataMini/asktable-python/commit/b4fe8f6225f6190443c96098dcd368be97ec7e44)) +* **api:** api update ([4271a76](https://github.com/DataMini/asktable-python/commit/4271a76c22284d1b2a1bdd2a0a658afba2bcc181)) +* **api:** api update ([1176bed](https://github.com/DataMini/asktable-python/commit/1176beda5149dba11a79fc7e02988f74f6e60aae)) +* **api:** api update ([02a8fff](https://github.com/DataMini/asktable-python/commit/02a8fff21477f2c32241a09141bb4095c0060d30)) +* **api:** api update ([8add1bf](https://github.com/DataMini/asktable-python/commit/8add1bf8ed03a6e674c63e405a0cbf3f3d06b104)) +* **api:** api update ([9ec8ffd](https://github.com/DataMini/asktable-python/commit/9ec8ffda5236139d9241cd8507b7798b9312b3dd)) +* **api:** api update ([5dbbf4f](https://github.com/DataMini/asktable-python/commit/5dbbf4fd77e617963eeaca8fd57054ddb3ebad05)) +* **api:** api update ([343d8d1](https://github.com/DataMini/asktable-python/commit/343d8d1db4e22208b3d3b335f2d51de166a64a22)) +* **api:** api update ([c5b1360](https://github.com/DataMini/asktable-python/commit/c5b136000d8771c1b8a9a8b3843316d12c7ba6d9)) +* **api:** api update ([9492d82](https://github.com/DataMini/asktable-python/commit/9492d823c21d636d68e654e485ef99ab07344b47)) +* **api:** api update ([692c5e4](https://github.com/DataMini/asktable-python/commit/692c5e4a06ed72d630cae83806a89eb36316e647)) +* **api:** api update ([a62c00a](https://github.com/DataMini/asktable-python/commit/a62c00ae12cbc0efdbcb4bdf02480ddbb36d693a)) +* **api:** api update ([94adaea](https://github.com/DataMini/asktable-python/commit/94adaeae5c0a3ab51b8d4f9ef9acba27d87efc06)) +* **api:** api update ([d79fd22](https://github.com/DataMini/asktable-python/commit/d79fd224c090d22b32cc02776c5fd32ea56d2a7b)) +* **api:** api update ([d3cbda0](https://github.com/DataMini/asktable-python/commit/d3cbda00e41261e559ba2111b843b1b10f9fb772)) +* **api:** api update ([8e94324](https://github.com/DataMini/asktable-python/commit/8e94324216695bc96c20ed8b066a342d35b1f377)) +* **api:** api update ([689b9c0](https://github.com/DataMini/asktable-python/commit/689b9c0c7863e30ea3a614607c1aac22f5745b52)) +* **api:** api update ([8e2933a](https://github.com/DataMini/asktable-python/commit/8e2933a2a07175e5b2a817f9243df5952b19a9fa)) +* **api:** api update ([8fa327a](https://github.com/DataMini/asktable-python/commit/8fa327a7bb92dc4b4aeb81ff356989c13712166d)) +* **api:** api update ([7a17247](https://github.com/DataMini/asktable-python/commit/7a17247ed3d0cb95ec279c1627b51dfb2ce48572)) +* **api:** api update ([fd21534](https://github.com/DataMini/asktable-python/commit/fd2153419e2ba1424b40398fef454d01db6d4a79)) +* **client:** support file upload requests ([e9bac63](https://github.com/DataMini/asktable-python/commit/e9bac63f9b86123f21df0343e44bd9423e053bbe)) +* improve future compat with pydantic v3 ([7d6836d](https://github.com/DataMini/asktable-python/commit/7d6836dc486cd6287e806f18177b2c4afb1be2e5)) +* **types:** replace List[str] with SequenceNotStr in params ([be4a6d6](https://github.com/DataMini/asktable-python/commit/be4a6d685ff133354c4b242992de4a80f475c2d4)) + + +### Bug Fixes + +* avoid newer type syntax ([2bc84ae](https://github.com/DataMini/asktable-python/commit/2bc84ae95415f7377dcbf554faf6d057605f5c74)) +* **parsing:** ignore empty metadata ([8c48f1b](https://github.com/DataMini/asktable-python/commit/8c48f1b05dbebb99a432ab9fd7b57f8aed109d60)) +* **parsing:** parse extra field types ([40c9351](https://github.com/DataMini/asktable-python/commit/40c9351059a44df1f640f5791a126e175ebadad6)) + + +### Chores + +* **internal:** add Sequence related utils ([d34ae74](https://github.com/DataMini/asktable-python/commit/d34ae74d7dd281b8b1bc806aec5965a042550d88)) +* **internal:** change ci workflow machines ([1781814](https://github.com/DataMini/asktable-python/commit/17818149ddfaa3397db71e1a6a2500b997576a97)) +* **internal:** codegen related update ([d60ba62](https://github.com/DataMini/asktable-python/commit/d60ba627627abf7310d0464d679d332ef9ba6e65)) +* **internal:** codegen related update ([f1cea4d](https://github.com/DataMini/asktable-python/commit/f1cea4d395932285e627b2695d2b95b3cc880296)) +* **internal:** codegen related update ([4277012](https://github.com/DataMini/asktable-python/commit/42770122e37df0e03d7f5643da5aef8ab61e8a55)) +* **internal:** codegen related update ([0c6162b](https://github.com/DataMini/asktable-python/commit/0c6162b65b8b1034dd6f9c65aff9020f41fd6af9)) +* **internal:** codegen related update ([86b895b](https://github.com/DataMini/asktable-python/commit/86b895bc21b209f651ab062637ca506a34e96992)) +* **internal:** fix ruff target version ([47ae330](https://github.com/DataMini/asktable-python/commit/47ae33089939da844b9fc6f96ea1d7a56d57887e)) +* **internal:** move mypy configurations to `pyproject.toml` file ([3a81ab1](https://github.com/DataMini/asktable-python/commit/3a81ab10fc9090dd6e0c850ebf4d2bc5dd0774aa)) +* **internal:** update comment in script ([595c402](https://github.com/DataMini/asktable-python/commit/595c4022caf668b57ad4dab50ec2e8a7dc3227af)) +* **internal:** update pydantic dependency ([7768ab5](https://github.com/DataMini/asktable-python/commit/7768ab57521d3e09e550013c14b188e6aeb62fd1)) +* **internal:** update pyright exclude list ([5bf3c78](https://github.com/DataMini/asktable-python/commit/5bf3c78a9d79882f1c2e7e4245187cbb1813229d)) +* **project:** add settings file for vscode ([1641a3d](https://github.com/DataMini/asktable-python/commit/1641a3d8c4a5647a81b6292b3fd8805ab3132bb8)) +* **tests:** bump steady to v0.19.7 ([7887929](https://github.com/DataMini/asktable-python/commit/7887929ff15541ebb8120765c55f84a6c3bd39d3)) +* **tests:** bump steady to v0.20.2 ([c48a104](https://github.com/DataMini/asktable-python/commit/c48a104834af9699b011fa5891cb4c1941a5bb27)) +* **tests:** simplify `get_platform` test ([f8251b5](https://github.com/DataMini/asktable-python/commit/f8251b5a76926a6603865967d8e94071a72f5d26)) +* **types:** change optional parameter type from NotGiven to Omit ([e2ab3d3](https://github.com/DataMini/asktable-python/commit/e2ab3d3508972ea2ac5df4ab1824036070eaf732)) +* update @stainless-api/prism-cli to v5.15.0 ([5d3abad](https://github.com/DataMini/asktable-python/commit/5d3abad79640464784e731af282d02600606db98)) +* update github action ([653ff06](https://github.com/DataMini/asktable-python/commit/653ff06315c440c09e931828916b8ff38a41d6bd)) + ## 5.5.0 (2025-07-19) Full Changelog: [v5.4.0...v5.5.0](https://github.com/DataMini/asktable-python/compare/v5.4.0...v5.5.0) diff --git a/pyproject.toml b/pyproject.toml index 162c6b43..5211d694 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "asktable" -version = "5.5.0" +version = "5.6.0" description = "The official Python library for the Asktable API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/asktable/_version.py b/src/asktable/_version.py index 118411d8..62ce948e 100644 --- a/src/asktable/_version.py +++ b/src/asktable/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "asktable" -__version__ = "5.5.0" # x-release-please-version +__version__ = "5.6.0" # x-release-please-version