tamar-model-client 0.1.5__py3-none-any.whl → 0.1.7__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.
@@ -4,7 +4,6 @@ import base64
4
4
  import json
5
5
  import logging
6
6
  import os
7
- import sys
8
7
 
9
8
  import grpc
10
9
  from typing import Optional, AsyncIterator, Union, Iterable
@@ -29,8 +28,7 @@ if not logging.getLogger().hasHandlers():
29
28
 
30
29
  logger = logging.getLogger(__name__)
31
30
 
32
- # 设置最大消息大小为 sys.maxsize
33
- MAX_MESSAGE_LENGTH = sys.maxsize
31
+ MAX_MESSAGE_LENGTH = 2 ** 31 - 1 # 对于32位系统
34
32
 
35
33
 
36
34
  def is_effective_value(value) -> bool:
@@ -140,7 +138,9 @@ class AsyncTamarModelClient:
140
138
  atexit.register(self._safe_sync_close) # 注册进程退出自动关闭
141
139
 
142
140
  def _build_auth_metadata(self) -> list:
143
- if not self.jwt_token and self.jwt_handler:
141
+ # if not self.jwt_token and self.jwt_handler:
142
+ # 更改为每次请求都生成一次token
143
+ if self.jwt_handler:
144
144
  self.jwt_token = self.jwt_handler.encode_token(self.default_payload, expires_in=self.token_expires_in)
145
145
  return [("authorization", f"Bearer {self.jwt_token}")] if self.jwt_token else []
146
146
 
@@ -267,7 +267,7 @@ class AsyncTamarModelClient:
267
267
  # 清理 serialize后的 grpc_request_kwargs
268
268
  grpc_request_kwargs = remove_none_from_dict(grpc_request_kwargs)
269
269
 
270
- request = model_service_pb2.ModelRequestItem(
270
+ request = model_service_pb2ModelRequestItem(
271
271
  provider=model_request.provider.value,
272
272
  channel=model_request.channel.value,
273
273
  invoke_type=model_request.invoke_type.value,
@@ -1,15 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tamar-model-client
3
- Version: 0.1.5
3
+ Version: 0.1.7
4
4
  Summary: A Python SDK for interacting with the Model Manager gRPC service
5
5
  Home-page: http://gitlab.tamaredge.top/project-tap/AgentOS/model-manager-client
6
6
  Author: Oscar Ou
7
7
  Author-email: oscar.ou@tamaredge.ai
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.8
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
8
  Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
13
10
  Classifier: License :: OSI Approved :: MIT License
14
11
  Classifier: Operating System :: OS Independent
15
12
  Requires-Python: >=3.8
@@ -14,7 +14,7 @@ model_manager_client/schemas/__init__.py,sha256=AxuI-TcvA4OMTj2FtK4wAItvz9LrK_29
14
14
  model_manager_client/schemas/inputs.py,sha256=3HUxnbuyQbuvMz1C46zydFYz-iEvLAUWVzOx7-eKS_I,14338
15
15
  model_manager_client/schemas/outputs.py,sha256=M_fcqUtXPJnfiLabHlyA8BorlC5pYkf5KLjXO1ysKIQ,1031
16
16
  tamar_model_client/__init__.py,sha256=LMECAuDARWHV1XzH3msoDXcyurS2eihRQmBy26_PUE0,328
17
- tamar_model_client/async_client.py,sha256=paPDWgoB9_hvAk4clEG2fNy7TbRaV38Wvb_bm3nWA9g,18899
17
+ tamar_model_client/async_client.py,sha256=0DMqLGYs2rmFp9GycLsdDg4mqIysV6Dol4gYph1kb_g,18949
18
18
  tamar_model_client/auth.py,sha256=gbwW5Aakeb49PMbmYvrYlVx1mfyn1LEDJ4qQVs-9DA4,438
19
19
  tamar_model_client/exceptions.py,sha256=jYU494OU_NeIa4X393V-Y73mTNm0JZ9yZApnlOM9CJQ,332
20
20
  tamar_model_client/sync_client.py,sha256=o8b20fQUvtMq1gWax3_dfOpputYT4l9pRTz6cHdB0lg,4006
@@ -28,7 +28,7 @@ tamar_model_client/generated/model_service_pb2_grpc.py,sha256=KW1UEGUim_kmSi_fCI
28
28
  tamar_model_client/schemas/__init__.py,sha256=AxuI-TcvA4OMTj2FtK4wAItvz9LrK_293pu3cmMLE7k,394
29
29
  tamar_model_client/schemas/inputs.py,sha256=Y9zzt-RoRklkxxe_3VJbZvPghJ00KUjHtFUmD0pCdHs,18721
30
30
  tamar_model_client/schemas/outputs.py,sha256=M_fcqUtXPJnfiLabHlyA8BorlC5pYkf5KLjXO1ysKIQ,1031
31
- tamar_model_client-0.1.5.dist-info/METADATA,sha256=XNZ2S9Cn0TFjYryxlgAknDfpAybEDW8e1swZ3VEGm3o,16608
32
- tamar_model_client-0.1.5.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
33
- tamar_model_client-0.1.5.dist-info/top_level.txt,sha256=_LfDhPv_fvON0PoZgQuo4M7EjoWtxPRoQOBJziJmip8,19
34
- tamar_model_client-0.1.5.dist-info/RECORD,,
31
+ tamar_model_client-0.1.7.dist-info/METADATA,sha256=VMthJOdDpCJPP835gkbLYjHKZCVF-NFnn5UpWch_BfQ,16457
32
+ tamar_model_client-0.1.7.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
33
+ tamar_model_client-0.1.7.dist-info/top_level.txt,sha256=_LfDhPv_fvON0PoZgQuo4M7EjoWtxPRoQOBJziJmip8,19
34
+ tamar_model_client-0.1.7.dist-info/RECORD,,