gllm-inference-binary 0.5.17__cp313-cp313-win_amd64.whl → 0.5.19__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.

@@ -1,14 +1,23 @@
1
1
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
2
- from gllm_inference.schema import Vector as Vector
2
+ from gllm_inference.schema import Attachment as Attachment, Vector as Vector
3
+ from gllm_inference.utils.io_utils import DEFAULT_BASE64_ALLOWED_MIMETYPES as DEFAULT_BASE64_ALLOWED_MIMETYPES, base64_to_bytes as base64_to_bytes
3
4
  from langchain_core.embeddings import Embeddings
4
5
  from pydantic import BaseModel
5
6
  from typing import Any
6
7
 
7
8
  class EMInvokerEmbeddings(BaseModel, Embeddings, arbitrary_types_allowed=True):
8
- """An adapter class that enables an `EMInvoker` to be used as a LangChain `Embeddings`.
9
+ '''An adapter class that enables an `EMInvoker` to be used as a LangChain `Embeddings`.
9
10
 
10
11
  Attributes:
11
12
  em_invoker (BaseEMInvoker): The `EMInvoker` instance to be interacted with.
13
+ use_base64 (bool):
14
+ Whether to apply strict base64 encoding to the input.
15
+ 1, If `True`, only inputs with specific MIME types (e.g. images,
16
+ audio, and video) will be converted into base64 strings before being sent.
17
+ 2. If `False`, each input is treated as a raw string.
18
+
19
+ This ensures "strict" handling: base64 encoding is not applied
20
+ universally, but only when required for those MIME types.
12
21
 
13
22
  Usage example:
14
23
  ```python
@@ -18,8 +27,9 @@ class EMInvokerEmbeddings(BaseModel, Embeddings, arbitrary_types_allowed=True):
18
27
  em_invoker = OpenAIEMInvoker(...)
19
28
  embeddings = EMInvokerEmbeddings(em_invoker=em_invoker)
20
29
  ```
21
- """
30
+ '''
22
31
  em_invoker: BaseEMInvoker
32
+ use_base64: bool
23
33
  async def aembed_documents(self, texts: list[str], **kwargs: Any) -> list[Vector]:
24
34
  """Asynchronously embed documents using the `EMInvoker`.
25
35
 
@@ -29,6 +39,9 @@ class EMInvokerEmbeddings(BaseModel, Embeddings, arbitrary_types_allowed=True):
29
39
 
30
40
  Returns:
31
41
  list[Vector]: List of embeddings, one for each text.
42
+
43
+ Raises:
44
+ ValueError: If `texts` is not a list of strings.
32
45
  """
33
46
  async def aembed_query(self, text: str, **kwargs: Any) -> Vector:
34
47
  """Asynchronously embed query using the `EMInvoker`.
@@ -39,6 +52,9 @@ class EMInvokerEmbeddings(BaseModel, Embeddings, arbitrary_types_allowed=True):
39
52
 
40
53
  Returns:
41
54
  Vector: Embeddings for the text.
55
+
56
+ Raises:
57
+ ValueError: If `text` is not a string.
42
58
  """
43
59
  def embed_documents(self, texts: list[str], **kwargs: Any) -> list[Vector]:
44
60
  """Embed documents using the `EMInvoker`.
@@ -49,6 +65,9 @@ class EMInvokerEmbeddings(BaseModel, Embeddings, arbitrary_types_allowed=True):
49
65
 
50
66
  Returns:
51
67
  list[Vector]: List of embeddings, one for each text.
68
+
69
+ Raises:
70
+ ValueError: If `texts` is not a list of strings.
52
71
  """
53
72
  def embed_query(self, text: str, **kwargs: Any) -> Vector:
54
73
  """Embed query using the `EMInvoker`.
@@ -59,4 +78,7 @@ class EMInvokerEmbeddings(BaseModel, Embeddings, arbitrary_types_allowed=True):
59
78
 
60
79
  Returns:
61
80
  Vector: Embeddings for the text.
81
+
82
+ Raises:
83
+ ValueError: If `text` is not a string.
62
84
  """
@@ -1,6 +1,5 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_core.utils.retry import RetryConfig as RetryConfig
3
- from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
4
3
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
4
  from gllm_inference.em_invoker.schema.twelvelabs import InputType as InputType, Key as Key, OutputType as OutputType
6
5
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig, Vector as Vector
@@ -1,4 +1,5 @@
1
+ from gllm_inference.utils.io_utils import base64_to_bytes as base64_to_bytes
1
2
  from gllm_inference.utils.langchain import load_langchain_model as load_langchain_model, parse_model_data as parse_model_data
2
3
  from gllm_inference.utils.validation import validate_string_enum as validate_string_enum
3
4
 
4
- __all__ = ['load_langchain_model', 'parse_model_data', 'validate_string_enum']
5
+ __all__ = ['base64_to_bytes', 'load_langchain_model', 'parse_model_data', 'validate_string_enum']
@@ -0,0 +1,26 @@
1
+ from _typeshed import Incomplete
2
+
3
+ logger: Incomplete
4
+ DEFAULT_BASE64_ALLOWED_MIMETYPES: Incomplete
5
+
6
+ def base64_to_bytes(value: str, *, allowed_mimetypes: tuple[str, ...] | None = ...) -> str | bytes:
7
+ '''Decode a base64 string to bytes based on allowed MIME type.
8
+
9
+ The conversion steps are as follows:
10
+ 1. The function first attempts to decode the given string from base64.
11
+ 2. If decoding succeeds, it checks the MIME type of the decoded content.
12
+ 3. When the MIME type matches one of the allowed patterns (e.g., ``"image/*"``),
13
+ the raw bytes are returned. Otherwise, the original string is returned unchanged.
14
+
15
+ Args:
16
+ value (str): Input data to decode.
17
+ allowed_mimetypes (tuple[str, ...], optional): MIME type prefixes that are allowed
18
+ to be decoded into bytes. Defaults to ("image/*", "audio/*", "video/*").
19
+
20
+ Returns:
21
+ str | bytes: Base64-encoded string or raw bytes if MIME type is allowed;
22
+ otherwise returns original string.
23
+
24
+ Raises:
25
+ ValueError: If the input is not a string.
26
+ '''
Binary file
gllm_inference.pyi CHANGED
@@ -117,4 +117,6 @@ import pathlib
117
117
  import pathlib.Path
118
118
  import filetype
119
119
  import magic
120
+ import binascii
121
+ import fnmatch
120
122
  import importlib
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.17
3
+ Version: 0.5.19
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
@@ -15,7 +15,7 @@ gllm_inference/em_invoker/bedrock_em_invoker.pyi,sha256=EbXyj_U0NK9QSnq9HSeCHJ1H
15
15
  gllm_inference/em_invoker/em_invoker.pyi,sha256=l_jnFRrfoVatVwKawpPA018bM0U6wMc8j_DVxkL8T4s,5133
16
16
  gllm_inference/em_invoker/google_em_invoker.pyi,sha256=DH_ddq07EfUgv5L0OTZVOhg-p3CqEpcWAjmCYJsSljM,6684
17
17
  gllm_inference/em_invoker/langchain/__init__.pyi,sha256=aOTlRvS9aG1tBErjsmhe75s4Sq-g2z9ArfGqNW7QyEs,151
18
- gllm_inference/em_invoker/langchain/em_invoker_embeddings.pyi,sha256=gEX21gJLngUh9fZo8v6Vbh0gpWFFqS2S-dGNZSrDjFQ,2409
18
+ gllm_inference/em_invoker/langchain/em_invoker_embeddings.pyi,sha256=BBSDazMOckO9Aw17tC3LGUTPqLb01my1xUZLtKZlwJY,3388
19
19
  gllm_inference/em_invoker/langchain_em_invoker.pyi,sha256=vQO5yheucM5eb7xWcwb4U7eGXASapwgOFC_SZdyysHA,3207
20
20
  gllm_inference/em_invoker/openai_compatible_em_invoker.pyi,sha256=zEYOBDXKQhvcMGer9DYDu50_3KRDjYyN8-JgpBIFPOI,5456
21
21
  gllm_inference/em_invoker/openai_em_invoker.pyi,sha256=0TDIQa-5UwsPcVxgkze-QJJWrt-ToakAKbuAk9TW5SM,4746
@@ -27,7 +27,7 @@ gllm_inference/em_invoker/schema/openai.pyi,sha256=rNRqN62y5wHOKlr4T0n0m41ikAnSr
27
27
  gllm_inference/em_invoker/schema/openai_compatible.pyi,sha256=A9MOeBhI-IPuvewOk4YYOAGtgyKohERx6-9cEYtbwvs,157
28
28
  gllm_inference/em_invoker/schema/twelvelabs.pyi,sha256=D3F9_1F-UTzE6Ymxj6u0IFdL6OFVGlc7noZJr3iuA6I,389
29
29
  gllm_inference/em_invoker/schema/voyage.pyi,sha256=Aqvu6mhFkNb01aXAI5mChLKIgEnFnr-jNKq1lVWB54M,304
30
- gllm_inference/em_invoker/twelevelabs_em_invoker.pyi,sha256=l_3AUwhPlEE9gheq4sqI3o8OATt-kHwemQGdCSwaXfg,5549
30
+ gllm_inference/em_invoker/twelevelabs_em_invoker.pyi,sha256=MMVgSnjMXksdhSDXIi3vOULIXnjbhtq19eR5LPnUmGo,5446
31
31
  gllm_inference/em_invoker/voyage_em_invoker.pyi,sha256=vdB_qS8QKrCcb-HtXwKZS4WW1R1wGzpMBFmOKC39sjU,5619
32
32
  gllm_inference/exceptions/__init__.pyi,sha256=2F05RytXZIKaOJScb1pD0O0bATIQHVeEAYYNX4y5N2A,981
33
33
  gllm_inference/exceptions/error_parser.pyi,sha256=ggmh8DJXdwFJInNLrP24WVJt_4raxbAVxzXRQgBpndA,2441
@@ -91,12 +91,13 @@ gllm_inference/schema/token_usage.pyi,sha256=WJiGQyz5qatzBK2b-sABLCyTRLCBbAvxCRc
91
91
  gllm_inference/schema/tool_call.pyi,sha256=OWT9LUqs_xfUcOkPG0aokAAqzLYYDkfnjTa0zOWvugk,403
92
92
  gllm_inference/schema/tool_result.pyi,sha256=IJsU3n8y0Q9nFMEiq4RmLEIHueSiim0Oz_DlhKrTqto,287
93
93
  gllm_inference/schema/type_alias.pyi,sha256=TQiskxG9yUlvj7xEj8X84pNxlhMvhbehujbUPPSVKD0,734
94
- gllm_inference/utils/__init__.pyi,sha256=RBTWDu1TDPpTd17fixcPYFv2L_vp4-IAOX0IsxgCsD4,299
94
+ gllm_inference/utils/__init__.pyi,sha256=H27RiiFjD6WQHRrYb1-sBnb2aqjVENw5_8-DdAe1k9A,396
95
+ gllm_inference/utils/io_utils.pyi,sha256=Eg7dvHWdXslTKdjh1j3dG50i7r35XG2zTmJ9XXvz4cI,1120
95
96
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
96
97
  gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
97
98
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
98
- gllm_inference.cp313-win_amd64.pyd,sha256=4uhbSo5ilHdU7UgaABSkXlwS4-Cq6FbZAIFaPsccnBk,2945536
99
- gllm_inference.pyi,sha256=BVwSps0XHsSJ4zwbhDLQ-R5gar7s7oQD9o4FVN-Z1x0,3605
100
- gllm_inference_binary-0.5.17.dist-info/METADATA,sha256=XT6EE6ZK5-7X1bv4wjRjo93u_EvxAXd0cZKnin-Y54A,4608
101
- gllm_inference_binary-0.5.17.dist-info/WHEEL,sha256=RBxSuTKD__NDRUBZC1I4b5R6FamU3rQfymmsTgmeb3A,98
102
- gllm_inference_binary-0.5.17.dist-info/RECORD,,
99
+ gllm_inference.cp313-win_amd64.pyd,sha256=OWFxh3b1pUG3Sa0SgHVQGiKTvJzNJILifNL1D5IpaaA,2972160
100
+ gllm_inference.pyi,sha256=uxl1voKdn19LurAHKEZLWbq9ryPO4UkJ1Nk1MM8IL34,3636
101
+ gllm_inference_binary-0.5.19.dist-info/METADATA,sha256=RYPC2mk8-uXt5cFOZh7VdB6ccfFPjZ7AjvSsCoCfZQI,4608
102
+ gllm_inference_binary-0.5.19.dist-info/WHEEL,sha256=RBxSuTKD__NDRUBZC1I4b5R6FamU3rQfymmsTgmeb3A,98
103
+ gllm_inference_binary-0.5.19.dist-info/RECORD,,