gllm-inference-binary 0.5.7__cp311-cp311-win_amd64.whl → 0.5.10b12__cp311-cp311-win_amd64.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.
@@ -7,3 +7,4 @@ INVOKER_PROPAGATED_MAX_RETRIES: int
7
7
  INVOKER_DEFAULT_TIMEOUT: float
8
8
  HEX_REPR_LENGTH: int
9
9
  HTTP_STATUS_CODE_PATTERNS: Incomplete
10
+ SECONDS_TO_MILLISECONDS: int
@@ -1,6 +1,6 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.utils.retry import RetryConfig as RetryConfig
3
- from gllm_inference.constants import GOOGLE_SCOPES as GOOGLE_SCOPES
3
+ from gllm_inference.constants import GOOGLE_SCOPES as GOOGLE_SCOPES, SECONDS_TO_MILLISECONDS as SECONDS_TO_MILLISECONDS
4
4
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.em_invoker.schema.google import Key as Key
6
6
  from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
@@ -1,11 +1,12 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
5
  from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
5
6
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
6
7
  from gllm_inference.lm_invoker.schema.anthropic import InputType as InputType, Key as Key, OutputType as OutputType
7
8
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EmitDataType as EmitDataType, LMOutput as LMOutput, Message as Message, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
8
- from langchain_core.tools import Tool as Tool
9
+ from langchain_core.tools import Tool as LangChainTool
9
10
  from typing import Any
10
11
 
11
12
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -49,7 +50,7 @@ class AnthropicLMInvoker(BaseLMInvoker):
49
50
 
50
51
  Tool calling:
51
52
  Tool calling is a feature that allows the language model to call tools to perform tasks.
52
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
53
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
53
54
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
54
55
  `tool_calls` attribute in the output.
55
56
 
@@ -222,7 +223,7 @@ class AnthropicLMInvoker(BaseLMInvoker):
222
223
  client: Incomplete
223
224
  thinking: Incomplete
224
225
  thinking_budget: Incomplete
225
- def __init__(self, model_name: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, thinking: bool = False, thinking_budget: int = ...) -> None:
226
+ def __init__(self, model_name: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, thinking: bool = False, thinking_budget: int = ...) -> None:
226
227
  """Initializes the AnthropicLmInvoker instance.
227
228
 
228
229
  Args:
@@ -232,7 +233,8 @@ class AnthropicLMInvoker(BaseLMInvoker):
232
233
  model_kwargs (dict[str, Any] | None, optional): Additional keyword arguments for the Anthropic client.
233
234
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
234
235
  Defaults to None.
235
- tools (list[Tool] | None, optional): Tools provided to the model to enable tool calling. Defaults to None.
236
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
237
+ Defaults to None, in which case an empty list is used.
236
238
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
237
239
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
238
240
  dictionary. Defaults to None.
@@ -248,13 +250,13 @@ class AnthropicLMInvoker(BaseLMInvoker):
248
250
  1. `thinking` is True, but the `thinking_budget` is less than 1024.
249
251
  3. `response_schema` is provided, but `tools` or `thinking` are also provided.
250
252
  """
251
- def set_tools(self, tools: list[Tool]) -> None:
253
+ def set_tools(self, tools: list[Tool | LangChainTool]) -> None:
252
254
  """Sets the tools for the Anthropic language model.
253
255
 
254
256
  This method sets the tools for the Anthropic language model. Any existing tools will be replaced.
255
257
 
256
258
  Args:
257
- tools (list[Tool]): The list of tools to be used.
259
+ tools (list[Tool | LangChainTool]): The list of tools to be used.
258
260
 
259
261
  Raises:
260
262
  ValueError: If `response_schema` exists.
@@ -1,10 +1,11 @@
1
1
  from _typeshed import Incomplete
2
+ from gllm_core.schema.tool import Tool as Tool
2
3
  from gllm_core.utils.retry import RetryConfig as RetryConfig
3
4
  from gllm_inference.constants import DEFAULT_AZURE_OPENAI_API_VERSION as DEFAULT_AZURE_OPENAI_API_VERSION, INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
4
5
  from gllm_inference.lm_invoker.openai_lm_invoker import OpenAILMInvoker as OpenAILMInvoker, ReasoningEffort as ReasoningEffort, ReasoningSummary as ReasoningSummary
5
6
  from gllm_inference.lm_invoker.schema.openai import Key as Key
6
7
  from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema
7
- from langchain_core.tools import Tool as Tool
8
+ from langchain_core.tools import Tool as LangChainTool
8
9
  from typing import Any
9
10
 
10
11
  class AzureOpenAILMInvoker(OpenAILMInvoker):
@@ -16,7 +17,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
16
17
  model_name (str): The name of the Azure OpenAI language model deployment.
17
18
  client (AsyncAzureOpenAI): The Azure OpenAI client instance.
18
19
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
19
- tools (list[Any]): The list of tools provided to the model to enable tool calling.
20
+ tools (list[Tool]): The list of tools provided to the model to enable tool calling.
20
21
  response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
21
22
  structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
22
23
  output_analytics (bool): Whether to output the invocation analytics.
@@ -51,7 +52,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
51
52
 
52
53
  Tool calling:
53
54
  Tool calling is a feature that allows the language model to call tools to perform tasks.
54
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
55
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
55
56
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
56
57
  `tool_calls` attribute in the output.
57
58
 
@@ -219,7 +220,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
219
220
  Defaults to an empty list.
220
221
  '''
221
222
  client: Incomplete
222
- def __init__(self, azure_endpoint: str, azure_deployment: str, api_key: str | None = None, api_version: str = ..., model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None, reasoning_summary: ReasoningSummary | None = None) -> None:
223
+ def __init__(self, azure_endpoint: str, azure_deployment: str, api_key: str | None = None, api_version: str = ..., model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None, reasoning_summary: ReasoningSummary | None = None) -> None:
223
224
  """Initializes a new instance of the AzureOpenAILMInvoker class.
