-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathapi_create_message.py
More file actions
93 lines (80 loc) · 2.59 KB
/
Copy pathapi_create_message.py
File metadata and controls
93 lines (80 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- coding: utf-8 -*-
# api_create_message.py
"""
This script is automatically generated for TaskingAI python client
Do not modify the file manually
Author: James Yao
Organization: TaskingAI
License: Apache 2.0
"""
from ..utils import get_api_client
from ..models import MessageCreateRequest, MessageCreateResponse
__all__ = ["api_create_message", "async_api_create_message"]
def api_create_message(
assistant_id: str,
chat_id: str,
payload: MessageCreateRequest,
**kwargs,
) -> MessageCreateResponse:
# get api client
sync_api_client = get_api_client(async_client=False)
# request parameters
path_params_dict = {
"assistant_id": assistant_id,
"chat_id": chat_id,
}
query_params_dict = {}
header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])}
body_params_dict = payload.model_dump()
files_dict = {}
# execute the request
return sync_api_client.call_api(
resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages",
method="POST",
path_params=path_params_dict,
query_params=query_params_dict,
header_params=header_params_dict,
body=body_params_dict,
post_params=[],
files=files_dict,
response_type=MessageCreateResponse,
auth_settings=[],
_return_http_data_only=True,
_preload_content=True,
_request_timeout=kwargs.get("timeout"),
collection_formats={},
)
async def async_api_create_message(
assistant_id: str,
chat_id: str,
payload: MessageCreateRequest,
**kwargs,
) -> MessageCreateResponse:
# get api client
async_api_client = get_api_client(async_client=True)
# request parameters
path_params_dict = {
"assistant_id": assistant_id,
"chat_id": chat_id,
}
query_params_dict = {}
header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])}
body_params_dict = payload.model_dump()
files_dict = {}
# execute the request
return await async_api_client.call_api(
resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages",
method="POST",
path_params=path_params_dict,
query_params=query_params_dict,
header_params=header_params_dict,
body=body_params_dict,
post_params=[],
files=files_dict,
response_type=MessageCreateResponse,
auth_settings=[],
_return_http_data_only=True,
_preload_content=True,
_request_timeout=kwargs.get("timeout"),
collection_formats={},
)