vectorvein 0.2.67__py3-none-any.whl → 0.2.69__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.
@@ -766,7 +766,7 @@ class AnthropicChatClient(BaseChatClient):
766
766
  "usage": {
767
767
  "prompt_tokens": response.usage.input_tokens + response.usage.cache_read_input_tokens
768
768
  if response.usage.cache_read_input_tokens
769
- else 0,
769
+ else response.usage.input_tokens,
770
770
  "completion_tokens": response.usage.output_tokens,
771
771
  "total_tokens": response.usage.input_tokens + response.usage.output_tokens,
772
772
  "prompt_tokens_details": {
@@ -1377,7 +1377,7 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
1377
1377
  "usage": {
1378
1378
  "prompt_tokens": response.usage.input_tokens + response.usage.cache_read_input_tokens
1379
1379
  if response.usage.cache_read_input_tokens
1380
- else 0,
1380
+ else response.usage.input_tokens,
1381
1381
  "completion_tokens": response.usage.output_tokens,
1382
1382
  "total_tokens": response.usage.input_tokens + response.usage.output_tokens,
1383
1383
  "prompt_tokens_details": {
@@ -117,7 +117,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
117
117
  model: str | None = None,
118
118
  stream: Literal[False] = False,
119
119
  temperature: float | None | NotGiven = NOT_GIVEN,
120
- max_tokens: int | None = None,
120
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
121
121
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
122
122
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
123
123
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -158,7 +158,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
158
158
  model: str | None = None,
159
159
  stream: Literal[True],
160
160
  temperature: float | None | NotGiven = NOT_GIVEN,
161
- max_tokens: int | None = None,
161
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
162
162
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
163
163
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
164
164
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -199,7 +199,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
199
199
  model: str | None = None,
200
200
  stream: bool,
201
201
  temperature: float | None | NotGiven = NOT_GIVEN,
202
- max_tokens: int | None = None,
202
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
203
203
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
204
204
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
205
205
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -239,7 +239,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
239
239
  model: str | None = None,
240
240
  stream: Literal[False] | Literal[True] = False,
241
241
  temperature: float | None | NotGiven = NOT_GIVEN,
242
- max_tokens: int | None = None,
242
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
243
243
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
244
244
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
245
245
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -280,6 +280,8 @@ class OpenAICompatibleChatClient(BaseChatClient):
280
280
  self.temperature = temperature
281
281
  if isinstance(top_p, AnthropicNotGiven):
282
282
  top_p = NOT_GIVEN
283
+ if isinstance(max_tokens, AnthropicNotGiven):
284
+ max_tokens = NOT_GIVEN
283
285
 
284
286
  raw_client = self.raw_client # 调用完 self.raw_client 后,self.model_id 会被赋值
285
287
  self.model_setting = self.backend_settings.models[self.model]
@@ -322,7 +324,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
322
324
  else:
323
325
  tools_params = {}
324
326
 
325
- if max_tokens is None:
327
+ if not max_tokens and not max_completion_tokens:
326
328
  max_output_tokens = self.model_setting.max_output_tokens
327
329
  token_counts = get_message_token_counts(messages=messages, tools=tools, model=self.model)
328
330
  if max_output_tokens is not None:
@@ -331,6 +333,10 @@ class OpenAICompatibleChatClient(BaseChatClient):
331
333
  else:
332
334
  max_tokens = self.model_setting.context_length - token_counts - 64
333
335
 
336
+ if "o3-mini" in self.model_id:
337
+ max_completion_tokens = max_tokens
338
+ max_tokens = NOT_GIVEN
339
+
334
340
  self._acquire_rate_limit(self.endpoint, self.model, messages)
335
341
 
336
342
  if self.stream:
@@ -587,7 +593,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
587
593
  model: str | None = None,
588
594
  stream: Literal[False] = False,
589
595
  temperature: float | None | NotGiven = NOT_GIVEN,
590
- max_tokens: int | None = None,
596
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
591
597
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
592
598
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
593
599
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -628,7 +634,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
628
634
  model: str | None = None,
629
635
  stream: Literal[True],
630
636
  temperature: float | None | NotGiven = NOT_GIVEN,
631
- max_tokens: int | None = None,
637
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
632
638
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
633
639
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
634
640
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -669,7 +675,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
669
675
  model: str | None = None,
670
676
  stream: bool,
671
677
  temperature: float | None | NotGiven = NOT_GIVEN,
672
- max_tokens: int | None = None,
678
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
673
679
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
674
680
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
675
681
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -709,7 +715,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
709
715
  model: str | None = None,
710
716
  stream: Literal[False] | Literal[True] = False,
711
717
  temperature: float | None | NotGiven = NOT_GIVEN,
712
- max_tokens: int | None = None,
718
+ max_tokens: int | None | NotGiven = NOT_GIVEN,
713
719
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
714
720
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
715
721
  response_format: ResponseFormat | NotGiven = NOT_GIVEN,
@@ -750,6 +756,8 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
750
756
  self.temperature = temperature
751
757
  if isinstance(top_p, AnthropicNotGiven):
752
758
  top_p = NOT_GIVEN
759
+ if isinstance(max_tokens, AnthropicNotGiven):
760
+ max_tokens = NOT_GIVEN
753
761
 
754
762
  raw_client = self.raw_client # 调用完 self.raw_client 后,self.model_id 会被赋值
755
763
  self.model_setting = self.backend_settings.models[self.model]
@@ -792,7 +800,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
792
800
  else:
793
801
  tools_params = {}
794
802
 
795
- if max_tokens is None:
803
+ if not max_tokens and not max_completion_tokens:
796
804
  max_output_tokens = self.model_setting.max_output_tokens
797
805
  token_counts = get_message_token_counts(messages=messages, tools=tools, model=self.model)
798
806
  if max_output_tokens is not None:
@@ -801,6 +809,10 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
801
809
  else:
802
810
  max_tokens = self.model_setting.context_length - token_counts - 64
803
811
 
812
+ if "o3-mini" in self.model_id:
813
+ max_completion_tokens = max_tokens
814
+ max_tokens = NOT_GIVEN
815
+
804
816
  await self._acquire_rate_limit(self.endpoint, self.model, messages)
805
817
 
806
818
  if self.stream:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.2.67
3
+ Version: 0.2.69
4
4
  Summary: VectorVein Python SDK
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,13 +1,13 @@
1
- vectorvein-0.2.67.dist-info/METADATA,sha256=qWWjTXDYBxtywqJT-x7olVtPDI3rkFcW1CdwtMWBUoc,4567
2
- vectorvein-0.2.67.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.2.67.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.2.69.dist-info/METADATA,sha256=ICBJqenymd9STyy9YjP3-4xKUfYUikSdVorW-N8Uro0,4567
2
+ vectorvein-0.2.69.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.2.69.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
7
7
  vectorvein/api/exceptions.py,sha256=uS_PAdx0ksC0r3dgfSGWdbLMZm4qdLeWSSqCv1g3_Gc,772
8
8
  vectorvein/api/models.py,sha256=xtPWMsB0yIJI7i-gY4B6MtvXv0ZIXnoeKspmeInH6fU,1449
9
9
  vectorvein/chat_clients/__init__.py,sha256=UIytpIgwo8qkZpIyrHVxLYTyliUOTp4J7C4iHRjbtWE,23850
10
- vectorvein/chat_clients/anthropic_client.py,sha256=yrGb87h_hpxhK-O3Ir0L5yMHLimPgzaJqdW4AjzskHk,68924
10
+ vectorvein/chat_clients/anthropic_client.py,sha256=IjQOFq7Ifxlb5_nN9hXelE-Odf3zvYnQ3VWgzIkk5ZI,68976
11
11
  vectorvein/chat_clients/baichuan_client.py,sha256=CVMvpgjdrZGv0BWnTOBD-f2ufZ3wq3496wqukumsAr4,526
12
12
  vectorvein/chat_clients/base_client.py,sha256=p7s-G4Wh9MSpDKEfG8wuFAeWy5DGvj5Go31hqrpQPhM,38817
13
13
  vectorvein/chat_clients/deepseek_client.py,sha256=3qWu01NlJAP2N-Ff62d5-CZXZitlizE1fzb20LNetig,526
@@ -19,7 +19,7 @@ vectorvein/chat_clients/minimax_client.py,sha256=YOILWcsHsN5tihLTMbKJIyJr9TJREMI
19
19
  vectorvein/chat_clients/mistral_client.py,sha256=1aKSylzBDaLYcFnaBIL4-sXSzWmXfBeON9Q0rq-ziWw,534
20
20
  vectorvein/chat_clients/moonshot_client.py,sha256=gbu-6nGxx8uM_U2WlI4Wus881rFRotzHtMSoYOcruGU,526
21
21
  vectorvein/chat_clients/openai_client.py,sha256=Nz6tV45pWcsOupxjnsRsGTicbQNJWIZyxuJoJ5DGMpg,527
22
- vectorvein/chat_clients/openai_compatible_client.py,sha256=3MEyKqlf1BtzbNpmqAHQq0JcYwlWxEzM0pOn0XNauas,47999
22
+ vectorvein/chat_clients/openai_compatible_client.py,sha256=pKvUvZMcE2b2WAftF_XyO1m5WlUlvB5VBtvSGVW29H0,48613
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
@@ -64,4 +64,4 @@ vectorvein/workflow/nodes/web_crawlers.py,sha256=FB0bTimkk___p3Z5UwQx2YarJyQCc45
64
64
  vectorvein/workflow/utils/check.py,sha256=Oj_S5WQf4_Fr_ro3ipjZt9unKFSFcuwZrrSmrS9kVLE,10193
65
65
  vectorvein/workflow/utils/json_to_code.py,sha256=ozdENkT1fYO67XdZX3Una5_jhGEUJdwD0DfZh0x4q3w,7120
66
66
  vectorvein/workflow/utils/layout.py,sha256=j0bRD3uaXu40xCS6U6BGahBI8FrHa5MiF55GbTrZ1LM,4565
67
- vectorvein-0.2.67.dist-info/RECORD,,
67
+ vectorvein-0.2.69.dist-info/RECORD,,