224
225
 
225
226
  Args:
@@ -232,7 +233,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
232
233
  model_kwargs (dict[str, Any] | None, optional): Additional model parameters. Defaults to None.
233
234
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
234
235
  Defaults to None.
235
- tools (list[Tool] | None, optional): Tools provided to the language model to enable tool calling.
236
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
236
237
  Defaults to None.
237
238
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
238
239
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
@@ -1,10 +1,11 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
5
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
5
6
  from gllm_inference.lm_invoker.schema.bedrock import InputType as InputType, Key as Key, OutputType as OutputType
6
7
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, LMOutput as LMOutput, Message as Message, ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
7
- from langchain_core.tools import Tool as Tool
8
+ from langchain_core.tools import Tool as LangChainTool
8
9
  from typing import Any
9
10
 
10
11
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -49,7 +50,7 @@ class BedrockLMInvoker(BaseLMInvoker):
49
50
 
50
51
  Tool calling:
51
52
  Tool calling is a feature that allows the language model to call tools to perform tasks.
52
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
53
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
53
54
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
54
55
  `tool_calls` attribute in the output.
55
56
 
@@ -179,7 +180,7 @@ class BedrockLMInvoker(BaseLMInvoker):
179
180
  '''
180
181
  session: Incomplete
181
182
  client_kwargs: Incomplete
182
- def __init__(self, model_name: str, access_key_id: str | None = None, secret_access_key: str | None = None, region_name: str = 'us-east-1', model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
183
+ def __init__(self, model_name: str, access_key_id: str | None = None, secret_access_key: str | None = None, region_name: str = 'us-east-1', model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
183
184
  '''Initializes the BedrockLMInvoker instance.
184
185
 
185
186
  Args:
@@ -192,7 +193,8 @@ class BedrockLMInvoker(BaseLMInvoker):
192
193
  model_kwargs (dict[str, Any] | None, optional): Additional keyword arguments for the Bedrock client.
193
194
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
194
195
  Defaults to None.
195
- tools (list[Tool] | None, optional): Tools provided to the model to enable tool calling. Defaults to None.
196
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
197
+ Defaults to None.
196
198
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
197
199
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
198
200
  dictionary. Defaults to None.
@@ -205,13 +207,13 @@ class BedrockLMInvoker(BaseLMInvoker):
205
207
  ValueError: If `access_key_id` or `secret_access_key` is neither provided nor set in the
206
208
  `AWS_ACCESS_KEY_ID` or `AWS_SECRET_ACCESS_KEY` environment variables, respectively.
