gllm-inference-binary 0.5.59__cp312-cp312-win_amd64.whl → 0.5.60__cp312-cp312-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.

@@ -104,11 +104,12 @@ class BatchOperations:
104
104
  Returns:
105
105
  BatchStatus: The status of the batch job.
106
106
  """
107
- async def retrieve(self, batch_id: str) -> dict[str, LMOutput]:
107
+ async def retrieve(self, batch_id: str, **kwargs: Any) -> dict[str, LMOutput]:
108
108
  """Retrieves the results of a batch job.
109
109
 
110
110
  Args:
111
111
  batch_id (str): The ID of the batch job to get the results of.
112
+ **kwargs (Any): Additional keyword arguments.
112
113
 
113
114
  Returns:
114
115
  dict[str, LMOutput]: The results of the batch job.
@@ -6,8 +6,8 @@ from gllm_inference.constants import GOOGLE_SCOPES as GOOGLE_SCOPES, SECONDS_TO_
6
6
  from gllm_inference.exceptions import BaseInvokerError as BaseInvokerError, convert_http_status_to_base_invoker_error as convert_http_status_to_base_invoker_error
7
7
  from gllm_inference.exceptions.provider_error_map import GOOGLE_ERROR_MAPPING as GOOGLE_ERROR_MAPPING
8
8
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
9
- from gllm_inference.lm_invoker.schema.google import InputType as InputType, Key as Key
10
- from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, LMOutput as LMOutput, Message as Message, MessageRole as MessageRole, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, ThinkingEvent as ThinkingEvent, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
9
+ from gllm_inference.lm_invoker.schema.google import InputType as InputType, JobState as JobState, Key as Key
10
+ from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, BatchStatus as BatchStatus, LMInput as LMInput, LMOutput as LMOutput, Message as Message, MessageRole as MessageRole, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, ThinkingEvent as ThinkingEvent, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
11
11
  from langchain_core.tools import Tool as LangChainTool
12
12
  from typing import Any
13
13
 
@@ -16,6 +16,7 @@ DEFAULT_THINKING_BUDGET: int
16
16
  REQUIRE_THINKING_MODEL_PREFIX: Incomplete
17
17
  IMAGE_GENERATION_MODELS: Incomplete
18
18
  YOUTUBE_URL_PATTERN: Incomplete
19
+ BATCH_STATUS_MAP: Incomplete
19
20
  GOOGLE_FILE_URL_PATTERN: Incomplete
20
21
 
21
22
  class GoogleLMInvoker(BaseLMInvoker):
@@ -261,6 +262,94 @@ class GoogleLMInvoker(BaseLMInvoker):
261
262
  ```python
262
263
  lm_invoker = GoogleLMInvoker(..., retry_config=retry_config)
263
264
  ```
