gllm-inference-binary 0.5.38__cp313-cp313-win_amd64.whl → 0.5.39__cp313-cp313-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.

Potentially problematic release.


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

@@ -188,17 +188,18 @@ class AnthropicLMInvoker(BaseLMInvoker):
188
188
  )
189
189
  ```
190
190
 
191
- When streaming is enabled, the thinking token will be streamed with the `EventType.DATA` event type.
192
-
193
191
  Streaming output example:
194
192
  ```python
195
- {"type": "data", "value": \'{"data_type": "thinking_start", "data_value": ""}\', ...}
196
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "Let me think "}\', ...}
197
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "about it..."}\', ...}
198
- {"type": "data", "value": \'{"data_type": "thinking_end", "data_value": ""}\', ...}
193
+ {"type": "thinking_start", "value": "", ...}
194
+ {"type": "thinking", "value": "Let me think "\', ...}
195
+ {"type": "thinking", "value": "about it..."}\', ...}
196
+ {"type": "thinking_end", "value": ""}\', ...}
199
197
  {"type": "response", "value": "Golden retriever ", ...}
200
198
  {"type": "response", "value": "is a good dog breed.", ...}
201
199
  ```
200
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
201
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
202
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
202
203
 
203
204
  Batch processing:
204
205
  The `AnthropicLMInvoker` supports batch processing, which allows the language model to process multiple
@@ -288,7 +289,7 @@ class AnthropicLMInvoker(BaseLMInvoker):
288
289
  client: Incomplete
289
290
  thinking: Incomplete
290
291
  thinking_budget: Incomplete
291
- 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:
292
+ 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 = ..., simplify_events: bool = False) -> None:
292
293
  """Initializes the AnthropicLmInvoker instance.
293
294
 
294
295
  Args:
@@ -309,6 +310,9 @@ class AnthropicLMInvoker(BaseLMInvoker):
309
310
  thinking (bool, optional): Whether to enable thinking. Only allowed for thinking models. Defaults to False.
310
311
  thinking_budget (int, optional): The tokens allocated for the thinking process. Must be greater than or
311
312
  equal to 1024. Only allowed for thinking models. Defaults to DEFAULT_THINKING_BUDGET.
313
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
314
+ When True, uses the simplified events format. When False, uses the legacy events format for
315
+ backward compatibility. Will be removed in v0.6. Defaults to False.
312
316
 
313
317
  Raises:
314
318
  ValueError:
@@ -191,16 +191,18 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
191
191
  )
192
192
  ```
193
193
 
194
- When streaming is enabled along with reasoning summary, the reasoning summary token will be streamed with the
195
- `EventType.DATA` event type.
196
-
197
194
  Streaming output example:
198
195
  ```python
199
- {"type": "data", "value": "Let me think ", ...} # Reasoning summary token
200
- {"type": "data", "value": "about it...", ...} # Reasoning summary token
201
- {"type": "response", "value": "Golden retriever ", ...} # Response token
202
- {"type": "response", "value": "is a good dog breed.", ...} # Response token
196
+ {"type": "thinking_start", "value": ""}\', ...}
197
+ {"type": "thinking", "value": "Let me think "}\', ...}
198
+ {"type": "thinking", "value": "about it..."}\', ...}
199
+ {"type": "thinking_end", "value": ""}\', ...}
200
+ {"type": "response", "value": "Golden retriever ", ...}
201
+ {"type": "response", "value": "is a good dog breed.", ...}
203
202
  ```
203
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
204
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
205
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
204
206
 
205
207
  Setting reasoning-related parameters for non-reasoning models will raise an error.
206
208
 
@@ -227,7 +229,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
227
229
  2.10. mcp_calls (list[MCPCall]): The MCP calls. Currently not supported. Defaults to an empty list.
228
230
  '''
229
231
  client_kwargs: Incomplete
230
- def __init__(self, azure_endpoint: str, azure_deployment: str, api_key: str | None = None, api_version: 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) -> None:
232
+ def __init__(self, azure_endpoint: str, azure_deployment: str, api_key: str | None = None, api_version: 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, simplify_events: bool = False) -> None:
231
233
  """Initializes a new instance of the AzureOpenAILMInvoker class.
232
234
 
233
235
  Args:
@@ -251,6 +253,9 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
251
253
  for non-reasoning models. If None, the model will perform medium reasoning effort. Defaults to None.
252
254
  reasoning_summary (ReasoningSummary | None, optional): The reasoning summary level for reasoning models.
253
255
  Not allowed for non-reasoning models. If None, no summary will be generated. Defaults to None.
256
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
257
+ When True, uses the simplified events format. When False, uses the legacy events format for
258
+ backward compatibility. Will be removed in v0.6. Defaults to False.
254
259
 
255
260
  Raises:
256
261
  ValueError:
@@ -3,7 +3,7 @@ from gllm_core.event import EventEmitter as EventEmitter
3
3
  from gllm_core.schema.tool import Tool as Tool
4
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
5
5
  from gllm_inference.constants import DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES, INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
6
- from gllm_inference.lm_invoker.openai_compatible_lm_invoker import OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker
6
+ from gllm_inference.lm_invoker.openai_chat_completions_lm_invoker import OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker
7
7
  from gllm_inference.lm_invoker.schema.datasaur import InputType as InputType, Key as Key
8
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
9
9
  from langchain_core.tools import Tool as LangChainTool
@@ -11,7 +11,7 @@ from typing import Any
11
11
 
12
12
  SUPPORTED_ATTACHMENTS: Incomplete
13
13
 
14
- class DatasaurLMInvoker(OpenAICompatibleLMInvoker):
14
+ class DatasaurLMInvoker(OpenAIChatCompletionsLMInvoker):
15
15
  '''A language model invoker to interact with Datasaur LLM Projects Deployment API.
16
16
 
17
17
  Attributes:
@@ -216,17 +216,18 @@ class GoogleLMInvoker(BaseLMInvoker):
216
216
  )
217
217
  ```
218
218
 
219
- When streaming is enabled, the thinking token will be streamed with the `EventType.DATA` event type.
220
-
221
219
  Streaming output example:
222
220
  ```python
223
- {"type": "data", "value": \'{"data_type": "thinking_start", "data_value": ""}\', ...}
224
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "Let me think "}\', ...}
225
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "about it..."}\', ...}
226
- {"type": "data", "value": \'{"data_type": "thinking_end", "data_value": ""}\', ...}
221
+ {"type": "thinking_start", "value": "", ...}
222
+ {"type": "thinking", "value": "Let me think "\', ...}
223
+ {"type": "thinking", "value": "about it...", ...}
224
+ {"type": "thinking_end", "value": ""}\', ...}
227
225
  {"type": "response", "value": "Golden retriever ", ...}
228
226
  {"type": "response", "value": "is a good dog breed.", ...}
229
227
  ```
228
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
229
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
230
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
230
231
 
231
232
  When thinking is enabled, the amount of tokens allocated for the thinking process can be set via the
232
233
  `thinking_budget` parameter. The `thinking_budget`:
@@ -259,7 +260,7 @@ class GoogleLMInvoker(BaseLMInvoker):
259
260
  client_params: Incomplete
260
261
  thinking: Incomplete
261
262
  thinking_budget: Incomplete
262
- 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:
263
+ 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 = ..., simplify_events: bool = False) -> None:
263
264
  '''Initializes a new instance of the GoogleLMInvoker class.
264
265
 
265
266
  Args:
@@ -288,6 +289,9 @@ class GoogleLMInvoker(BaseLMInvoker):
288
289
  Defaults to True for Gemini 2.5 Pro models and False for other models.
289
290
  thinking_budget (int, optional): The tokens allowed for thinking process. Only allowed for thinking models.
290
291
  Defaults to -1, in which case the model will control the budget automatically.
292
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
293
+ When True, uses the simplified events format. When False, uses the legacy events format for
294
+ backward compatibility. Will be removed in v0.6. Defaults to False.
291
295
 
292
296
  Note:
293
297
  If neither `api_key` nor `credentials_path` is provided, Google Gen AI will be used by default.
@@ -2,7 +2,7 @@ from _typeshed import Incomplete
2
2
  from gllm_core.event import EventEmitter as EventEmitter
3
3
  from gllm_core.schema.tool import Tool as Tool
4
4
  from gllm_core.utils.retry import RetryConfig as RetryConfig
5
- from gllm_inference.lm_invoker.openai_compatible_lm_invoker import OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker
5
+ from gllm_inference.lm_invoker.openai_chat_completions_lm_invoker import OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker
6
6
  from gllm_inference.lm_invoker.openai_lm_invoker import ReasoningEffort as ReasoningEffort
7
7
  from gllm_inference.schema import AttachmentType as AttachmentType, LMOutput as LMOutput, ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema
8
8
  from langchain_core.tools import Tool as LangChainTool
@@ -10,7 +10,7 @@ from typing import Any
10
10
 
11
11
  SUPPORTED_ATTACHMENTS: Incomplete
12
12
 
13
- class LiteLLMLMInvoker(OpenAICompatibleLMInvoker):
13
+ class LiteLLMLMInvoker(OpenAIChatCompletionsLMInvoker):
14
14
  '''A language model invoker to interact with language models using LiteLLM.
15
15
 
16
16
  Attributes:
@@ -192,17 +192,18 @@ class LiteLLMLMInvoker(OpenAICompatibleLMInvoker):
192
192
  )
193
193
  ```
194
194
 
195
- When streaming is enabled along with reasoning and the provider supports reasoning output, the reasoning token
196
- will be streamed with the `EventType.DATA` event type.
197
-
198
195
  Streaming output example:
199
196
  ```python
200
- {"type": "data", "value": \'{"data_type": "thinking_start", "data_value": ""}\', ...}
201
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "Let me think "}\', ...}
202
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "about it..."}\', ...}
203
- {"type": "data", "value": \'{"data_type": "thinking_end", "data_value": ""}\', ...}
197
+ {"type": "thinking_start", "value": ""}\', ...}
198
+ {"type": "thinking", "value": "Let me think "}\', ...}
199
+ {"type": "thinking", "value": "about it..."}\', ...}
200
+ {"type": "thinking_end", "value": ""}\', ...}
204
201
  {"type": "response", "value": "Golden retriever ", ...}
205
202
  {"type": "response", "value": "is a good dog breed.", ...}
203
+ ```
204
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
205
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
206
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
206
207
 
207
208
  Setting reasoning-related parameters for non-reasoning models will raise an error.
208
209
 
@@ -229,7 +230,7 @@ class LiteLLMLMInvoker(OpenAICompatibleLMInvoker):
229
230
  2.10. mcp_calls (list[MCPCall]): The MCP calls. Currently not supported. Defaults to an empty list.
230
231
  '''
231
232
  completion: Incomplete
232
- 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:
233
+ 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, simplify_events: bool = False) -> None:
233
234
  """Initializes a new instance of the LiteLLMLMInvoker class.
234
235
 
235
236
  Args:
@@ -246,4 +247,7 @@ class LiteLLMLMInvoker(OpenAICompatibleLMInvoker):
246
247
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
247
248
  reasoning_effort (ReasoningEffort | None, optional): The reasoning effort for reasoning models.
248
249
  Defaults to None.
250
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
251
+ When True, uses the simplified events format. When False, uses the legacy events format for
252
+ backward compatibility. Will be removed in v0.6. Defaults to False.
249
253
  """
@@ -56,7 +56,7 @@ class BaseLMInvoker(ABC, metaclass=abc.ABCMeta):
56
56
  response_schema: Incomplete
57
57
  output_analytics: Incomplete
58
58
  retry_config: Incomplete
59
- 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:
59
+ 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, simplify_events: bool = False) -> None:
60
60
  """Initializes a new instance of the BaseLMInvoker class.
61
61
 
62
62
  Args:
@@ -73,6 +73,9 @@ class BaseLMInvoker(ABC, metaclass=abc.ABCMeta):
73
73
  output_analytics (bool, optional): Whether to output the invocation analytics. Defaults to False.
74
74
  retry_config (RetryConfig | None, optional): The retry configuration for the language model.
75
75
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
76
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
77
+ When True, uses the simplified events format. When False, uses the legacy events format for
78
+ backward compatibility. Will be removed in v0.6. Defaults to False.
76
79
  """
77
80
  @property
78
81
  def model_id(self) -> str:
@@ -207,18 +207,18 @@ class OpenAIChatCompletionsLMInvoker(BaseLMInvoker):
207
207
  )
208
208
  ```
209
209
 
210
- When streaming is enabled along with reasoning and the provider supports reasoning output, the reasoning token
211
- will be streamed with the `EventType.DATA` event type.
212
-
213
210
  Streaming output example:
214
211
  ```python
215
- {"type": "data", "value": \'{"data_type": "thinking_start", "data_value": ""}\', ...}
216
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "Let me think "}\', ...}
217
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "about it..."}\', ...}
218
- {"type": "data", "value": \'{"data_type": "thinking_end", "data_value": ""}\', ...}
212
+ {"type": "thinking_start", "value": ""}\', ...}
213
+ {"type": "thinking", "value": "Let me think "}\', ...}
214
+ {"type": "thinking", "value": "about it..."}\', ...}
215
+ {"type": "thinking_end", "value": ""}\', ...}
219
216
  {"type": "response", "value": "Golden retriever ", ...}
220
217
  {"type": "response", "value": "is a good dog breed.", ...}
221
218
  ```
219
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
220
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
221
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
222
222
 
223
223
  Setting reasoning-related parameters for non-reasoning models will raise an error.
224
224
 
@@ -244,7 +244,7 @@ class OpenAIChatCompletionsLMInvoker(BaseLMInvoker):
244
244
  2.10. mcp_calls (list[MCPCall]): The MCP calls. Currently not supported. Defaults to an empty list.
245
245
  '''
246
246
  client_kwargs: Incomplete
247
- def __init__(self, model_name: str, api_key: str | None = None, base_url: 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) -> None:
247
+ def __init__(self, model_name: str, api_key: str | None = None, base_url: 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, simplify_events: bool = False) -> None:
248
248
  '''Initializes a new instance of the OpenAIChatCompletionsLMInvoker class.
249
249
 
250
250
  Args:
@@ -266,6 +266,9 @@ class OpenAIChatCompletionsLMInvoker(BaseLMInvoker):
266
266
  retry_config (RetryConfig | None, optional): The retry configuration for the language model.
267
267
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
268
268
  reasoning_effort (str | None, optional): The reasoning effort for the language model. Defaults to None.
269
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
270
+ When True, uses the simplified events format. When False, uses the legacy events format for
271
+ backward compatibility. Will be removed in v0.6. Defaults to False.
269
272
  '''
270
273
  def set_response_schema(self, response_schema: ResponseSchema | None) -> None:
271
274
  """Sets the response schema for the OpenAI language model.
@@ -25,7 +25,7 @@ class OpenAICompatibleLMInvoker(OpenAIChatCompletionsLMInvoker):
25
25
 
26
26
  This class is deprecated and will be removed in v0.6. Please use the `OpenAIChatCompletionsLMInvoker` class instead.
27
27
  """
28
- 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:
28
+ 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, simplify_events: bool = False) -> None:
29
29
  '''Initializes a new instance of the OpenAICompatibleLMInvoker class.
30
30
 
31
31
  Args:
@@ -46,4 +46,7 @@ class OpenAICompatibleLMInvoker(OpenAIChatCompletionsLMInvoker):
46
46
  retry_config (RetryConfig | None, optional): The retry configuration for the language model.
47
47
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
48
48
  reasoning_effort (str | None, optional): The reasoning effort for the language model. Defaults to None.
49
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
50
+ When True, uses the simplified events format. When False, uses the legacy events format for
51
+ backward compatibility. Will be removed in v0.6. Defaults to False.
49
52
  '''
@@ -216,18 +216,18 @@ class OpenAILMInvoker(BaseLMInvoker):
216
216
  )