207
209
  '''
208
- def set_tools(self, tools: list[Tool]) -> None:
210
+ def set_tools(self, tools: list[Tool | LangChainTool]) -> None:
209
211
  """Sets the tools for the Bedrock language model.
210
212
 
211
213
  This method sets the tools for the Bedrock language model. Any existing tools will be replaced.
212
214
 
213
215
  Args:
214
- tools (list[Tool]): The list of tools to be used.
216
+ tools (list[Tool | LangChainTool]): The list of tools to be used.
215
217
 
216
218
  Raises:
217
219
  ValueError: If `response_schema` exists.
@@ -1,11 +1,12 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
5
  from gllm_inference.constants import DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES, INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
5
6
  from gllm_inference.lm_invoker.openai_compatible_lm_invoker import OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker
6
7
  from gllm_inference.lm_invoker.schema.datasaur import InputType as InputType, Key as Key
7
8
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, LMOutput as LMOutput, Message as Message, ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema, ToolCall as ToolCall, ToolResult as ToolResult
8
- from langchain_core.tools import Tool as Tool
9
+ from langchain_core.tools import Tool as LangChainTool
9
10
  from typing import Any
10
11
 
11
12
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -139,14 +140,14 @@ class DatasaurLMInvoker(OpenAICompatibleLMInvoker):
139
140
  Raises:
140
141
  ValueError: If the `api_key` is not provided and the `DATASAUR_API_KEY` environment variable is not set.
141
142
  """
142
- def set_tools(self, tools: list[Tool]) -> None:
143
+ def set_tools(self, tools: list[Tool | LangChainTool]) -> None:
143
144
  """Sets the tools for the Datasaur LLM Projects Deployment API.
144
145
 
145
146
  This method is raises a `NotImplementedError` because the Datasaur LLM Projects Deployment API does not
146
147
  support tools.
147
148
 
148
149
  Args:
149
- tools (list[Tool]): The list of tools to be used.
150
+ tools (list[Tool | LangChainTool]): The list of tools to be used.
150
151
 
151
152
  Raises:
152
153
  NotImplementedError: This method is not supported for the Datasaur LLM Projects Deployment API.
@@ -1,11 +1,12 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
- from gllm_inference.constants import GOOGLE_SCOPES as GOOGLE_SCOPES
5
+ from gllm_inference.constants import GOOGLE_SCOPES as GOOGLE_SCOPES, SECONDS_TO_MILLISECONDS as SECONDS_TO_MILLISECONDS
5
6
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
6
7
  from gllm_inference.lm_invoker.schema.google import InputType as InputType, Key as Key
7
8
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EmitDataType as EmitDataType, LMOutput as LMOutput, Message as Message, MessageRole as MessageRole, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
8
- from langchain_core.tools import Tool
9
+ from langchain_core.tools import Tool as LangChainTool
9
10
  from typing import Any
10
11
 
11
12
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -79,7 +80,7 @@ class GoogleLMInvoker(BaseLMInvoker):
79
80
 
80
81
  Tool calling:
81
82
  Tool calling is a feature that allows the language model to call tools to perform tasks.
82
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
83
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
83
84
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
84
85
  `tool_calls` attribute in the output.
85
86
 
@@ -161,7 +162,12 @@ class GoogleLMInvoker(BaseLMInvoker):
161
162
  ```python
162
163
  LMOutput(
163
164
  response="Golden retriever is a good dog breed.",
164
- 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
+ ),
165
171
  duration=0.729,
166
172
  finish_details={"finish_reason": "STOP", "finish_message": None},
167
173
  )
@@ -250,7 +256,7 @@ class GoogleLMInvoker(BaseLMInvoker):
250
256
  client_params: Incomplete
251
257
  thinking: Incomplete
252
258
  thinking_budget: Incomplete
253
- def __init__(self, model_name: str, api_key: str | None = None, credentials_path: str | None = None, project_id: str | None = None, location: str = 'us-central1', model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, thinking: bool | None = None, thinking_budget: int = ...) -> None:
259
+ def __init__(self, model_name: str, api_key: str | None = None, credentials_path: str | None = None, project_id: str | None = None, location: str = 'us-central1', model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, thinking: bool | None = None, thinking_budget: int = ...) -> None:
254
260
  '''Initializes a new instance of the GoogleLMInvoker class.
255
261
 
256
262
  Args:
@@ -267,7 +273,7 @@ class GoogleLMInvoker(BaseLMInvoker):
267
273
  client.
268
274
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
269
275
  Defaults to None.
270
- tools (list[Tool] | None, optional): Tools provided to the language model to enable tool calling.
276
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
271
277
  Defaults to None.
272
278
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
273
279
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
@@ -284,13 +290,13 @@ class GoogleLMInvoker(BaseLMInvoker):
284
290
  If neither `api_key` nor `credentials_path` is provided, Google Gen AI will be used by default.
285
291
  The `GOOGLE_API_KEY` environment variable will be used for authentication.
286
292
  '''
287
- def set_tools(self, tools: list[Tool]) -> None:
293
+ def set_tools(self, tools: list[Tool | LangChainTool]) -> None:
288
294
  """Sets the tools for the Google language model.
289
295
 
290
296
  This method sets the tools for the Google language model. Any existing tools will be replaced.
291
297
 
292
298
  Args:
293
- tools (list[Tool]): The list of tools to be used.
299
+ tools (list[Tool | LangChainTool]): The list of tools to be used.
294
300
 
295
301
  Raises:
296
302
  ValueError: If `response_schema` exists.
@@ -1,5 +1,6 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig
4
5
  from gllm_inference.constants import INVOKER_DEFAULT_TIMEOUT as INVOKER_DEFAULT_TIMEOUT, INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
5
6
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
@@ -8,7 +9,7 @@ from gllm_inference.schema import Attachment as Attachment, AttachmentType as At
8
9
  from gllm_inference.utils import load_langchain_model as load_langchain_model, parse_model_data as parse_model_data
9
10
  from langchain_core.language_models import BaseChatModel as BaseChatModel
10
11
  from langchain_core.messages import BaseMessage as BaseMessage
11
- from langchain_core.tools import Tool as Tool
12
+ from langchain_core.tools import Tool as LangChainTool
12
13
  from typing import Any
13
14
 
14
15
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -77,7 +78,7 @@ class LangChainLMInvoker(BaseLMInvoker):
77
78
 
78
79
  Tool calling:
79
80
  Tool calling is a feature that allows the language model to call tools to perform tasks.
80
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
81
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
81
82
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
82
83
  `tool_calls` attribute in the output.
83
84
 
@@ -204,7 +205,7 @@ class LangChainLMInvoker(BaseLMInvoker):
204
205
  Defaults to an empty list.
205
206
  '''
