From dba48e1aebe2abab983f6fe802d8605abdab82ac Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:45:41 +0000
Subject: [PATCH 1/4] feat(api): manual updates (#173)
---
.stats.yml | 2 +-
api.md | 31 +++
src/asktable/_client.py | 22 +-
src/asktable/resources/__init__.py | 28 +++
.../resources/datasources/datasources.py | 234 ++++++++++++++----
src/asktable/resources/polish.py | 198 +++++++++++++++
.../resources/single_turn/__init__.py | 33 +++
src/asktable/resources/single_turn/q2w.py | 215 ++++++++++++++++
.../resources/single_turn/single_turn.py | 102 ++++++++
src/asktable/types/__init__.py | 6 +
...tasource_retrieve_runtime_meta_response.py | 12 +
.../types/datasource_update_field_params.py | 19 ++
src/asktable/types/polish_create_params.py | 18 ++
src/asktable/types/polish_create_response.py | 11 +
src/asktable/types/single_turn/__init__.py | 5 +
.../types/single_turn/q2w_create_params.py | 11 +
tests/api_resources/single_turn/__init__.py | 1 +
tests/api_resources/single_turn/test_q2w.py | 133 ++++++++++
tests/api_resources/test_datasources.py | 199 +++++++++++++++
tests/api_resources/test_polish.py | 108 ++++++++
20 files changed, 1332 insertions(+), 56 deletions(-)
create mode 100644 src/asktable/resources/polish.py
create mode 100644 src/asktable/resources/single_turn/__init__.py
create mode 100644 src/asktable/resources/single_turn/q2w.py
create mode 100644 src/asktable/resources/single_turn/single_turn.py
create mode 100644 src/asktable/types/datasource_retrieve_runtime_meta_response.py
create mode 100644 src/asktable/types/datasource_update_field_params.py
create mode 100644 src/asktable/types/polish_create_params.py
create mode 100644 src/asktable/types/polish_create_response.py
create mode 100644 src/asktable/types/single_turn/__init__.py
create mode 100644 src/asktable/types/single_turn/q2w_create_params.py
create mode 100644 tests/api_resources/single_turn/__init__.py
create mode 100644 tests/api_resources/single_turn/test_q2w.py
create mode 100644 tests/api_resources/test_polish.py
diff --git a/.stats.yml b/.stats.yml
index 559383cc..95102f37 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 93
+configured_endpoints: 98
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-02fbb644978089e8596def9999f5729633b652fba35bf04e374dbb71e7630355.yml
diff --git a/api.md b/api.md
index 1f1f2ec8..741eeba0 100644
--- a/api.md
+++ b/api.md
@@ -140,6 +140,8 @@ from asktable.types import (
DatasourceDeleteResponse,
DatasourceAddFileResponse,
DatasourceDeleteFileResponse,
+ DatasourceRetrieveRuntimeMetaResponse,
+ DatasourceUpdateFieldResponse,
)
```
@@ -152,6 +154,8 @@ Methods:
- client.datasources.delete(datasource_id) -> object
- client.datasources.add_file(datasource_id, \*\*params) -> object
- client.datasources.delete_file(file_id, \*, datasource_id) -> object
+- client.datasources.retrieve_runtime_meta(datasource_id) -> DatasourceRetrieveRuntimeMetaResponse
+- client.datasources.update_field(datasource_id, \*\*params) -> object
## Meta
@@ -405,3 +409,30 @@ from asktable.types import DataframeRetrieveResponse
Methods:
- client.dataframes.retrieve(dataframe_id) -> DataframeRetrieveResponse
+
+# SingleTurn
+
+## Q2w
+
+Types:
+
+```python
+from asktable.types.single_turn import Q2wCreateResponse, Q2wListResponse
+```
+
+Methods:
+
+- client.single_turn.q2w.create(\*\*params) -> object
+- client.single_turn.q2w.list() -> object
+
+# Polish
+
+Types:
+
+```python
+from asktable.types import PolishCreateResponse
+```
+
+Methods:
+
+- client.polish.create(\*\*params) -> PolishCreateResponse
diff --git a/src/asktable/_client.py b/src/asktable/_client.py
index 0fa09487..2c3407ee 100644
--- a/src/asktable/_client.py
+++ b/src/asktable/_client.py
@@ -31,6 +31,7 @@
files,
roles,
caches,
+ polish,
scores,
answers,
project,
@@ -53,6 +54,7 @@
from .resources.chats import chats
from .resources.extapis import extapis
from .resources.datasources import datasources
+from .resources.single_turn import single_turn
__all__ = [
"Timeout",
@@ -87,6 +89,8 @@ class Asktable(SyncAPIClient):
scores: scores.ScoresResource
files: files.FilesResource
dataframes: dataframes.DataframesResource
+ single_turn: single_turn.SingleTurnResource
+ polish: polish.PolishResource
with_raw_response: AsktableWithRawResponse
with_streaming_response: AsktableWithStreamedResponse
@@ -131,7 +135,7 @@ def __init__(
if base_url is None:
base_url = os.environ.get("ASKTABLE_BASE_URL")
if base_url is None:
- base_url = f"https://api.asktable.com"
+ base_url = f"https://api.asktable.com/v1"
super().__init__(
version=__version__,
@@ -164,6 +168,8 @@ def __init__(
self.scores = scores.ScoresResource(self)
self.files = files.FilesResource(self)
self.dataframes = dataframes.DataframesResource(self)
+ self.single_turn = single_turn.SingleTurnResource(self)
+ self.polish = polish.PolishResource(self)
self.with_raw_response = AsktableWithRawResponse(self)
self.with_streaming_response = AsktableWithStreamedResponse(self)
@@ -293,6 +299,8 @@ class AsyncAsktable(AsyncAPIClient):
scores: scores.AsyncScoresResource
files: files.AsyncFilesResource
dataframes: dataframes.AsyncDataframesResource
+ single_turn: single_turn.AsyncSingleTurnResource
+ polish: polish.AsyncPolishResource
with_raw_response: AsyncAsktableWithRawResponse
with_streaming_response: AsyncAsktableWithStreamedResponse
@@ -337,7 +345,7 @@ def __init__(
if base_url is None:
base_url = os.environ.get("ASKTABLE_BASE_URL")
if base_url is None:
- base_url = f"https://api.asktable.com"
+ base_url = f"https://api.asktable.com/v1"
super().__init__(
version=__version__,
@@ -370,6 +378,8 @@ def __init__(
self.scores = scores.AsyncScoresResource(self)
self.files = files.AsyncFilesResource(self)
self.dataframes = dataframes.AsyncDataframesResource(self)
+ self.single_turn = single_turn.AsyncSingleTurnResource(self)
+ self.polish = polish.AsyncPolishResource(self)
self.with_raw_response = AsyncAsktableWithRawResponse(self)
self.with_streaming_response = AsyncAsktableWithStreamedResponse(self)
@@ -500,6 +510,8 @@ def __init__(self, client: Asktable) -> None:
self.scores = scores.ScoresResourceWithRawResponse(client.scores)
self.files = files.FilesResourceWithRawResponse(client.files)
self.dataframes = dataframes.DataframesResourceWithRawResponse(client.dataframes)
+ self.single_turn = single_turn.SingleTurnResourceWithRawResponse(client.single_turn)
+ self.polish = polish.PolishResourceWithRawResponse(client.polish)
class AsyncAsktableWithRawResponse:
@@ -526,6 +538,8 @@ def __init__(self, client: AsyncAsktable) -> None:
self.scores = scores.AsyncScoresResourceWithRawResponse(client.scores)
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.dataframes = dataframes.AsyncDataframesResourceWithRawResponse(client.dataframes)
+ self.single_turn = single_turn.AsyncSingleTurnResourceWithRawResponse(client.single_turn)
+ self.polish = polish.AsyncPolishResourceWithRawResponse(client.polish)
class AsktableWithStreamedResponse:
@@ -552,6 +566,8 @@ def __init__(self, client: Asktable) -> None:
self.scores = scores.ScoresResourceWithStreamingResponse(client.scores)
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.dataframes = dataframes.DataframesResourceWithStreamingResponse(client.dataframes)
+ self.single_turn = single_turn.SingleTurnResourceWithStreamingResponse(client.single_turn)
+ self.polish = polish.PolishResourceWithStreamingResponse(client.polish)
class AsyncAsktableWithStreamedResponse:
@@ -578,6 +594,8 @@ def __init__(self, client: AsyncAsktable) -> None:
self.scores = scores.AsyncScoresResourceWithStreamingResponse(client.scores)
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.dataframes = dataframes.AsyncDataframesResourceWithStreamingResponse(client.dataframes)
+ self.single_turn = single_turn.AsyncSingleTurnResourceWithStreamingResponse(client.single_turn)
+ self.polish = polish.AsyncPolishResourceWithStreamingResponse(client.polish)
Client = Asktable
diff --git a/src/asktable/resources/__init__.py b/src/asktable/resources/__init__.py
index 45e0bfb5..caab4d93 100644
--- a/src/asktable/resources/__init__.py
+++ b/src/asktable/resources/__init__.py
@@ -64,6 +64,14 @@
CachesResourceWithStreamingResponse,
AsyncCachesResourceWithStreamingResponse,
)
+from .polish import (
+ PolishResource,
+ AsyncPolishResource,
+ PolishResourceWithRawResponse,
+ AsyncPolishResourceWithRawResponse,
+ PolishResourceWithStreamingResponse,
+ AsyncPolishResourceWithStreamingResponse,
+)
from .scores import (
ScoresResource,
AsyncScoresResource,
@@ -144,6 +152,14 @@
PreferencesResourceWithStreamingResponse,
AsyncPreferencesResourceWithStreamingResponse,
)
+from .single_turn import (
+ SingleTurnResource,
+ AsyncSingleTurnResource,
+ SingleTurnResourceWithRawResponse,
+ AsyncSingleTurnResourceWithRawResponse,
+ SingleTurnResourceWithStreamingResponse,
+ AsyncSingleTurnResourceWithStreamingResponse,
+)
from .securetunnels import (
SecuretunnelsResource,
AsyncSecuretunnelsResource,
@@ -282,4 +298,16 @@
"AsyncDataframesResourceWithRawResponse",
"DataframesResourceWithStreamingResponse",
"AsyncDataframesResourceWithStreamingResponse",
+ "SingleTurnResource",
+ "AsyncSingleTurnResource",
+ "SingleTurnResourceWithRawResponse",
+ "AsyncSingleTurnResourceWithRawResponse",
+ "SingleTurnResourceWithStreamingResponse",
+ "AsyncSingleTurnResourceWithStreamingResponse",
+ "PolishResource",
+ "AsyncPolishResource",
+ "PolishResourceWithRawResponse",
+ "AsyncPolishResourceWithRawResponse",
+ "PolishResourceWithStreamingResponse",
+ "AsyncPolishResourceWithStreamingResponse",
]
diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py
index a2b9d29d..9bbb6ac1 100644
--- a/src/asktable/resources/datasources/datasources.py
+++ b/src/asktable/resources/datasources/datasources.py
@@ -20,6 +20,7 @@
datasource_create_params,
datasource_update_params,
datasource_add_file_params,
+ datasource_update_field_params,
)
from .indexes import (
IndexesResource,
@@ -56,6 +57,7 @@
from ..._base_client import AsyncPaginator, make_request_options
from ...types.datasource import Datasource
from ...types.datasource_retrieve_response import DatasourceRetrieveResponse
+from ...types.datasource_retrieve_runtime_meta_response import DatasourceRetrieveRuntimeMetaResponse
__all__ = ["DatasourcesResource", "AsyncDatasourcesResource"]
@@ -441,75 +443,91 @@ def delete_file(
cast_to=object,
)
- def add_file_and_update_meta(
+ def retrieve_runtime_meta(
self,
datasource_id: str,
- file: FileTypes,
*,
- name: str = "auto_generated_meta",
- async_process_meta: bool | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> None:
- self.add_file(
- datasource_id,
- file=file,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- )
- self.meta.create(
- datasource_id=datasource_id,
- name=name,
- async_process_meta=async_process_meta,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
+ ) -> DatasourceRetrieveRuntimeMetaResponse:
+ """
+ 获取指定数据源的运行时元数据
+
+ 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 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",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DatasourceRetrieveRuntimeMetaResponse,
)
- def create_from_file(
+ def update_field(
self,
- engine: Literal["excel", "csv"],
- file: FileTypes,
+ datasource_id: str,
*,
- name: str = "auto_generated",
- async_process_meta: bool | NotGiven = NOT_GIVEN,
+ field_name: str,
+ schema_name: str,
+ table_name: str,
+ visibility: Optional[bool] | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Datasource:
- datasource = self.create(
- engine=engine,
- name=name,
- async_process_meta=False,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- )
- self.add_file(
- datasource.id,
- file=file,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- )
- self.meta.create(
- datasource.id,
- name=name,
- async_process_meta=async_process_meta,
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
+ ) -> object:
+ """
+ 更新数据源的某个字段的描述
+
+ Args:
+ visibility: field visibility
+
+ 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 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",
+ body=maybe_transform(
+ {"visibility": visibility}, datasource_update_field_params.DatasourceUpdateFieldParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "field_name": field_name,
+ "schema_name": schema_name,
+ "table_name": table_name,
+ },
+ datasource_update_field_params.DatasourceUpdateFieldParams,
+ ),
+ ),
+ cast_to=object,
)
- return datasource
class AsyncDatasourcesResource(AsyncAPIResource):
@cached_property
@@ -892,6 +910,92 @@ async def delete_file(
cast_to=object,
)
+ async def retrieve_runtime_meta(
+ self,
+ 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,
+ ) -> DatasourceRetrieveRuntimeMetaResponse:
+ """
+ 获取指定数据源的运行时元数据
+
+ 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 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",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DatasourceRetrieveRuntimeMetaResponse,
+ )
+
+ async def update_field(
+ self,
+ datasource_id: str,
+ *,
+ field_name: str,
+ schema_name: str,
+ table_name: str,
+ visibility: Optional[bool] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> object:
+ """
+ 更新数据源的某个字段的描述
+
+ Args:
+ visibility: field visibility
+
+ 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 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",
+ body=await async_maybe_transform(
+ {"visibility": visibility}, datasource_update_field_params.DatasourceUpdateFieldParams
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "field_name": field_name,
+ "schema_name": schema_name,
+ "table_name": table_name,
+ },
+ datasource_update_field_params.DatasourceUpdateFieldParams,
+ ),
+ ),
+ cast_to=object,
+ )
+
class DatasourcesResourceWithRawResponse:
def __init__(self, datasources: DatasourcesResource) -> None:
@@ -918,6 +1022,12 @@ def __init__(self, datasources: DatasourcesResource) -> None:
self.delete_file = to_raw_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = to_raw_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = to_raw_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> MetaResourceWithRawResponse:
@@ -957,6 +1067,12 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None:
self.delete_file = async_to_raw_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = async_to_raw_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = async_to_raw_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> AsyncMetaResourceWithRawResponse:
@@ -996,6 +1112,12 @@ def __init__(self, datasources: DatasourcesResource) -> None:
self.delete_file = to_streamed_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = to_streamed_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = to_streamed_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> MetaResourceWithStreamingResponse:
@@ -1035,6 +1157,12 @@ def __init__(self, datasources: AsyncDatasourcesResource) -> None:
self.delete_file = async_to_streamed_response_wrapper(
datasources.delete_file,
)
+ self.retrieve_runtime_meta = async_to_streamed_response_wrapper(
+ datasources.retrieve_runtime_meta,
+ )
+ self.update_field = async_to_streamed_response_wrapper(
+ datasources.update_field,
+ )
@cached_property
def meta(self) -> AsyncMetaResourceWithStreamingResponse:
diff --git a/src/asktable/resources/polish.py b/src/asktable/resources/polish.py
new file mode 100644
index 00000000..3343078e
--- /dev/null
+++ b/src/asktable/resources/polish.py
@@ -0,0 +1,198 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal
+
+import httpx
+
+from ..types import polish_create_params
+from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+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 ..types.polish_create_response import PolishCreateResponse
+
+__all__ = ["PolishResource", "AsyncPolishResource"]
+
+
+class PolishResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> PolishResourceWithRawResponse:
+ """
+ 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 PolishResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> PolishResourceWithStreamingResponse:
+ """
+ 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 PolishResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ max_word_count: int,
+ user_desc: str,
+ polish_mode: Literal[0] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> PolishCreateResponse:
+ """
+ Polish Table Desc
+
+ Args:
+ max_word_count: 润色后的最大字数,注意:该值不是绝对值,实际优化后的字数可能会超过该值
+
+ user_desc: 需要润色的用户输入
+
+ polish_mode: 润色模式,默认是简化模式
+
+ 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/polish",
+ body=maybe_transform(
+ {
+ "max_word_count": max_word_count,
+ "user_desc": user_desc,
+ "polish_mode": polish_mode,
+ },
+ polish_create_params.PolishCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=PolishCreateResponse,
+ )
+
+
+class AsyncPolishResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncPolishResourceWithRawResponse:
+ """
+ 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 AsyncPolishResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncPolishResourceWithStreamingResponse:
+ """
+ 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 AsyncPolishResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ max_word_count: int,
+ user_desc: str,
+ polish_mode: Literal[0] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> PolishCreateResponse:
+ """
+ Polish Table Desc
+
+ Args:
+ max_word_count: 润色后的最大字数,注意:该值不是绝对值,实际优化后的字数可能会超过该值
+
+ user_desc: 需要润色的用户输入
+
+ polish_mode: 润色模式,默认是简化模式
+
+ 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/polish",
+ body=await async_maybe_transform(
+ {
+ "max_word_count": max_word_count,
+ "user_desc": user_desc,
+ "polish_mode": polish_mode,
+ },
+ polish_create_params.PolishCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=PolishCreateResponse,
+ )
+
+
+class PolishResourceWithRawResponse:
+ def __init__(self, polish: PolishResource) -> None:
+ self._polish = polish
+
+ self.create = to_raw_response_wrapper(
+ polish.create,
+ )
+
+
+class AsyncPolishResourceWithRawResponse:
+ def __init__(self, polish: AsyncPolishResource) -> None:
+ self._polish = polish
+
+ self.create = async_to_raw_response_wrapper(
+ polish.create,
+ )
+
+
+class PolishResourceWithStreamingResponse:
+ def __init__(self, polish: PolishResource) -> None:
+ self._polish = polish
+
+ self.create = to_streamed_response_wrapper(
+ polish.create,
+ )
+
+
+class AsyncPolishResourceWithStreamingResponse:
+ def __init__(self, polish: AsyncPolishResource) -> None:
+ self._polish = polish
+
+ self.create = async_to_streamed_response_wrapper(
+ polish.create,
+ )
diff --git a/src/asktable/resources/single_turn/__init__.py b/src/asktable/resources/single_turn/__init__.py
new file mode 100644
index 00000000..25231734
--- /dev/null
+++ b/src/asktable/resources/single_turn/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .q2w import (
+ Q2wResource,
+ AsyncQ2wResource,
+ Q2wResourceWithRawResponse,
+ AsyncQ2wResourceWithRawResponse,
+ Q2wResourceWithStreamingResponse,
+ AsyncQ2wResourceWithStreamingResponse,
+)
+from .single_turn import (
+ SingleTurnResource,
+ AsyncSingleTurnResource,
+ SingleTurnResourceWithRawResponse,
+ AsyncSingleTurnResourceWithRawResponse,
+ SingleTurnResourceWithStreamingResponse,
+ AsyncSingleTurnResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "Q2wResource",
+ "AsyncQ2wResource",
+ "Q2wResourceWithRawResponse",
+ "AsyncQ2wResourceWithRawResponse",
+ "Q2wResourceWithStreamingResponse",
+ "AsyncQ2wResourceWithStreamingResponse",
+ "SingleTurnResource",
+ "AsyncSingleTurnResource",
+ "SingleTurnResourceWithRawResponse",
+ "AsyncSingleTurnResourceWithRawResponse",
+ "SingleTurnResourceWithStreamingResponse",
+ "AsyncSingleTurnResourceWithStreamingResponse",
+]
diff --git a/src/asktable/resources/single_turn/q2w.py b/src/asktable/resources/single_turn/q2w.py
new file mode 100644
index 00000000..c88191d2
--- /dev/null
+++ b/src/asktable/resources/single_turn/q2w.py
@@ -0,0 +1,215 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+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 ...types.single_turn import q2w_create_params
+
+__all__ = ["Q2wResource", "AsyncQ2wResource"]
+
+
+class Q2wResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> Q2wResourceWithRawResponse:
+ """
+ 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 Q2wResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> Q2wResourceWithStreamingResponse:
+ """
+ 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 Q2wResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ body: 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:
+ """
+ Create Q2W
+
+ 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
+ """
+ return self._post(
+ "/v1/single-turn/q2w",
+ body=maybe_transform(body, q2w_create_params.Q2wCreateParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=object,
+ )
+
+ def list(
+ 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,
+ ) -> object:
+ """获取所有的 Q2W 记录"""
+ return self._get(
+ "/v1/single-turn/q2w",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=object,
+ )
+
+
+class AsyncQ2wResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncQ2wResourceWithRawResponse:
+ """
+ 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 AsyncQ2wResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncQ2wResourceWithStreamingResponse:
+ """
+ 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 AsyncQ2wResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ body: 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:
+ """
+ Create Q2W
+
+ 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
+ """
+ return await self._post(
+ "/v1/single-turn/q2w",
+ body=await async_maybe_transform(body, q2w_create_params.Q2wCreateParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=object,
+ )
+
+ async def list(
+ 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,
+ ) -> object:
+ """获取所有的 Q2W 记录"""
+ return await self._get(
+ "/v1/single-turn/q2w",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=object,
+ )
+
+
+class Q2wResourceWithRawResponse:
+ def __init__(self, q2w: Q2wResource) -> None:
+ self._q2w = q2w
+
+ self.create = to_raw_response_wrapper(
+ q2w.create,
+ )
+ self.list = to_raw_response_wrapper(
+ q2w.list,
+ )
+
+
+class AsyncQ2wResourceWithRawResponse:
+ def __init__(self, q2w: AsyncQ2wResource) -> None:
+ self._q2w = q2w
+
+ self.create = async_to_raw_response_wrapper(
+ q2w.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ q2w.list,
+ )
+
+
+class Q2wResourceWithStreamingResponse:
+ def __init__(self, q2w: Q2wResource) -> None:
+ self._q2w = q2w
+
+ self.create = to_streamed_response_wrapper(
+ q2w.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ q2w.list,
+ )
+
+
+class AsyncQ2wResourceWithStreamingResponse:
+ def __init__(self, q2w: AsyncQ2wResource) -> None:
+ self._q2w = q2w
+
+ self.create = async_to_streamed_response_wrapper(
+ q2w.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ q2w.list,
+ )
diff --git a/src/asktable/resources/single_turn/single_turn.py b/src/asktable/resources/single_turn/single_turn.py
new file mode 100644
index 00000000..ea0e0ecd
--- /dev/null
+++ b/src/asktable/resources/single_turn/single_turn.py
@@ -0,0 +1,102 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .q2w import (
+ Q2wResource,
+ AsyncQ2wResource,
+ Q2wResourceWithRawResponse,
+ AsyncQ2wResourceWithRawResponse,
+ Q2wResourceWithStreamingResponse,
+ AsyncQ2wResourceWithStreamingResponse,
+)
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+
+__all__ = ["SingleTurnResource", "AsyncSingleTurnResource"]
+
+
+class SingleTurnResource(SyncAPIResource):
+ @cached_property
+ def q2w(self) -> Q2wResource:
+ return Q2wResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> SingleTurnResourceWithRawResponse:
+ """
+ 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 SingleTurnResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> SingleTurnResourceWithStreamingResponse:
+ """
+ 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 SingleTurnResourceWithStreamingResponse(self)
+
+
+class AsyncSingleTurnResource(AsyncAPIResource):
+ @cached_property
+ def q2w(self) -> AsyncQ2wResource:
+ return AsyncQ2wResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncSingleTurnResourceWithRawResponse:
+ """
+ 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 AsyncSingleTurnResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncSingleTurnResourceWithStreamingResponse:
+ """
+ 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 AsyncSingleTurnResourceWithStreamingResponse(self)
+
+
+class SingleTurnResourceWithRawResponse:
+ def __init__(self, single_turn: SingleTurnResource) -> None:
+ self._single_turn = single_turn
+
+ @cached_property
+ def q2w(self) -> Q2wResourceWithRawResponse:
+ return Q2wResourceWithRawResponse(self._single_turn.q2w)
+
+
+class AsyncSingleTurnResourceWithRawResponse:
+ def __init__(self, single_turn: AsyncSingleTurnResource) -> None:
+ self._single_turn = single_turn
+
+ @cached_property
+ def q2w(self) -> AsyncQ2wResourceWithRawResponse:
+ return AsyncQ2wResourceWithRawResponse(self._single_turn.q2w)
+
+
+class SingleTurnResourceWithStreamingResponse:
+ def __init__(self, single_turn: SingleTurnResource) -> None:
+ self._single_turn = single_turn
+
+ @cached_property
+ def q2w(self) -> Q2wResourceWithStreamingResponse:
+ return Q2wResourceWithStreamingResponse(self._single_turn.q2w)
+
+
+class AsyncSingleTurnResourceWithStreamingResponse:
+ def __init__(self, single_turn: AsyncSingleTurnResource) -> None:
+ self._single_turn = single_turn
+
+ @cached_property
+ def q2w(self) -> AsyncQ2wResourceWithStreamingResponse:
+ return AsyncQ2wResourceWithStreamingResponse(self._single_turn.q2w)
diff --git a/src/asktable/types/__init__.py b/src/asktable/types/__init__.py
index a132d23f..19d3b17f 100644
--- a/src/asktable/types/__init__.py
+++ b/src/asktable/types/__init__.py
@@ -39,12 +39,14 @@
from .extapi_update_params import ExtapiUpdateParams as ExtapiUpdateParams
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 .entry_with_definition import EntryWithDefinition as EntryWithDefinition
from .project_update_params import ProjectUpdateParams as ProjectUpdateParams
from .score_create_response import ScoreCreateResponse as ScoreCreateResponse
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
@@ -66,6 +68,7 @@
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
+from .datasource_update_field_params import DatasourceUpdateFieldParams as DatasourceUpdateFieldParams
from .securetunnel_list_links_params import SecuretunnelListLinksParams as SecuretunnelListLinksParams
from .business_glossary_create_params import BusinessGlossaryCreateParams as BusinessGlossaryCreateParams
from .business_glossary_update_params import BusinessGlossaryUpdateParams as BusinessGlossaryUpdateParams
@@ -74,3 +77,6 @@
from .business_glossary_create_response import BusinessGlossaryCreateResponse as BusinessGlossaryCreateResponse
from .integration_create_excel_ds_params import IntegrationCreateExcelDsParams as IntegrationCreateExcelDsParams
from .project_list_model_groups_response import ProjectListModelGroupsResponse as ProjectListModelGroupsResponse
+from .datasource_retrieve_runtime_meta_response import (
+ DatasourceRetrieveRuntimeMetaResponse as DatasourceRetrieveRuntimeMetaResponse,
+)
diff --git a/src/asktable/types/datasource_retrieve_runtime_meta_response.py b/src/asktable/types/datasource_retrieve_runtime_meta_response.py
new file mode 100644
index 00000000..4465ecb6
--- /dev/null
+++ b/src/asktable/types/datasource_retrieve_runtime_meta_response.py
@@ -0,0 +1,12 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Dict, List
+
+from .._models import BaseModel
+
+__all__ = ["DatasourceRetrieveRuntimeMetaResponse"]
+
+
+class DatasourceRetrieveRuntimeMetaResponse(BaseModel):
+ schemas: Dict[str, List[str]]
+ """元数据"""
diff --git a/src/asktable/types/datasource_update_field_params.py b/src/asktable/types/datasource_update_field_params.py
new file mode 100644
index 00000000..9236c80e
--- /dev/null
+++ b/src/asktable/types/datasource_update_field_params.py
@@ -0,0 +1,19 @@
+# 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__ = ["DatasourceUpdateFieldParams"]
+
+
+class DatasourceUpdateFieldParams(TypedDict, total=False):
+ field_name: Required[str]
+
+ schema_name: Required[str]
+
+ table_name: Required[str]
+
+ visibility: Optional[bool]
+ """field visibility"""
diff --git a/src/asktable/types/polish_create_params.py b/src/asktable/types/polish_create_params.py
new file mode 100644
index 00000000..08474fe4
--- /dev/null
+++ b/src/asktable/types/polish_create_params.py
@@ -0,0 +1,18 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, Required, TypedDict
+
+__all__ = ["PolishCreateParams"]
+
+
+class PolishCreateParams(TypedDict, total=False):
+ max_word_count: Required[int]
+ """润色后的最大字数,注意:该值不是绝对值,实际优化后的字数可能会超过该值"""
+
+ user_desc: Required[str]
+ """需要润色的用户输入"""
+
+ polish_mode: Literal[0]
+ """润色模式,默认是简化模式"""
diff --git a/src/asktable/types/polish_create_response.py b/src/asktable/types/polish_create_response.py
new file mode 100644
index 00000000..b92795cc
--- /dev/null
+++ b/src/asktable/types/polish_create_response.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+
+from .._models import BaseModel
+
+__all__ = ["PolishCreateResponse"]
+
+
+class PolishCreateResponse(BaseModel):
+ polish_desc: str
+ """润色后的结果"""
diff --git a/src/asktable/types/single_turn/__init__.py b/src/asktable/types/single_turn/__init__.py
new file mode 100644
index 00000000..7d939a20
--- /dev/null
+++ b/src/asktable/types/single_turn/__init__.py
@@ -0,0 +1,5 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .q2w_create_params import Q2wCreateParams as Q2wCreateParams
diff --git a/src/asktable/types/single_turn/q2w_create_params.py b/src/asktable/types/single_turn/q2w_create_params.py
new file mode 100644
index 00000000..4b03cfe5
--- /dev/null
+++ b/src/asktable/types/single_turn/q2w_create_params.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["Q2wCreateParams"]
+
+
+class Q2wCreateParams(TypedDict, total=False):
+ body: Required[object]
diff --git a/tests/api_resources/single_turn/__init__.py b/tests/api_resources/single_turn/__init__.py
new file mode 100644
index 00000000..fd8019a9
--- /dev/null
+++ b/tests/api_resources/single_turn/__init__.py
@@ -0,0 +1 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/single_turn/test_q2w.py b/tests/api_resources/single_turn/test_q2w.py
new file mode 100644
index 00000000..bb01c335
--- /dev/null
+++ b/tests/api_resources/single_turn/test_q2w.py
@@ -0,0 +1,133 @@
+# 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
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestQ2w:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Asktable) -> None:
+ q2w = client.single_turn.q2w.create(
+ body={},
+ )
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Asktable) -> None:
+ response = client.single_turn.q2w.with_raw_response.create(
+ body={},
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ q2w = response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Asktable) -> None:
+ with client.single_turn.q2w.with_streaming_response.create(
+ body={},
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ q2w = response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_method_list(self, client: Asktable) -> None:
+ q2w = client.single_turn.q2w.list()
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ def test_raw_response_list(self, client: Asktable) -> None:
+ response = client.single_turn.q2w.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ q2w = response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ def test_streaming_response_list(self, client: Asktable) -> None:
+ with client.single_turn.q2w.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ q2w = response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncQ2w:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncAsktable) -> None:
+ q2w = await async_client.single_turn.q2w.create(
+ body={},
+ )
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.single_turn.q2w.with_raw_response.create(
+ body={},
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ q2w = await response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
+ async with async_client.single_turn.q2w.with_streaming_response.create(
+ body={},
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ q2w = await response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_method_list(self, async_client: AsyncAsktable) -> None:
+ q2w = await async_client.single_turn.q2w.list()
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.single_turn.q2w.with_raw_response.list()
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ q2w = await response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncAsktable) -> None:
+ async with async_client.single_turn.q2w.with_streaming_response.list() as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ q2w = await response.parse()
+ assert_matches_type(object, q2w, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_datasources.py b/tests/api_resources/test_datasources.py
index 6cb041a0..a99d4858 100644
--- a/tests/api_resources/test_datasources.py
+++ b/tests/api_resources/test_datasources.py
@@ -12,6 +12,7 @@
from asktable.types import (
Datasource,
DatasourceRetrieveResponse,
+ DatasourceRetrieveRuntimeMetaResponse,
)
from asktable.pagination import SyncPage, AsyncPage
@@ -334,6 +335,105 @@ def test_path_params_delete_file(self, client: Asktable) -> None:
datasource_id="datasource_id",
)
+ @parametrize
+ def test_method_retrieve_runtime_meta(self, client: Asktable) -> None:
+ datasource = client.datasources.retrieve_runtime_meta(
+ "datasource_id",
+ )
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ def test_raw_response_retrieve_runtime_meta(self, client: Asktable) -> None:
+ response = client.datasources.with_raw_response.retrieve_runtime_meta(
+ "datasource_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ def test_streaming_response_retrieve_runtime_meta(self, client: Asktable) -> None:
+ with client.datasources.with_streaming_response.retrieve_runtime_meta(
+ "datasource_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_retrieve_runtime_meta(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.retrieve_runtime_meta(
+ "",
+ )
+
+ @parametrize
+ def test_method_update_field(self, client: Asktable) -> None:
+ datasource = client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ def test_method_update_field_with_all_params(self, client: Asktable) -> None:
+ datasource = client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ visibility=True,
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ def test_raw_response_update_field(self, client: Asktable) -> None:
+ response = client.datasources.with_raw_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ def test_streaming_response_update_field(self, client: Asktable) -> None:
+ with client.datasources.with_streaming_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_update_field(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.update_field(
+ datasource_id="",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+
class TestAsyncDatasources:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -650,3 +750,102 @@ async def test_path_params_delete_file(self, async_client: AsyncAsktable) -> Non
file_id="",
datasource_id="datasource_id",
)
+
+ @parametrize
+ async def test_method_retrieve_runtime_meta(self, async_client: AsyncAsktable) -> None:
+ datasource = await async_client.datasources.retrieve_runtime_meta(
+ "datasource_id",
+ )
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ async def test_raw_response_retrieve_runtime_meta(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.datasources.with_raw_response.retrieve_runtime_meta(
+ "datasource_id",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = await response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_retrieve_runtime_meta(self, async_client: AsyncAsktable) -> None:
+ async with async_client.datasources.with_streaming_response.retrieve_runtime_meta(
+ "datasource_id",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = await response.parse()
+ assert_matches_type(DatasourceRetrieveRuntimeMetaResponse, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_retrieve_runtime_meta(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.retrieve_runtime_meta(
+ "",
+ )
+
+ @parametrize
+ async def test_method_update_field(self, async_client: AsyncAsktable) -> None:
+ datasource = await async_client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ async def test_method_update_field_with_all_params(self, async_client: AsyncAsktable) -> None:
+ datasource = await async_client.datasources.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ visibility=True,
+ )
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ async def test_raw_response_update_field(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.datasources.with_raw_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ datasource = await response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_update_field(self, async_client: AsyncAsktable) -> None:
+ async with async_client.datasources.with_streaming_response.update_field(
+ datasource_id="datasource_id",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ datasource = await response.parse()
+ assert_matches_type(object, datasource, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_update_field(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.update_field(
+ datasource_id="",
+ field_name="field_name",
+ schema_name="schema_name",
+ table_name="table_name",
+ )
diff --git a/tests/api_resources/test_polish.py b/tests/api_resources/test_polish.py
new file mode 100644
index 00000000..45ff3b66
--- /dev/null
+++ b/tests/api_resources/test_polish.py
@@ -0,0 +1,108 @@
+# 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 PolishCreateResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestPolish:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ def test_method_create(self, client: Asktable) -> None:
+ polish = client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Asktable) -> None:
+ polish = client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ polish_mode=0,
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Asktable) -> None:
+ response = client.polish.with_raw_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ polish = response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Asktable) -> None:
+ with client.polish.with_streaming_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ polish = response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncPolish:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @parametrize
+ async def test_method_create(self, async_client: AsyncAsktable) -> None:
+ polish = await async_client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
+ polish = await async_client.polish.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ polish_mode=0,
+ )
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
+ response = await async_client.polish.with_raw_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ polish = await response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
+ async with async_client.polish.with_streaming_response.create(
+ max_word_count=0,
+ user_desc="user_desc",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ polish = await response.parse()
+ assert_matches_type(PolishCreateResponse, polish, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
From 64bd21ff24dbc8a8495a48c73207fbeab1ac5082 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:43:01 +0000
Subject: [PATCH 2/4] feat(api): manual updates (#175)
---
.stats.yml | 2 +-
api.md | 15 --
src/asktable/_client.py | 9 -
src/asktable/resources/__init__.py | 14 --
.../resources/single_turn/__init__.py | 33 ---
src/asktable/resources/single_turn/q2w.py | 215 ------------------
.../resources/single_turn/single_turn.py | 102 ---------
src/asktable/types/single_turn/__init__.py | 5 -
.../types/single_turn/q2w_create_params.py | 11 -
tests/api_resources/single_turn/__init__.py | 1 -
tests/api_resources/single_turn/test_q2w.py | 133 -----------
11 files changed, 1 insertion(+), 539 deletions(-)
delete mode 100644 src/asktable/resources/single_turn/__init__.py
delete mode 100644 src/asktable/resources/single_turn/q2w.py
delete mode 100644 src/asktable/resources/single_turn/single_turn.py
delete mode 100644 src/asktable/types/single_turn/__init__.py
delete mode 100644 src/asktable/types/single_turn/q2w_create_params.py
delete mode 100644 tests/api_resources/single_turn/__init__.py
delete mode 100644 tests/api_resources/single_turn/test_q2w.py
diff --git a/.stats.yml b/.stats.yml
index 95102f37..92764e07 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 98
+configured_endpoints: 96
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-02fbb644978089e8596def9999f5729633b652fba35bf04e374dbb71e7630355.yml
diff --git a/api.md b/api.md
index 741eeba0..dc8deb6e 100644
--- a/api.md
+++ b/api.md
@@ -410,21 +410,6 @@ Methods:
- client.dataframes.retrieve(dataframe_id) -> DataframeRetrieveResponse
-# SingleTurn
-
-## Q2w
-
-Types:
-
-```python
-from asktable.types.single_turn import Q2wCreateResponse, Q2wListResponse
-```
-
-Methods:
-
-- client.single_turn.q2w.create(\*\*params) -> object
-- client.single_turn.q2w.list() -> object
-
# Polish
Types:
diff --git a/src/asktable/_client.py b/src/asktable/_client.py
index 2c3407ee..bfd1d278 100644
--- a/src/asktable/_client.py
+++ b/src/asktable/_client.py
@@ -54,7 +54,6 @@
from .resources.chats import chats
from .resources.extapis import extapis
from .resources.datasources import datasources
-from .resources.single_turn import single_turn
__all__ = [
"Timeout",
@@ -89,7 +88,6 @@ class Asktable(SyncAPIClient):
scores: scores.ScoresResource
files: files.FilesResource
dataframes: dataframes.DataframesResource
- single_turn: single_turn.SingleTurnResource
polish: polish.PolishResource
with_raw_response: AsktableWithRawResponse
with_streaming_response: AsktableWithStreamedResponse
@@ -168,7 +166,6 @@ def __init__(
self.scores = scores.ScoresResource(self)
self.files = files.FilesResource(self)
self.dataframes = dataframes.DataframesResource(self)
- self.single_turn = single_turn.SingleTurnResource(self)
self.polish = polish.PolishResource(self)
self.with_raw_response = AsktableWithRawResponse(self)
self.with_streaming_response = AsktableWithStreamedResponse(self)
@@ -299,7 +296,6 @@ class AsyncAsktable(AsyncAPIClient):
scores: scores.AsyncScoresResource
files: files.AsyncFilesResource
dataframes: dataframes.AsyncDataframesResource
- single_turn: single_turn.AsyncSingleTurnResource
polish: polish.AsyncPolishResource
with_raw_response: AsyncAsktableWithRawResponse
with_streaming_response: AsyncAsktableWithStreamedResponse
@@ -378,7 +374,6 @@ def __init__(
self.scores = scores.AsyncScoresResource(self)
self.files = files.AsyncFilesResource(self)
self.dataframes = dataframes.AsyncDataframesResource(self)
- self.single_turn = single_turn.AsyncSingleTurnResource(self)
self.polish = polish.AsyncPolishResource(self)
self.with_raw_response = AsyncAsktableWithRawResponse(self)
self.with_streaming_response = AsyncAsktableWithStreamedResponse(self)
@@ -510,7 +505,6 @@ def __init__(self, client: Asktable) -> None:
self.scores = scores.ScoresResourceWithRawResponse(client.scores)
self.files = files.FilesResourceWithRawResponse(client.files)
self.dataframes = dataframes.DataframesResourceWithRawResponse(client.dataframes)
- self.single_turn = single_turn.SingleTurnResourceWithRawResponse(client.single_turn)
self.polish = polish.PolishResourceWithRawResponse(client.polish)
@@ -538,7 +532,6 @@ def __init__(self, client: AsyncAsktable) -> None:
self.scores = scores.AsyncScoresResourceWithRawResponse(client.scores)
self.files = files.AsyncFilesResourceWithRawResponse(client.files)
self.dataframes = dataframes.AsyncDataframesResourceWithRawResponse(client.dataframes)
- self.single_turn = single_turn.AsyncSingleTurnResourceWithRawResponse(client.single_turn)
self.polish = polish.AsyncPolishResourceWithRawResponse(client.polish)
@@ -566,7 +559,6 @@ def __init__(self, client: Asktable) -> None:
self.scores = scores.ScoresResourceWithStreamingResponse(client.scores)
self.files = files.FilesResourceWithStreamingResponse(client.files)
self.dataframes = dataframes.DataframesResourceWithStreamingResponse(client.dataframes)
- self.single_turn = single_turn.SingleTurnResourceWithStreamingResponse(client.single_turn)
self.polish = polish.PolishResourceWithStreamingResponse(client.polish)
@@ -594,7 +586,6 @@ def __init__(self, client: AsyncAsktable) -> None:
self.scores = scores.AsyncScoresResourceWithStreamingResponse(client.scores)
self.files = files.AsyncFilesResourceWithStreamingResponse(client.files)
self.dataframes = dataframes.AsyncDataframesResourceWithStreamingResponse(client.dataframes)
- self.single_turn = single_turn.AsyncSingleTurnResourceWithStreamingResponse(client.single_turn)
self.polish = polish.AsyncPolishResourceWithStreamingResponse(client.polish)
diff --git a/src/asktable/resources/__init__.py b/src/asktable/resources/__init__.py
index caab4d93..9f12d790 100644
--- a/src/asktable/resources/__init__.py
+++ b/src/asktable/resources/__init__.py
@@ -152,14 +152,6 @@
PreferencesResourceWithStreamingResponse,
AsyncPreferencesResourceWithStreamingResponse,
)
-from .single_turn import (
- SingleTurnResource,
- AsyncSingleTurnResource,
- SingleTurnResourceWithRawResponse,
- AsyncSingleTurnResourceWithRawResponse,
- SingleTurnResourceWithStreamingResponse,
- AsyncSingleTurnResourceWithStreamingResponse,
-)
from .securetunnels import (
SecuretunnelsResource,
AsyncSecuretunnelsResource,
@@ -298,12 +290,6 @@
"AsyncDataframesResourceWithRawResponse",
"DataframesResourceWithStreamingResponse",
"AsyncDataframesResourceWithStreamingResponse",
- "SingleTurnResource",
- "AsyncSingleTurnResource",
- "SingleTurnResourceWithRawResponse",
- "AsyncSingleTurnResourceWithRawResponse",
- "SingleTurnResourceWithStreamingResponse",
- "AsyncSingleTurnResourceWithStreamingResponse",
"PolishResource",
"AsyncPolishResource",
"PolishResourceWithRawResponse",
diff --git a/src/asktable/resources/single_turn/__init__.py b/src/asktable/resources/single_turn/__init__.py
deleted file mode 100644
index 25231734..00000000
--- a/src/asktable/resources/single_turn/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from .q2w import (
- Q2wResource,
- AsyncQ2wResource,
- Q2wResourceWithRawResponse,
- AsyncQ2wResourceWithRawResponse,
- Q2wResourceWithStreamingResponse,
- AsyncQ2wResourceWithStreamingResponse,
-)
-from .single_turn import (
- SingleTurnResource,
- AsyncSingleTurnResource,
- SingleTurnResourceWithRawResponse,
- AsyncSingleTurnResourceWithRawResponse,
- SingleTurnResourceWithStreamingResponse,
- AsyncSingleTurnResourceWithStreamingResponse,
-)
-
-__all__ = [
- "Q2wResource",
- "AsyncQ2wResource",
- "Q2wResourceWithRawResponse",
- "AsyncQ2wResourceWithRawResponse",
- "Q2wResourceWithStreamingResponse",
- "AsyncQ2wResourceWithStreamingResponse",
- "SingleTurnResource",
- "AsyncSingleTurnResource",
- "SingleTurnResourceWithRawResponse",
- "AsyncSingleTurnResourceWithRawResponse",
- "SingleTurnResourceWithStreamingResponse",
- "AsyncSingleTurnResourceWithStreamingResponse",
-]
diff --git a/src/asktable/resources/single_turn/q2w.py b/src/asktable/resources/single_turn/q2w.py
deleted file mode 100644
index c88191d2..00000000
--- a/src/asktable/resources/single_turn/q2w.py
+++ /dev/null
@@ -1,215 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import httpx
-
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-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 ...types.single_turn import q2w_create_params
-
-__all__ = ["Q2wResource", "AsyncQ2wResource"]
-
-
-class Q2wResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> Q2wResourceWithRawResponse:
- """
- 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 Q2wResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> Q2wResourceWithStreamingResponse:
- """
- 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 Q2wResourceWithStreamingResponse(self)
-
- def create(
- self,
- *,
- body: 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:
- """
- Create Q2W
-
- 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
- """
- return self._post(
- "/v1/single-turn/q2w",
- body=maybe_transform(body, q2w_create_params.Q2wCreateParams),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=object,
- )
-
- def list(
- 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,
- ) -> object:
- """获取所有的 Q2W 记录"""
- return self._get(
- "/v1/single-turn/q2w",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=object,
- )
-
-
-class AsyncQ2wResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncQ2wResourceWithRawResponse:
- """
- 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 AsyncQ2wResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncQ2wResourceWithStreamingResponse:
- """
- 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 AsyncQ2wResourceWithStreamingResponse(self)
-
- async def create(
- self,
- *,
- body: 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:
- """
- Create Q2W
-
- 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
- """
- return await self._post(
- "/v1/single-turn/q2w",
- body=await async_maybe_transform(body, q2w_create_params.Q2wCreateParams),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=object,
- )
-
- async def list(
- 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,
- ) -> object:
- """获取所有的 Q2W 记录"""
- return await self._get(
- "/v1/single-turn/q2w",
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=object,
- )
-
-
-class Q2wResourceWithRawResponse:
- def __init__(self, q2w: Q2wResource) -> None:
- self._q2w = q2w
-
- self.create = to_raw_response_wrapper(
- q2w.create,
- )
- self.list = to_raw_response_wrapper(
- q2w.list,
- )
-
-
-class AsyncQ2wResourceWithRawResponse:
- def __init__(self, q2w: AsyncQ2wResource) -> None:
- self._q2w = q2w
-
- self.create = async_to_raw_response_wrapper(
- q2w.create,
- )
- self.list = async_to_raw_response_wrapper(
- q2w.list,
- )
-
-
-class Q2wResourceWithStreamingResponse:
- def __init__(self, q2w: Q2wResource) -> None:
- self._q2w = q2w
-
- self.create = to_streamed_response_wrapper(
- q2w.create,
- )
- self.list = to_streamed_response_wrapper(
- q2w.list,
- )
-
-
-class AsyncQ2wResourceWithStreamingResponse:
- def __init__(self, q2w: AsyncQ2wResource) -> None:
- self._q2w = q2w
-
- self.create = async_to_streamed_response_wrapper(
- q2w.create,
- )
- self.list = async_to_streamed_response_wrapper(
- q2w.list,
- )
diff --git a/src/asktable/resources/single_turn/single_turn.py b/src/asktable/resources/single_turn/single_turn.py
deleted file mode 100644
index ea0e0ecd..00000000
--- a/src/asktable/resources/single_turn/single_turn.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from .q2w import (
- Q2wResource,
- AsyncQ2wResource,
- Q2wResourceWithRawResponse,
- AsyncQ2wResourceWithRawResponse,
- Q2wResourceWithStreamingResponse,
- AsyncQ2wResourceWithStreamingResponse,
-)
-from ..._compat import cached_property
-from ..._resource import SyncAPIResource, AsyncAPIResource
-
-__all__ = ["SingleTurnResource", "AsyncSingleTurnResource"]
-
-
-class SingleTurnResource(SyncAPIResource):
- @cached_property
- def q2w(self) -> Q2wResource:
- return Q2wResource(self._client)
-
- @cached_property
- def with_raw_response(self) -> SingleTurnResourceWithRawResponse:
- """
- 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 SingleTurnResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> SingleTurnResourceWithStreamingResponse:
- """
- 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 SingleTurnResourceWithStreamingResponse(self)
-
-
-class AsyncSingleTurnResource(AsyncAPIResource):
- @cached_property
- def q2w(self) -> AsyncQ2wResource:
- return AsyncQ2wResource(self._client)
-
- @cached_property
- def with_raw_response(self) -> AsyncSingleTurnResourceWithRawResponse:
- """
- 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 AsyncSingleTurnResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncSingleTurnResourceWithStreamingResponse:
- """
- 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 AsyncSingleTurnResourceWithStreamingResponse(self)
-
-
-class SingleTurnResourceWithRawResponse:
- def __init__(self, single_turn: SingleTurnResource) -> None:
- self._single_turn = single_turn
-
- @cached_property
- def q2w(self) -> Q2wResourceWithRawResponse:
- return Q2wResourceWithRawResponse(self._single_turn.q2w)
-
-
-class AsyncSingleTurnResourceWithRawResponse:
- def __init__(self, single_turn: AsyncSingleTurnResource) -> None:
- self._single_turn = single_turn
-
- @cached_property
- def q2w(self) -> AsyncQ2wResourceWithRawResponse:
- return AsyncQ2wResourceWithRawResponse(self._single_turn.q2w)
-
-
-class SingleTurnResourceWithStreamingResponse:
- def __init__(self, single_turn: SingleTurnResource) -> None:
- self._single_turn = single_turn
-
- @cached_property
- def q2w(self) -> Q2wResourceWithStreamingResponse:
- return Q2wResourceWithStreamingResponse(self._single_turn.q2w)
-
-
-class AsyncSingleTurnResourceWithStreamingResponse:
- def __init__(self, single_turn: AsyncSingleTurnResource) -> None:
- self._single_turn = single_turn
-
- @cached_property
- def q2w(self) -> AsyncQ2wResourceWithStreamingResponse:
- return AsyncQ2wResourceWithStreamingResponse(self._single_turn.q2w)
diff --git a/src/asktable/types/single_turn/__init__.py b/src/asktable/types/single_turn/__init__.py
deleted file mode 100644
index 7d939a20..00000000
--- a/src/asktable/types/single_turn/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from .q2w_create_params import Q2wCreateParams as Q2wCreateParams
diff --git a/src/asktable/types/single_turn/q2w_create_params.py b/src/asktable/types/single_turn/q2w_create_params.py
deleted file mode 100644
index 4b03cfe5..00000000
--- a/src/asktable/types/single_turn/q2w_create_params.py
+++ /dev/null
@@ -1,11 +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__ = ["Q2wCreateParams"]
-
-
-class Q2wCreateParams(TypedDict, total=False):
- body: Required[object]
diff --git a/tests/api_resources/single_turn/__init__.py b/tests/api_resources/single_turn/__init__.py
deleted file mode 100644
index fd8019a9..00000000
--- a/tests/api_resources/single_turn/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
diff --git a/tests/api_resources/single_turn/test_q2w.py b/tests/api_resources/single_turn/test_q2w.py
deleted file mode 100644
index bb01c335..00000000
--- a/tests/api_resources/single_turn/test_q2w.py
+++ /dev/null
@@ -1,133 +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
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestQ2w:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_create(self, client: Asktable) -> None:
- q2w = client.single_turn.q2w.create(
- body={},
- )
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- def test_raw_response_create(self, client: Asktable) -> None:
- response = client.single_turn.q2w.with_raw_response.create(
- body={},
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- q2w = response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- def test_streaming_response_create(self, client: Asktable) -> None:
- with client.single_turn.q2w.with_streaming_response.create(
- body={},
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- q2w = response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_method_list(self, client: Asktable) -> None:
- q2w = client.single_turn.q2w.list()
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- def test_raw_response_list(self, client: Asktable) -> None:
- response = client.single_turn.q2w.with_raw_response.list()
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- q2w = response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- def test_streaming_response_list(self, client: Asktable) -> None:
- with client.single_turn.q2w.with_streaming_response.list() as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- q2w = response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
-
-class TestAsyncQ2w:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_create(self, async_client: AsyncAsktable) -> None:
- q2w = await async_client.single_turn.q2w.create(
- body={},
- )
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
- response = await async_client.single_turn.q2w.with_raw_response.create(
- body={},
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- q2w = await response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
- async with async_client.single_turn.q2w.with_streaming_response.create(
- body={},
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- q2w = await response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_method_list(self, async_client: AsyncAsktable) -> None:
- q2w = await async_client.single_turn.q2w.list()
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- async def test_raw_response_list(self, async_client: AsyncAsktable) -> None:
- response = await async_client.single_turn.q2w.with_raw_response.list()
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- q2w = await response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- @parametrize
- async def test_streaming_response_list(self, async_client: AsyncAsktable) -> None:
- async with async_client.single_turn.q2w.with_streaming_response.list() as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- q2w = await response.parse()
- assert_matches_type(object, q2w, path=["response"])
-
- assert cast(Any, response.is_closed) is True
From c1a81420aeb2a7eb8c6f0b32c8f84134a50e0a37 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:49:15 +0000
Subject: [PATCH 3/4] chore: remove custom code
---
src/asktable/resources/datasources/datasources.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/asktable/resources/datasources/datasources.py b/src/asktable/resources/datasources/datasources.py
index 9bbb6ac1..099d2695 100644
--- a/src/asktable/resources/datasources/datasources.py
+++ b/src/asktable/resources/datasources/datasources.py
@@ -529,6 +529,7 @@ def update_field(
cast_to=object,
)
+
class AsyncDatasourcesResource(AsyncAPIResource):
@cached_property
def meta(self) -> AsyncMetaResource:
From 68a45386f1384bc033346d9c0bf11c2773b8d98b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sat, 15 Mar 2025 10:49:31 +0000
Subject: [PATCH 4/4] release: 5.0.0
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 14 ++++++++++++++
pyproject.toml | 2 +-
src/asktable/_version.py | 2 +-
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 1eec10e9..8e76abb5 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.7.0"
+ ".": "5.0.0"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e8a3e96..b5f4057f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 5.0.0 (2025-03-15)
+
+Full Changelog: [v4.7.0...v5.0.0](https://github.com/DataMini/asktable-python/compare/v4.7.0...v5.0.0)
+
+### Features
+
+* **api:** manual updates ([#173](https://github.com/DataMini/asktable-python/issues/173)) ([dba48e1](https://github.com/DataMini/asktable-python/commit/dba48e1aebe2abab983f6fe802d8605abdab82ac))
+* **api:** manual updates ([#175](https://github.com/DataMini/asktable-python/issues/175)) ([64bd21f](https://github.com/DataMini/asktable-python/commit/64bd21ff24dbc8a8495a48c73207fbeab1ac5082))
+
+
+### Chores
+
+* remove custom code ([c1a8142](https://github.com/DataMini/asktable-python/commit/c1a81420aeb2a7eb8c6f0b32c8f84134a50e0a37))
+
## 4.7.0 (2025-03-15)
Full Changelog: [v4.6.0...v4.7.0](https://github.com/DataMini/asktable-python/compare/v4.6.0...v4.7.0)
diff --git a/pyproject.toml b/pyproject.toml
index d772cbb9..3d28da26 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "asktable"
-version = "4.7.0"
+version = "5.0.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 f987046f..cb3aca18 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__ = "4.7.0" # x-release-please-version
+__version__ = "5.0.0" # x-release-please-version