vikingdb-python-sdk 0.1.29__tar.gz → 0.1.32__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.
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/PKG-INFO +26 -1
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/README.md +25 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/_client.py +33 -1
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/client.py +9 -5
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/collection.py +16 -16
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/memory/client.py +4 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/memory/collection.py +28 -28
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/client.py +8 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/version.py +1 -1
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/PKG-INFO +26 -1
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/LICENSE.txt +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/pyproject.toml +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/setup.cfg +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/__init__.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/auth.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/exceptions.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/__init__.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/exceptions.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/__init__.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/base.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/chat.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/doc.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/point.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/rerank.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/search.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/service_chat.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/memory/__init__.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/memory/exceptions.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/memory/types.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/request_options.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/__init__.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/base.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/collection.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/embedding.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/exceptions.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/index.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/__init__.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/base.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/collection.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/embedding.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/index.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/rerank.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/rerank.py +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/SOURCES.txt +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/dependency_links.txt +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/requires.txt +0 -0
- {vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vikingdb-python-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.32
|
|
4
4
|
Summary: vikingdb Python SDK
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://github.com/volcengine/vikingdb-python-sdk/blob/main/README.md
|
|
@@ -64,6 +64,8 @@ client = VikingDB(
|
|
|
64
64
|
auth=auth,
|
|
65
65
|
scheme="https",
|
|
66
66
|
timeout=30,
|
|
67
|
+
pool_connections=20,
|
|
68
|
+
pool_maxsize=50,
|
|
67
69
|
)
|
|
68
70
|
index = client.index(
|
|
69
71
|
collection_name=os.environ["VIKINGDB_COLLECTION"],
|
|
@@ -85,6 +87,8 @@ client = VikingMem(
|
|
|
85
87
|
region="cn-beijing",
|
|
86
88
|
auth=auth,
|
|
87
89
|
scheme="http",
|
|
90
|
+
pool_connections=20,
|
|
91
|
+
pool_maxsize=50,
|
|
88
92
|
)
|
|
89
93
|
|
|
90
94
|
# Get collection
|
|
@@ -132,6 +136,8 @@ client = VikingKnowledge(
|
|
|
132
136
|
host="api-knowledgebase.mlp.cn-beijing.volces.com",
|
|
133
137
|
region="cn-beijing",
|
|
134
138
|
scheme="http",
|
|
139
|
+
pool_connections=20,
|
|
140
|
+
pool_maxsize=50,
|
|
135
141
|
)
|
|
136
142
|
|
|
137
143
|
collection = client.collection(
|
|
@@ -149,6 +155,25 @@ print(f"request_id={resp.request_id} hits={len(resp.result.result_list or [])}")
|
|
|
149
155
|
svc_client = VikingKnowledge(auth=APIKey(api_key=os.getenv("VIKING_SERVICE_API_KEY")))
|
|
150
156
|
```
|
|
151
157
|
|
|
158
|
+
### Connection Pool Tuning
|
|
159
|
+
|
|
160
|
+
For high-concurrency synchronous workloads, the client constructors support
|
|
161
|
+
`pool_connections` and `pool_maxsize` and pass them through to
|
|
162
|
+
the underlying `requests` `HTTPAdapter`.
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
client = VikingDB(
|
|
166
|
+
host=os.environ["VIKINGDB_HOST"],
|
|
167
|
+
region=os.environ["VIKINGDB_REGION"],
|
|
168
|
+
auth=auth,
|
|
169
|
+
pool_connections=20,
|
|
170
|
+
pool_maxsize=50,
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- `pool_connections`: number of cached connection pools
|
|
175
|
+
- `pool_maxsize`: max reusable connections per host
|
|
176
|
+
|
|
152
177
|
### Example Guides
|
|
153
178
|
|
|
154
179
|
#### Vector Examples
|
|
@@ -36,6 +36,8 @@ client = VikingDB(
|
|
|
36
36
|
auth=auth,
|
|
37
37
|
scheme="https",
|
|
38
38
|
timeout=30,
|
|
39
|
+
pool_connections=20,
|
|
40
|
+
pool_maxsize=50,
|
|
39
41
|
)
|
|
40
42
|
index = client.index(
|
|
41
43
|
collection_name=os.environ["VIKINGDB_COLLECTION"],
|
|
@@ -57,6 +59,8 @@ client = VikingMem(
|
|
|
57
59
|
region="cn-beijing",
|
|
58
60
|
auth=auth,
|
|
59
61
|
scheme="http",
|
|
62
|
+
pool_connections=20,
|
|
63
|
+
pool_maxsize=50,
|
|
60
64
|
)
|
|
61
65
|
|
|
62
66
|
# Get collection
|
|
@@ -104,6 +108,8 @@ client = VikingKnowledge(
|
|
|
104
108
|
host="api-knowledgebase.mlp.cn-beijing.volces.com",
|
|
105
109
|
region="cn-beijing",
|
|
106
110
|
scheme="http",
|
|
111
|
+
pool_connections=20,
|
|
112
|
+
pool_maxsize=50,
|
|
107
113
|
)
|
|
108
114
|
|
|
109
115
|
collection = client.collection(
|
|
@@ -121,6 +127,25 @@ print(f"request_id={resp.request_id} hits={len(resp.result.result_list or [])}")
|
|
|
121
127
|
svc_client = VikingKnowledge(auth=APIKey(api_key=os.getenv("VIKING_SERVICE_API_KEY")))
|
|
122
128
|
```
|
|
123
129
|
|
|
130
|
+
### Connection Pool Tuning
|
|
131
|
+
|
|
132
|
+
For high-concurrency synchronous workloads, the client constructors support
|
|
133
|
+
`pool_connections` and `pool_maxsize` and pass them through to
|
|
134
|
+
the underlying `requests` `HTTPAdapter`.
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
client = VikingDB(
|
|
138
|
+
host=os.environ["VIKINGDB_HOST"],
|
|
139
|
+
region=os.environ["VIKINGDB_REGION"],
|
|
140
|
+
auth=auth,
|
|
141
|
+
pool_connections=20,
|
|
142
|
+
pool_maxsize=50,
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- `pool_connections`: number of cached connection pools
|
|
147
|
+
- `pool_maxsize`: max reusable connections per host
|
|
148
|
+
|
|
124
149
|
### Example Guides
|
|
125
150
|
|
|
126
151
|
#### Vector Examples
|
|
@@ -17,6 +17,7 @@ from volcengine.ServiceInfo import ServiceInfo
|
|
|
17
17
|
from volcengine.base.Request import Request
|
|
18
18
|
from volcengine.base.Service import Service
|
|
19
19
|
import requests
|
|
20
|
+
from requests.adapters import HTTPAdapter
|
|
20
21
|
|
|
21
22
|
from .auth import Auth, IAM, APIKey, HeaderAuth
|
|
22
23
|
from .exceptions import (
|
|
@@ -26,6 +27,8 @@ from .exceptions import (
|
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
_REQUEST_ID_HEADER = "X-Tt-Logid"
|
|
30
|
+
_DEFAULT_POOL_CONNECTIONS = 10
|
|
31
|
+
_DEFAULT_POOL_MAXSIZE = 10
|
|
29
32
|
|
|
30
33
|
|
|
31
34
|
class Client(Service, ABC):
|
|
@@ -41,6 +44,9 @@ class Client(Service, ABC):
|
|
|
41
44
|
sts_token: str = "",
|
|
42
45
|
scheme: str = "http",
|
|
43
46
|
timeout: int = 30,
|
|
47
|
+
pool_connections: int = _DEFAULT_POOL_CONNECTIONS,
|
|
48
|
+
pool_maxsize: int = _DEFAULT_POOL_MAXSIZE,
|
|
49
|
+
pool_block: bool = False,
|
|
44
50
|
):
|
|
45
51
|
self.region = region
|
|
46
52
|
self.service = service
|
|
@@ -57,7 +63,11 @@ class Client(Service, ABC):
|
|
|
57
63
|
if isinstance(auth, (IAM, APIKey, HeaderAuth)):
|
|
58
64
|
# volcengine Service.init() 可能读取环境变量或 ~/.volc/config 覆盖 AK/SK,
|
|
59
65
|
# 这里确保使用用户传入的 IAM 凭证,因此不使用super().__init__初始化
|
|
60
|
-
self.session =
|
|
66
|
+
self.session = self._build_session(
|
|
67
|
+
pool_connections=pool_connections,
|
|
68
|
+
pool_maxsize=pool_maxsize,
|
|
69
|
+
pool_block=pool_block,
|
|
70
|
+
)
|
|
61
71
|
else:
|
|
62
72
|
raise ValueError("auth must be IAM, APIKey or HeaderAuth type")
|
|
63
73
|
|
|
@@ -85,6 +95,28 @@ class Client(Service, ABC):
|
|
|
85
95
|
scheme=scheme,
|
|
86
96
|
)
|
|
87
97
|
|
|
98
|
+
@staticmethod
|
|
99
|
+
def _build_session(
|
|
100
|
+
*,
|
|
101
|
+
pool_connections: int,
|
|
102
|
+
pool_maxsize: int,
|
|
103
|
+
pool_block: bool,
|
|
104
|
+
) -> requests.Session:
|
|
105
|
+
if pool_connections <= 0:
|
|
106
|
+
raise ValueError("pool_connections must be greater than 0")
|
|
107
|
+
if pool_maxsize <= 0:
|
|
108
|
+
raise ValueError("pool_maxsize must be greater than 0")
|
|
109
|
+
|
|
110
|
+
session = requests.session()
|
|
111
|
+
adapter = HTTPAdapter(
|
|
112
|
+
pool_connections=pool_connections,
|
|
113
|
+
pool_maxsize=pool_maxsize,
|
|
114
|
+
pool_block=pool_block,
|
|
115
|
+
)
|
|
116
|
+
session.mount("http://", adapter)
|
|
117
|
+
session.mount("https://", adapter)
|
|
118
|
+
return session
|
|
119
|
+
|
|
88
120
|
def prepare_request(self, api_info: ApiInfo, params: Optional[Mapping[str, Any]], doseq: int = 0):
|
|
89
121
|
"""Prepare a volcengine request without adding implicit headers."""
|
|
90
122
|
request = Request()
|
|
@@ -43,6 +43,8 @@ class VikingKnowledge(Client):
|
|
|
43
43
|
sts_token: str = "",
|
|
44
44
|
scheme: str = "http",
|
|
45
45
|
timeout: int = 30,
|
|
46
|
+
pool_connections: int = 10,
|
|
47
|
+
pool_maxsize: int = 10,
|
|
46
48
|
):
|
|
47
49
|
super().__init__(
|
|
48
50
|
host=host,
|
|
@@ -52,6 +54,8 @@ class VikingKnowledge(Client):
|
|
|
52
54
|
sts_token=sts_token,
|
|
53
55
|
scheme=scheme,
|
|
54
56
|
timeout=timeout,
|
|
57
|
+
pool_connections=pool_connections,
|
|
58
|
+
pool_maxsize=pool_maxsize,
|
|
55
59
|
)
|
|
56
60
|
|
|
57
61
|
def _build_api_info(self):
|
|
@@ -148,7 +152,7 @@ class VikingKnowledge(Client):
|
|
|
148
152
|
payload["rerank_instruction"] = rerank_instruction
|
|
149
153
|
if endpoint_id is not None:
|
|
150
154
|
payload["endpoint_id"] = endpoint_id
|
|
151
|
-
res = self.json_exception("Rerank", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
155
|
+
res = self.json_exception("Rerank", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
152
156
|
response = RerankResponse.parse_with(res)
|
|
153
157
|
return response
|
|
154
158
|
|
|
@@ -166,11 +170,11 @@ class VikingKnowledge(Client):
|
|
|
166
170
|
)
|
|
167
171
|
if bool(payload.get("stream")):
|
|
168
172
|
def _gen():
|
|
169
|
-
for res in self.stream_json_exception("ChatCompletion", {}, json.dumps(payload), headers=headers, timeout=timeout):
|
|
173
|
+
for res in self.stream_json_exception("ChatCompletion", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout):
|
|
170
174
|
yield ChatCompletionResponse.parse_with(res)
|
|
171
175
|
return _gen()
|
|
172
176
|
else:
|
|
173
|
-
res = self.json_exception("ChatCompletion", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
177
|
+
res = self.json_exception("ChatCompletion", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
174
178
|
return ChatCompletionResponse.parse_with(res)
|
|
175
179
|
|
|
176
180
|
def service_chat(
|
|
@@ -187,9 +191,9 @@ class VikingKnowledge(Client):
|
|
|
187
191
|
)
|
|
188
192
|
if bool(payload.get("stream")):
|
|
189
193
|
def _gen():
|
|
190
|
-
for res in self.stream_json_exception("ServiceChat", {}, json.dumps(payload), headers=headers, timeout=timeout):
|
|
194
|
+
for res in self.stream_json_exception("ServiceChat", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout):
|
|
191
195
|
yield ServiceChatResponse.parse_with(res)
|
|
192
196
|
return _gen()
|
|
193
197
|
else:
|
|
194
|
-
res = self.json_exception("ServiceChat", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
198
|
+
res = self.json_exception("ServiceChat", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
195
199
|
return ServiceChatResponse.parse_with(res)
|
|
@@ -47,7 +47,7 @@ class KnowledgeCollection:
|
|
|
47
47
|
else dict(request)
|
|
48
48
|
)
|
|
49
49
|
payload = {**self._meta_payload, **req_payload}
|
|
50
|
-
res = self.client.json_exception("AddDoc", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
50
|
+
res = self.client.json_exception("AddDoc", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
51
51
|
response = AddDocResponse.parse_with(res)
|
|
52
52
|
return response
|
|
53
53
|
|
|
@@ -64,7 +64,7 @@ class KnowledgeCollection:
|
|
|
64
64
|
else dict(request)
|
|
65
65
|
)
|
|
66
66
|
payload = {**self._meta_payload, **req_payload}
|
|
67
|
-
res = self.client.json_exception("AddDocV2", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
67
|
+
res = self.client.json_exception("AddDocV2", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
68
68
|
response = AddDocV2Response.parse_with(res)
|
|
69
69
|
return response
|
|
70
70
|
|
|
@@ -76,7 +76,7 @@ class KnowledgeCollection:
|
|
|
76
76
|
timeout: Optional[int] = None,
|
|
77
77
|
) -> CommonResponse:
|
|
78
78
|
payload = {**self._meta_payload, "doc_id": doc_id}
|
|
79
|
-
res = self.client.json_exception("DeleteDoc", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
79
|
+
res = self.client.json_exception("DeleteDoc", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
80
80
|
response = CommonResponse.model_validate(res)
|
|
81
81
|
return response
|
|
82
82
|
|
|
@@ -91,7 +91,7 @@ class KnowledgeCollection:
|
|
|
91
91
|
payload = {**self._meta_payload, "doc_id": doc_id}
|
|
92
92
|
if return_token_usage:
|
|
93
93
|
payload["return_token_usage"] = True
|
|
94
|
-
res = self.client.json_exception("GetDocInfo", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
94
|
+
res = self.client.json_exception("GetDocInfo", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
95
95
|
data_obj = res["data"] if isinstance(res, dict) and "data" in res else {}
|
|
96
96
|
if not isinstance(data_obj, dict):
|
|
97
97
|
data_obj = {}
|
|
@@ -113,7 +113,7 @@ class KnowledgeCollection:
|
|
|
113
113
|
else dict(request)
|
|
114
114
|
)
|
|
115
115
|
payload: dict = {**self._meta_payload, **req_payload}
|
|
116
|
-
res = self.client.json_exception("ListDocs", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
116
|
+
res = self.client.json_exception("ListDocs", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
117
117
|
response = ListDocsResponse.parse_with(res)
|
|
118
118
|
return response
|
|
119
119
|
|
|
@@ -130,7 +130,7 @@ class KnowledgeCollection:
|
|
|
130
130
|
else dict(request)
|
|
131
131
|
)
|
|
132
132
|
payload: dict = {**self._meta_payload, **req_payload}
|
|
133
|
-
res = self.client.json_exception("ListDocsV2", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
133
|
+
res = self.client.json_exception("ListDocsV2", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
134
134
|
response = ListDocsV2Response.parse_with(res)
|
|
135
135
|
return response
|
|
136
136
|
|
|
@@ -147,7 +147,7 @@ class KnowledgeCollection:
|
|
|
147
147
|
else dict(request)
|
|
148
148
|
)
|
|
149
149
|
payload: dict = {**self._meta_payload, **req_payload}
|
|
150
|
-
res = self.client.json_exception("SearchDocsByFilter", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
150
|
+
res = self.client.json_exception("SearchDocsByFilter", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
151
151
|
response = SearchDocsByFilterResponse.parse_with(res)
|
|
152
152
|
return response
|
|
153
153
|
|
|
@@ -160,7 +160,7 @@ class KnowledgeCollection:
|
|
|
160
160
|
timeout: Optional[int] = None,
|
|
161
161
|
) -> CommonResponse:
|
|
162
162
|
payload = {**self._meta_payload, "doc_id": doc_id, "meta": [item.model_dump(by_alias=True) for item in meta]}
|
|
163
|
-
res = self.client.json_exception("UpdateDocMeta", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
163
|
+
res = self.client.json_exception("UpdateDocMeta", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
164
164
|
response = CommonResponse.model_validate(res)
|
|
165
165
|
return response
|
|
166
166
|
|
|
@@ -173,7 +173,7 @@ class KnowledgeCollection:
|
|
|
173
173
|
timeout: Optional[int] = None,
|
|
174
174
|
) -> CommonResponse:
|
|
175
175
|
payload = {**self._meta_payload, "doc_id": doc_id, "doc_name": doc_name}
|
|
176
|
-
res = self.client.json_exception("UpdateDoc", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
176
|
+
res = self.client.json_exception("UpdateDoc", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
177
177
|
response = CommonResponse.model_validate(res)
|
|
178
178
|
return response
|
|
179
179
|
|
|
@@ -188,7 +188,7 @@ class KnowledgeCollection:
|
|
|
188
188
|
payload = {**self._meta_payload, "point_id": point_id}
|
|
189
189
|
if get_attachment_link:
|
|
190
190
|
payload["get_attachment_link"] = True
|
|
191
|
-
res = self.client.json_exception("GetPointInfo", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
191
|
+
res = self.client.json_exception("GetPointInfo", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
192
192
|
data_obj = res["data"] if isinstance(res, dict) and "data" in res else {}
|
|
193
193
|
if not isinstance(data_obj, dict):
|
|
194
194
|
data_obj = {}
|
|
@@ -210,7 +210,7 @@ class KnowledgeCollection:
|
|
|
210
210
|
else dict(request)
|
|
211
211
|
)
|
|
212
212
|
payload: dict = {**self._meta_payload, **req_payload}
|
|
213
|
-
res = self.client.json_exception("ListPoints", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
213
|
+
res = self.client.json_exception("ListPoints", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
214
214
|
response = ListPointsResponse.parse_with(res)
|
|
215
215
|
return response
|
|
216
216
|
|
|
@@ -227,7 +227,7 @@ class KnowledgeCollection:
|
|
|
227
227
|
else dict(request)
|
|
228
228
|
)
|
|
229
229
|
payload = {**self._meta_payload, **req_payload}
|
|
230
|
-
res = self.client.json_exception("AddPoint", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
230
|
+
res = self.client.json_exception("AddPoint", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
231
231
|
response = PointAddResponse.parse_with(res)
|
|
232
232
|
return response
|
|
233
233
|
|
|
@@ -245,7 +245,7 @@ class KnowledgeCollection:
|
|
|
245
245
|
else dict(update)
|
|
246
246
|
)
|
|
247
247
|
payload = {**self._meta_payload, "point_id": point_id, **upd_payload}
|
|
248
|
-
res = self.client.json_exception("UpdatePoint", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
248
|
+
res = self.client.json_exception("UpdatePoint", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
249
249
|
response = CommonResponse.model_validate(res)
|
|
250
250
|
return response
|
|
251
251
|
|
|
@@ -262,7 +262,7 @@ class KnowledgeCollection:
|
|
|
262
262
|
else dict(request)
|
|
263
263
|
)
|
|
264
264
|
payload = {**self._meta_payload, **req_payload}
|
|
265
|
-
res = self.client.json_exception("DeletePoint", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
265
|
+
res = self.client.json_exception("DeletePoint", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
266
266
|
response = CommonResponse.model_validate(res)
|
|
267
267
|
return response
|
|
268
268
|
|
|
@@ -279,7 +279,7 @@ class KnowledgeCollection:
|
|
|
279
279
|
else dict(request)
|
|
280
280
|
)
|
|
281
281
|
payload: dict = {**self._meta_payload, **req_payload, "name": self._meta.collection_name}
|
|
282
|
-
res = self.client.json_exception("SearchCollection", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
282
|
+
res = self.client.json_exception("SearchCollection", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
283
283
|
response = SearchResponse.parse_with(res)
|
|
284
284
|
return response
|
|
285
285
|
|
|
@@ -297,6 +297,6 @@ class KnowledgeCollection:
|
|
|
297
297
|
else dict(request)
|
|
298
298
|
)
|
|
299
299
|
payload: dict = {**self._meta_payload, **req_payload, "name": self._meta.collection_name}
|
|
300
|
-
res = self.client.json_exception("SearchKnowledge", {}, json.dumps(payload), headers=headers, timeout=timeout)
|
|
300
|
+
res = self.client.json_exception("SearchKnowledge", {}, json.dumps(payload, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
301
301
|
response = SearchKnowledgeResponse.parse_with(res)
|
|
302
302
|
return response
|
|
@@ -38,6 +38,8 @@ class VikingMem(Client):
|
|
|
38
38
|
sts_token: str = "",
|
|
39
39
|
scheme: str = "http",
|
|
40
40
|
timeout: int = 30,
|
|
41
|
+
pool_connections: int = 10,
|
|
42
|
+
pool_maxsize: int = 10,
|
|
41
43
|
):
|
|
42
44
|
"""
|
|
43
45
|
Initialize Viking Memory Service
|
|
@@ -63,6 +65,8 @@ class VikingMem(Client):
|
|
|
63
65
|
sts_token=sts_token,
|
|
64
66
|
scheme=scheme,
|
|
65
67
|
timeout=timeout,
|
|
68
|
+
pool_connections=pool_connections,
|
|
69
|
+
pool_maxsize=pool_maxsize,
|
|
66
70
|
)
|
|
67
71
|
|
|
68
72
|
def ping(self):
|
|
@@ -90,7 +90,7 @@ class Collection:
|
|
|
90
90
|
if self.resource_id is not None:
|
|
91
91
|
params["resource_id"] = self.resource_id
|
|
92
92
|
|
|
93
|
-
res = self.client.json_exception("AddEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
93
|
+
res = self.client.json_exception("AddEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
94
94
|
return res
|
|
95
95
|
|
|
96
96
|
async def async_add_event(
|
|
@@ -139,7 +139,7 @@ class Collection:
|
|
|
139
139
|
if self.resource_id is not None:
|
|
140
140
|
params["resource_id"] = self.resource_id
|
|
141
141
|
|
|
142
|
-
res = await self.client.async_json_exception("AddEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
142
|
+
res = await self.client.async_json_exception("AddEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
143
143
|
return res
|
|
144
144
|
|
|
145
145
|
def update_event(
|
|
@@ -180,7 +180,7 @@ class Collection:
|
|
|
180
180
|
if self.resource_id is not None:
|
|
181
181
|
params["resource_id"] = self.resource_id
|
|
182
182
|
|
|
183
|
-
res = self.client.json_exception("UpdateEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
183
|
+
res = self.client.json_exception("UpdateEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
184
184
|
return res
|
|
185
185
|
|
|
186
186
|
async def async_update_event(
|
|
@@ -221,7 +221,7 @@ class Collection:
|
|
|
221
221
|
if self.resource_id is not None:
|
|
222
222
|
params["resource_id"] = self.resource_id
|
|
223
223
|
|
|
224
|
-
res = await self.client.async_json_exception("UpdateEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
224
|
+
res = await self.client.async_json_exception("UpdateEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
225
225
|
return res
|
|
226
226
|
|
|
227
227
|
def delete_event(
|
|
@@ -251,7 +251,7 @@ class Collection:
|
|
|
251
251
|
if self.resource_id is not None:
|
|
252
252
|
params["resource_id"] = self.resource_id
|
|
253
253
|
|
|
254
|
-
res = self.client.json_exception("DeleteEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
254
|
+
res = self.client.json_exception("DeleteEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
255
255
|
return res
|
|
256
256
|
|
|
257
257
|
async def async_delete_event(
|
|
@@ -281,7 +281,7 @@ class Collection:
|
|
|
281
281
|
if self.resource_id is not None:
|
|
282
282
|
params["resource_id"] = self.resource_id
|
|
283
283
|
|
|
284
|
-
res = await self.client.async_json_exception("DeleteEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
284
|
+
res = await self.client.async_json_exception("DeleteEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
285
285
|
return res
|
|
286
286
|
|
|
287
287
|
def batch_delete_event(
|
|
@@ -315,7 +315,7 @@ class Collection:
|
|
|
315
315
|
if self.resource_id is not None:
|
|
316
316
|
params["resource_id"] = self.resource_id
|
|
317
317
|
|
|
318
|
-
res = self.client.json_exception("BatchDeleteEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
318
|
+
res = self.client.json_exception("BatchDeleteEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
319
319
|
return res
|
|
320
320
|
|
|
321
321
|
async def async_batch_delete_event(
|
|
@@ -349,7 +349,7 @@ class Collection:
|
|
|
349
349
|
if self.resource_id is not None:
|
|
350
350
|
params["resource_id"] = self.resource_id
|
|
351
351
|
|
|
352
|
-
res = await self.client.async_json_exception("BatchDeleteEvent", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
352
|
+
res = await self.client.async_json_exception("BatchDeleteEvent", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
353
353
|
return res
|
|
354
354
|
# ==================== Profile Operations ====================
|
|
355
355
|
|
|
@@ -398,7 +398,7 @@ class Collection:
|
|
|
398
398
|
if self.resource_id is not None:
|
|
399
399
|
params["resource_id"] = self.resource_id
|
|
400
400
|
|
|
401
|
-
res = self.client.json_exception("AddProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
401
|
+
res = self.client.json_exception("AddProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
402
402
|
return res
|
|
403
403
|
|
|
404
404
|
async def async_add_profile(
|
|
@@ -446,7 +446,7 @@ class Collection:
|
|
|
446
446
|
if self.resource_id is not None:
|
|
447
447
|
params["resource_id"] = self.resource_id
|
|
448
448
|
|
|
449
|
-
res = await self.client.async_json_exception("AddProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
449
|
+
res = await self.client.async_json_exception("AddProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
450
450
|
return res
|
|
451
451
|
|
|
452
452
|
def update_profile(
|
|
@@ -479,7 +479,7 @@ class Collection:
|
|
|
479
479
|
if self.resource_id is not None:
|
|
480
480
|
params["resource_id"] = self.resource_id
|
|
481
481
|
|
|
482
|
-
res = self.client.json_exception("UpdateProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
482
|
+
res = self.client.json_exception("UpdateProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
483
483
|
return res
|
|
484
484
|
|
|
485
485
|
async def async_update_profile(
|
|
@@ -512,7 +512,7 @@ class Collection:
|
|
|
512
512
|
if self.resource_id is not None:
|
|
513
513
|
params["resource_id"] = self.resource_id
|
|
514
514
|
|
|
515
|
-
res = await self.client.async_json_exception("UpdateProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
515
|
+
res = await self.client.async_json_exception("UpdateProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
516
516
|
return res
|
|
517
517
|
|
|
518
518
|
def delete_profile(
|
|
@@ -542,7 +542,7 @@ class Collection:
|
|
|
542
542
|
if self.resource_id is not None:
|
|
543
543
|
params["resource_id"] = self.resource_id
|
|
544
544
|
|
|
545
|
-
res = self.client.json_exception("DeleteProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
545
|
+
res = self.client.json_exception("DeleteProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
546
546
|
return res
|
|
547
547
|
|
|
548
548
|
async def async_delete_profile(
|
|
@@ -572,7 +572,7 @@ class Collection:
|
|
|
572
572
|
if self.resource_id is not None:
|
|
573
573
|
params["resource_id"] = self.resource_id
|
|
574
574
|
|
|
575
|
-
res = await self.client.async_json_exception("DeleteProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
575
|
+
res = await self.client.async_json_exception("DeleteProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
576
576
|
return res
|
|
577
577
|
|
|
578
578
|
def trigger_update_profile(
|
|
@@ -606,7 +606,7 @@ class Collection:
|
|
|
606
606
|
if self.resource_id is not None:
|
|
607
607
|
params["resource_id"] = self.resource_id
|
|
608
608
|
|
|
609
|
-
res = self.client.json_exception("TriggerUpdateProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
609
|
+
res = self.client.json_exception("TriggerUpdateProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
610
610
|
return res
|
|
611
611
|
|
|
612
612
|
async def async_trigger_update_profile(
|
|
@@ -631,7 +631,7 @@ class Collection:
|
|
|
631
631
|
if self.resource_id is not None:
|
|
632
632
|
params["resource_id"] = self.resource_id
|
|
633
633
|
|
|
634
|
-
res = await self.client.async_json_exception("TriggerUpdateProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
634
|
+
res = await self.client.async_json_exception("TriggerUpdateProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
635
635
|
return res
|
|
636
636
|
|
|
637
637
|
def batch_delete_profile(
|
|
@@ -661,7 +661,7 @@ class Collection:
|
|
|
661
661
|
if self.resource_id is not None:
|
|
662
662
|
params["resource_id"] = self.resource_id
|
|
663
663
|
|
|
664
|
-
res = self.client.json_exception("BatchDeleteProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
664
|
+
res = self.client.json_exception("BatchDeleteProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
665
665
|
return res
|
|
666
666
|
|
|
667
667
|
async def async_batch_delete_profile(
|
|
@@ -691,7 +691,7 @@ class Collection:
|
|
|
691
691
|
if self.resource_id is not None:
|
|
692
692
|
params["resource_id"] = self.resource_id
|
|
693
693
|
|
|
694
|
-
res = await self.client.async_json_exception("BatchDeleteProfile", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
694
|
+
res = await self.client.async_json_exception("BatchDeleteProfile", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
695
695
|
return res
|
|
696
696
|
# ==================== Session Operations ====================
|
|
697
697
|
|
|
@@ -736,7 +736,7 @@ class Collection:
|
|
|
736
736
|
if store_file is not None:
|
|
737
737
|
params["store_file"] = store_file
|
|
738
738
|
|
|
739
|
-
res = self.client.json_exception("AddSession", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
739
|
+
res = self.client.json_exception("AddSession", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
740
740
|
return res
|
|
741
741
|
|
|
742
742
|
async def async_add_session(
|
|
@@ -780,7 +780,7 @@ class Collection:
|
|
|
780
780
|
if store_file is not None:
|
|
781
781
|
params["store_file"] = store_file
|
|
782
782
|
|
|
783
|
-
res = await self.client.async_json_exception("AddSession", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
783
|
+
res = await self.client.async_json_exception("AddSession", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
784
784
|
return res
|
|
785
785
|
|
|
786
786
|
# ==================== Session Info Operations ====================
|
|
@@ -812,7 +812,7 @@ class Collection:
|
|
|
812
812
|
if self.resource_id is not None:
|
|
813
813
|
params["resource_id"] = self.resource_id
|
|
814
814
|
|
|
815
|
-
res = self.client.json_exception("GetSessionInfo", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
815
|
+
res = self.client.json_exception("GetSessionInfo", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
816
816
|
return res
|
|
817
817
|
|
|
818
818
|
async def async_get_session_info(
|
|
@@ -842,7 +842,7 @@ class Collection:
|
|
|
842
842
|
if self.resource_id is not None:
|
|
843
843
|
params["resource_id"] = self.resource_id
|
|
844
844
|
|
|
845
|
-
res = await self.client.async_json_exception("GetSessionInfo", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
845
|
+
res = await self.client.async_json_exception("GetSessionInfo", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
846
846
|
return res
|
|
847
847
|
|
|
848
848
|
# ==================== Search Operations ====================
|
|
@@ -882,7 +882,7 @@ class Collection:
|
|
|
882
882
|
if self.resource_id is not None:
|
|
883
883
|
params["resource_id"] = self.resource_id
|
|
884
884
|
|
|
885
|
-
res = self.client.json_exception("SearchMemory", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
885
|
+
res = self.client.json_exception("SearchMemory", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
886
886
|
return res
|
|
887
887
|
|
|
888
888
|
async def async_search_memory(
|
|
@@ -920,7 +920,7 @@ class Collection:
|
|
|
920
920
|
if self.resource_id is not None:
|
|
921
921
|
params["resource_id"] = self.resource_id
|
|
922
922
|
|
|
923
|
-
res = await self.client.async_json_exception("SearchMemory", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
923
|
+
res = await self.client.async_json_exception("SearchMemory", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
924
924
|
return res
|
|
925
925
|
|
|
926
926
|
def search_event_memory(
|
|
@@ -948,7 +948,7 @@ class Collection:
|
|
|
948
948
|
if self.resource_id is not None:
|
|
949
949
|
params["resource_id"] = self.resource_id
|
|
950
950
|
|
|
951
|
-
res = self.client.json_exception("SearchEventMemory", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
951
|
+
res = self.client.json_exception("SearchEventMemory", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
952
952
|
return res
|
|
953
953
|
|
|
954
954
|
def search_profile_memory(
|
|
@@ -973,7 +973,7 @@ class Collection:
|
|
|
973
973
|
if self.resource_id is not None:
|
|
974
974
|
params["resource_id"] = self.resource_id
|
|
975
975
|
|
|
976
|
-
res = self.client.json_exception("SearchProfileMemory", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
976
|
+
res = self.client.json_exception("SearchProfileMemory", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
977
977
|
return res
|
|
978
978
|
|
|
979
979
|
async def async_search_event_memory(
|
|
@@ -1004,7 +1004,7 @@ class Collection:
|
|
|
1004
1004
|
if self.resource_id is not None:
|
|
1005
1005
|
params["resource_id"] = self.resource_id
|
|
1006
1006
|
|
|
1007
|
-
res = await self.client.async_json_exception("SearchEventMemory", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
1007
|
+
res = await self.client.async_json_exception("SearchEventMemory", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
1008
1008
|
return res
|
|
1009
1009
|
|
|
1010
1010
|
async def async_search_profile_memory(
|
|
@@ -1032,7 +1032,7 @@ class Collection:
|
|
|
1032
1032
|
if self.resource_id is not None:
|
|
1033
1033
|
params["resource_id"] = self.resource_id
|
|
1034
1034
|
|
|
1035
|
-
res = await self.client.async_json_exception("SearchProfileMemory", {}, json.dumps(params, cls=EnumEncoder), headers=headers, timeout=timeout)
|
|
1035
|
+
res = await self.client.async_json_exception("SearchProfileMemory", {}, json.dumps(params, cls=EnumEncoder, ensure_ascii=False), headers=headers, timeout=timeout)
|
|
1036
1036
|
return res
|
|
1037
1037
|
|
|
1038
1038
|
|
|
@@ -66,6 +66,8 @@ class VikingDB(Client):
|
|
|
66
66
|
scheme: str = "https",
|
|
67
67
|
sts_token: str = "",
|
|
68
68
|
timeout: int = 30,
|
|
69
|
+
pool_connections: int = 10,
|
|
70
|
+
pool_maxsize: int = 10,
|
|
69
71
|
) -> None:
|
|
70
72
|
if auth is None:
|
|
71
73
|
raise ValueError("auth is required for VikingDB")
|
|
@@ -78,6 +80,8 @@ class VikingDB(Client):
|
|
|
78
80
|
sts_token=sts_token,
|
|
79
81
|
scheme=scheme,
|
|
80
82
|
timeout=timeout,
|
|
83
|
+
pool_connections=pool_connections,
|
|
84
|
+
pool_maxsize=pool_maxsize,
|
|
81
85
|
)
|
|
82
86
|
try:
|
|
83
87
|
resp = self.session.get(f"{scheme}://{host}/api/vikingdb/Ping")
|
|
@@ -317,6 +321,8 @@ class VikingVector(VikingDB):
|
|
|
317
321
|
scheme: str = "https",
|
|
318
322
|
sts_token: str = "",
|
|
319
323
|
timeout: int = 30,
|
|
324
|
+
pool_connections: int = 10,
|
|
325
|
+
pool_maxsize: int = 10,
|
|
320
326
|
) -> None:
|
|
321
327
|
warnings.warn(
|
|
322
328
|
"VikingVector is deprecated; use VikingDB instead.",
|
|
@@ -330,4 +336,6 @@ class VikingVector(VikingDB):
|
|
|
330
336
|
scheme=scheme,
|
|
331
337
|
sts_token=sts_token,
|
|
332
338
|
timeout=timeout,
|
|
339
|
+
pool_connections=pool_connections,
|
|
340
|
+
pool_maxsize=pool_maxsize,
|
|
333
341
|
)
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vikingdb-python-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.32
|
|
4
4
|
Summary: vikingdb Python SDK
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://github.com/volcengine/vikingdb-python-sdk/blob/main/README.md
|
|
@@ -64,6 +64,8 @@ client = VikingDB(
|
|
|
64
64
|
auth=auth,
|
|
65
65
|
scheme="https",
|
|
66
66
|
timeout=30,
|
|
67
|
+
pool_connections=20,
|
|
68
|
+
pool_maxsize=50,
|
|
67
69
|
)
|
|
68
70
|
index = client.index(
|
|
69
71
|
collection_name=os.environ["VIKINGDB_COLLECTION"],
|
|
@@ -85,6 +87,8 @@ client = VikingMem(
|
|
|
85
87
|
region="cn-beijing",
|
|
86
88
|
auth=auth,
|
|
87
89
|
scheme="http",
|
|
90
|
+
pool_connections=20,
|
|
91
|
+
pool_maxsize=50,
|
|
88
92
|
)
|
|
89
93
|
|
|
90
94
|
# Get collection
|
|
@@ -132,6 +136,8 @@ client = VikingKnowledge(
|
|
|
132
136
|
host="api-knowledgebase.mlp.cn-beijing.volces.com",
|
|
133
137
|
region="cn-beijing",
|
|
134
138
|
scheme="http",
|
|
139
|
+
pool_connections=20,
|
|
140
|
+
pool_maxsize=50,
|
|
135
141
|
)
|
|
136
142
|
|
|
137
143
|
collection = client.collection(
|
|
@@ -149,6 +155,25 @@ print(f"request_id={resp.request_id} hits={len(resp.result.result_list or [])}")
|
|
|
149
155
|
svc_client = VikingKnowledge(auth=APIKey(api_key=os.getenv("VIKING_SERVICE_API_KEY")))
|
|
150
156
|
```
|
|
151
157
|
|
|
158
|
+
### Connection Pool Tuning
|
|
159
|
+
|
|
160
|
+
For high-concurrency synchronous workloads, the client constructors support
|
|
161
|
+
`pool_connections` and `pool_maxsize` and pass them through to
|
|
162
|
+
the underlying `requests` `HTTPAdapter`.
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
client = VikingDB(
|
|
166
|
+
host=os.environ["VIKINGDB_HOST"],
|
|
167
|
+
region=os.environ["VIKINGDB_REGION"],
|
|
168
|
+
auth=auth,
|
|
169
|
+
pool_connections=20,
|
|
170
|
+
pool_maxsize=50,
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- `pool_connections`: number of cached connection pools
|
|
175
|
+
- `pool_maxsize`: max reusable connections per host
|
|
176
|
+
|
|
152
177
|
### Example Guides
|
|
153
178
|
|
|
154
179
|
#### Vector Examples
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/point.py
RENAMED
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/rerank.py
RENAMED
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/search.py
RENAMED
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/knowledge/models/service_chat.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/collection.py
RENAMED
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb/vector/models/embedding.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/requires.txt
RENAMED
|
File without changes
|
{vikingdb_python_sdk-0.1.29 → vikingdb_python_sdk-0.1.32}/vikingdb_python_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|