22
33from __future__ import annotations
44
5- from typing import Any , Dict , Union , Optional , cast
5+ from typing import Dict , Union , Optional
66
77import httpx
88
9- from ...types import chat_list_params , chat_create_params , chat_send_message_params
9+ from ...types import chat_list_params , chat_create_params
1010from ..._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
1111from ..._utils import (
1212 maybe_transform ,
3232from ...types .chat import Chat
3333from ..._base_client import AsyncPaginator , make_request_options
3434from ...types .chat_retrieve_response import ChatRetrieveResponse
35- from ...types .chat_send_message_response import ChatSendMessageResponse
3635
3736__all__ = ["ChatsResource" , "AsyncChatsResource" ]
3837
@@ -232,49 +231,6 @@ def delete(
232231 cast_to = NoneType ,
233232 )
234233
235- def send_message (
236- self ,
237- chat_id : str ,
238- * ,
239- question : str ,
240- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
241- # The extra values given here take precedence over values defined on the client or passed to this method.
242- extra_headers : Headers | None = None ,
243- extra_query : Query | None = None ,
244- extra_body : Body | None = None ,
245- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
246- ) -> ChatSendMessageResponse :
247- """
248- 发消息
249-
250- Args:
251- extra_headers: Send extra headers
252-
253- extra_query: Add additional query parameters to the request
254-
255- extra_body: Add additional JSON properties to the request
256-
257- timeout: Override the client-level default timeout for this request, in seconds
258- """
259- if not chat_id :
260- raise ValueError (f"Expected a non-empty value for `chat_id` but received { chat_id !r} " )
261- return cast (
262- ChatSendMessageResponse ,
263- self ._post (
264- f"/chats/{ chat_id } " ,
265- options = make_request_options (
266- extra_headers = extra_headers ,
267- extra_query = extra_query ,
268- extra_body = extra_body ,
269- timeout = timeout ,
270- query = maybe_transform ({"question" : question }, chat_send_message_params .ChatSendMessageParams ),
271- ),
272- cast_to = cast (
273- Any , ChatSendMessageResponse
274- ), # Union types cannot be passed in as arguments in the type system
275- ),
276- )
277-
278234
279235class AsyncChatsResource (AsyncAPIResource ):
280236 @cached_property
@@ -471,51 +427,6 @@ async def delete(
471427 cast_to = NoneType ,
472428 )
473429
474- async def send_message (
475- self ,
476- chat_id : str ,
477- * ,
478- question : str ,
479- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
480- # The extra values given here take precedence over values defined on the client or passed to this method.
481- extra_headers : Headers | None = None ,
482- extra_query : Query | None = None ,
483- extra_body : Body | None = None ,
484- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
485- ) -> ChatSendMessageResponse :
486- """
487- 发消息
488-
489- Args:
490- extra_headers: Send extra headers
491-
492- extra_query: Add additional query parameters to the request
493-
494- extra_body: Add additional JSON properties to the request
495-
496- timeout: Override the client-level default timeout for this request, in seconds
497- """
498- if not chat_id :
499- raise ValueError (f"Expected a non-empty value for `chat_id` but received { chat_id !r} " )
500- return cast (
501- ChatSendMessageResponse ,
502- await self ._post (
503- f"/chats/{ chat_id } " ,
504- options = make_request_options (
505- extra_headers = extra_headers ,
506- extra_query = extra_query ,
507- extra_body = extra_body ,
508- timeout = timeout ,
509- query = await async_maybe_transform (
510- {"question" : question }, chat_send_message_params .ChatSendMessageParams
511- ),
512- ),
513- cast_to = cast (
514- Any , ChatSendMessageResponse
515- ), # Union types cannot be passed in as arguments in the type system
516- ),
517- )
518-
519430
520431class ChatsResourceWithRawResponse :
521432 def __init__ (self , chats : ChatsResource ) -> None :
@@ -533,9 +444,6 @@ def __init__(self, chats: ChatsResource) -> None:
533444 self .delete = to_raw_response_wrapper (
534445 chats .delete ,
535446 )
536- self .send_message = to_raw_response_wrapper (
537- chats .send_message ,
538- )
539447
540448 @cached_property
541449 def messages (self ) -> MessagesResourceWithRawResponse :
@@ -558,9 +466,6 @@ def __init__(self, chats: AsyncChatsResource) -> None:
558466 self .delete = async_to_raw_response_wrapper (
559467 chats .delete ,
560468 )
561- self .send_message = async_to_raw_response_wrapper (
562- chats .send_message ,
563- )
564469
565470 @cached_property
566471 def messages (self ) -> AsyncMessagesResourceWithRawResponse :
@@ -583,9 +488,6 @@ def __init__(self, chats: ChatsResource) -> None:
583488 self .delete = to_streamed_response_wrapper (
584489 chats .delete ,
585490 )
586- self .send_message = to_streamed_response_wrapper (
587- chats .send_message ,
588- )
589491
590492 @cached_property
591493 def messages (self ) -> MessagesResourceWithStreamingResponse :
@@ -608,9 +510,6 @@ def __init__(self, chats: AsyncChatsResource) -> None:
608510 self .delete = async_to_streamed_response_wrapper (
609511 chats .delete ,
610512 )
611- self .send_message = async_to_streamed_response_wrapper (
612- chats .send_message ,
613- )
614513
615514 @cached_property
616515 def messages (self ) -> AsyncMessagesResourceWithStreamingResponse :
0 commit comments