vectorvein 0.1.77__py3-none-any.whl → 0.1.78__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.
@@ -21,6 +21,7 @@ from .moonshot_client import MoonshotChatClient, AsyncMoonshotChatClient
21
21
  from .deepseek_client import DeepSeekChatClient, AsyncDeepSeekChatClient
22
22
 
23
23
  from ..types import defaults as defs
24
+ from ..types.llm_parameters import NOT_GIVEN, NotGiven
24
25
  from ..types.enums import BackendType, ContextLengthControlType
25
26
  from .anthropic_client import AnthropicChatClient, AsyncAnthropicChatClient
26
27
  from .utils import format_messages, get_token_counts, get_message_token_counts, ToolCallContentProcessor
@@ -69,7 +70,7 @@ def create_chat_client(
69
70
  backend: Literal[BackendType.Anthropic],
70
71
  model: str | None = None,
71
72
  stream: bool = False,
72
- temperature: float = 0.7,
73
+ temperature: float | None | NotGiven = NOT_GIVEN,
73
74
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
74
75
  random_endpoint: bool = True,
75
76
  endpoint_id: str = "",
@@ -83,7 +84,7 @@ def create_chat_client(
83
84
  backend: Literal[BackendType.DeepSeek],
84
85
  model: str | None = None,
85
86
  stream: bool = False,
86
- temperature: float = 0.7,
87
+ temperature: float | None | NotGiven = NOT_GIVEN,
87
88
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
88
89
  random_endpoint: bool = True,
89
90
  endpoint_id: str = "",
@@ -97,7 +98,7 @@ def create_chat_client(
97
98
  backend: Literal[BackendType.Gemini],
98
99
  model: str | None = None,
99
100
  stream: bool = False,
100
- temperature: float = 0.7,
101
+ temperature: float | None | NotGiven = NOT_GIVEN,
101
102
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
102
103
  random_endpoint: bool = True,
103
104
  endpoint_id: str = "",
@@ -111,7 +112,7 @@ def create_chat_client(
111
112
  backend: Literal[BackendType.Groq],
112
113
  model: str | None = None,
113
114
  stream: bool = False,
114
- temperature: float = 0.7,
115
+ temperature: float | None | NotGiven = NOT_GIVEN,
115
116
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
116
117
  random_endpoint: bool = True,
117
118
  endpoint_id: str = "",
@@ -125,7 +126,7 @@ def create_chat_client(
125
126
  backend: Literal[BackendType.Local],
126
127
  model: str | None = None,
127
128
  stream: bool = False,
128
- temperature: float = 0.7,
129
+ temperature: float | None | NotGiven = NOT_GIVEN,
129
130
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
130
131
  random_endpoint: bool = True,
131
132
  endpoint_id: str = "",
@@ -139,7 +140,7 @@ def create_chat_client(
139
140
  backend: Literal[BackendType.MiniMax],
140
141
  model: str | None = None,
141
142
  stream: bool = False,
142
- temperature: float = 0.7,
143
+ temperature: float | None | NotGiven = NOT_GIVEN,
143
144
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
144
145
  random_endpoint: bool = True,
145
146
  endpoint_id: str = "",
@@ -153,7 +154,7 @@ def create_chat_client(
153
154
  backend: Literal[BackendType.Mistral],
154
155
  model: str | None = None,
155
156
  stream: bool = False,
156
- temperature: float = 0.7,
157
+ temperature: float | None | NotGiven = NOT_GIVEN,
157
158
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
158
159
  random_endpoint: bool = True,
159
160
  endpoint_id: str = "",
@@ -167,7 +168,7 @@ def create_chat_client(
167
168
  backend: Literal[BackendType.Moonshot],
168
169
  model: str | None = None,
169
170
  stream: bool = False,
170
- temperature: float = 0.7,
171
+ temperature: float | None | NotGiven = NOT_GIVEN,
171
172
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
172
173
  random_endpoint: bool = True,
173
174
  endpoint_id: str = "",
@@ -181,7 +182,7 @@ def create_chat_client(
181
182
  backend: Literal[BackendType.OpenAI],
182
183
  model: str | None = None,
183
184
  stream: bool = False,
184
- temperature: float = 0.7,
185
+ temperature: float | None | NotGiven = NOT_GIVEN,
185
186
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
186
187
  random_endpoint: bool = True,
187
188
  endpoint_id: str = "",
@@ -195,7 +196,7 @@ def create_chat_client(
195
196
  backend: Literal[BackendType.Qwen],
196
197
  model: str | None = None,
197
198
  stream: bool = False,
198
- temperature: float = 0.7,
199
+ temperature: float | None | NotGiven = NOT_GIVEN,
199
200
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
200
201
  random_endpoint: bool = True,
201
202
  endpoint_id: str = "",
@@ -209,7 +210,7 @@ def create_chat_client(
209
210
  backend: Literal[BackendType.Yi],
210
211
  model: str | None = None,
211
212
  stream: bool = False,
212
- temperature: float = 0.7,
213
+ temperature: float | None | NotGiven = NOT_GIVEN,
213
214
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
214
215
  random_endpoint: bool = True,
215
216
  endpoint_id: str = "",
@@ -223,7 +224,7 @@ def create_chat_client(
223
224
  backend: Literal[BackendType.ZhiPuAI],
224
225
  model: str | None = None,
225
226
  stream: bool = False,
226
- temperature: float = 0.7,
227
+ temperature: float | None | NotGiven = NOT_GIVEN,
227
228
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
228
229
  random_endpoint: bool = True,
229
230
  endpoint_id: str = "",
@@ -237,7 +238,7 @@ def create_chat_client(
237
238
  backend: Literal[BackendType.Baichuan],
238
239
  model: str | None = None,
239
240
  stream: bool = False,
240
- temperature: float = 0.7,
241
+ temperature: float | None | NotGiven = NOT_GIVEN,
241
242
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
242
243
  random_endpoint: bool = True,
243
244
  endpoint_id: str = "",
@@ -251,7 +252,7 @@ def create_chat_client(
251
252
  backend: Literal[BackendType.StepFun],
252
253
  model: str | None = None,
253
254
  stream: bool = False,
254
- temperature: float = 0.7,
255
+ temperature: float | None | NotGiven = NOT_GIVEN,
255
256
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
256
257
  random_endpoint: bool = True,
257
258
  endpoint_id: str = "",
@@ -265,7 +266,7 @@ def create_chat_client(
265
266
  backend: Literal[BackendType.XAI],
266
267
  model: str | None = None,
267
268
  stream: bool = False,
268
- temperature: float = 0.7,
269
+ temperature: float | None | NotGiven = NOT_GIVEN,
269
270
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
270
271
  random_endpoint: bool = True,
271
272
  endpoint_id: str = "",
@@ -279,7 +280,7 @@ def create_chat_client(
279
280
  backend: BackendType,
280
281
  model: str | None = None,
281
282
  stream: bool = False,
282
- temperature: float = 0.7,
283
+ temperature: float | None | NotGiven = NOT_GIVEN,
283
284
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
284
285
  random_endpoint: bool = True,
285
286
  endpoint_id: str = "",
@@ -292,7 +293,7 @@ def create_chat_client(
292
293
  backend: BackendType,
293
294
  model: str | None = None,
294
295
  stream: bool = False,
295
- temperature: float = 0.7,
296
+ temperature: float | None | NotGiven = NOT_GIVEN,
296
297
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
297
298
  random_endpoint: bool = True,
298
299
  endpoint_id: str = "",
@@ -322,7 +323,7 @@ def create_async_chat_client(
322
323
  backend: Literal[BackendType.Anthropic],
323
324
  model: str | None = None,
324
325
  stream: bool = False,
325
- temperature: float = 0.7,
326
+ temperature: float | None | NotGiven = NOT_GIVEN,
326
327
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
327
328
  random_endpoint: bool = True,
328
329
  endpoint_id: str = "",
@@ -336,7 +337,7 @@ def create_async_chat_client(
336
337
  backend: Literal[BackendType.DeepSeek],
337
338
  model: str | None = None,
338
339
  stream: bool = False,
339
- temperature: float = 0.7,
340
+ temperature: float | None | NotGiven = NOT_GIVEN,
340
341
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
341
342
  random_endpoint: bool = True,
342
343
  endpoint_id: str = "",
@@ -350,7 +351,7 @@ def create_async_chat_client(
350
351
  backend: Literal[BackendType.Gemini],
351
352
  model: str | None = None,
352
353
  stream: bool = False,
353
- temperature: float = 0.7,
354
+ temperature: float | None | NotGiven = NOT_GIVEN,
354
355
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
355
356
  random_endpoint: bool = True,
356
357
  endpoint_id: str = "",
@@ -364,7 +365,7 @@ def create_async_chat_client(
364
365
  backend: Literal[BackendType.Groq],
365
366
  model: str | None = None,
366
367
  stream: bool = False,
367
- temperature: float = 0.7,
368
+ temperature: float | None | NotGiven = NOT_GIVEN,
368
369
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
369
370
  random_endpoint: bool = True,
370
371
  endpoint_id: str = "",
@@ -378,7 +379,7 @@ def create_async_chat_client(
378
379
  backend: Literal[BackendType.Local],
379
380
  model: str | None = None,
380
381
  stream: bool = False,
381
- temperature: float = 0.7,
382
+ temperature: float | None | NotGiven = NOT_GIVEN,
382
383
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
383
384
  random_endpoint: bool = True,
384
385
  endpoint_id: str = "",
@@ -392,7 +393,7 @@ def create_async_chat_client(
392
393
  backend: Literal[BackendType.MiniMax],
393
394
  model: str | None = None,
394
395
  stream: bool = False,
395
- temperature: float = 0.7,
396
+ temperature: float | None | NotGiven = NOT_GIVEN,
396
397
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
397
398
  random_endpoint: bool = True,
398
399
  endpoint_id: str = "",
@@ -406,7 +407,7 @@ def create_async_chat_client(
406
407
  backend: Literal[BackendType.Mistral],
407
408
  model: str | None = None,
408
409
  stream: bool = False,
409
- temperature: float = 0.7,
410
+ temperature: float | None | NotGiven = NOT_GIVEN,
410
411
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
411
412
  random_endpoint: bool = True,
412
413
  endpoint_id: str = "",
@@ -420,7 +421,7 @@ def create_async_chat_client(
420
421
  backend: Literal[BackendType.Moonshot],
421
422
  model: str | None = None,
422
423
  stream: bool = False,
423
- temperature: float = 0.7,
424
+ temperature: float | None | NotGiven = NOT_GIVEN,
424
425
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
425
426
  random_endpoint: bool = True,
426
427
  endpoint_id: str = "",
@@ -434,7 +435,7 @@ def create_async_chat_client(
434
435
  backend: Literal[BackendType.OpenAI],
435
436
  model: str | None = None,
436
437
  stream: bool = False,
437
- temperature: float = 0.7,
438
+ temperature: float | None | NotGiven = NOT_GIVEN,
438
439
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
439
440
  random_endpoint: bool = True,
440
441
  endpoint_id: str = "",
@@ -448,7 +449,7 @@ def create_async_chat_client(
448
449
  backend: Literal[BackendType.Qwen],
449
450
  model: str | None = None,
450
451
  stream: bool = False,
451
- temperature: float = 0.7,
452
+ temperature: float | None | NotGiven = NOT_GIVEN,
452
453
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
453
454
  random_endpoint: bool = True,
454
455
  endpoint_id: str = "",
@@ -462,7 +463,7 @@ def create_async_chat_client(
462
463
  backend: Literal[BackendType.Yi],
463
464
  model: str | None = None,
464
465
  stream: bool = False,
465
- temperature: float = 0.7,
466
+ temperature: float | None | NotGiven = NOT_GIVEN,
466
467
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
467
468
  random_endpoint: bool = True,
468
469
  endpoint_id: str = "",
@@ -476,7 +477,7 @@ def create_async_chat_client(
476
477
  backend: Literal[BackendType.ZhiPuAI],
477
478
  model: str | None = None,
478
479
  stream: bool = False,
479
- temperature: float = 0.7,
480
+ temperature: float | None | NotGiven = NOT_GIVEN,
480
481
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
481
482
  random_endpoint: bool = True,
482
483
  endpoint_id: str = "",
@@ -490,7 +491,7 @@ def create_async_chat_client(
490
491
  backend: Literal[BackendType.Baichuan],
491
492
  model: str | None = None,
492
493
  stream: bool = False,
493
- temperature: float = 0.7,
494
+ temperature: float | None | NotGiven = NOT_GIVEN,
494
495
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
495
496
  random_endpoint: bool = True,
496
497
  endpoint_id: str = "",
@@ -504,7 +505,7 @@ def create_async_chat_client(
504
505
  backend: Literal[BackendType.StepFun],
505
506
  model: str | None = None,
506
507
  stream: bool = False,
507
- temperature: float = 0.7,
508
+ temperature: float | None | NotGiven = NOT_GIVEN,
508
509
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
509
510
  random_endpoint: bool = True,
510
511
  endpoint_id: str = "",
@@ -518,7 +519,7 @@ def create_async_chat_client(
518
519
  backend: Literal[BackendType.XAI],
519
520
  model: str | None = None,
520
521
  stream: bool = False,
521
- temperature: float = 0.7,
522
+ temperature: float | None | NotGiven = NOT_GIVEN,
522
523
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
523
524
  random_endpoint: bool = True,
524
525
  endpoint_id: str = "",
@@ -532,7 +533,7 @@ def create_async_chat_client(
532
533
  backend: BackendType,
533
534
  model: str | None = None,
534
535
  stream: bool = False,
535
- temperature: float = 0.7,
536
+ temperature: float | None | NotGiven = NOT_GIVEN,
536
537
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
537
538
  random_endpoint: bool = True,
538
539
  endpoint_id: str = "",
@@ -545,7 +546,7 @@ def create_async_chat_client(
545
546
  backend: BackendType,
546
547
  model: str | None = None,
547
548
  stream: bool = False,
548
- temperature: float = 0.7,
549
+ temperature: float | None | NotGiven = NOT_GIVEN,
549
550
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
550
551
  random_endpoint: bool = True,
551
552
  endpoint_id: str = "",
@@ -157,7 +157,7 @@ class AnthropicChatClient(BaseChatClient):
157
157
  self,
158
158
  model: str = defs.ANTHROPIC_DEFAULT_MODEL,
159
159
  stream: bool = True,
160
- temperature: float = 0.7,
160
+ temperature: float | None | NotGiven = NOT_GIVEN,
161
161
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
162
162
  random_endpoint: bool = True,
163
163
  endpoint_id: str = "",
@@ -253,7 +253,7 @@ class AnthropicChatClient(BaseChatClient):
253
253
  messages: list,
254
254
  model: str | None = None,
255
255
  stream: Literal[False] = False,
256
- temperature: float | None = None,
256
+ temperature: float | None | NotGiven = NOT_GIVEN,
257
257
  max_tokens: int | None = None,
258
258
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
259
259
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -272,7 +272,7 @@ class AnthropicChatClient(BaseChatClient):
272
272
  messages: list,
273
273
  model: str | None = None,
274
274
  stream: Literal[True],
275
- temperature: float | None = None,
275
+ temperature: float | None | NotGiven = NOT_GIVEN,
276
276
  max_tokens: int | None = None,
277
277
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
278
278
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -291,7 +291,7 @@ class AnthropicChatClient(BaseChatClient):
291
291
  messages: list,
292
292
  model: str | None = None,
293
293
  stream: bool,
294
- temperature: float | None = None,
294
+ temperature: float | None | NotGiven = NOT_GIVEN,
295
295
  max_tokens: int | None = None,
296
296
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
297
297
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -309,7 +309,7 @@ class AnthropicChatClient(BaseChatClient):
309
309
  messages: list,
310
310
  model: str | None = None,
311
311
  stream: Literal[False] | Literal[True] = False,
312
- temperature: float | None = None,
312
+ temperature: float | None | NotGiven = NOT_GIVEN,
313
313
  max_tokens: int | None = None,
314
314
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
315
315
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -401,6 +401,8 @@ class AnthropicChatClient(BaseChatClient):
401
401
  tool_choice = NOT_GIVEN
402
402
  if isinstance(top_p, OpenAINotGiven) or top_p is None:
403
403
  top_p = NOT_GIVEN
404
+ if isinstance(self.temperature, NotGiven) or self.temperature is None:
405
+ self.temperature = NOT_GIVEN
404
406
 
405
407
  if messages[0].get("role") == "system":
406
408
  system_prompt: str = messages[0]["content"]
@@ -492,7 +494,13 @@ class AnthropicChatClient(BaseChatClient):
492
494
  result["usage"]["total_tokens"] = (
493
495
  result["usage"]["prompt_tokens"] + result["usage"]["completion_tokens"]
494
496
  )
495
- yield ChatCompletionDeltaMessage(usage=Usage(**result["usage"]))
497
+ yield ChatCompletionDeltaMessage(
498
+ usage=Usage(
499
+ prompt_tokens=result["usage"]["prompt_tokens"],
500
+ completion_tokens=result["usage"]["completion_tokens"],
501
+ total_tokens=result["usage"]["total_tokens"],
502
+ )
503
+ )
496
504
 
497
505
  return generator()
498
506
  else:
@@ -538,7 +546,7 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
538
546
  self,
539
547
  model: str = defs.ANTHROPIC_DEFAULT_MODEL,
540
548
  stream: bool = True,
541
- temperature: float = 0.7,
549
+ temperature: float | None | NotGiven = NOT_GIVEN,
542
550
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
543
551
  random_endpoint: bool = True,
544
552
  endpoint_id: str = "",
@@ -633,7 +641,7 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
633
641
  messages: list,
634
642
  model: str | None = None,
635
643
  stream: Literal[False] = False,
636
- temperature: float | None = None,
644
+ temperature: float | None | NotGiven = NOT_GIVEN,
637
645
  max_tokens: int | None = None,
638
646
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
639
647
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -652,7 +660,7 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
652
660
  messages: list,
653
661
  model: str | None = None,
654
662
  stream: Literal[True],
655
- temperature: float | None = None,
663
+ temperature: float | None | NotGiven = NOT_GIVEN,
656
664
  max_tokens: int | None = None,
657
665
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
658
666
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -671,7 +679,7 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
671
679
  messages: list,
672
680
  model: str | None = None,
673
681
  stream: bool,
674
- temperature: float | None = None,
682
+ temperature: float | None | NotGiven = NOT_GIVEN,
675
683
  max_tokens: int | None = None,
676
684
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
677
685
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -689,7 +697,7 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
689
697
  messages: list,
690
698
  model: str | None = None,
691
699
  stream: Literal[False] | Literal[True] = False,
692
- temperature: float | None = None,
700
+ temperature: float | None | NotGiven = NOT_GIVEN,
693
701
  max_tokens: int | None = None,
694
702
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
695
703
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -783,6 +791,8 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
783
791
  tool_choice = NOT_GIVEN
784
792
  if isinstance(top_p, OpenAINotGiven) or top_p is None:
785
793
  top_p = NOT_GIVEN
794
+ if isinstance(self.temperature, NotGiven) or self.temperature is None:
795
+ self.temperature = NOT_GIVEN
786
796
 
787
797
  if messages[0].get("role") == "system":
788
798
  system_prompt = messages[0]["content"]
@@ -874,7 +884,13 @@ class AsyncAnthropicChatClient(BaseAsyncChatClient):
874
884
  result["usage"]["total_tokens"] = (
875
885
  result["usage"]["prompt_tokens"] + result["usage"]["completion_tokens"]
876
886
  )
877
- yield ChatCompletionDeltaMessage(usage=Usage(**result["usage"]))
887
+ yield ChatCompletionDeltaMessage(
888
+ usage=Usage(
889
+ prompt_tokens=result["usage"]["prompt_tokens"],
890
+ completion_tokens=result["usage"]["completion_tokens"],
891
+ total_tokens=result["usage"]["total_tokens"],
892
+ )
893
+ )
878
894
 
879
895
  return generator()
880
896
  else:
@@ -9,8 +9,8 @@ import httpx
9
9
  from openai import OpenAI, AsyncOpenAI, AzureOpenAI, AsyncAzureOpenAI
10
10
  from anthropic import (
11
11
  Anthropic,
12
- AnthropicVertex,
13
12
  AsyncAnthropic,
13
+ AnthropicVertex,
14
14
  AsyncAnthropicVertex,
15
15
  AnthropicBedrock,
16
16
  AsyncAnthropicBedrock,
@@ -39,7 +39,7 @@ class BaseChatClient(ABC):
39
39
  self,
40
40
  model: str = "",
41
41
  stream: bool = False,
42
- temperature: float = 0.7,
42
+ temperature: float | None | NotGiven = NOT_GIVEN,
43
43
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
44
44
  random_endpoint: bool = True,
45
45
  endpoint_id: str = "",
@@ -108,7 +108,7 @@ class BaseChatClient(ABC):
108
108
  messages: list,
109
109
  model: str | None = None,
110
110
  stream: Literal[False] = False,
111
- temperature: float = 0.7,
111
+ temperature: float | None | NotGiven = NOT_GIVEN,
112
112
  max_tokens: int | None = None,
113
113
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
114
114
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -128,7 +128,7 @@ class BaseChatClient(ABC):
128
128
  messages: list,
129
129
  model: str | None = None,
130
130
  stream: Literal[True],
131
- temperature: float = 0.7,
131
+ temperature: float | None | NotGiven = NOT_GIVEN,
132
132
  max_tokens: int | None = None,
133
133
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
134
134
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -148,7 +148,7 @@ class BaseChatClient(ABC):
148
148
  messages: list,
149
149
  model: str | None = None,
150
150
  stream: bool,
151
- temperature: float = 0.7,
151
+ temperature: float | None | NotGiven = NOT_GIVEN,
152
152
  max_tokens: int | None = None,
153
153
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
154
154
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -167,7 +167,7 @@ class BaseChatClient(ABC):
167
167
  messages: list,
168
168
  model: str | None = None,
169
169
  stream: Literal[False] | Literal[True] = False,
170
- temperature: float = 0.7,
170
+ temperature: float | None | NotGiven = NOT_GIVEN,
171
171
  max_tokens: int | None = None,
172
172
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
173
173
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -184,7 +184,7 @@ class BaseChatClient(ABC):
184
184
  *,
185
185
  messages: list,
186
186
  model: str | None = None,
187
- temperature: float = 0.7,
187
+ temperature: float | None | NotGiven = NOT_GIVEN,
188
188
  max_tokens: int | None = None,
189
189
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
190
190
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -216,7 +216,7 @@ class BaseAsyncChatClient(ABC):
216
216
  self,
217
217
  model: str = "",
218
218
  stream: bool = False,
219
- temperature: float = 0.7,
219
+ temperature: float | None | NotGiven = NOT_GIVEN,
220
220
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
221
221
  random_endpoint: bool = True,
222
222
  endpoint_id: str = "",
@@ -293,7 +293,7 @@ class BaseAsyncChatClient(ABC):
293
293
  messages: list,
294
294
  model: str | None = None,
295
295
  stream: Literal[False] = False,
296
- temperature: float = 0.7,
296
+ temperature: float | None | NotGiven = NOT_GIVEN,
297
297
  max_tokens: int | None = None,
298
298
  tools: list | NotGiven = NOT_GIVEN,
299
299
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -313,7 +313,7 @@ class BaseAsyncChatClient(ABC):
313
313
  messages: list,
314
314
  model: str | None = None,
315
315
  stream: Literal[True],
316
- temperature: float = 0.7,
316
+ temperature: float | None | NotGiven = NOT_GIVEN,
317
317
  max_tokens: int | None = None,
318
318
  tools: list | NotGiven = NOT_GIVEN,
319
319
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -333,7 +333,7 @@ class BaseAsyncChatClient(ABC):
333
333
  messages: list,
334
334
  model: str | None = None,
335
335
  stream: bool,
336
- temperature: float = 0.7,
336
+ temperature: float | None | NotGiven = NOT_GIVEN,
337
337
  max_tokens: int | None = None,
338
338
  tools: list | NotGiven = NOT_GIVEN,
339
339
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -352,7 +352,7 @@ class BaseAsyncChatClient(ABC):
352
352
  messages: list,
353
353
  model: str | None = None,
354
354
  stream: Literal[False] | Literal[True] = False,
355
- temperature: float = 0.7,
355
+ temperature: float | None | NotGiven = NOT_GIVEN,
356
356
  max_tokens: int | None = None,
357
357
  tools: list | NotGiven = NOT_GIVEN,
358
358
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -369,7 +369,7 @@ class BaseAsyncChatClient(ABC):
369
369
  *,
370
370
  messages: list,
371
371
  model: str | None = None,
372
- temperature: float = 0.7,
372
+ temperature: float | None | NotGiven = NOT_GIVEN,
373
373
  max_tokens: int | None = None,
374
374
  tools: list | NotGiven = NOT_GIVEN,
375
375
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -29,7 +29,7 @@ class GeminiChatClient(BaseChatClient):
29
29
  self,
30
30
  model: str = defs.GEMINI_DEFAULT_MODEL,
31
31
  stream: bool = True,
32
- temperature: float = 0.7,
32
+ temperature: float | None | NotGiven = NOT_GIVEN,
33
33
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
34
34
  random_endpoint: bool = True,
35
35
  endpoint_id: str = "",
@@ -63,7 +63,7 @@ class GeminiChatClient(BaseChatClient):
63
63
  messages: list,
64
64
  model: str | None = None,
65
65
  stream: Literal[False] = False,
66
- temperature: float | None = None,
66
+ temperature: float | None | NotGiven = NOT_GIVEN,
67
67
  max_tokens: int | None = None,
68
68
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
69
69
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -82,7 +82,7 @@ class GeminiChatClient(BaseChatClient):
82
82
  messages: list,
83
83
  model: str | None = None,
84
84
  stream: Literal[True],
85
- temperature: float | None = None,
85
+ temperature: float | None | NotGiven = NOT_GIVEN,
86
86
  max_tokens: int | None = None,
87
87
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
88
88
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -101,7 +101,7 @@ class GeminiChatClient(BaseChatClient):
101
101
  messages: list,
102
102
  model: str | None = None,
103
103
  stream: bool,
104
- temperature: float | None = None,
104
+ temperature: float | None | NotGiven = NOT_GIVEN,
105
105
  max_tokens: int | None = None,
106
106
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
107
107
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -119,7 +119,7 @@ class GeminiChatClient(BaseChatClient):
119
119
  messages: list,
120
120
  model: str | None = None,
121
121
  stream: Literal[False] | Literal[True] = False,
122
- temperature: float | None = None,
122
+ temperature: float | None | NotGiven = NOT_GIVEN,
123
123
  max_tokens: int | None = None,
124
124
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
125
125
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -169,6 +169,10 @@ class GeminiChatClient(BaseChatClient):
169
169
  if top_p:
170
170
  top_p_params = {"top_p": top_p}
171
171
 
172
+ temperature_params = {}
173
+ if temperature:
174
+ temperature_params = {"temperature": temperature}
175
+
172
176
  request_body = {
173
177
  "contents": messages,
174
178
  "safetySettings": [
@@ -178,8 +182,8 @@ class GeminiChatClient(BaseChatClient):
178
182
  }
179
183
  ],
180
184
  "generationConfig": {
181
- "temperature": self.temperature,
182
185
  "maxOutputTokens": max_tokens,
186
+ **temperature_params,
183
187
  **top_p_params,
184
188
  **response_format_params,
185
189
  },
@@ -277,7 +281,7 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
277
281
  self,
278
282
  model: str = defs.GEMINI_DEFAULT_MODEL,
279
283
  stream: bool = True,
280
- temperature: float = 0.7,
284
+ temperature: float | None | NotGiven = NOT_GIVEN,
281
285
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
282
286
  random_endpoint: bool = True,
283
287
  endpoint_id: str = "",
@@ -311,7 +315,7 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
311
315
  messages: list,
312
316
  model: str | None = None,
313
317
  stream: Literal[False] = False,
314
- temperature: float | None = None,
318
+ temperature: float | None | NotGiven = NOT_GIVEN,
315
319
  max_tokens: int | None = None,
316
320
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
317
321
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -330,7 +334,7 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
330
334
  messages: list,
331
335
  model: str | None = None,
332
336
  stream: Literal[True],
333
- temperature: float | None = None,
337
+ temperature: float | None | NotGiven = NOT_GIVEN,
334
338
  max_tokens: int | None = None,
335
339
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
336
340
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -349,7 +353,7 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
349
353
  messages: list,
350
354
  model: str | None = None,
351
355
  stream: bool,
352
- temperature: float | None = None,
356
+ temperature: float | None | NotGiven = NOT_GIVEN,
353
357
  max_tokens: int | None = None,
354
358
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
355
359
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -367,7 +371,7 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
367
371
  messages: list,
368
372
  model: str | None = None,
369
373
  stream: Literal[False] | Literal[True] = False,
370
- temperature: float | None = None,
374
+ temperature: float | None | NotGiven = NOT_GIVEN,
371
375
  max_tokens: int | None = None,
372
376
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
373
377
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -417,6 +421,10 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
417
421
  if top_p:
418
422
  top_p_params = {"top_p": top_p}
419
423
 
424
+ temperature_params = {}
425
+ if temperature:
426
+ temperature_params = {"temperature": temperature}
427
+
420
428
  request_body = {
421
429
  "contents": messages,
422
430
  "safetySettings": [
@@ -426,8 +434,8 @@ class AsyncGeminiChatClient(BaseAsyncChatClient):
426
434
  }
427
435
  ],
428
436
  "generationConfig": {
429
- "temperature": self.temperature,
430
437
  "maxOutputTokens": max_tokens,
438
+ **temperature_params,
431
439
  **top_p_params,
432
440
  **response_format_params,
433
441
  },
@@ -51,7 +51,7 @@ class MiniMaxChatClient(BaseChatClient):
51
51
  self,
52
52
  model: str = defs.MINIMAX_DEFAULT_MODEL,
53
53
  stream: bool = True,
54
- temperature: float = 0.7,
54
+ temperature: float | None | NotGiven = NOT_GIVEN,
55
55
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
56
56
  random_endpoint: bool = True,
57
57
  endpoint_id: str = "",
@@ -85,7 +85,7 @@ class MiniMaxChatClient(BaseChatClient):
85
85
  messages: list,
86
86
  model: str | None = None,
87
87
  stream: Literal[False] = False,
88
- temperature: float | None = None,
88
+ temperature: float | None | NotGiven = NOT_GIVEN,
89
89
  max_tokens: int | None = None,
90
90
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
91
91
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -104,7 +104,7 @@ class MiniMaxChatClient(BaseChatClient):
104
104
  messages: list,
105
105
  model: str | None = None,
106
106
  stream: Literal[True],
107
- temperature: float | None = None,
107
+ temperature: float | None | NotGiven = NOT_GIVEN,
108
108
  max_tokens: int | None = None,
109
109
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
110
110
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -123,7 +123,7 @@ class MiniMaxChatClient(BaseChatClient):
123
123
  messages: list,
124
124
  model: str | None = None,
125
125
  stream: bool,
126
- temperature: float | None = None,
126
+ temperature: float | None | NotGiven = NOT_GIVEN,
127
127
  max_tokens: int | None = None,
128
128
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
129
129
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -140,7 +140,7 @@ class MiniMaxChatClient(BaseChatClient):
140
140
  messages: list,
141
141
  model: str | None = None,
142
142
  stream: Literal[False] | Literal[True] = False,
143
- temperature: float | None = None,
143
+ temperature: float | None | NotGiven = NOT_GIVEN,
144
144
  max_tokens: int | None = None,
145
145
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
146
146
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -198,6 +198,10 @@ class MiniMaxChatClient(BaseChatClient):
198
198
  else:
199
199
  top_p_params = {}
200
200
 
201
+ temperature_params = {}
202
+ if temperature:
203
+ temperature_params = {"temperature": temperature}
204
+
201
205
  if max_tokens is None:
202
206
  max_output_tokens = self.model_setting.max_output_tokens
203
207
  if max_output_tokens is not None:
@@ -223,9 +227,9 @@ class MiniMaxChatClient(BaseChatClient):
223
227
  "model": self.model_id,
224
228
  "messages": messages,
225
229
  "max_tokens": max_tokens,
226
- "temperature": self.temperature,
227
230
  "stream": self.stream,
228
231
  "mask_sensitive_info": False,
232
+ **temperature_params,
229
233
  **top_p_params,
230
234
  **tools_params,
231
235
  **kwargs,
@@ -298,7 +302,7 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
298
302
  self,
299
303
  model: str = defs.MINIMAX_DEFAULT_MODEL,
300
304
  stream: bool = True,
301
- temperature: float = 0.7,
305
+ temperature: float | None | NotGiven = NOT_GIVEN,
302
306
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
303
307
  random_endpoint: bool = True,
304
308
  endpoint_id: str = "",
@@ -332,7 +336,7 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
332
336
  messages: list,
333
337
  model: str | None = None,
334
338
  stream: Literal[False] = False,
335
- temperature: float | None = None,
339
+ temperature: float | None | NotGiven = NOT_GIVEN,
336
340
  max_tokens: int | None = None,
337
341
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
338
342
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -351,7 +355,7 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
351
355
  messages: list,
352
356
  model: str | None = None,
353
357
  stream: Literal[True],
354
- temperature: float | None = None,
358
+ temperature: float | None | NotGiven = NOT_GIVEN,
355
359
  max_tokens: int | None = None,
356
360
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
357
361
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -370,7 +374,7 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
370
374
  messages: list,
371
375
  model: str | None = None,
372
376
  stream: bool,
373
- temperature: float | None = None,
377
+ temperature: float | None | NotGiven = NOT_GIVEN,
374
378
  max_tokens: int | None = None,
375
379
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
376
380
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -388,7 +392,7 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
388
392
  messages: list,
389
393
  model: str | None = None,
390
394
  stream: Literal[False] | Literal[True] = False,
391
- temperature: float | None = None,
395
+ temperature: float | None | NotGiven = NOT_GIVEN,
392
396
  max_tokens: int | None = None,
393
397
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
394
398
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -444,6 +448,10 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
444
448
  else:
445
449
  top_p_params = {}
446
450
 
451
+ temperature_params = {}
452
+ if temperature:
453
+ temperature_params = {"temperature": temperature}
454
+
447
455
  if max_tokens is None:
448
456
  max_output_tokens = self.model_setting.max_output_tokens
449
457
  if max_output_tokens is not None:
@@ -469,9 +477,9 @@ class AsyncMiniMaxChatClient(BaseAsyncChatClient):
469
477
  "model": self.model_id,
470
478
  "messages": messages,
471
479
  "max_tokens": max_tokens,
472
- "temperature": self.temperature,
473
480
  "stream": self.stream,
474
481
  "mask_sensitive_info": False,
482
+ **temperature_params,
475
483
  **top_p_params,
476
484
  **tools_params,
477
485
  **kwargs,
@@ -38,7 +38,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
38
38
  self,
39
39
  model: str = "",
40
40
  stream: bool = True,
41
- temperature: float = 0.7,
41
+ temperature: float | None | NotGiven = NOT_GIVEN,
42
42
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
43
43
  random_endpoint: bool = True,
44
44
  endpoint_id: str = "",
@@ -88,7 +88,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
88
88
  messages: list,
89
89
  model: str | None = None,
90
90
  stream: Literal[False] = False,
91
- temperature: float | None = None,
91
+ temperature: float | None | NotGiven = NOT_GIVEN,
92
92
  max_tokens: int | None = None,
93
93
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
94
94
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -107,7 +107,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
107
107
  messages: list,
108
108
  model: str | None = None,
109
109
  stream: Literal[True],
110
- temperature: float | None = None,
110
+ temperature: float | None | NotGiven = NOT_GIVEN,
111
111
  max_tokens: int | None = None,
112
112
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
113
113
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -126,7 +126,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
126
126
  messages: list,
127
127
  model: str | None = None,
128
128
  stream: bool,
129
- temperature: float | None = None,
129
+ temperature: float | None | NotGiven = NOT_GIVEN,
130
130
  max_tokens: int | None = None,
131
131
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
132
132
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -144,7 +144,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
144
144
  messages: list,
145
145
  model: str | None = None,
146
146
  stream: Literal[False] | Literal[True] = False,
147
- temperature: float | None = None,
147
+ temperature: float | None | NotGiven = NOT_GIVEN,
148
148
  max_tokens: int | None = None,
149
149
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
150
150
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -158,6 +158,8 @@ class OpenAICompatibleChatClient(BaseChatClient):
158
158
  self.model = model
159
159
  if stream is not None:
160
160
  self.stream = stream
161
+ if isinstance(temperature, AnthropicNotGiven):
162
+ temperature = NOT_GIVEN
161
163
  if temperature is not None:
162
164
  self.temperature = temperature
163
165
  if isinstance(top_p, AnthropicNotGiven):
@@ -233,6 +235,8 @@ class OpenAICompatibleChatClient(BaseChatClient):
233
235
  completion_tokens=chunk.usage.completion_tokens or 0,
234
236
  prompt_tokens=chunk.usage.prompt_tokens or 0,
235
237
  total_tokens=chunk.usage.total_tokens or 0,
238
+ prompt_tokens_details=chunk.usage.prompt_tokens_details,
239
+ completion_tokens_details=chunk.usage.completion_tokens_details,
236
240
  )
237
241
 
238
242
  if len(chunk.choices) == 0:
@@ -279,6 +283,7 @@ class OpenAICompatibleChatClient(BaseChatClient):
279
283
 
280
284
  result = {
281
285
  "content": response.choices[0].message.content,
286
+ "reasoning_content": getattr(response.choices[0].message, "reasoning_content", None),
282
287
  "usage": response.usage.model_dump() if response.usage else None,
283
288
  }
284
289
  if tools:
@@ -305,7 +310,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
305
310
  self,
306
311
  model: str = "",
307
312
  stream: bool = True,
308
- temperature: float = 0.7,
313
+ temperature: float | None | NotGiven = NOT_GIVEN,
309
314
  context_length_control: ContextLengthControlType = defs.CONTEXT_LENGTH_CONTROL,
310
315
  random_endpoint: bool = True,
311
316
  endpoint_id: str = "",
@@ -355,7 +360,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
355
360
  messages: list,
356
361
  model: str | None = None,
357
362
  stream: Literal[False] = False,
358
- temperature: float | None = None,
363
+ temperature: float | None | NotGiven = NOT_GIVEN,
359
364
  max_tokens: int | None = None,
360
365
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
361
366
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -374,7 +379,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
374
379
  messages: list,
375
380
  model: str | None = None,
376
381
  stream: Literal[True],
377
- temperature: float | None = None,
382
+ temperature: float | None | NotGiven = NOT_GIVEN,
378
383
  max_tokens: int | None = None,
379
384
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
380
385
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -393,7 +398,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
393
398
  messages: list,
394
399
  model: str | None = None,
395
400
  stream: bool,
396
- temperature: float | None = None,
401
+ temperature: float | None | NotGiven = NOT_GIVEN,
397
402
  max_tokens: int | None = None,
398
403
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
399
404
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -411,7 +416,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
411
416
  messages: list,
412
417
  model: str | None = None,
413
418
  stream: Literal[False] | Literal[True] = False,
414
- temperature: float | None = None,
419
+ temperature: float | None | NotGiven = NOT_GIVEN,
415
420
  max_tokens: int | None = None,
416
421
  tools: Iterable[ToolParam] | NotGiven = NOT_GIVEN,
417
422
  tool_choice: ToolChoice | NotGiven = NOT_GIVEN,
@@ -425,6 +430,8 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
425
430
  self.model = model
426
431
  if stream is not None:
427
432
  self.stream = stream
433
+ if isinstance(temperature, AnthropicNotGiven):
434
+ temperature = NOT_GIVEN
428
435
  if temperature is not None:
429
436
  self.temperature = temperature
430
437
  if isinstance(top_p, AnthropicNotGiven):
@@ -500,6 +507,8 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
500
507
  completion_tokens=chunk.usage.completion_tokens or 0,
501
508
  prompt_tokens=chunk.usage.prompt_tokens or 0,
502
509
  total_tokens=chunk.usage.total_tokens or 0,
510
+ completion_tokens_details=chunk.usage.completion_tokens_details,
511
+ prompt_tokens_details=chunk.usage.prompt_tokens_details,
503
512
  )
504
513
 
505
514
  if len(chunk.choices) == 0:
@@ -546,6 +555,7 @@ class AsyncOpenAICompatibleChatClient(BaseAsyncChatClient):
546
555
  )
547
556
  result = {
548
557
  "content": response.choices[0].message.content,
558
+ "reasoning_content": getattr(response.choices[0].message, "reasoning_content", None),
549
559
  "usage": response.usage.model_dump() if response.usage else None,
550
560
  }
551
561
  if tools:
@@ -39,11 +39,18 @@ MOONSHOT_DEFAULT_MODEL: Final[str] = "moonshot-v1-8k"
39
39
  DEEPSEEK_MODELS: Final[Dict[str, Dict[str, Any]]] = {
40
40
  "deepseek-chat": {
41
41
  "id": "deepseek-chat",
42
- "context_length": 128000,
43
- "max_output_tokens": 4096,
42
+ "context_length": 64000,
43
+ "max_output_tokens": 8192,
44
44
  "function_call_available": True,
45
45
  "response_format_available": True,
46
46
  },
47
+ "deepseek-reasoner": {
48
+ "id": "deepseek-reasoner",
49
+ "context_length": 64000,
50
+ "max_output_tokens": 8192,
51
+ "function_call_available": False,
52
+ "response_format_available": False,
53
+ },
47
54
  }
48
55
  DEEPSEEK_DEFAULT_MODEL: Final[str] = "deepseek-chat"
49
56
 
@@ -812,4 +819,17 @@ XAI_MODELS: Final[Dict[str, Dict[str, Any]]] = {
812
819
  "function_call_available": True,
813
820
  "response_format_available": True,
814
821
  },
822
+ "grok-2-latest": {
823
+ "id": "grok-2-latest",
824
+ "context_length": 131072,
825
+ "function_call_available": True,
826
+ "response_format_available": True,
827
+ },
828
+ "grok-2-vision-latest": {
829
+ "id": "grok-2-vision-latest",
830
+ "context_length": 32768,
831
+ "function_call_available": True,
832
+ "response_format_available": True,
833
+ "native_multimodal": True,
834
+ },
815
835
  }
@@ -13,6 +13,7 @@ from openai._types import NotGiven as OpenAINotGiven
13
13
  from openai._types import NOT_GIVEN as OPENAI_NOT_GIVEN
14
14
  from openai.types.chat.chat_completion_chunk import ChoiceDeltaToolCall
15
15
  from openai.types.chat.chat_completion_tool_param import ChatCompletionToolParam
16
+ from openai.types.completion_usage import CompletionTokensDetails, PromptTokensDetails
16
17
  from openai.types.chat.chat_completion_message_tool_call import ChatCompletionMessageToolCall
17
18
  from openai.types.chat.chat_completion_stream_options_param import ChatCompletionStreamOptionsParam
18
19
  from openai.types.chat.chat_completion_tool_choice_option_param import ChatCompletionToolChoiceOptionParam
@@ -80,13 +81,23 @@ class BackendSettings(BaseModel):
80
81
 
81
82
  class Usage(BaseModel):
82
83
  completion_tokens: int
84
+
83
85
  prompt_tokens: int
86
+
84
87
  total_tokens: int
85
88
 
89
+ completion_tokens_details: Optional[CompletionTokensDetails] = None
90
+ """Breakdown of tokens used in a completion."""
91
+
92
+ prompt_tokens_details: Optional[PromptTokensDetails] = None
93
+ """Breakdown of tokens used in the prompt."""
94
+
86
95
 
87
96
  class ChatCompletionMessage(BaseModel):
88
97
  content: Optional[str] = None
89
98
 
99
+ reasoning_content: Optional[str] = None
100
+
90
101
  tool_calls: Optional[List[ChatCompletionMessageToolCall]] = None
91
102
  """The tool calls generated by the model, such as function calls."""
92
103
 
@@ -98,6 +109,8 @@ class ChatCompletionMessage(BaseModel):
98
109
  class ChatCompletionDeltaMessage(BaseModel):
99
110
  content: Optional[str] = None
100
111
 
112
+ reasoning_content: Optional[str] = None
113
+
101
114
  tool_calls: Optional[List[ChoiceDeltaToolCall]] = None
102
115
  """The tool calls generated by the model, such as function calls."""
103
116
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vectorvein
3
- Version: 0.1.77
3
+ Version: 0.1.78
4
4
  Summary: VectorVein python SDK
5
5
  Author-Email: Anderson <andersonby@163.com>
6
6
  License: MIT
@@ -1,20 +1,20 @@
1
- vectorvein-0.1.77.dist-info/METADATA,sha256=EGx61L2VDmmghx_inG3CK2RuFi3tp8H2VOprx_XuqSE,641
2
- vectorvein-0.1.77.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- vectorvein-0.1.77.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ vectorvein-0.1.78.dist-info/METADATA,sha256=zoS7DULHUtC0Tygj-G517o8MD0QL8wLMoagcHU8qS7Q,641
2
+ vectorvein-0.1.78.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ vectorvein-0.1.78.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  vectorvein/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- vectorvein/chat_clients/__init__.py,sha256=Oev7Lv1DIEWCMD-2Pm7e2cwzX7JFQTnIK-j6o4iUuyQ,17725
6
- vectorvein/chat_clients/anthropic_client.py,sha256=Uy9E8t6hrYymNobRsPRCX5W-KsBXRun-8rAiRsN8M00,37217
5
+ vectorvein/chat_clients/__init__.py,sha256=omQuG4PRRPNflSAgtdU--rwsWG6vMpwMEyIGZyFVHVQ,18596
6
+ vectorvein/chat_clients/anthropic_client.py,sha256=PGIKldH4FnGrqozoY_FZ6LqhDHC-jY7NF5J1F1zT2Ok,38257
7
7
  vectorvein/chat_clients/baichuan_client.py,sha256=CVMvpgjdrZGv0BWnTOBD-f2ufZ3wq3496wqukumsAr4,526
8
- vectorvein/chat_clients/base_client.py,sha256=Dar-2b7YR13YcWlH6sLIrKNr9_6IrpdUMjdwVFQyu0Q,13350
8
+ vectorvein/chat_clients/base_client.py,sha256=Rw-BYFxy86ohZQH8KABiXP6xuNQBjWC3JkeN6WsXfLw,13638
9
9
  vectorvein/chat_clients/deepseek_client.py,sha256=3qWu01NlJAP2N-Ff62d5-CZXZitlizE1fzb20LNetig,526
10
- vectorvein/chat_clients/gemini_client.py,sha256=BsOhK4LI04pxak6wtmSju63it2P-zzIAXhCtgC6DfOQ,20453
10
+ vectorvein/chat_clients/gemini_client.py,sha256=qqqjQ9X8sIgJaT8xgvtG_cY-lmNGzA_f9V4tUcGRcBo,20853
11
11
  vectorvein/chat_clients/groq_client.py,sha256=Uow4pgdmFi93ZQSoOol2-0PhhqkW-S0XuSldvppz5U4,498
12
12
  vectorvein/chat_clients/local_client.py,sha256=55nOsxzqUf79q3Y14MKROA71zxhsT7p7FsDZ89rts2M,422
13
- vectorvein/chat_clients/minimax_client.py,sha256=TOfYDLJvs9JWSyU7S8V5SV3ozOC8anI2QEDdKy29HMk,19633
13
+ vectorvein/chat_clients/minimax_client.py,sha256=ooJU92UCACC4TVWKJ-uo8vqQ8qF3K14ziAuSFm8Wj3M,20025
14
14
  vectorvein/chat_clients/mistral_client.py,sha256=1aKSylzBDaLYcFnaBIL4-sXSzWmXfBeON9Q0rq-ziWw,534
15
15
  vectorvein/chat_clients/moonshot_client.py,sha256=gbu-6nGxx8uM_U2WlI4Wus881rFRotzHtMSoYOcruGU,526
16
16
  vectorvein/chat_clients/openai_client.py,sha256=Nz6tV45pWcsOupxjnsRsGTicbQNJWIZyxuJoJ5DGMpg,527
17
- vectorvein/chat_clients/openai_compatible_client.py,sha256=tL_pj8OFhSo3yvHQxshjO695pTesaOrHLGVnkmfQZqw,22953
17
+ vectorvein/chat_clients/openai_compatible_client.py,sha256=nuBcsoPOuv6fKs8wb5uE2tVeqGWwZfRu_DuFaukEQSg,23881
18
18
  vectorvein/chat_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  vectorvein/chat_clients/qwen_client.py,sha256=-ryh-m9PgsO0fc4ulcCmPTy1155J8YUy15uPoJQOHA0,513
20
20
  vectorvein/chat_clients/stepfun_client.py,sha256=zsD2W5ahmR4DD9cqQTXmJr3txrGuvxbRWhFlRdwNijI,519
@@ -26,11 +26,11 @@ vectorvein/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
26
  vectorvein/server/token_server.py,sha256=36F9PKSNOX8ZtYBXY_l-76GQTpUSmQ2Y8EMy1H7wtdQ,1353
27
27
  vectorvein/settings/__init__.py,sha256=g01y74x0k2JEAqNpRGG0PDs0NTULjOAZV6HRhydPX1c,3874
28
28
  vectorvein/settings/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- vectorvein/types/defaults.py,sha256=4qF31QJSFexF8E-Og8aGM0wCzegtPe65vxd8VQj7oKA,25579
29
+ vectorvein/types/defaults.py,sha256=LB6G8RoWWDdZkFw0EGTpLxFXlV557BBTzmUXgNDhlUk,26227
30
30
  vectorvein/types/enums.py,sha256=7KTJSVtQueImmbr1fSwv3rQVtc0RyMWXJmoE2tDOaso,1667
31
31
  vectorvein/types/exception.py,sha256=gnW4GnJ76jND6UGnodk9xmqkcbeS7Cz2rvncA2HpD5E,69
32
- vectorvein/types/llm_parameters.py,sha256=I-b__6OZhobxneSOTWfoug2xJr6HBljanHVXU6cByUM,5447
32
+ vectorvein/types/llm_parameters.py,sha256=CLhDSp9KI_zzjIXUvjiTuGxfYXpubTNBCVcJ6RgH2iY,5879
33
33
  vectorvein/types/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  vectorvein/utilities/media_processing.py,sha256=CTRq-lGlFkFgP_FSRhNwF_qUgmOrXPf2_1Ok9HY42_g,5887
35
35
  vectorvein/utilities/retry.py,sha256=6KFS9R2HdhqM3_9jkjD4F36ZSpEx2YNFGOVlpOsUetM,2208
36
- vectorvein-0.1.77.dist-info/RECORD,,
36
+ vectorvein-0.1.78.dist-info/RECORD,,