265
+
266
+ Batch processing:
267
+ The `GoogleLMInvoker` supports batch processing, which allows the language model to process multiple
268
+ requests in a single call. Batch processing is supported through the `batch` attribute.
269
+
270
+ Due to Google SDK limitations with batch processing:
271
+ 1. Only inline requests are currently supported (not file-based or BigQuery sources).
272
+ 2. The total size of all requests must be under 20MB.
273
+ 3. Original request indices are not preserved in the results. The results are keyed by request index in the
274
+ format \'1\', \'2\', etc, in which order are preserved based on the original request order. If you want to use
275
+ custom request IDs, you can pass them as a list of strings to the `custom_request_ids` keyword argument
276
+
277
+ Usage example:
278
+ ```python
279
+ requests = {"1": "What color is the sky?", "2": "What color is the grass?"}
280
+ results = await lm_invoker.batch.invoke(requests)
281
+ ```
282
+
283
+ Output example:
284
+ ```python
285
+ {
286
+ "1": LMOutput(outputs=[LMOutputItem(type="text", output="The sky is blue.")]),
287
+ "2": LMOutput(finish_details={"type": "error", "message": "..."}),
288
+ }
289
+ ```
290
+
291
+ The `GoogleLMInvoker` also supports the following standalone batch processing operations:
292
+
293
+ 1. Create a batch job:
294
+ ```python
295
+ requests = {"1": "What color is the sky?", "2": "What color is the grass?"}
296
+ batch_id = await lm_invoker.batch.create(requests)
297
+ ```
298
+
299
+ 2. Get the status of a batch job:
300
+ ```python
301
+ status = await lm_invoker.batch.status(batch_id)
302
+ ```
303
+
304
+ 3. Retrieve the results of a batch job:
305
+
306
+ In default, the results will be keyed by request index in the format \'1\', \'2\', etc,
307
+ in which order are preserved based on the original request order.
308
+
309
+
310
+ ```python
311
+ results = await lm_invoker.batch.retrieve(batch_id)
312
+ ```
313
+
314
+ Output example:
315
+ ```python
316
+ {
317
+ "1": LMOutput(outputs=[LMOutputItem(type="text", output="The sky is blue.")]),
318
+ "2": LMOutput(finish_details={"type": "error", "error": {"message": "...", ...}, ...}),
319
+ }
320
+ ```
321
+
322
+ If you pass custom_request_ids to the create method, the results will be keyed by the custom_request_ids.
323
+ ```python
324
+ results = await lm_invoker.batch.retrieve(batch_id, custom_request_ids=["request_1", "request_2"])
325
+ ```
326
+
327
+ Output example:
328
+ ```python
329
+ {
330
+ "request_1": LMOutput(outputs=[LMOutputItem(type="text", output="The sky is blue.")]),
331
+ "request_2": LMOutput(finish_details={"type": "error", "error": {"message": "...", ...}, ...}),
332
+ }
333
+ ```
334
+
335
+ 4. List the batch jobs:
336
+ ```python
337
+ batch_jobs = await lm_invoker.batch.list()
338
+ ```
339
+
340
+ Output example:
341
+ ```python
342
+ [
343
+ {"id": "batch_123", "status": "finished"},
344
+ {"id": "batch_456", "status": "in_progress"},
345
+ {"id": "batch_789", "status": "canceling"},
346
+ ]
347
+ ```
348
+
349
+ 5. Cancel a batch job:
350
+ ```python
351
+ await lm_invoker.batch.cancel(batch_id)
352
+ ```
264
353
  '''
265
354
  client_params: Incomplete
266
355
  image_generation: Incomplete
@@ -7,8 +7,10 @@ class Key:
7
7
  FUNCTION: str
8
8
  FUNCTION_CALL: str
9
9
  HTTP_OPTIONS: str
10
+ ID: str
10
11
  NAME: str
11
12
  RETRY_OPTIONS: str
13
+ STATUS: str
12
14
  SYSTEM_INSTRUCTION: str
13
15
  THINKING_CONFIG: str
14
16
  TIMEOUT: str
@@ -16,9 +18,19 @@ class Key:
16
18
  RESPONSE_SCHEMA: str
17
19
  RESPONSE_MIME_TYPE: str
18
20
  VERTEXAI: str
21
+ CUSTOM_REQUEST_IDS: str
19
22
 
20
23
  class InputType:
21
24
  """Defines valid input types in Google."""
22
25
  APPLICATION_JSON: str
23
26
  MODEL: str
24
27
  USER: str
28
+
29
+ class JobState:
30
+ """Defines valid output types in Google."""
31
+ JOB_STATE_CANCELLED: str
32
+ JOB_STATE_EXPIRED: str
33
+ JOB_STATE_FAILED: str
34
+ JOB_STATE_PENDING: str
35
+ JOB_STATE_RUNNING: str
36
+ JOB_STATE_SUCCEEDED: str
@@ -9,9 +9,11 @@ class AttachmentType(StrEnum):
9
9
 
10
10
  class BatchStatus(StrEnum):
11
11
  """Defines the status of a batch job."""
12
- CANCELING = 'canceling'
13
12
  IN_PROGRESS = 'in_progress'
14
13
  FINISHED = 'finished'
14
+ FAILED = 'failed'
15
+ CANCELING = 'canceling'
16
+ EXPIRED = 'expired'
15
17
  UNKNOWN = 'unknown'
16
18
 
17
19
  class LMEventType(StrEnum):
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.59
3
+ Version: 0.5.60
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.cp312-win_amd64.pyd,sha256=N0oHEnIhVKT1VotWdJthKu7g6O5hPcCoH4ChSlSPz9Q,3976192
1
+ gllm_inference.cp312-win_amd64.pyd,sha256=yWHLDowySBzJo8GNdY3_KZzwO8LNXHCIdwJseQXqYYI,4029952
2
2
  gllm_inference.pyi,sha256=t6lCcDjutByvoSK439LdRhQ9i7dq9tmp0Vwr5aAuv4Y,5077
3
3
  gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  gllm_inference/constants.pyi,sha256=8jIYOyxJYVWUYXSXF3vag9HhHwjq1iU9tzPiosRHkWk,328
@@ -45,7 +45,7 @@ gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=_Dst_88LOpC-FN01hApihx
45
45
  gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=uV98H2nJsElCTsxAuInZ9KSk1jOTq6SROAGQRPR-_r0,13173
46
46
  gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=qXmFK6zsOM3nPfueEhY5pAfG24bZytA1jqemPa63vLY,10951
47
47
  gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=FnpayOW_Zi0pWFSawLX8XahEnknbnpsRWrkhKZe8Y3U,8035
48
- gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=LFX9c7dQviIP3lRUmAlJPU50utTW3kF5rQRMLE7iFdU,16727
48
+ gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=XFQigZlicGnpm9_p8Hso-CB8xoi5ENbJwJvE8TubKus,20339
49
49
  gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=ull3cX-iUT4hYMbixcxqfrNUxR8ZoR4Vt9ACVILQWSM,12126
50
50
  gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=qG8pPTiDJZR2e7wr5Q2VyceC227tz3QybX3UPihT5ng,11400
51
51
  gllm_inference/lm_invoker/lm_invoker.pyi,sha256=L_PHRCeHo0dNs6BjnB8H29irGib-qhxKYf7F7pZlU0E,8652
@@ -55,12 +55,12 @@ gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=ReU37hrmYZFbLfCD_c14ryRgn
55
55
  gllm_inference/lm_invoker/portkey_lm_invoker.pyi,sha256=FYOp4BaDfOtompWIRhDqzMVVSK-TiFyw7JA4TznANQE,15236
56
56
  gllm_inference/lm_invoker/xai_lm_invoker.pyi,sha256=6beZsQjGUTo7TdzWBWksRzVGT58XyipErpGfiRq6NH0,13017
57
57
  gllm_inference/lm_invoker/batch/__init__.pyi,sha256=vJOTHRJ83oq8Bq0UsMdID9_HW5JAxr06gUs4aPRZfEE,130
58
- gllm_inference/lm_invoker/batch/batch_operations.pyi,sha256=o2U17M41RKVFW6j_oxy-SxU1JqUtVt75pKRxrqXzorE,5499
58
+ gllm_inference/lm_invoker/batch/batch_operations.pyi,sha256=EKwINY8DQFOXquGGrUTr_Yg24ZrSyiiAo2hX8If9vyQ,5573
59
59
  gllm_inference/lm_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  gllm_inference/lm_invoker/schema/anthropic.pyi,sha256=Ol_IqeBPgrmG5iaY3NV6AD-alC2HmUvljp0vI8GApWo,1154
61
61
  gllm_inference/lm_invoker/schema/bedrock.pyi,sha256=rB1AWfER2BBKZ5I219211YE2EUFPF25bhzysqjdPgiY,1080
62
62
  gllm_inference/lm_invoker/schema/datasaur.pyi,sha256=8lmb1PRbkqBsF_l7iOffxW0K5Xxpi69GW9Z7KxyxHTE,279
63
- gllm_inference/lm_invoker/schema/google.pyi,sha256=elXHrUMS46pbTsulk7hBXVVFcT022iD-_U_I590xeV8,529
63
+ gllm_inference/lm_invoker/schema/google.pyi,sha256=LQ14PJyDOe3K5TYvE-gzE1fjpZCSAy-0Sy9Lmw6fICY,827
64
64
  gllm_inference/lm_invoker/schema/langchain.pyi,sha256=2OJOUQPlGdlUbIOTDOyiWDBOMm3MoVX-kU2nK0zQsF0,452
65
65
  gllm_inference/lm_invoker/schema/openai.pyi,sha256=GIrqEtUPinn8VD-w-38gOw0qiIYuVzM9cj5dRYuGIoQ,2387
66
66
  gllm_inference/lm_invoker/schema/openai_chat_completions.pyi,sha256=nNPb7ETC9IrJwkV5wfbGf6Co3-qdq4lhcXz0l_qYCE4,1261
@@ -114,7 +114,7 @@ gllm_inference/schema/activity.pyi,sha256=atrU4OwLesA9FEt1H7K3gsUWYNdOqpI5i2VdWk
114
114
  gllm_inference/schema/attachment.pyi,sha256=myJ_cI_h5mwUdvmMrWpSQIwj3nIxe8SD7HxO37o_3D4,4611
115
115
  gllm_inference/schema/code_exec_result.pyi,sha256=WQ-ARoGM9r6nyRX-A0Ro1XKiqrc9R3jRYXZpu_xo5S4,573
116
116
  gllm_inference/schema/config.pyi,sha256=NVmjQK6HipIE0dKSfx12hgIC0O-S1HEcAc-TWlXAF5A,689
117
- gllm_inference/schema/enums.pyi,sha256=aJjmCCUV4ASDM8VTiSJlxPxdapKkxXjS4_NqRplyUnE,2145
117
+ gllm_inference/schema/enums.pyi,sha256=U-lADk7xNjA5rByem0fo0xDAy9T3GsekY8B5szTlWPQ,2193
118
118
  gllm_inference/schema/events.pyi,sha256=_CKuGNzb3j2Y1dOB2yssFkT_9FQz1AY4J_ApCwKNizU,4743
119
119
  gllm_inference/schema/lm_input.pyi,sha256=HxQiZgY7zcXh_Dw8nK8LSeBTZEHMPZVwmPmnfgSsAbs,197
120
120
  gllm_inference/schema/lm_output.pyi,sha256=N75CIF_2kZRdXKy2jvu9hhqzk5DrCbsHXTrhKqQ-7vo,11667
@@ -131,7 +131,7 @@ gllm_inference/utils/io_utils.pyi,sha256=Eg7dvHWdXslTKdjh1j3dG50i7r35XG2zTmJ9XXv
131
131
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
132
132
  gllm_inference/utils/validation.pyi,sha256=OWRZxeVGIuuvNU0LqLGB-9gNmypvbH-LcSJx91rnH1k,453
133
133
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
134
- gllm_inference_binary-0.5.59.dist-info/METADATA,sha256=zgTWioKaUScz7TQm2RllQ_jv1d1l8CApNKZ1Bjo_kQ4,5945
135
- gllm_inference_binary-0.5.59.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
136
- gllm_inference_binary-0.5.59.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
137
- gllm_inference_binary-0.5.59.dist-info/RECORD,,
134
+ gllm_inference_binary-0.5.60.dist-info/METADATA,sha256=jFQ1DplA4e1zYc2YKbuvcnha_DNN3seGwOAm8YZG2u8,5945
135
+ gllm_inference_binary-0.5.60.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
136
+ gllm_inference_binary-0.5.60.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
137
+ gllm_inference_binary-0.5.60.dist-info/RECORD,,