vectorvein 0.2.39__py3-none-any.whl → 0.2.41__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.
@@ -223,29 +223,32 @@ def get_token_counts(text: str | dict, model: str = "", use_token_server_first:
223
223
  return result["totalTokens"]
224
224
  elif model.startswith("claude"):
225
225
  backend_setting = settings.get_backend(BackendType.Anthropic)
226
- for endpoint_choice in backend_setting.models[model].endpoints:
227
- if isinstance(endpoint_choice, dict):
228
- endpoint_id = endpoint_choice["endpoint_id"]
229
- else:
230
- endpoint_id = endpoint_choice
231
- endpoint = settings.get_endpoint(endpoint_id)
232
-
233
- if (
234
- endpoint.is_vertex
235
- or endpoint.is_bedrock
236
- or endpoint.endpoint_type == "anthropic_vertex"
237
- or endpoint.endpoint_type == "anthropic_bedrock"
238
- ):
239
- continue
240
- elif endpoint.api_schema_type == "default":
241
- return (
242
- Anthropic(
243
- api_key=endpoint.api_key,
244
- base_url=endpoint.api_base,
226
+ try:
227
+ for endpoint_choice in backend_setting.models[model].endpoints:
228
+ if isinstance(endpoint_choice, dict):
229
+ endpoint_id = endpoint_choice["endpoint_id"]
230
+ else:
231
+ endpoint_id = endpoint_choice
232
+ endpoint = settings.get_endpoint(endpoint_id)
233
+
234
+ if (
235
+ endpoint.is_vertex
236
+ or endpoint.is_bedrock
237
+ or endpoint.endpoint_type == "anthropic_vertex"
238
+ or endpoint.endpoint_type == "anthropic_bedrock"
239
+ ):
240
+ continue
241
+ elif endpoint.api_schema_type == "default":
242
+ return (
243
+ Anthropic(
244
+ api_key=endpoint.api_key,
245
+ base_url=endpoint.api_base,
246
+ )
247
+ .beta.messages.count_tokens(messages=[{"role": "user", "content": text}], model=model)
248
+ .input_tokens
245
249
  )
246
- .beta.messages.count_tokens(messages=[{"role": "user", "content": text}], model=model)
247
- .input_tokens
248
- )
250
+ except Exception as e:
251
+ warnings.warn(f"Anthropic token counting failed: {e}")
249
252
 
250
253
  # TODO: Use anthropic token counting
251
254
  warnings.warn("Anthropic token counting is not implemented in Vertex or Bedrock yet")
@@ -53,8 +53,8 @@ class ModelConfigDict(TypedDict):
53
53
  function_call_available: NotRequired[bool]
54
54
  response_format_available: NotRequired[bool]
55
55
  native_multimodal: NotRequired[bool]
56
- context_length: NotRequired[int]
57
- max_output_tokens: NotRequired[int]
56
+ context_length: NotRequired[Optional[int]]
57
+ max_output_tokens: NotRequired[Optional[int]]
58
58
 
59
59
 
60
60
  class BackendSettingsDict(TypedDict):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.2.39
3
+ Version: 0.2.41
4
4
  Summary: VectorVein Python SDK
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
- vectorvein-0.2.39.dist-info/METADATA,sha256=-PDS72SITnnru7I3ahdoPh9m_fdoEKVukfjV15ptYKs,4570
2
- vectorvein-0.2.39.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.2.39.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.2.41.dist-info/METADATA,sha256=QYgOR290hHjJUf4Hj_a65fIp3uOtq4Fxmt0rmSp2NUw,4570
2
+ vectorvein-0.2.41.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.2.41.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  vectorvein/api/__init__.py,sha256=lfY-XA46fgD2iIZTU0VYP8i07AwA03Egj4Qua0vUKrQ,738
6
6
  vectorvein/api/client.py,sha256=xF-leKDQzVyyy9FnIRaz0k4eElYW1XbbzeRLcpnyk90,33047
@@ -23,7 +23,7 @@ vectorvein/chat_clients/openai_compatible_client.py,sha256=d6V6T_FvPxEuOhHoQC-NH
23
23
  vectorvein/chat_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  vectorvein/chat_clients/qwen_client.py,sha256=-ryh-m9PgsO0fc4ulcCmPTy1155J8YUy15uPoJQOHA0,513
25
25
  vectorvein/chat_clients/stepfun_client.py,sha256=zsD2W5ahmR4DD9cqQTXmJr3txrGuvxbRWhFlRdwNijI,519
26
- vectorvein/chat_clients/utils.py,sha256=CNJejyTmZ5x9TMmVfSnn3OR0optuS9fZjF9Ocu8tSOM,26891
26
+ vectorvein/chat_clients/utils.py,sha256=O2fLN_R4uJuJfi9gUlIZUALVrTtBwmiKQ7EkN29wTgE,27090
27
27
  vectorvein/chat_clients/xai_client.py,sha256=eLFJJrNRJ-ni3DpshODcr3S1EJQLbhVwxyO1E54LaqM,491
28
28
  vectorvein/chat_clients/yi_client.py,sha256=RNf4CRuPJfixrwLZ3-DEc3t25QDe1mvZeb9sku2f8Bc,484
29
29
  vectorvein/chat_clients/zhipuai_client.py,sha256=Ys5DSeLCuedaDXr3PfG1EW2zKXopt-awO2IylWSwY0s,519
@@ -37,7 +37,7 @@ vectorvein/types/enums.py,sha256=LplSVkXLBK-t8TWtJKj_f7ktWTd6CSHWRLb67XKMm54,171
37
37
  vectorvein/types/exception.py,sha256=KtnqZ-1DstHm95SZAyZdHhkGq1bJ4A9Aw3Zfdu-VIFo,130
38
38
  vectorvein/types/llm_parameters.py,sha256=1-8G6ieUj_Hb_hnJNTj7kt_7R6LkPmA6fcbNuIIiDDs,8070
39
39
  vectorvein/types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- vectorvein/types/settings.py,sha256=82RsherFSCc8s9-v0E7F_FK6avVh_XvC1b7EkNlFHbc,4918
40
+ vectorvein/types/settings.py,sha256=08kROkDbb_v0TR8FcdfHA1XBIq6-tkM2ezO6taDLuV8,4938
41
41
  vectorvein/utilities/media_processing.py,sha256=7KtbLFzOYIn1e9QTN9G6C76NH8CBlV9kfAgiRKEIeXY,6263
42
42
  vectorvein/utilities/rate_limiter.py,sha256=dwolIUVw2wP83Odqpx0AAaE77de1GzxkYDGH4tM_u_4,10300
43
43
  vectorvein/utilities/retry.py,sha256=6KFS9R2HdhqM3_9jkjD4F36ZSpEx2YNFGOVlpOsUetM,2208
@@ -62,4 +62,4 @@ vectorvein/workflow/nodes/vector_db.py,sha256=t6I17q6iR3yQreiDHpRrksMdWDPIvgqJs0
62
62
  vectorvein/workflow/nodes/video_generation.py,sha256=qmdg-t_idpxq1veukd-jv_ChICMOoInKxprV9Z4Vi2w,4118
63
63
  vectorvein/workflow/nodes/web_crawlers.py,sha256=BhJBX1AZH7-22Gu95Ox4qJqmH5DU-m4dbUb5N5DTA-M,5559
64
64
  vectorvein/workflow/utils/json_to_code.py,sha256=F7dhDy8kGc8ndOeihGLRLGFGlquoxVlb02ENtxnQ0C8,5914
65
- vectorvein-0.2.39.dist-info/RECORD,,
65
+ vectorvein-0.2.41.dist-info/RECORD,,