Skip to content

Commit 2acb60f

Browse files
feat(api): api update
1 parent 1f93cc7 commit 2acb60f

File tree

10 files changed

+116
-24
lines changed

10 files changed

+116
-24
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 105
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-5202276c7c4f0702d5ad5e1a29f64f69a73431e0ce8ffc0fa3c43d1786b0943f.yml
3-
openapi_spec_hash: 56dd465d441566baf82a7c2995be83c0
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-bcad499bae337a6750b7a254db7d342713402b90b04cb7fa0eeab514c2179b83.yml
3+
openapi_spec_hash: d6e641529b9e13ff068eae74bc0a1ff9
44
config_hash: acdf4142177ed1932c2d82372693f811

src/asktable/resources/chats/messages.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, cast
5+
from typing import Any, Optional, cast
66

77
import httpx
88

@@ -50,7 +50,8 @@ def create(
5050
self,
5151
chat_id: str,
5252
*,
53-
question: str,
53+
query_question: Optional[str] | Omit = omit,
54+
body_question: Optional[str] | Omit = omit,
5455
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5556
# The extra values given here take precedence over values defined on the client or passed to this method.
5657
extra_headers: Headers | None = None,
@@ -62,6 +63,8 @@ def create(
6263
Send a message to the chat
6364
6465
Args:
66+
body_question: 用户问题
67+
6568
extra_headers: Send extra headers
6669
6770
extra_query: Add additional query parameters to the request
@@ -76,12 +79,15 @@ def create(
7679
MessageCreateResponse,
7780
self._post(
7881
f"/v1/chats/{chat_id}/messages",
82+
body=maybe_transform({"body_question": body_question}, message_create_params.MessageCreateParams),
7983
options=make_request_options(
8084
extra_headers=extra_headers,
8185
extra_query=extra_query,
8286
extra_body=extra_body,
8387
timeout=timeout,
84-
query=maybe_transform({"question": question}, message_create_params.MessageCreateParams),
88+
query=maybe_transform(
89+
{"query_question": query_question}, message_create_params.MessageCreateParams
90+
),
8591
),
8692
cast_to=cast(
8793
Any, MessageCreateResponse
@@ -205,7 +211,8 @@ async def create(
205211
self,
206212
chat_id: str,
207213
*,
208-
question: str,
214+
query_question: Optional[str] | Omit = omit,
215+
body_question: Optional[str] | Omit = omit,
209216
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
210217
# The extra values given here take precedence over values defined on the client or passed to this method.
211218
extra_headers: Headers | None = None,
@@ -217,6 +224,8 @@ async def create(
217224
Send a message to the chat
218225
219226
Args:
227+
body_question: 用户问题
228+
220229
extra_headers: Send extra headers
221230
222231
extra_query: Add additional query parameters to the request
@@ -231,13 +240,16 @@ async def create(
231240
MessageCreateResponse,
232241
await self._post(
233242
f"/v1/chats/{chat_id}/messages",
243+
body=await async_maybe_transform(
244+
{"body_question": body_question}, message_create_params.MessageCreateParams
245+
),
234246
options=make_request_options(
235247
extra_headers=extra_headers,
236248
extra_query=extra_query,
237249
extra_body=extra_body,
238250
timeout=timeout,
239251
query=await async_maybe_transform(
240-
{"question": question}, message_create_params.MessageCreateParams
252+
{"query_question": query_question}, message_create_params.MessageCreateParams
241253
),
242254
),
243255
cast_to=cast(

src/asktable/resources/datasources/datasources.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def create(
116116
"mogdb",
117117
"hologres",
118118
"maxcompute",
119+
"gaussdb",
120+
"tdsqlmysql",
121+
"tdsqlpg",
122+
"kingbasees",
123+
"gbase8c",
124+
"yashandb",
125+
"gbase8a",
126+
"gaussdbdws",
119127
"dap",
120128
],
121129
access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit,
@@ -225,6 +233,14 @@ def update(
225233
"mogdb",
226234
"hologres",
227235
"maxcompute",
236+
"gaussdb",
237+
"tdsqlmysql",
238+
"tdsqlpg",
239+
"kingbasees",
240+
"gbase8c",
241+
"yashandb",
242+
"gbase8a",
243+
"gaussdbdws",
228244
"dap",
229245
]
230246
]
@@ -616,6 +632,14 @@ async def create(
616632
"mogdb",
617633
"hologres",
618634
"maxcompute",
635+
"gaussdb",
636+
"tdsqlmysql",
637+
"tdsqlpg",
638+
"kingbasees",
639+
"gbase8c",
640+
"yashandb",
641+
"gbase8a",
642+
"gaussdbdws",
619643
"dap",
620644
],
621645
access_config: Optional[datasource_create_params.AccessConfig] | Omit = omit,
@@ -725,6 +749,14 @@ async def update(
725749
"mogdb",
726750
"hologres",
727751
"maxcompute",
752+
"gaussdb",
753+
"tdsqlmysql",
754+
"tdsqlpg",
755+
"kingbasees",
756+
"gbase8c",
757+
"yashandb",
758+
"gbase8a",
759+
"gaussdbdws",
728760
"dap",
729761
]
730762
]

src/asktable/types/chats/message_create_params.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing import Optional
6+
from typing_extensions import Annotated, TypedDict
7+
8+
from ..._utils import PropertyInfo
69

710
__all__ = ["MessageCreateParams"]
811

912

1013
class MessageCreateParams(TypedDict, total=False):
11-
question: Required[str]
14+
query_question: Annotated[Optional[str], PropertyInfo(alias="question")]
15+
16+
body_question: Annotated[Optional[str], PropertyInfo(alias="question")]
17+
"""用户问题"""

src/asktable/types/dataframe_retrieve_response.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
44
from datetime import datetime
55

66
from .._models import BaseModel
@@ -15,9 +15,6 @@ class DataframeRetrieveResponse(BaseModel):
1515
chart_options: object
1616
"""图表选项"""
1717

18-
content: List[object]
19-
"""内容"""
20-
2118
created_at: datetime
2219
"""创建时间"""
2320

@@ -27,9 +24,6 @@ class DataframeRetrieveResponse(BaseModel):
2724
modified_at: datetime
2825
"""更新时间"""
2926

30-
msg_id: str
31-
"""消息 ID"""
32-
3327
project_id: str
3428
"""项目 ID"""
3529

@@ -41,3 +35,9 @@ class DataframeRetrieveResponse(BaseModel):
4135

4236
title: str
4337
"""标题"""
38+
39+
content: Optional[List[object]] = None
40+
"""内容"""
41+
42+
msg_id: Optional[str] = None
43+
"""消息 ID"""

src/asktable/types/datasource.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ class Datasource(BaseModel):
4040
"mogdb",
4141
"hologres",
4242
"maxcompute",
43+
"gaussdb",
44+
"tdsqlmysql",
45+
"tdsqlpg",
46+
"kingbasees",
47+
"gbase8c",
48+
"yashandb",
49+
"gbase8a",
50+
"gaussdbdws",
4351
"dap",
4452
]
4553
"""数据源引擎"""

src/asktable/types/datasource_create_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ class DatasourceCreateParams(TypedDict, total=False):
4141
"mogdb",
4242
"hologres",
4343
"maxcompute",
44+
"gaussdb",
45+
"tdsqlmysql",
46+
"tdsqlpg",
47+
"kingbasees",
48+
"gbase8c",
49+
"yashandb",
50+
"gbase8a",
51+
"gaussdbdws",
4452
"dap",
4553
]
4654
]

src/asktable/types/datasource_retrieve_response.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ class DatasourceRetrieveResponse(BaseModel):
9595
"mogdb",
9696
"hologres",
9797
"maxcompute",
98+
"gaussdb",
99+
"tdsqlmysql",
100+
"tdsqlpg",
101+
"kingbasees",
102+
"gbase8c",
103+
"yashandb",
104+
"gbase8a",
105+
"gaussdbdws",
98106
"dap",
99107
]
100108
"""数据源引擎"""

src/asktable/types/datasource_update_params.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ class DatasourceUpdateParams(TypedDict, total=False):
4646
"mogdb",
4747
"hologres",
4848
"maxcompute",
49+
"gaussdb",
50+
"tdsqlmysql",
51+
"tdsqlpg",
52+
"kingbasees",
53+
"gbase8c",
54+
"yashandb",
55+
"gbase8a",
56+
"gaussdbdws",
4957
"dap",
5058
]
5159
]

tests/api_resources/chats/test_messages.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,22 @@ class TestMessages:
2626
def test_method_create(self, client: Asktable) -> None:
2727
message = client.chats.messages.create(
2828
chat_id="chat_id",
29-
question="question",
29+
)
30+
assert_matches_type(MessageCreateResponse, message, path=["response"])
31+
32+
@parametrize
33+
def test_method_create_with_all_params(self, client: Asktable) -> None:
34+
message = client.chats.messages.create(
35+
chat_id="chat_id",
36+
query_question="question",
37+
body_question="question",
3038
)
3139
assert_matches_type(MessageCreateResponse, message, path=["response"])
3240

3341
@parametrize
3442
def test_raw_response_create(self, client: Asktable) -> None:
3543
response = client.chats.messages.with_raw_response.create(
3644
chat_id="chat_id",
37-
question="question",
3845
)
3946

4047
assert response.is_closed is True
@@ -46,7 +53,6 @@ def test_raw_response_create(self, client: Asktable) -> None:
4653
def test_streaming_response_create(self, client: Asktable) -> None:
4754
with client.chats.messages.with_streaming_response.create(
4855
chat_id="chat_id",
49-
question="question",
5056
) as response:
5157
assert not response.is_closed
5258
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -61,7 +67,6 @@ def test_path_params_create(self, client: Asktable) -> None:
6167
with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"):
6268
client.chats.messages.with_raw_response.create(
6369
chat_id="",
64-
question="question",
6570
)
6671

6772
@parametrize
@@ -169,15 +174,22 @@ class TestAsyncMessages:
169174
async def test_method_create(self, async_client: AsyncAsktable) -> None:
170175
message = await async_client.chats.messages.create(
171176
chat_id="chat_id",
172-
question="question",
177+
)
178+
assert_matches_type(MessageCreateResponse, message, path=["response"])
179+
180+
@parametrize
181+
async def test_method_create_with_all_params(self, async_client: AsyncAsktable) -> None:
182+
message = await async_client.chats.messages.create(
183+
chat_id="chat_id",
184+
query_question="question",
185+
body_question="question",
173186
)
174187
assert_matches_type(MessageCreateResponse, message, path=["response"])
175188

176189
@parametrize
177190
async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
178191
response = await async_client.chats.messages.with_raw_response.create(
179192
chat_id="chat_id",
180-
question="question",
181193
)
182194

183195
assert response.is_closed is True
@@ -189,7 +201,6 @@ async def test_raw_response_create(self, async_client: AsyncAsktable) -> None:
189201
async def test_streaming_response_create(self, async_client: AsyncAsktable) -> None:
190202
async with async_client.chats.messages.with_streaming_response.create(
191203
chat_id="chat_id",
192-
question="question",
193204
) as response:
194205
assert not response.is_closed
195206
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:
204215
with pytest.raises(ValueError, match=r"Expected a non-empty value for `chat_id` but received ''"):
205216
await async_client.chats.messages.with_raw_response.create(
206217
chat_id="",
207-
question="question",
208218
)
209219

210220
@parametrize

0 commit comments

Comments
 (0)