206
207
  model: Incomplete
207
- def __init__(self, model: BaseChatModel | None = None, model_class_path: str | None = None, model_name: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
208
+ def __init__(self, model: BaseChatModel | None = None, model_class_path: str | None = None, model_name: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
208
209
  '''Initializes a new instance of the LangChainLMInvoker class.
209
210
 
210
211
  Args:
@@ -219,7 +220,8 @@ class LangChainLMInvoker(BaseLMInvoker):
219
220
  `model_class_path` is provided. Defaults to None.
220
221
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
221
222
  Defaults to None.
222
- tools (list[Tool] | None, optional): Tools provided to the model to enable tool calling. Defaults to None.
223
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
224
+ Defaults to None.
223
225
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
224
226
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
225
227
  dictionary. Defaults to None.
@@ -231,7 +233,7 @@ class LangChainLMInvoker(BaseLMInvoker):
231
233
  ValueError: If `response_schema` is provided, but `tools` are also provided.
232
234
  '''
233
235
  tools: Incomplete
234
- def set_tools(self, tools: list[Tool]) -> None:
236
+ def set_tools(self, tools: list[Tool | LangChainTool]) -> None:
235
237
  """Sets the tools for LangChain's BaseChatModel.
236
238
 
237
239
  This method sets the tools for LangChain's BaseChatModel. Any existing tools will be replaced.
@@ -1,10 +1,11 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
5
  from gllm_inference.lm_invoker.openai_compatible_lm_invoker import OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker
5
6
  from gllm_inference.lm_invoker.openai_lm_invoker import ReasoningEffort as ReasoningEffort
6
7
  from gllm_inference.schema import AttachmentType as AttachmentType, LMOutput as LMOutput, ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema
7
- from langchain_core.tools import Tool as Tool
8
+ from langchain_core.tools import Tool as LangChainTool
8
9
  from typing import Any
9
10
 
10
11
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -58,7 +59,7 @@ class LiteLLMLMInvoker(OpenAICompatibleLMInvoker):
58
59
 
59
60
  Tool calling:
60
61
  Tool calling is a feature that allows the language model to call tools to perform tasks.
61
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
62
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
62
63
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
63
64
  `tool_calls` attribute in the output.
64
65
 
@@ -227,14 +228,15 @@ class LiteLLMLMInvoker(OpenAICompatibleLMInvoker):
227
228
  Defaults to an empty list.
228
229
  '''
229
230
  completion: Incomplete
230
- def __init__(self, model_id: str, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None) -> None:
231
+ def __init__(self, model_id: str, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None) -> None:
231
232
  """Initializes a new instance of the LiteLLMLMInvoker class.
232
233
 
233
234
  Args:
234
235
  model_id (str): The ID of the model to use. Must be in the format of `provider/model_name`.
235
236
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
236
237
  Defaults to None.
237
- tools (list[Tool] | None, optional): Tools provided to the model to enable tool calling. Defaults to None.
238
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
239
+ Defaults to None.
238
240
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
239
241
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
240
242
  dictionary. Defaults to None.
@@ -2,11 +2,12 @@ import abc
2
2
  from _typeshed import Incomplete
3
3
  from abc import ABC
4
4
  from gllm_core.event import EventEmitter as EventEmitter
5
- from gllm_core.utils.retry import RetryConfig
5
+ from gllm_core.schema.tool import Tool
6
+ from gllm_core.utils import RetryConfig
6
7
  from gllm_inference.constants import DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES, INVOKER_DEFAULT_TIMEOUT as INVOKER_DEFAULT_TIMEOUT
7
8
  from gllm_inference.exceptions import parse_error_message as parse_error_message
8
9
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EmitDataType as EmitDataType, LMOutput as LMOutput, Message as Message, MessageContent as MessageContent, MessageRole as MessageRole, ModelId as ModelId, Reasoning as Reasoning, ResponseSchema as ResponseSchema, ToolCall as ToolCall, ToolResult as ToolResult
9
- from langchain_core.tools import Tool as Tool
10
+ from langchain_core.tools import Tool as LangChainTool
10
11
  from typing import Any
11
12
 
12
13
  class _Key:
@@ -16,8 +17,14 @@ class _Key:
16
17
  DATA_TYPE: str
17
18
  DATA_VALUE: str
18
19
  DEFAULT: str
20
+ DESCRIPTION: str
21
+ FUNCTION: str
22
+ META: str
23
+ NAME: str
24
+ PARAMETERS: str
19
25
  PROPERTIES: str
20
26
  REQUIRED: str
27
+ TITLE: str
21
28
  TYPE: str
22
29
 
23
30
  class _InputType:
@@ -46,7 +53,7 @@ class BaseLMInvoker(ABC, metaclass=abc.ABCMeta):
46
53
  response_schema: Incomplete
47
54
  output_analytics: Incomplete
48
55
  retry_config: Incomplete
49
- def __init__(self, model_id: ModelId, default_hyperparameters: dict[str, Any] | None = None, supported_attachments: set[str] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
56
+ def __init__(self, model_id: ModelId, default_hyperparameters: dict[str, Any] | None = None, supported_attachments: set[str] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
50
57
  """Initializes a new instance of the BaseLMInvoker class.
51
58
 
52
59
  Args:
@@ -55,7 +62,7 @@ class BaseLMInvoker(ABC, metaclass=abc.ABCMeta):
55
62
  language model. Defaults to None, in which case an empty dictionary is used.
56
63
  supported_attachments (set[str] | None, optional): A set of supported attachment types. Defaults to None,
57
64
  in which case an empty set is used (indicating that no attachments are supported).
58
- tools (list[Tool] | None, optional): Tools provided to the language model to enable tool calling.
65
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
59
66
  Defaults to None, in which case an empty list is used.
60
67
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
61
68
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
@@ -85,13 +92,13 @@ class BaseLMInvoker(ABC, metaclass=abc.ABCMeta):
85
92
  Returns:
86
93
  str: The name of the language model.
87
94
  """
88
- def set_tools(self, tools: list[Tool]) -> None:
95
+ def set_tools(self, tools: list[Tool | LangChainTool]) -> None:
89
96
  """Sets the tools for the language model.
90
97
 
91
98
  This method sets the tools for the language model. Any existing tools will be replaced.
92
99
 
93
100
  Args:
94
- tools (list[Tool]): The list of tools to be used.
101
+ tools (list[Tool | LangChainTool]): The list of tools to be used.
95
102
  """
96
103
  def clear_tools(self) -> None:
97
104
  """Clears the tools for the language model.
@@ -1,12 +1,13 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
5
  from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
5
6
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
6
7
  from gllm_inference.lm_invoker.schema.openai_compatible import InputType as InputType, Key as Key, ReasoningEffort as ReasoningEffort
7
8
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EmitDataType as EmitDataType, LMOutput as LMOutput, Message as Message, MessageRole as MessageRole, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
8
9
  from gllm_inference.utils import validate_string_enum as validate_string_enum
9
- from langchain_core.tools import Tool as Tool
10
+ from langchain_core.tools import Tool as LangChainTool
10
11
  from typing import Any
11
12
 
12
13
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -20,7 +21,7 @@ class OpenAICompatibleLMInvoker(BaseLMInvoker):
20
21
  model_name (str): The name of the language model.
21
22
  client (AsyncOpenAI): The OpenAI client instance.
22
23
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
23
- tools (list[Any]): The list of tools provided to the model to enable tool calling.
24
+ tools (list[Tool]): The list of tools provided to the model to enable tool calling.
24
25
  response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
25
26
  structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
26
27
  output_analytics (bool): Whether to output the invocation analytics.
@@ -63,7 +64,7 @@ class OpenAICompatibleLMInvoker(BaseLMInvoker):
63
64
 
64
65
  Tool calling:
65
66
  Tool calling is a feature that allows the language model to call tools to perform tasks.
66
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
67
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
67
68
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
68
69
  `tool_calls` attribute in the output.
69
70
 
@@ -231,7 +232,7 @@ class OpenAICompatibleLMInvoker(BaseLMInvoker):
231
232
  Defaults to an empty list.
232
233
  '''
233
234
  client: Incomplete
234
- def __init__(self, model_name: str, base_url: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None) -> None:
235
+ def __init__(self, model_name: str, base_url: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None) -> None:
235
236
  '''Initializes a new instance of the OpenAICompatibleLMInvoker class.
236
237
 
237
238
  Args:
@@ -243,7 +244,7 @@ class OpenAICompatibleLMInvoker(BaseLMInvoker):
243
244
  model_kwargs (dict[str, Any] | None, optional): Additional model parameters. Defaults to None.
244
245
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
245
246
  Defaults to None.
246
- tools (list[Tool] | None, optional): Tools provided to the language model to enable tool calling.
247
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
247
248
  Defaults to None.
248
249
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
249
250
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
@@ -1,12 +1,13 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
3
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
5
  from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
5
6
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
6
7
  from gllm_inference.lm_invoker.schema.openai import InputType as InputType, Key as Key, OutputType as OutputType, ReasoningEffort as ReasoningEffort, ReasoningSummary as ReasoningSummary
7
8
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, CodeExecResult as CodeExecResult, EmitDataType as EmitDataType, LMOutput as LMOutput, Message as Message, MessageRole as MessageRole, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
8
9
  from gllm_inference.utils import validate_string_enum as validate_string_enum
9
- from langchain_core.tools import Tool as Tool
10
+ from langchain_core.tools import Tool as LangChainTool
10
11
  from typing import Any
11
12
 
12
13
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -20,7 +21,7 @@ class OpenAILMInvoker(BaseLMInvoker):
20
21
  model_name (str): The name of the language model.
21
22
  client (AsyncOpenAI): The OpenAI client instance.
22
23
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
23
- tools (list[Any]): The list of tools provided to the model to enable tool calling.
24
+ tools (list[Tool]): The list of tools provided to the model to enable tool calling.
24
25
  response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
25
26
  structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
26
27
  output_analytics (bool): Whether to output the invocation analytics.
@@ -52,7 +53,7 @@ class OpenAILMInvoker(BaseLMInvoker):
52
53
 
53
54
  Tool calling:
54
55
  Tool calling is a feature that allows the language model to call tools to perform tasks.
55
- Tools can be passed to the via the `tools` parameter as a list of LangChain\'s `Tool` objects.
56
+ Tools can be passed to the via the `tools` parameter as a list of `Tool` objects.
56
57
  When tools are provided and the model decides to call a tool, the tool calls are stored in the
57
58
  `tool_calls` attribute in the output.
58
59
 
@@ -319,7 +320,7 @@ class OpenAILMInvoker(BaseLMInvoker):
319
320
  enabled and the language model decides to execute any codes. Defaults to an empty list.
320
321
  '''
321
322
  client: Incomplete
322
- def __init__(self, model_name: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None, reasoning_summary: ReasoningSummary | None = None, code_interpreter: bool = False, web_search: bool = False) -> None:
323
+ def __init__(self, model_name: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, reasoning_effort: ReasoningEffort | None = None, reasoning_summary: ReasoningSummary | None = None, code_interpreter: bool = False, web_search: bool = False) -> None:
323
324
  """Initializes a new instance of the OpenAILMInvoker class.
324
325
 
325
326
  Args:
@@ -329,8 +330,8 @@ class OpenAILMInvoker(BaseLMInvoker):
329
330
  model_kwargs (dict[str, Any] | None, optional): Additional model parameters. Defaults to None.
330
331
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
331
332
  Defaults to None.
332
- tools (list[Tool] | None, optional): Tools provided to the language model to enable tool calling.
333
- Defaults to None.
333
+ tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
334
+ Defaults to None, in which case an empty list is used.
334
335
  response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
335
336
  output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
336
337
  dictionary. Defaults to None.
@@ -4,7 +4,6 @@ class Key:
4
4
  CONTENT: str
5
5
  DATA: str
6
6
  DESCRIPTION: str
7
- FUNCTION: str
8
7
  ID: str
9
8
  INPUT: str
10
9
  INPUT_SCHEMA: str
@@ -8,11 +8,11 @@ class Key:
8
8
  CONTENT: str
9
9
  DEFAULT: str
10
10
  DEFS: str
11
+ DESCRIPTION: str
11
12
  EFFORT: str
12
13
  FILE_DATA: str
13
14
  FILENAME: str
14
15
  FORMAT: str
15
- FUNCTION: str
16
16
  ID: str
17
17
  IMAGE_URL: str
18
18
  INCLUDE: str
@@ -7,6 +7,7 @@ class Key:
7
7
  CHOICES: str
8
8
  DATA: str
9
9
  DEFS: str
10
+ DESCRIPTION: str
10
11
  EFFORT: str
11
12
  FINISH_REASON: str
12
13
  FORMAT: str
@@ -18,6 +19,7 @@ class Key:
18
19
  MAX_RETRIES: str
19
20
  MESSAGE: str
20
21
  NAME: str
22
+ PARAMETERS: str
21
23
  RESPONSE_FORMAT: str
22
24
  ROLE: str
23
25
  SCHEMA: str
@@ -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
+ """
Binary file
gllm_inference.pyi CHANGED
@@ -75,9 +75,9 @@ import requests
75
75
  import gllm_inference.schema.ErrorResponse
76
76
  import gllm_core.constants
77
77
  import gllm_core.event
78
+ import gllm_core.schema
79
+ import gllm_core.schema.tool
78
80
  import langchain_core.tools
79
- import langchain_core.utils
80
- import langchain_core.utils.function_calling
81
81
  import gllm_inference.schema.EmitDataType
82
82
  import gllm_inference.schema.LMOutput
83
83
  import gllm_inference.schema.Message
@@ -88,13 +88,14 @@ import gllm_inference.schema.ToolCall
88
88
  import gllm_inference.schema.ToolResult
89
89
  import anthropic
90
90
  import aioboto3
91
- import gllm_core.schema
92
91
  import gllm_inference.schema.MessageRole
93
92
  import langchain_core.language_models
94
93
  import langchain_core.messages
95
94
  import litellm
96
95
  import time
97
96
  import jsonschema
97
+ import langchain_core.utils
98
+ import langchain_core.utils.function_calling
98
99
  import gllm_inference.schema.MessageContent
99
100
  import gllm_inference.utils.validate_string_enum
100
101
  import gllm_inference.schema.CodeExecResult
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.7
3
+ Version: 0.5.10b12
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
@@ -8,11 +8,11 @@ gllm_inference/catalog/__init__.pyi,sha256=HWgPKWIzprpMHRKe_qN9BZSIQhVhrqiyjLjIX
8
8
  gllm_inference/catalog/catalog.pyi,sha256=eWPqgQKi-SJGHabi_XOTEKpAj96OSRypKsb5ZEC1VWU,4911
9
9
  gllm_inference/catalog/lm_request_processor_catalog.pyi,sha256=GemCEjFRHNChtNOfbyXSVsJiA3klOCAe_X11fnymhYs,5540
10
10
  gllm_inference/catalog/prompt_builder_catalog.pyi,sha256=iViWB4SaezzjQY4UY1YxeoXUNxqxa2cTJGaD9JSx4Q8,3279
11
- gllm_inference/constants.pyi,sha256=xSET67ZCfeVK4a2ji1FZyQxs5DUTIsN7S6H7-F-ewZ0,265
11
+ gllm_inference/constants.pyi,sha256=q1bzWw4fcz2RbdqQs3WYpvWc5aeassX-uQ5F0pDcKw4,295
12
12
  gllm_inference/em_invoker/__init__.pyi,sha256=eZifmg3ZS3YdFUwbGPTurrfF4oV_MAPvqErJe7oTpZI,882
13
13
  gllm_inference/em_invoker/azure_openai_em_invoker.pyi,sha256=QimqPII-KN9OgsfH1Iubn_tCHhtWjPQ5rilZoT6Ir-U,4688
14
14
  gllm_inference/em_invoker/em_invoker.pyi,sha256=KX4i0xBWR5j6z14nEL6T8at3StKfdf3miQ4xixtYhZk,4424
15
- gllm_inference/em_invoker/google_em_invoker.pyi,sha256=YJtRJs7bNGNEfTKtj3IVP1XkLcJ3LRmcAC80zzOHxKw,6254
15
+ gllm_inference/em_invoker/google_em_invoker.pyi,sha256=c0XJuLS4ji-Y9aHmbb8PRLwrbH6QA2WtdS1-2HbWFq8,6306
16
16
  gllm_inference/em_invoker/langchain/__init__.pyi,sha256=aOTlRvS9aG1tBErjsmhe75s4Sq-g2z9ArfGqNW7QyEs,151
17
17
  gllm_inference/em_invoker/langchain/em_invoker_embeddings.pyi,sha256=gEX21gJLngUh9fZo8v6Vbh0gpWFFqS2S-dGNZSrDjFQ,2409
18
18
  gllm_inference/em_invoker/langchain_em_invoker.pyi,sha256=sFmsRE89MIdnD8g0VSMsdLvtfZL6dfPkUtDhH_WfgLc,2823
@@ -31,24 +31,24 @@ gllm_inference/exceptions/__init__.pyi,sha256=2F05RytXZIKaOJScb1pD0O0bATIQHVeEAY
31
31
  gllm_inference/exceptions/error_parser.pyi,sha256=ggmh8DJXdwFJInNLrP24WVJt_4raxbAVxzXRQgBpndA,2441
32
32
  gllm_inference/exceptions/exceptions.pyi,sha256=ViXvIzm7tLcstjqfwC6nPziDg0UAmoUAWZVWrAJyp3w,4763
33
33
  gllm_inference/lm_invoker/__init__.pyi,sha256=g-wu6W6ly_WAVPLDWKjt4J5cMo-CJ1x5unuObVSUnug,1115
34
- gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=Jpu7YPr_oUB4WurY3MqDT9J-PgDDRakj7mtrle8S3gE,15038
35
- gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=h71Redwp4a4Ibq3tVTtwM7FUX4AqIlmty4i0Dt8lglk,14788
36
- gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=uOppVYAy2G7TnIK_BsRllW0akP3x14zNjrfwVrTSo8I,12530
37
- gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=AzjC-zEJt73I9wtgckZAlrlsC97U86cLksbYzO1XDK0,9280
38
- gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=a5ALWfhv8zW3go4gC4G-dGjQHbpQwHbSr6wdLiKiCKk,16702
39
- gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=iD_nFw0UGX9AHSEZT57T6e2ft2ApHW4sOKk49BDpBO8,13413
40
- gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=ye73iH8wXUXzAd87JCjup5wmgVxTNhgbebRNh1hCtjE,13283
41
- gllm_inference/lm_invoker/lm_invoker.pyi,sha256=1wH81ssLRLLSGdf7CMQ5CZqKLcuJZHmElwBjQwitqfg,7754
42
- gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=jgeRQPw9IH24NoZ9dN8aW2w29D7Unn4w5L-6dhFX6l0,15125
43
- gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=oXK_-nk3sdFnYIEPGkDCg4UWNyRvvMvVjkj7jozZhRk,19787
34
+ gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=85uvShLv4-eiGOpTMgwWpQGZXPW6XaB6GrexBmxg_sQ,15200
35
+ gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=N2TjGz5Gi6xiLkAgI6SzWq_V3tj66HJfMNff7d04uU0,14856
36
+ gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=ae5P_9sjtcOgMIUaRchvp8F0FujoeP4e2F_OoHSe_go,12655
37
+ gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=c4H3TOz0LIhWjokCCdQ4asiwQR4_LPyaimo4RAqU9es,9369
38
+ gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=I3plg_oVuTl0hiShFBmCYPclP4gWbzU61xUSgon24Ew,17102
39
+ gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=bBGOxJfjnzOtDR4kH4PuCiOCKEPu8rTqzZodTXCHQ2k,13522
40
+ gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=HHwW7i8ryXHI23JZQwscyva6aPmPOB13Muhf7gaaMUM,13376
41
+ gllm_inference/lm_invoker/lm_invoker.pyi,sha256=YNJ0Sh_BOl1WbC69xvuxWM75qyByXJSXAYWSwtQ84cc,7960
42
+ gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=U9dolHJT1pDsiiyrdpSAAdcBkil4_qeG_3BKfygq8GM,15193
43
+ gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=SEHWAwpT8KmIQukurXtXOU2xyU2rp_HtM2SARsBF3dU,19892
44
44
  gllm_inference/lm_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
- gllm_inference/lm_invoker/schema/anthropic.pyi,sha256=LWhE6th4dpZwk7As11p_rhhvVoPXBsF3oAy5CtTMBrg,1060
45
+ gllm_inference/lm_invoker/schema/anthropic.pyi,sha256=lGJ7xYLchdtv6003Is4GcaKiGdbmIOAzQsaldKG0Aww,1041
46
46
  gllm_inference/lm_invoker/schema/bedrock.pyi,sha256=H3attoGWhBA725W4FpXw7Mty46N9jHKjw9PT-0lMEJs,975
47
47
  gllm_inference/lm_invoker/schema/datasaur.pyi,sha256=GLv6XAwKtWyRrX6EsbEufYjkPffHNiEpXwJOn9HqxMA,242
48
48
  gllm_inference/lm_invoker/schema/google.pyi,sha256=elXHrUMS46pbTsulk7hBXVVFcT022iD-_U_I590xeV8,529
49
49
  gllm_inference/lm_invoker/schema/langchain.pyi,sha256=uEG0DSD0z4L_rDMkBm-TtUy5oTyEHEEJWiLsYvFf1sw,431
50
- gllm_inference/lm_invoker/schema/openai.pyi,sha256=CNkIGljwRyQYx0krONX1ik9hwBiN45t9vBk-ZY45rP4,1989
51
- gllm_inference/lm_invoker/schema/openai_compatible.pyi,sha256=2KXyTy43SHz0K_hB0WGXVuaHXL7bwYFIzWHZ_jmdDUo,1114
50
+ gllm_inference/lm_invoker/schema/openai.pyi,sha256=Cxp5QMkF6lspcVUgCNZR1qDK43Fj6OoEdOiQ1x5arsQ,1992
51
+ gllm_inference/lm_invoker/schema/openai_compatible.pyi,sha256=FnRfc3CiqY-y6WmZqi2OhxOnNrZENBEXCmk2WPADkBQ,1157
52
52
  gllm_inference/model/__init__.pyi,sha256=JKQB0wVSVYD-_tdRkG7N_oEVAKGCcoBw0BUOUMLieFo,602
53
53
  gllm_inference/model/em/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  gllm_inference/model/em/google_em.pyi,sha256=c53H-KNdNOK9ppPLyOSkmCA890eF5FsMd05upkPIzF0,487
@@ -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,7 +82,7 @@ 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
@@ -90,8 +90,8 @@ gllm_inference/utils/__init__.pyi,sha256=RBTWDu1TDPpTd17fixcPYFv2L_vp4-IAOX0Isxg
90
90
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
91
91
  gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
92
92
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
93
- gllm_inference.cp311-win_amd64.pyd,sha256=hYbjt2yhDh_GQb1f8NT0OAIm1xsWyZDWKt3XMvukpt8,2687488
94
- gllm_inference.pyi,sha256=HPIjsiX3usTXFeStYEslrHJDUtwpBBwl-Exzcf7y7Mc,3295
95
- gllm_inference_binary-0.5.7.dist-info/METADATA,sha256=5l9vCcKon7_P35hWo6n7VhczO9x6rBULOCosHG3l4sY,4531
96
- gllm_inference_binary-0.5.7.dist-info/WHEEL,sha256=-FZBVKyKauScY3vLa8vJR6hBCpAJfFykw2MOwlNKr1g,98
97
- gllm_inference_binary-0.5.7.dist-info/RECORD,,
93
+ gllm_inference.cp311-win_amd64.pyd,sha256=ps5de1Zy0niIitf_qMVwZVsWtVk0NND-0Iysj9tDMxs,2732032
94
+ gllm_inference.pyi,sha256=fsNCXXsB4E8WhP477yGq_QOJAfOyoZA4G2PfAMBav5Y,3324
95
+ gllm_inference_binary-0.5.10b12.dist-info/METADATA,sha256=4VxkEu42rcmnLJChwVgqcxxC1PQutoY-Ba4X2352AoA,4535
96
+ gllm_inference_binary-0.5.10b12.dist-info/WHEEL,sha256=-FZBVKyKauScY3vLa8vJR6hBCpAJfFykw2MOwlNKr1g,98
97
+ gllm_inference_binary-0.5.10b12.dist-info/RECORD,,