gllm-inference-binary 0.5.9__py3-none-any.whl → 0.5.10b3__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.

Potentially problematic release.


This version of gllm-inference-binary might be problematic. Click here for more details.

@@ -162,7 +162,12 @@ class GoogleLMInvoker(BaseLMInvoker):
162
162
  ```python
163
163
  LMOutput(
164
164
  response="Golden retriever is a good dog breed.",
165
- token_usage=TokenUsage(input_tokens=100, output_tokens=50),
165
+ token_usage=TokenUsage(
166
+ input_tokens=1500,
167
+ output_tokens=200,
168
+ input_token_details=InputTokenDetails(cached_tokens=1200, uncached_tokens=300),
169
+ output_token_details=OutputTokenDetails(reasoning_tokens=180, response_tokens=20),
170
+ ),
166
171
  duration=0.729,
167
172
  finish_details={"finish_reason": "STOP", "finish_message": None},
168
173
  )
@@ -5,9 +5,9 @@ from gllm_inference.schema.lm_output import LMOutput as LMOutput
5
5
  from gllm_inference.schema.message import Message as Message
6
6
  from gllm_inference.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider
7
7
  from gllm_inference.schema.reasoning import Reasoning as Reasoning
8
- from gllm_inference.schema.token_usage import TokenUsage as TokenUsage
8
+ from gllm_inference.schema.token_usage import InputTokenDetails as InputTokenDetails, OutputTokenDetails as OutputTokenDetails, TokenUsage as TokenUsage
9
9
  from gllm_inference.schema.tool_call import ToolCall as ToolCall
10
10
  from gllm_inference.schema.tool_result import ToolResult as ToolResult
11
11
  from gllm_inference.schema.type_alias import EMContent as EMContent, ErrorResponse as ErrorResponse, MessageContent as MessageContent, ResponseSchema as ResponseSchema, Vector as Vector
12
12
 
13
- __all__ = ['Attachment', 'AttachmentType', 'CodeExecResult', 'EMContent', 'EmitDataType', 'ErrorResponse', 'MessageContent', 'LMOutput', 'ModelId', 'ModelProvider', 'Message', 'MessageRole', 'Reasoning', 'ResponseSchema', 'TokenUsage', 'ToolCall', 'ToolResult', 'Vector']
13
+ __all__ = ['Attachment', 'AttachmentType', 'CodeExecResult', 'EMContent', 'EmitDataType', 'ErrorResponse', 'InputTokenDetails', 'MessageContent', 'LMOutput', 'ModelId', 'ModelProvider', 'Message', 'MessageRole', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'TokenUsage', 'ToolCall', 'ToolResult', 'Vector']
@@ -1,11 +1,75 @@
1
1
  from pydantic import BaseModel
2
2
 
3
+ class InputTokenDetails(BaseModel):
4
+ """Defines the input token details schema.
5
+
6
+ Attributes:
7
+ cached_tokens (int): The number of cached tokens. Defaults to 0.
8
+ uncached_tokens (int): The number of uncached tokens. Defaults to 0.
9
+ """
10
+ cached_tokens: int
11
+ uncached_tokens: int
12
+ def __add__(self, other: InputTokenDetails) -> InputTokenDetails:
13
+ """Add two InputTokenDetails objects together.
14
+
15
+ Args:
16
+ other (InputTokenDetails): The other InputTokenDetails object to add.
17
+
18
+ Returns:
19
+ InputTokenDetails: A new InputTokenDetails object with summed values.
20
+ """
21
+
22
+ class OutputTokenDetails(BaseModel):
23
+ """Defines the output token details schema.
24
+
25
+ Attributes:
26
+ reasoning_tokens (int): The number of reasoning tokens. Defaults to 0.
27
+ response_tokens (int): The number of response tokens. Defaults to 0.
28
+ """
29
+ reasoning_tokens: int
30
+ response_tokens: int
31
+ def __add__(self, other: OutputTokenDetails) -> OutputTokenDetails:
32
+ """Add two OutputTokenDetails objects together.
33
+
34
+ Args:
35
+ other (OutputTokenDetails): The other OutputTokenDetails object to add.
36
+
37
+ Returns:
38
+ OutputTokenDetails: A new OutputTokenDetails object with summed values.
39
+ """
40
+
3
41
  class TokenUsage(BaseModel):
4
42
  """Defines the token usage data structure of a language model.
5
43
 
6
44
  Attributes:
7
- input_tokens (int): The number of input tokens.
8
- output_tokens (int): The number of output tokens.
45
+ input_tokens (int): The number of input tokens. Defaults to 0.
46
+ output_tokens (int): The number of output tokens. Defaults to 0.
47
+ input_token_details (InputTokenDetails | None): The details of the input tokens. Defaults to None.
48
+ output_token_details (OutputTokenDetails | None): The details of the output tokens. Defaults to None.
9
49
  """
10
50
  input_tokens: int
11
51
  output_tokens: int
52
+ input_token_details: InputTokenDetails | None
53
+ output_token_details: OutputTokenDetails | None
54
+ @classmethod
55
+ def from_token_details(cls, input_tokens: int | None = None, output_tokens: int | None = None, cached_tokens: int | None = None, reasoning_tokens: int | None = None) -> TokenUsage:
56
+ """Creates a TokenUsage from token details.
57
+
58
+ Args:
59
+ input_tokens (int | None): The number of input tokens. Defaults to None.
60
+ output_tokens (int | None): The number of output tokens. Defaults to None.
61
+ cached_tokens (int | None): The number of cached tokens. Defaults to None.
62
+ reasoning_tokens (int | None): The number of reasoning tokens. Defaults to None.
63
+
64
+ Returns:
65
+ TokenUsage: The instantiated TokenUsage.
66
+ """
67
+ def __add__(self, other: TokenUsage) -> TokenUsage:
68
+ """Add two TokenUsage objects together.
69
+
70
+ Args:
71
+ other (TokenUsage): The other TokenUsage object to add.
72
+
73
+ Returns:
74
+ TokenUsage: A new TokenUsage object with summed values.
75
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.9
3
+ Version: 0.5.10b3
4
4
  Summary: A library containing components related to model inferences in Gen AI applications.
5
5
  Author: Henry Wicaksono
6
6
  Author-email: henry.wicaksono@gdplabs.id
@@ -35,7 +35,7 @@ gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=85uvShLv4-eiGOpTMgwWpQ
35
35
  gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=N2TjGz5Gi6xiLkAgI6SzWq_V3tj66HJfMNff7d04uU0,14856
36
36
  gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=ae5P_9sjtcOgMIUaRchvp8F0FujoeP4e2F_OoHSe_go,12655
37
37
  gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=c4H3TOz0LIhWjokCCdQ4asiwQR4_LPyaimo4RAqU9es,9369
38
- gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=Ph9QmTdFlar92iUDDcWwwVY_KDkt9Rumfi41zpTNfRg,16853
38
+ gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=I3plg_oVuTl0hiShFBmCYPclP4gWbzU61xUSgon24Ew,17102
39
39
  gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=bBGOxJfjnzOtDR4kH4PuCiOCKEPu8rTqzZodTXCHQ2k,13522
40
40
  gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=HHwW7i8ryXHI23JZQwscyva6aPmPOB13Muhf7gaaMUM,13376
41
41
  gllm_inference/lm_invoker/lm_invoker.pyi,sha256=YNJ0Sh_BOl1WbC69xvuxWM75qyByXJSXAYWSwtQ84cc,7960
@@ -74,7 +74,7 @@ gllm_inference/prompt_formatter/prompt_formatter.pyi,sha256=hAc6rxWc6JSYdD-OypLi
74
74
  gllm_inference/request_processor/__init__.pyi,sha256=giEme2WFQhgyKiBZHhSet0_nKSCHwGy-_2p6NRzg0Zc,231
75
75
  gllm_inference/request_processor/lm_request_processor.pyi,sha256=rInXhC95BvQnw9q98KZWpjPH8Q_TV4zC2ycNjypEBZ4,5516
76
76
  gllm_inference/request_processor/uses_lm_mixin.pyi,sha256=znBG4AWWm_H70Qqrc1mO4ohmWotX9id81Fqe-x9Qa6Q,2371
77
- gllm_inference/schema/__init__.pyi,sha256=-ldt0xJQJirVNdwLFev3bmzmFRw9HSUWBRmmIVH7uyU,1251
77
+ gllm_inference/schema/__init__.pyi,sha256=Mg9aKyvShNaB4XmqLWcZZ0arSNJhT2g1hhIqP1IBuaM,1376
78
78
  gllm_inference/schema/attachment.pyi,sha256=9zgAjGXBjLfzPGaKi68FMW6b5mXdEA352nDe-ynOSvY,3385
79
79
  gllm_inference/schema/code_exec_result.pyi,sha256=WQ-ARoGM9r6nyRX-A0Ro1XKiqrc9R3jRYXZpu_xo5S4,573
80
80
  gllm_inference/schema/enums.pyi,sha256=SQ9mXt8j7uK333uUnUHRs-mkRxf0Z5NCtkAkgQZPIb4,629
@@ -82,13 +82,13 @@ gllm_inference/schema/lm_output.pyi,sha256=WP2LQrY0D03OJtFoaW_dGoJ_-yFUh2HbVlllg
82
82
  gllm_inference/schema/message.pyi,sha256=jJV6A0ihEcun2OhzyMtNkiHnf7d6v5R-GdpTBGfJ0AQ,2272
83
83
  gllm_inference/schema/model_id.pyi,sha256=3prO19l-FCSecRupe93ruXe91-Xw3GJOpbuQ66bijo0,5368
84
84
  gllm_inference/schema/reasoning.pyi,sha256=jbPxkDRHt0Vt-zdcc8lTT1l2hIE1Jm3HIHeNd0hfXGo,577
85
- gllm_inference/schema/token_usage.pyi,sha256=Eevs8S-yXoM7kQkkzhXHEvORU8DMGzdQynAamqtIoX4,323
85
+ gllm_inference/schema/token_usage.pyi,sha256=WJiGQyz5qatzBK2b-sABLCyTRLCBbAvxCRcqSJOzu-8,3025
86
86
  gllm_inference/schema/tool_call.pyi,sha256=OWT9LUqs_xfUcOkPG0aokAAqzLYYDkfnjTa0zOWvugk,403
87
87
  gllm_inference/schema/tool_result.pyi,sha256=IJsU3n8y0Q9nFMEiq4RmLEIHueSiim0Oz_DlhKrTqto,287
88
88
  gllm_inference/schema/type_alias.pyi,sha256=qAljeBoeQEfT601maGe_mEpXD9inNzbGte1i6joQafc,740
89
89
  gllm_inference/utils/__init__.pyi,sha256=RBTWDu1TDPpTd17fixcPYFv2L_vp4-IAOX0IsxgCsD4,299
90
90
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
91
91
  gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
92
- gllm_inference_binary-0.5.9.dist-info/METADATA,sha256=C4ovZJsiSKuRWp_2DbNV57oJwtxC0sI8sPrKXlCHFN4,4531
93
- gllm_inference_binary-0.5.9.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
94
- gllm_inference_binary-0.5.9.dist-info/RECORD,,
92
+ gllm_inference_binary-0.5.10b3.dist-info/METADATA,sha256=3JPygQCKjjaCWg8h4lzWtx3sLY3KmvD9GUtMnT1dVqQ,4534
93
+ gllm_inference_binary-0.5.10b3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
94
+ gllm_inference_binary-0.5.10b3.dist-info/RECORD,,