217
217
  ```
218
218
 
219
- When streaming is enabled along with reasoning summary, the reasoning summary token will be streamed with the
220
- `EventType.DATA` event type.
221
-
222
219
  Streaming output example:
223
220
  ```python
224
- {"type": "data", "value": \'{"data_type": "thinking_start", "data_value": ""}\', ...}
225
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "Let me think "}\', ...}
226
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "about it..."}\', ...}
227
- {"type": "data", "value": \'{"data_type": "thinking_end", "data_value": ""}\', ...}
221
+ {"type": "thinking_start", "value": ""}\', ...}
222
+ {"type": "thinking", "value": "Let me think "}\', ...}
223
+ {"type": "thinking", "value": "about it..."}\', ...}
224
+ {"type": "thinking_end", "value": ""}\', ...}
228
225
  {"type": "response", "value": "Golden retriever ", ...}
229
226
  {"type": "response", "value": "is a good dog breed.", ...}
230
227
  ```
228
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
229
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
230
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
231
231
 
232
232
  Setting reasoning-related parameters for non-reasoning models will raise an error.
233
233
 
@@ -262,14 +262,16 @@ class OpenAILMInvoker(BaseLMInvoker):
262
262
  )
263
263
  ```
264
264
 
265
- When streaming is enabled, the MCP call activities will be streamed with the `EventType.DATA` event type.
266
265
  Streaming output example:
267
266
  ```python
268
- {"type": "data", "value": \'{"data_type": "activity", "data_value": "{\\"type\\": \\"mcp_list_tools\\"}", ...}\', ...}
269
- {"type": "data", "value": \'{"data_type": "activity", "data_value": "{\\"type\\": \\"mcp_call\\"}", ...}\', ...}
267
+ {"type": "activity", "value": {"type": "mcp_list_tools", ...}, ...}
268
+ {"type": "activity", "value": {"type": "mcp_call", ...}, ...}
270
269
  {"type": "response", "value": "The result ", ...}
271
270
  {"type": "response", "value": "is 10.", ...}
272
271
  ```
272
+ Note: By default, the activity token will be streamed with the legacy `EventType.DATA` event type.
273
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
274
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
273
275
 
274
276
  Code interpreter:
275
277
  The code interpreter is a feature that allows the language model to write and run Python code in a
@@ -287,14 +289,8 @@ class OpenAILMInvoker(BaseLMInvoker):
287
289
  Messages example:
288
290
  ```python
289
291
  messages = [
290
- Message(
291
- role=MessageRole.SYSTEM,
292
- contents=["You are a data analyst. Use the python tool to generate a file."],
293
- ),
294
- Message(
295
- role=MessageRole.USER,
296
- contents=["Show an histogram of the following data: [1, 2, 1, 4, 1, 2, 4, 2, 3, 1]"],
297
- ),
292
+ Message.system("You are a data analyst. Use the python tool to generate a file."]),
293
+ Message.user("Show an histogram of the following data: [1, 2, 1, 4, 1, 2, 4, 2, 3, 1]"),
298
294
  ]
299
295
  ```
300
296
 
@@ -315,16 +311,18 @@ class OpenAILMInvoker(BaseLMInvoker):
315
311
  )
