zep-cloud 2.2.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/PKG-INFO +1 -1
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/pyproject.toml +5 -7
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/__init__.py +4 -4
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/client_wrapper.py +1 -1
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/http_client.py +96 -56
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/jsonable_encoder.py +3 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/request_options.py +2 -2
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/document/client.py +559 -383
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/client.py +60 -36
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/edge/client.py +132 -80
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/episode/client.py +204 -56
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/node/client.py +101 -61
- zep_cloud-2.4.0/src/zep_cloud/group/client.py +620 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/memory/client.py +719 -443
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/__init__.py +4 -4
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/group.py +3 -0
- zep_cloud-2.4.0/src/zep_cloud/types/group_list_response.py +32 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/memory.py +2 -1
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/session.py +2 -2
- zep_cloud-2.4.0/src/zep_cloud/types/user_node_response.py +30 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/user/client.py +317 -128
- zep_cloud-2.2.0/src/zep_cloud/group/client.py +0 -262
- zep_cloud-2.2.0/src/zep_cloud/types/apidata_fact_rating_examples.py +0 -31
- zep_cloud-2.2.0/src/zep_cloud/types/apidata_fact_rating_instruction.py +0 -45
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/LICENSE +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/README.md +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/base_client.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/client.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/api_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/datetime_utils.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/file.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/pydantic_utilities.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/query_encoder.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/core/remove_none_from_dict.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/document/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/environment.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/errors/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/errors/bad_request_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/errors/conflict_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/errors/internal_server_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/errors/not_found_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/errors/unauthorized_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/external_clients/document.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/external_clients/memory.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/external_clients/user.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/extractor/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/extractor/models.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/edge/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/episode/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/graph/node/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/group/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/memory/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/py.typed +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/add_memory_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/api_error.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/apidata_document.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/apidata_document_collection.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/apidata_document_search_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/apidata_document_with_score.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/classify_session_request.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/create_document_request.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/end_session_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/end_sessions_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/entity_edge.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/entity_node.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/episode.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/episode_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/fact.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/fact_rating_examples.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/fact_rating_instruction.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/fact_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/facts_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/graph_data_type.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/graph_search_results.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/graph_search_scope.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/memory_search_result.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/message.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/message_list_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/new_fact.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/question.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/reranker.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/role_type.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/search_scope.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/search_type.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/session_classification.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/session_list_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/session_search_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/session_search_result.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/success_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/summary.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/summary_list_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/update_document_list_request.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/user.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/types/user_list_response.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/user/__init__.py +0 -0
- {zep_cloud-2.2.0 → zep_cloud-2.4.0}/src/zep_cloud/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "zep-cloud"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.4.0"
|
|
4
4
|
description = ""
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = []
|
|
@@ -17,12 +17,10 @@ mypy = "1.9.0"
|
|
|
17
17
|
pytest = "^7.4.0"
|
|
18
18
|
pytest-asyncio = "^0.23.5"
|
|
19
19
|
python-dateutil = "^2.9.0"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
langchain-openai = "^0.
|
|
23
|
-
|
|
24
|
-
ruff = "^0.4.8"
|
|
25
|
-
ipykernel = "^6.29.4"
|
|
20
|
+
black = "^24.10.0"
|
|
21
|
+
ruff = "^0.9.3"
|
|
22
|
+
langchain-openai = "^0.3.2"
|
|
23
|
+
langgraph = "^0.2.67"
|
|
26
24
|
|
|
27
25
|
[tool.pytest.ini_options]
|
|
28
26
|
testpaths = ["tests"]
|
|
@@ -7,8 +7,6 @@ from .types import (
|
|
|
7
7
|
ApidataDocumentCollection,
|
|
8
8
|
ApidataDocumentSearchResponse,
|
|
9
9
|
ApidataDocumentWithScore,
|
|
10
|
-
ApidataFactRatingExamples,
|
|
11
|
-
ApidataFactRatingInstruction,
|
|
12
10
|
ClassifySessionRequest,
|
|
13
11
|
CreateDocumentRequest,
|
|
14
12
|
EndSessionResponse,
|
|
@@ -26,6 +24,7 @@ from .types import (
|
|
|
26
24
|
GraphSearchResults,
|
|
27
25
|
GraphSearchScope,
|
|
28
26
|
Group,
|
|
27
|
+
GroupListResponse,
|
|
29
28
|
Memory,
|
|
30
29
|
MemorySearchResult,
|
|
31
30
|
Message,
|
|
@@ -47,6 +46,7 @@ from .types import (
|
|
|
47
46
|
UpdateDocumentListRequest,
|
|
48
47
|
User,
|
|
49
48
|
UserListResponse,
|
|
49
|
+
UserNodeResponse,
|
|
50
50
|
)
|
|
51
51
|
from .errors import BadRequestError, ConflictError, InternalServerError, NotFoundError, UnauthorizedError
|
|
52
52
|
from . import document, graph, group, memory, user
|
|
@@ -60,8 +60,6 @@ __all__ = [
|
|
|
60
60
|
"ApidataDocumentCollection",
|
|
61
61
|
"ApidataDocumentSearchResponse",
|
|
62
62
|
"ApidataDocumentWithScore",
|
|
63
|
-
"ApidataFactRatingExamples",
|
|
64
|
-
"ApidataFactRatingInstruction",
|
|
65
63
|
"BadRequestError",
|
|
66
64
|
"ClassifySessionRequest",
|
|
67
65
|
"ConflictError",
|
|
@@ -81,6 +79,7 @@ __all__ = [
|
|
|
81
79
|
"GraphSearchResults",
|
|
82
80
|
"GraphSearchScope",
|
|
83
81
|
"Group",
|
|
82
|
+
"GroupListResponse",
|
|
84
83
|
"InternalServerError",
|
|
85
84
|
"Memory",
|
|
86
85
|
"MemorySearchResult",
|
|
@@ -105,6 +104,7 @@ __all__ = [
|
|
|
105
104
|
"UpdateDocumentListRequest",
|
|
106
105
|
"User",
|
|
107
106
|
"UserListResponse",
|
|
107
|
+
"UserNodeResponse",
|
|
108
108
|
"ZepEnvironment",
|
|
109
109
|
"__version__",
|
|
110
110
|
"document",
|
|
@@ -17,7 +17,7 @@ class BaseClientWrapper:
|
|
|
17
17
|
headers: typing.Dict[str, str] = {
|
|
18
18
|
"X-Fern-Language": "Python",
|
|
19
19
|
"X-Fern-SDK-Name": "zep-cloud",
|
|
20
|
-
"X-Fern-SDK-Version": "2.
|
|
20
|
+
"X-Fern-SDK-Version": "2.4.0",
|
|
21
21
|
}
|
|
22
22
|
headers["Authorization"] = f"Api-Key {self.api_key}"
|
|
23
23
|
return headers
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import email.utils
|
|
5
|
+
import json
|
|
5
6
|
import re
|
|
6
7
|
import time
|
|
7
8
|
import typing
|
|
@@ -106,14 +107,18 @@ def maybe_filter_request_body(
|
|
|
106
107
|
omit: typing.Optional[typing.Any],
|
|
107
108
|
) -> typing.Optional[typing.Any]:
|
|
108
109
|
if data is None:
|
|
109
|
-
return
|
|
110
|
+
return (
|
|
111
|
+
jsonable_encoder(request_options.get("additional_body_parameters", {})) or {}
|
|
112
|
+
if request_options is not None
|
|
113
|
+
else None
|
|
114
|
+
)
|
|
110
115
|
elif not isinstance(data, typing.Mapping):
|
|
111
116
|
data_content = jsonable_encoder(data)
|
|
112
117
|
else:
|
|
113
118
|
data_content = {
|
|
114
119
|
**(jsonable_encoder(remove_omit_from_dict(data, omit))), # type: ignore
|
|
115
120
|
**(
|
|
116
|
-
jsonable_encoder(request_options.get("additional_body_parameters", {}))
|
|
121
|
+
jsonable_encoder(request_options.get("additional_body_parameters", {})) or {}
|
|
117
122
|
if request_options is not None
|
|
118
123
|
else {}
|
|
119
124
|
),
|
|
@@ -121,6 +126,25 @@ def maybe_filter_request_body(
|
|
|
121
126
|
return data_content
|
|
122
127
|
|
|
123
128
|
|
|
129
|
+
# Abstracted out for testing purposes
|
|
130
|
+
def get_request_body(
|
|
131
|
+
*,
|
|
132
|
+
json: typing.Optional[typing.Any],
|
|
133
|
+
data: typing.Optional[typing.Any],
|
|
134
|
+
request_options: typing.Optional[RequestOptions],
|
|
135
|
+
omit: typing.Optional[typing.Any],
|
|
136
|
+
) -> typing.Tuple[typing.Optional[typing.Any], typing.Optional[typing.Any]]:
|
|
137
|
+
json_body = None
|
|
138
|
+
data_body = None
|
|
139
|
+
if data is not None:
|
|
140
|
+
data_body = maybe_filter_request_body(data, request_options, omit)
|
|
141
|
+
else:
|
|
142
|
+
# If both data and json are None, we send json data in the event extra properties are specified
|
|
143
|
+
json_body = maybe_filter_request_body(json, request_options, omit)
|
|
144
|
+
|
|
145
|
+
return json_body, data_body
|
|
146
|
+
|
|
147
|
+
|
|
124
148
|
class HttpClient:
|
|
125
149
|
def __init__(
|
|
126
150
|
self,
|
|
@@ -151,7 +175,7 @@ class HttpClient:
|
|
|
151
175
|
json: typing.Optional[typing.Any] = None,
|
|
152
176
|
data: typing.Optional[typing.Any] = None,
|
|
153
177
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
|
154
|
-
files: typing.Optional[typing.Dict[str, typing.Union[File, typing.List[File]]]] = None,
|
|
178
|
+
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
155
179
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
156
180
|
request_options: typing.Optional[RequestOptions] = None,
|
|
157
181
|
retries: int = 0,
|
|
@@ -164,6 +188,8 @@ class HttpClient:
|
|
|
164
188
|
else self.base_timeout
|
|
165
189
|
)
|
|
166
190
|
|
|
191
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
192
|
+
|
|
167
193
|
response = self.httpx_client.request(
|
|
168
194
|
method=method,
|
|
169
195
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
|
@@ -172,27 +198,29 @@ class HttpClient:
|
|
|
172
198
|
{
|
|
173
199
|
**self.base_headers,
|
|
174
200
|
**(headers if headers is not None else {}),
|
|
175
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
|
201
|
+
**(request_options.get("additional_headers", {}) or {} if request_options is not None else {}),
|
|
176
202
|
}
|
|
177
203
|
)
|
|
178
204
|
),
|
|
179
205
|
params=encode_query(
|
|
180
206
|
jsonable_encoder(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
207
|
+
remove_none_from_dict(
|
|
208
|
+
remove_omit_from_dict(
|
|
209
|
+
{
|
|
210
|
+
**(params if params is not None else {}),
|
|
211
|
+
**(
|
|
212
|
+
request_options.get("additional_query_parameters", {}) or {}
|
|
213
|
+
if request_options is not None
|
|
214
|
+
else {}
|
|
215
|
+
),
|
|
216
|
+
},
|
|
217
|
+
omit,
|
|
218
|
+
)
|
|
191
219
|
)
|
|
192
220
|
)
|
|
193
221
|
),
|
|
194
|
-
json=
|
|
195
|
-
data=
|
|
222
|
+
json=json_body,
|
|
223
|
+
data=data_body,
|
|
196
224
|
content=content,
|
|
197
225
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
198
226
|
timeout=timeout,
|
|
@@ -229,7 +257,7 @@ class HttpClient:
|
|
|
229
257
|
json: typing.Optional[typing.Any] = None,
|
|
230
258
|
data: typing.Optional[typing.Any] = None,
|
|
231
259
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
|
232
|
-
files: typing.Optional[typing.Dict[str, typing.Union[File, typing.List[File]]]] = None,
|
|
260
|
+
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
233
261
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
234
262
|
request_options: typing.Optional[RequestOptions] = None,
|
|
235
263
|
retries: int = 0,
|
|
@@ -242,6 +270,8 @@ class HttpClient:
|
|
|
242
270
|
else self.base_timeout
|
|
243
271
|
)
|
|
244
272
|
|
|
273
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
274
|
+
|
|
245
275
|
with self.httpx_client.stream(
|
|
246
276
|
method=method,
|
|
247
277
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
|
@@ -256,21 +286,23 @@ class HttpClient:
|
|
|
256
286
|
),
|
|
257
287
|
params=encode_query(
|
|
258
288
|
jsonable_encoder(
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
289
|
+
remove_none_from_dict(
|
|
290
|
+
remove_omit_from_dict(
|
|
291
|
+
{
|
|
292
|
+
**(params if params is not None else {}),
|
|
293
|
+
**(
|
|
294
|
+
request_options.get("additional_query_parameters", {})
|
|
295
|
+
if request_options is not None
|
|
296
|
+
else {}
|
|
297
|
+
),
|
|
298
|
+
},
|
|
299
|
+
omit,
|
|
300
|
+
)
|
|
269
301
|
)
|
|
270
302
|
)
|
|
271
303
|
),
|
|
272
|
-
json=
|
|
273
|
-
data=
|
|
304
|
+
json=json_body,
|
|
305
|
+
data=data_body,
|
|
274
306
|
content=content,
|
|
275
307
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
276
308
|
timeout=timeout,
|
|
@@ -308,7 +340,7 @@ class AsyncHttpClient:
|
|
|
308
340
|
json: typing.Optional[typing.Any] = None,
|
|
309
341
|
data: typing.Optional[typing.Any] = None,
|
|
310
342
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
|
311
|
-
files: typing.Optional[typing.Dict[str, typing.Union[File, typing.List[File]]]] = None,
|
|
343
|
+
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
312
344
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
313
345
|
request_options: typing.Optional[RequestOptions] = None,
|
|
314
346
|
retries: int = 0,
|
|
@@ -321,6 +353,8 @@ class AsyncHttpClient:
|
|
|
321
353
|
else self.base_timeout
|
|
322
354
|
)
|
|
323
355
|
|
|
356
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
357
|
+
|
|
324
358
|
# Add the input to each of these and do None-safety checks
|
|
325
359
|
response = await self.httpx_client.request(
|
|
326
360
|
method=method,
|
|
@@ -330,27 +364,29 @@ class AsyncHttpClient:
|
|
|
330
364
|
{
|
|
331
365
|
**self.base_headers,
|
|
332
366
|
**(headers if headers is not None else {}),
|
|
333
|
-
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
|
367
|
+
**(request_options.get("additional_headers", {}) or {} if request_options is not None else {}),
|
|
334
368
|
}
|
|
335
369
|
)
|
|
336
370
|
),
|
|
337
371
|
params=encode_query(
|
|
338
372
|
jsonable_encoder(
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
373
|
+
remove_none_from_dict(
|
|
374
|
+
remove_omit_from_dict(
|
|
375
|
+
{
|
|
376
|
+
**(params if params is not None else {}),
|
|
377
|
+
**(
|
|
378
|
+
request_options.get("additional_query_parameters", {}) or {}
|
|
379
|
+
if request_options is not None
|
|
380
|
+
else {}
|
|
381
|
+
),
|
|
382
|
+
},
|
|
383
|
+
omit,
|
|
384
|
+
)
|
|
349
385
|
)
|
|
350
386
|
)
|
|
351
387
|
),
|
|
352
|
-
json=
|
|
353
|
-
data=
|
|
388
|
+
json=json_body,
|
|
389
|
+
data=data_body,
|
|
354
390
|
content=content,
|
|
355
391
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
356
392
|
timeout=timeout,
|
|
@@ -386,7 +422,7 @@ class AsyncHttpClient:
|
|
|
386
422
|
json: typing.Optional[typing.Any] = None,
|
|
387
423
|
data: typing.Optional[typing.Any] = None,
|
|
388
424
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
|
389
|
-
files: typing.Optional[typing.Dict[str, typing.Union[File, typing.List[File]]]] = None,
|
|
425
|
+
files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None,
|
|
390
426
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
|
391
427
|
request_options: typing.Optional[RequestOptions] = None,
|
|
392
428
|
retries: int = 0,
|
|
@@ -399,6 +435,8 @@ class AsyncHttpClient:
|
|
|
399
435
|
else self.base_timeout
|
|
400
436
|
)
|
|
401
437
|
|
|
438
|
+
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
|
439
|
+
|
|
402
440
|
async with self.httpx_client.stream(
|
|
403
441
|
method=method,
|
|
404
442
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
|
@@ -413,21 +451,23 @@ class AsyncHttpClient:
|
|
|
413
451
|
),
|
|
414
452
|
params=encode_query(
|
|
415
453
|
jsonable_encoder(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
454
|
+
remove_none_from_dict(
|
|
455
|
+
remove_omit_from_dict(
|
|
456
|
+
{
|
|
457
|
+
**(params if params is not None else {}),
|
|
458
|
+
**(
|
|
459
|
+
request_options.get("additional_query_parameters", {})
|
|
460
|
+
if request_options is not None
|
|
461
|
+
else {}
|
|
462
|
+
),
|
|
463
|
+
},
|
|
464
|
+
omit=omit,
|
|
465
|
+
)
|
|
426
466
|
)
|
|
427
467
|
)
|
|
428
468
|
),
|
|
429
|
-
json=
|
|
430
|
-
data=
|
|
469
|
+
json=json_body,
|
|
470
|
+
data=data_body,
|
|
431
471
|
content=content,
|
|
432
472
|
files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None,
|
|
433
473
|
timeout=timeout,
|
|
@@ -8,6 +8,7 @@ Taken from FastAPI, and made a bit simpler
|
|
|
8
8
|
https://github.com/tiangolo/fastapi/blob/master/fastapi/encoders.py
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
+
import base64
|
|
11
12
|
import dataclasses
|
|
12
13
|
import datetime as dt
|
|
13
14
|
from collections import defaultdict
|
|
@@ -55,6 +56,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
|
|
|
55
56
|
if dataclasses.is_dataclass(obj):
|
|
56
57
|
obj_dict = dataclasses.asdict(obj)
|
|
57
58
|
return jsonable_encoder(obj_dict, custom_encoder=custom_encoder)
|
|
59
|
+
if isinstance(obj, bytes):
|
|
60
|
+
return base64.b64encode(obj).decode("utf-8")
|
|
58
61
|
if isinstance(obj, Enum):
|
|
59
62
|
return obj.value
|
|
60
63
|
if isinstance(obj, PurePath):
|
|
@@ -5,10 +5,10 @@ import typing
|
|
|
5
5
|
try:
|
|
6
6
|
from typing import NotRequired # type: ignore
|
|
7
7
|
except ImportError:
|
|
8
|
-
from typing_extensions import NotRequired
|
|
8
|
+
from typing_extensions import NotRequired
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class RequestOptions(typing.TypedDict):
|
|
11
|
+
class RequestOptions(typing.TypedDict, total=False):
|
|
12
12
|
"""
|
|
13
13
|
Additional options for request-specific configuration when calling APIs via the SDK.
|
|
14
14
|
This is used primarily as an optional final parameter for service functions.
|