agentos-sdk-python 2.0.0__py3-none-any.whl → 3.0.0__py3-none-any.whl
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.
- agentos_sdk/clients/modelkit.py +3 -2
- agentos_sdk/normalizers.py +6 -1
- agentos_sdk/protocol.py +9 -5
- agentos_sdk/sdk.py +4 -2
- {agentos_sdk_python-2.0.0.dist-info → agentos_sdk_python-3.0.0.dist-info}/METADATA +4 -3
- {agentos_sdk_python-2.0.0.dist-info → agentos_sdk_python-3.0.0.dist-info}/RECORD +8 -8
- {agentos_sdk_python-2.0.0.dist-info → agentos_sdk_python-3.0.0.dist-info}/WHEEL +0 -0
- {agentos_sdk_python-2.0.0.dist-info → agentos_sdk_python-3.0.0.dist-info}/licenses/LICENSE +0 -0
agentos_sdk/clients/modelkit.py
CHANGED
|
@@ -10,6 +10,7 @@ from agentos_sdk.normalizers import (
|
|
|
10
10
|
normalize_model_info,
|
|
11
11
|
serialize_chat_request,
|
|
12
12
|
)
|
|
13
|
+
from agentos_sdk.protocol import AppModelRegistration, AppModelUpdate
|
|
13
14
|
from agentos_sdk.transport import ApiClient, iter_sse
|
|
14
15
|
|
|
15
16
|
|
|
@@ -163,7 +164,7 @@ class ModelKitClient:
|
|
|
163
164
|
return [normalize_app_model(item) for item in data]
|
|
164
165
|
|
|
165
166
|
async def register_app_model(
|
|
166
|
-
self, bearer_token: str, request:
|
|
167
|
+
self, bearer_token: str, request: AppModelRegistration
|
|
167
168
|
) -> dict[str, Any]:
|
|
168
169
|
"""Register (or replace) an app model (``POST /modelkit/app-models``).
|
|
169
170
|
|
|
@@ -187,7 +188,7 @@ class ModelKitClient:
|
|
|
187
188
|
)
|
|
188
189
|
|
|
189
190
|
async def update_app_model(
|
|
190
|
-
self, bearer_token: str, model_id: str, request:
|
|
191
|
+
self, bearer_token: str, model_id: str, request: AppModelUpdate
|
|
191
192
|
) -> dict[str, Any]:
|
|
192
193
|
"""Partially update an owned app model (``PUT /modelkit/app-models/<id>``).
|
|
193
194
|
|
agentos_sdk/normalizers.py
CHANGED
|
@@ -94,7 +94,7 @@ def normalize_agent_event_name(event_type: str) -> str:
|
|
|
94
94
|
return event_type
|
|
95
95
|
|
|
96
96
|
|
|
97
|
-
MODEL_TASKS = {"chat", "embedding", "asr", "tts", "decision"}
|
|
97
|
+
MODEL_TASKS = {"chat", "embedding", "asr", "tts", "decision", "image", "video", "music"}
|
|
98
98
|
MODALITIES = {"text", "image", "audio", "video", "decisions"}
|
|
99
99
|
MODEL_SOURCES = {"local", "platform", "custom", "app"}
|
|
100
100
|
# Wire values of ``billingType`` (the same as the AgentOS server's model list); parsing is case-insensitive.
|
|
@@ -175,6 +175,9 @@ def normalize_model_info(item: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
175
175
|
value = str(item[key]).strip() if item.get(key) is not None else ""
|
|
176
176
|
if value:
|
|
177
177
|
result[key] = value
|
|
178
|
+
for key in ("endpointProtocol", "provider"):
|
|
179
|
+
if item.get(key):
|
|
180
|
+
result[key] = str(item[key])
|
|
178
181
|
return result
|
|
179
182
|
|
|
180
183
|
|
|
@@ -205,6 +208,8 @@ def normalize_app_model(item: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
205
208
|
result["contextWindowSize"] = item["contextWindowSize"]
|
|
206
209
|
if item.get("maxOutputTokens") is not None:
|
|
207
210
|
result["maxOutputTokens"] = item["maxOutputTokens"]
|
|
211
|
+
if item.get("endpointProtocol"):
|
|
212
|
+
result["endpointProtocol"] = str(item["endpointProtocol"])
|
|
208
213
|
return result
|
|
209
214
|
|
|
210
215
|
|
agentos_sdk/protocol.py
CHANGED
|
@@ -6,7 +6,7 @@ from typing_extensions import NotRequired
|
|
|
6
6
|
|
|
7
7
|
JsonMap = dict[str, Any]
|
|
8
8
|
ContentType = Literal["text", "imageUrl"]
|
|
9
|
-
ModelTask = Literal["chat", "embedding", "asr", "tts", "decision"]
|
|
9
|
+
ModelTask = Literal["chat", "embedding", "asr", "tts", "decision", "image", "video", "music"]
|
|
10
10
|
Modality = Literal["text", "image", "audio", "video", "decisions"]
|
|
11
11
|
# 模型互斥的来源,对应网关 ``/modelkit/models`` 的 ``source`` 字段。
|
|
12
12
|
ModelSource = Literal["local", "platform", "custom", "app"]
|
|
@@ -321,6 +321,7 @@ class AppModel(TypedDict):
|
|
|
321
321
|
alias: str
|
|
322
322
|
description: str
|
|
323
323
|
task: ModelTask
|
|
324
|
+
endpointProtocol: NotRequired[str]
|
|
324
325
|
provider: str
|
|
325
326
|
input: list[Modality]
|
|
326
327
|
output: list[Modality]
|
|
@@ -338,7 +339,7 @@ class AppModel(TypedDict):
|
|
|
338
339
|
class AppModelRegistration(TypedDict):
|
|
339
340
|
"""Request body of ``register_app_model``.
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
``name``, ``endpointProtocol`` and ``baseUrl`` are required; unset fields are omitted so the server applies
|
|
342
343
|
its own defaults. The model id is not part of the request: the gateway
|
|
343
344
|
generates it and returns it in ``AppModelWriteResult.id``.
|
|
344
345
|
|
|
@@ -351,11 +352,13 @@ class AppModelRegistration(TypedDict):
|
|
|
351
352
|
alias: NotRequired[str]
|
|
352
353
|
description: NotRequired[str]
|
|
353
354
|
task: NotRequired[ModelTask]
|
|
355
|
+
endpointProtocol: str
|
|
356
|
+
adapterSettings: NotRequired[JsonMap]
|
|
354
357
|
provider: NotRequired[str]
|
|
355
358
|
input: NotRequired[list[Modality]]
|
|
356
359
|
output: NotRequired[list[Modality]]
|
|
357
360
|
capabilities: NotRequired[dict[str, bool]]
|
|
358
|
-
baseUrl:
|
|
361
|
+
baseUrl: str
|
|
359
362
|
apiKey: NotRequired[str]
|
|
360
363
|
contextWindowSize: NotRequired[int]
|
|
361
364
|
# Maximum number of tokens the model can generate in one response.
|
|
@@ -367,8 +370,7 @@ class AppModelRegistration(TypedDict):
|
|
|
367
370
|
class AppModelUpdate(TypedDict, total=False):
|
|
368
371
|
"""Request body of ``update_app_model`` (partial update).
|
|
369
372
|
|
|
370
|
-
|
|
371
|
-
non-empty. When ``task`` changes, input/output/capabilities that are not
|
|
373
|
+
Changing provider or origin clears the saved key unless a new one is supplied. When ``task`` changes, input/output/capabilities that are not
|
|
372
374
|
provided are reset to the new task's defaults. The owning ``appBundleId``
|
|
373
375
|
cannot be changed.
|
|
374
376
|
"""
|
|
@@ -377,6 +379,8 @@ class AppModelUpdate(TypedDict, total=False):
|
|
|
377
379
|
alias: str
|
|
378
380
|
description: str
|
|
379
381
|
task: ModelTask
|
|
382
|
+
endpointProtocol: str
|
|
383
|
+
adapterSettings: JsonMap
|
|
380
384
|
provider: str
|
|
381
385
|
input: list[Modality]
|
|
382
386
|
output: list[Modality]
|
agentos_sdk/sdk.py
CHANGED
|
@@ -33,6 +33,8 @@ from agentos_sdk.handlers import (
|
|
|
33
33
|
from agentos_sdk.protocol import (
|
|
34
34
|
AccessToken,
|
|
35
35
|
AgentMessage,
|
|
36
|
+
AppModelRegistration,
|
|
37
|
+
AppModelUpdate,
|
|
36
38
|
HarnessKitCommandReceipt,
|
|
37
39
|
HarnessKitEngineId,
|
|
38
40
|
HarnessKitEngineSwitchResult,
|
|
@@ -693,7 +695,7 @@ class ModelKitModule:
|
|
|
693
695
|
"""List models registered by apps. No app registration needed."""
|
|
694
696
|
return await self._sdk.modelKit.list_app_models()
|
|
695
697
|
|
|
696
|
-
async def register_app_model(self, *, request:
|
|
698
|
+
async def register_app_model(self, *, request: AppModelRegistration) -> dict[str, Any]:
|
|
697
699
|
"""Register (or replace) a model owned by the current app.
|
|
698
700
|
|
|
699
701
|
Requires ``register_bundle`` first; the app token is attached automatically.
|
|
@@ -703,7 +705,7 @@ class ModelKitModule:
|
|
|
703
705
|
)
|
|
704
706
|
|
|
705
707
|
async def update_app_model(
|
|
706
|
-
self, *, model_id: str, request:
|
|
708
|
+
self, *, model_id: str, request: AppModelUpdate
|
|
707
709
|
) -> dict[str, Any]:
|
|
708
710
|
"""Partially update a model owned by the current app."""
|
|
709
711
|
return await self._sdk._with_app_auth_retry(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentos-sdk-python
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.0
|
|
4
4
|
Summary: Async Python SDK for AgentOS APIs.
|
|
5
5
|
Project-URL: Repository, https://gitlab.litevar.com/litevar/agentos/agentos-sdk-python
|
|
6
6
|
Project-URL: Issues, https://gitlab.litevar.com/litevar/agentos/agentos-sdk-python/-/issues
|
|
@@ -308,7 +308,7 @@ only present when the gateway reports it. Only chat models report
|
|
|
308
308
|
text, so the key is absent for them); a chat model that reports
|
|
309
309
|
`contextWindowSize` reports `maxOutputTokens` too, using the same number when it
|
|
310
310
|
has no value of its own. Apps can set both when registering a model
|
|
311
|
-
(`register_app_model(request={"name": ..., "contextWindowSize": 32768,
|
|
311
|
+
(`register_app_model(request={"name": ..., "baseUrl": ..., "endpointProtocol": ..., "contextWindowSize": 32768,
|
|
312
312
|
"maxOutputTokens": 4096})`); app model records report them back, and
|
|
313
313
|
`update_app_model` can change them.
|
|
314
314
|
|
|
@@ -388,11 +388,12 @@ your model. A `name` is unique within your app; different apps may use the same
|
|
|
388
388
|
async with AgentOSSDK() as sdk:
|
|
389
389
|
await sdk.agentos.register_bundle({"bundleId": "com.example.app"})
|
|
390
390
|
|
|
391
|
-
# Register (or replace) a model.
|
|
391
|
+
# Register (or replace) a model. The required fields are `name`, `baseUrl` and `endpointProtocol`.
|
|
392
392
|
result = await sdk.modelkit.register_app_model(
|
|
393
393
|
request={
|
|
394
394
|
"name": "my-router",
|
|
395
395
|
"task": "decision",
|
|
396
|
+
"endpointProtocol": "/v1/systemone",
|
|
396
397
|
"baseUrl": "http://127.0.0.1:9000",
|
|
397
398
|
"apiKey": "upstream-secret", # stored by the server, never returned
|
|
398
399
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
agentos_sdk/__init__.py,sha256=MDJAptD0tCknYk1HYeHKLtrrw3MnI8EVEp2qQoShlUo,3741
|
|
2
2
|
agentos_sdk/handlers.py,sha256=0LVT-IQlu-bNbRRxMp4Ei3nMwT1OuQcuvsF4cDQKYTM,3435
|
|
3
|
-
agentos_sdk/normalizers.py,sha256=
|
|
4
|
-
agentos_sdk/protocol.py,sha256=
|
|
3
|
+
agentos_sdk/normalizers.py,sha256=GNuiaV4ZRHLGx6ZpQvjW2dpa5qo35AgSJZnJtccnej0,8555
|
|
4
|
+
agentos_sdk/protocol.py,sha256=RkoDN4u0FLk9Pa28NjulweHSnCmzT_tfeUiWd5ogsM0,18495
|
|
5
5
|
agentos_sdk/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
6
|
-
agentos_sdk/sdk.py,sha256=
|
|
6
|
+
agentos_sdk/sdk.py,sha256=U2Y32KUMrMNt1SMqj7QAILMLfM56QysWMunZXJ6xmhs,41203
|
|
7
7
|
agentos_sdk/transport.py,sha256=MHUOdejTmTzJuS1TXYK4J5wd-LORyg54Q4FAfF3bm3w,6995
|
|
8
8
|
agentos_sdk/clients/__init__.py,sha256=rhutJ_h6C8omVjul-Z-JVS1xjf-Utfq295HGk2_SV2s,682
|
|
9
9
|
agentos_sdk/clients/agentkit.py,sha256=D83yaccY2W1ZgHb-XDTlAoqzSlx5Y47x2iVoFgdOZog,5991
|
|
@@ -12,12 +12,12 @@ agentos_sdk/clients/authkit.py,sha256=9TYDwQUxO9HDS7qrTUMnSerlP2p-LCda3zmcLaA5UD
|
|
|
12
12
|
agentos_sdk/clients/cronkit.py,sha256=DiprjNhV3VEXXY5i15Ghgj5WgjHeoVfIEqs2zhuTRcY,4858
|
|
13
13
|
agentos_sdk/clients/discoverykit.py,sha256=KdkkCC_BNNbnqNfHBxe0UPuwMOHq7zyqZYNoOvm_nHk,1245
|
|
14
14
|
agentos_sdk/clients/harnesskit.py,sha256=Mp01B9ifyj9E4AE5DcugkDS6apM8xj9Cx5X2vOQTux8,15265
|
|
15
|
-
agentos_sdk/clients/modelkit.py,sha256=
|
|
15
|
+
agentos_sdk/clients/modelkit.py,sha256=wCExCcT0p-kYi-r5CRGBsFEPOfHIv0536eBEn3bPA2M,8908
|
|
16
16
|
agentos_sdk/clients/notifykit.py,sha256=YClS7r4TsndTLceAXD_EG-ZPr2E3_xd5r5pSzseTvGI,1795
|
|
17
17
|
agentos_sdk/clients/systemkit.py,sha256=1afOdJ_SUuMLP6b28FG2E2POf9OZisNHHBcm8YW0b6s,641
|
|
18
18
|
agentos_sdk/clients/toolkit.py,sha256=wWv4AJYlJfOrC9eVqxSAAYm-xYNca-lvT49SwxWp8VY,5277
|
|
19
19
|
agentos_sdk/clients/transferkit.py,sha256=IpTy56HD-xv509w--SXfTQZgDKgKPFlWfrkaTdrCa14,1978
|
|
20
|
-
agentos_sdk_python-
|
|
21
|
-
agentos_sdk_python-
|
|
22
|
-
agentos_sdk_python-
|
|
23
|
-
agentos_sdk_python-
|
|
20
|
+
agentos_sdk_python-3.0.0.dist-info/METADATA,sha256=UqlbhL3f5sZJ6i-ldnRIxrjCLg6RZYHn36zp-c_gqdA,31918
|
|
21
|
+
agentos_sdk_python-3.0.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
22
|
+
agentos_sdk_python-3.0.0.dist-info/licenses/LICENSE,sha256=oarEto4UtUv6Y2Yeph34qL9zLBJEp0ZjuXrrwQ9uVdg,1064
|
|
23
|
+
agentos_sdk_python-3.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|