316
312
  ```
317
313
 
318
- When streaming is enabled, the executed code will be streamed with the `EventType.DATA` event type.
319
314
  Streaming output example:
320
315
  ```python
321
- {"type": "data", "value": \'{"data_type": "code_start", "data_value": ""}\', ...}
322
- {"type": "data", "value": \'{"data_type": "code", "data_value": "import matplotlib"}\', ...}
323
- {"type": "data", "value": \'{"data_type": "code", "data_value": ".pyplot as plt..."}\', ...}
324
- {"type": "data", "value": \'{"data_type": "code_end", "data_value": ""}\', ...}
316
+ {"type": "code_start", "value": ""}\', ...}
317
+ {"type": "code", "value": "import matplotlib"}\', ...}
318
+ {"type": "code", "value": ".pyplot as plt..."}\', ...}
319
+ {"type": "code_end", "value": ""}\', ...}
325
320
  {"type": "response", "value": "The histogram ", ...}
326
321
  {"type": "response", "value": "is attached.", ...}
327
322
  ```
323
+ Note: By default, the code token will be streamed with the legacy `EventType.DATA` event type.
324
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
325
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
328
326
 
329
327
  Web search:
330
328
  The web search is a feature that allows the language model to search the web for relevant information.
@@ -359,13 +357,15 @@ class OpenAILMInvoker(BaseLMInvoker):
359
357
  )
360
358
  ```
361
359
 
362
- When streaming is enabled, the web search activities will be streamed with the `EventType.DATA` event type.
363
360
  Streaming output example:
364
361
  ```python
365
- {"type": "data", "value": \'{"data_type": "activity", "data_value": "{\\"query\\": \\"search query\\"}", ...}\', ...}
362
+ {"type": "activity", "value": {"query": "search query"}, ...}
366
363
  {"type": "response", "value": "The winner of the match ", ...}
367
364
  {"type": "response", "value": "is team A ([Example title](https://www.example.com)).", ...}
368
365
  ```
366
+ Note: By default, the activity token will be streamed with the legacy `EventType.DATA` event type.
367
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
368
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
369
369
 
370
370
  Output types:
371
371
  The output of the `OpenAILMInvoker` can either be:
@@ -392,7 +392,7 @@ class OpenAILMInvoker(BaseLMInvoker):
392
392
  decides to invoke MCP tools. Defaults to an empty list.
393
393
  '''
394
394
  client_kwargs: Incomplete
395
- def __init__(self, model_name: str, api_key: str | None = None, base_url: 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, mcp_servers: list[MCPServer] | None = None, code_interpreter: bool = False, web_search: bool = False) -> None:
395
+ def __init__(self, model_name: str, api_key: str | None = None, base_url: 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, mcp_servers: list[MCPServer] | None = None, code_interpreter: bool = False, web_search: bool = False, simplify_events: bool = False) -> None:
396
396
  '''Initializes a new instance of the OpenAILMInvoker class.
397
397
 
398
398
  Args:
@@ -421,6 +421,9 @@ class OpenAILMInvoker(BaseLMInvoker):
421
421
  language model. Defaults to None.
422
422
  code_interpreter (bool, optional): Whether to enable the code interpreter. Defaults to False.
423
423
  web_search (bool, optional): Whether to enable the web search. Defaults to False.
424
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
425
+ When True, uses the simplified events format. When False, uses the legacy events format for
426
+ backward compatibility. Will be removed in v0.6. Defaults to False.
424
427
 
425
428
  Raises:
426
429
  ValueError:
@@ -153,18 +153,18 @@ class XAILMInvoker(BaseLMInvoker):
153
153
  )
154
154
  ```
155
155
 
156
- When streaming is enabled along with reasoning summary, the reasoning summary token will be streamed with the
157
- `EventType.DATA` event type.
158
-
159
156
  Streaming output example:
160
157
  ```python
161
- {"type": "data", "value": \'{"data_type": "thinking_start", "data_value": ""}\', ...}
162
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "Let me think "}\', ...}
163
- {"type": "data", "value": \'{"data_type": "thinking", "data_value": "about it..."}\', ...}
164
- {"type": "data", "value": \'{"data_type": "thinking_end", "data_value": ""}\', ...}
158
+ {"type": "thinking_start", "value": ""}\', ...}
159
+ {"type": "thinking", "value": "Let me think "}\', ...}
160
+ {"type": "thinking", "value": "about it..."}\', ...}
161
+ {"type": "thinking_end", "value": ""}\', ...}
165
162
  {"type": "response", "value": "Golden retriever ", ...}
166
163
  {"type": "response", "value": "is a good dog breed.", ...}
167
164
  ```
165
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
166
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
167
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
168
168
 
169
169
  Setting reasoning-related parameters for non-reasoning models will raise an error.
170
170
 
@@ -218,13 +218,13 @@ class XAILMInvoker(BaseLMInvoker):
218
218
  ```
219
219
 
220
220
  When web search is enabled, the language model will search for relevant information and may cite the
221
- relevant sources (including from X platform). The citations will be stored as `Chunk` objects in the `citations`
222
- attribute in the output.
221
+ relevant sources (including from X platform). The citations will be stored as `Chunk` objects in the
222
+ `citations` attribute in the output.
223
223
 
224
224
  Output example:
225
225
  ```python
226
226
  LMOutput(
227
- response="According to recent reports, the latest AI developments include... ([Source](https://example.com)).",
227
+ response="According to recent reports, the latest AI developments... ([Source](https://example.com)).",
228
228
  citations=[
229
229
  Chunk(
230
230
  id="search_result_1",
@@ -241,16 +241,6 @@ class XAILMInvoker(BaseLMInvoker):
241
241
  )
242
242
  ```
243
243
 
244
- When streaming is enabled, the live search activities will be streamed with the `EventType.DATA` event type.
245
- This allows you to track the search process in real-time.
246
-
247
- Streaming output example:
248
- ```python
249
- {"type": "data", "value": \'{"data_type": "activity", "data_value": "{\\"query\\": \\"search query\\"}", ...}\', ...}
250
- {"type": "response", "value": "According to recent reports, ", ...}
251
- {"type": "response", "value": "the latest AI developments include...", ...}
252
- ```
253
-
254
244
  Output types:
255
245
  The output of the `XAILMInvoker` can either be:
256
246
  1. `str`: The text response if no additional output is needed.
@@ -276,7 +266,7 @@ class XAILMInvoker(BaseLMInvoker):
276
266
  reasoning_effort: Incomplete
277
267
  web_search: Incomplete
278
268
  client_params: Incomplete
279
- 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, web_search: bool = False) -> None:
269
+ 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, web_search: bool = False, simplify_events: bool = False) -> None:
280
270
  """Initializes a new instance of the XAILMInvoker class.
281
271
 
282
272
  Args:
@@ -298,6 +288,9 @@ class XAILMInvoker(BaseLMInvoker):
298
288
  reasoning_effort (ReasoningEffort | None, optional): The reasoning effort for reasoning models. Not allowed
299
289
  for non-reasoning models. If None, the model will perform medium reasoning effort. Defaults to None.
300
290
  web_search (bool, optional): Whether to enable the web search. Defaults to False.
291
+ simplify_events (bool, optional): Temporary parameter to control the streamed events format.
292
+ When True, uses the simplified events format. When False, uses the legacy events format for
293
+ backward compatibility. Will be removed in v0.6. Defaults to False.
301
294
 
302
295
  Raises:
303
296
  ValueError:
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.38
3
+ Version: 0.5.39
4
4
  Summary: A library containing components related to model inferences in Gen AI applications.
5
5
  Author-email: Henry Wicaksono <henry.wicaksono@gdplabs.id>, Resti Febrina <resti.febrina@gdplabs.id>
6
6
  Requires-Python: <3.14,>=3.11
@@ -1,4 +1,4 @@
1
- gllm_inference.cp313-win_amd64.pyd,sha256=uP3RI8161EsIM2FizmuvQlGJygtK10n4htojUkuK9T8,3543040
1
+ gllm_inference.cp313-win_amd64.pyd,sha256=nUkymTjVs8f2rSGYculJnhZrrTx4NpNav00YIOdUkU0,3560448
2
2
  gllm_inference.pyi,sha256=CM8fddhFC2U0VGu9_JWrokO5YDc3B-eXx8pSjLYRlGY,4750
3
3
  gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  gllm_inference/constants.pyi,sha256=1OBoHfeWfW9bXH9kStNEH__MGnGp--jLfyheAeQnogY,302
@@ -36,18 +36,18 @@ gllm_inference/exceptions/error_parser.pyi,sha256=4aiJZhBzBOqlhdmpvaCvildGy7_Xxl
36
36
  gllm_inference/exceptions/exceptions.pyi,sha256=6y3ECgHAStqMGgQv8Dv-Ui-5PDD07mSj6qaRZeSWea4,5857
37
37
  gllm_inference/exceptions/provider_error_map.pyi,sha256=4AsAgbXAh91mxEW2YiomEuhBoeSNeAIo9WbT9WK8gQk,1233
38
38
  gllm_inference/lm_invoker/__init__.pyi,sha256=jG1xc5fTOeIgeKKVYSnsMzQThKk9kTW38yO_MYtv540,1387
39
- gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=Cpt20CsCq-5CgFjQSA7zyS3NoRCBQxcIq-i-ZoOZU84,17577
40
- gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=xQO_lNI0hgeloGUJKResh1UbfodaGOo4UdkXz7sc0Qk,15315
39
+ gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=qc9zU0ZMT8RIAIqNSUTaQaDyNleNg-E6-0D5cPn2s_c,17952
40
+ gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=nv9WZwgsMUKlct3CYAv2VM8vU423ZTu7pZ5l1yyPfbQ,15835
41
41
  gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=ptyHTm1szPJEpQObdrsxHpbTkchCWE6K-YmVTmbdhvM,13037
42
- gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=Gi1n6ySpXZH8BuXiQ3owTFwVt3T1xnhG18C4csbZUKU,9516
43
- gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=JsY1lTY4atVcvuXr8gmZLDBYnzA9DY3Ia7rljL-X87w,17484
42
+ gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=S50ULbQO_HW3rvyKPtIcS08gvEcXzjtKPSBzwk3q1i4,9537
43
+ gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=CbWl2NGe0Hb-FV3fNzYyAoe1Tb4k1J0g9yGQyodLkXk,17856
44
44
  gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=dKN0flBxjiCUWW1QOz8HjoRfKpqXjNEz1pm5cS-40zA,13966
45
- gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=cnkg4Lk9sRqXylWQq5G3ujD_DzcVX88DCfEpA5hkTFA,13487
46
- gllm_inference/lm_invoker/lm_invoker.pyi,sha256=RVTE1aMsK9ksZRGI9UaUBgoW3SYqN0RSeIWyD_9agoQ,8328
47
- gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi,sha256=R8MMzhpKXN56WHzgS2w7UYkMSMF-oogfdythuy0t3Hs,16050
48
- gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=Ad3RUYT1yGWGNSMRf8R8qw2pFEpdatnwsm6G0leh2kk,3913
49
- gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=iG9Vakak5RENvN83K-L_kHBgRlSnikUlSBJg1-51edo,24279
50
- gllm_inference/lm_invoker/xai_lm_invoker.pyi,sha256=vEbWPniy8mnoHgbw0DUlBiLn91S0d4lIefxPEmIW97s,15994
45
+ gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=FtrOu0h-M8jMToMPUzt7ngRtPBdRNmKYI4ewP-TplWc,13826
46
+ gllm_inference/lm_invoker/lm_invoker.pyi,sha256=vUmMNEl7F__PavQJ42scoYGyWdEvZOw2Bwxhoqv_gKE,8659
47
+ gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi,sha256=iwjwm9ZuxGZUVInNeknJUNqs56nnnQlw8ye_3cUkJ9M,16355
48
+ gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=T9sShA_9fgEuaaAuT2gJZq_EYNbEhf3IkWwMCwfszY8,4244
49
+ gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=ndXAsrnibKc9kk59t7enzteFrMfwinexCRVcDX6OgyA,24735
50
+ gllm_inference/lm_invoker/xai_lm_invoker.pyi,sha256=4SnQdkomkIGZFswj2t-dx9yKRVAvs6PKc3MooBYkuxA,15773
51
51
  gllm_inference/lm_invoker/batch/__init__.pyi,sha256=vJOTHRJ83oq8Bq0UsMdID9_HW5JAxr06gUs4aPRZfEE,130
52
52
  gllm_inference/lm_invoker/batch/batch_operations.pyi,sha256=o2U17M41RKVFW6j_oxy-SxU1JqUtVt75pKRxrqXzorE,5499
53
53
  gllm_inference/lm_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -117,7 +117,7 @@ gllm_inference/utils/io_utils.pyi,sha256=Eg7dvHWdXslTKdjh1j3dG50i7r35XG2zTmJ9XXv
117
117
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
118
118
  gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
119
119
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
120
- gllm_inference_binary-0.5.38.dist-info/METADATA,sha256=Uysv4QWBKPE7Z5BebyI69N8fkhTvV4zDyr6DBOGaGVA,5770
121
- gllm_inference_binary-0.5.38.dist-info/WHEEL,sha256=O_u6PJIQ2pIcyIInxVQ9r-yArMuUZbBIaF1kpYVkYxA,96
122
- gllm_inference_binary-0.5.38.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
123
- gllm_inference_binary-0.5.38.dist-info/RECORD,,
120
+ gllm_inference_binary-0.5.39.dist-info/METADATA,sha256=fclPfv4h7mJziMKUfIgKXJJVXnT-OpvX8Aqnbg7m0go,5770
121
+ gllm_inference_binary-0.5.39.dist-info/WHEEL,sha256=O_u6PJIQ2pIcyIInxVQ9r-yArMuUZbBIaF1kpYVkYxA,96
122
+ gllm_inference_binary-0.5.39.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
123
+ gllm_inference_binary-0.5.39.dist-info/RECORD,,