gllm-inference-binary 0.5.15__cp311-cp311-win_amd64.whl → 0.5.17__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.

Potentially problematic release.


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

@@ -3,7 +3,7 @@ from gllm_core.utils.retry import RetryConfig as RetryConfig
3
3
  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
4
  from gllm_inference.em_invoker.openai_em_invoker import OpenAIEMInvoker as OpenAIEMInvoker
5
5
  from gllm_inference.em_invoker.schema.openai import Key as Key
6
- from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider
6
+ from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig
7
7
  from typing import Any
8
8
 
9
9
  class AzureOpenAIEMInvoker(OpenAIEMInvoker):
@@ -16,6 +16,7 @@ class AzureOpenAIEMInvoker(OpenAIEMInvoker):
16
16
  client (AsyncAzureOpenAI): The client for the Azure OpenAI API.
17
17
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
18
18
  retry_config (RetryConfig): The retry configuration for the embedding model.
19
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
19
20
 
20
21
  Input types:
21
22
  The `AzureOpenAIEMInvoker` only supports text inputs.
@@ -68,7 +69,7 @@ class AzureOpenAIEMInvoker(OpenAIEMInvoker):
68
69
  ```
69
70
  '''
70
71
  client: Incomplete
71
- 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, retry_config: RetryConfig | None = None) -> None:
72
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
72
73
  """Initializes a new instance of the AzureOpenAIEMInvoker class.
73
74
 
74
75
  Args:
@@ -83,4 +84,6 @@ class AzureOpenAIEMInvoker(OpenAIEMInvoker):
83
84
  Defaults to None.
84
85
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
85
86
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
87
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
88
+ Defaults to None, in which case no truncation is applied.
86
89
  """
@@ -3,7 +3,7 @@ from enum import StrEnum
3
3
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
4
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.em_invoker.schema.bedrock import InputType as InputType, Key as Key, OutputType as OutputType
6
- from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
+ from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig, Vector as Vector
7
7
  from typing import Any
8
8
 
9
9
  class ModelType(StrEnum):
@@ -24,6 +24,7 @@ class BedrockEMInvoker(BaseEMInvoker):
24
24
  client_kwargs (dict[str, Any]): The Bedrock client kwargs.
25
25
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
26
26
  retry_config (RetryConfig): The retry configuration for the embedding model.
27
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
27
28
 
28
29
  Input types:
29
30
  The `BedrockEMInvoker` only supports text inputs.
@@ -77,7 +78,7 @@ class BedrockEMInvoker(BaseEMInvoker):
77
78
  '''
78
79
  session: Incomplete
79
80
  client_kwargs: Incomplete
80
- 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, retry_config: RetryConfig | None = None) -> None:
81
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
81
82
  '''Initializes a new instance of the BedrockEMInvoker class.
82
83
 
83
84
  Args:
@@ -93,6 +94,8 @@ class BedrockEMInvoker(BaseEMInvoker):
93
94
  Defaults to None.
94
95
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
95
96
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
97
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
98
+ Defaults to None, in which case no truncation is applied.
96
99
 
97
100
  Raises:
98
101
  ValueError: If the model name is not supported.
@@ -4,7 +4,7 @@ from abc import ABC
4
4
  from gllm_core.utils.retry import RetryConfig
5
5
  from gllm_inference.constants import DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES, INVOKER_DEFAULT_TIMEOUT as INVOKER_DEFAULT_TIMEOUT
6
6
  from gllm_inference.exceptions import parse_error_message as parse_error_message
7
- from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, Vector as Vector
7
+ from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, TruncateSide as TruncateSide, TruncationConfig as TruncationConfig, Vector as Vector
8
8
  from typing import Any
9
9
 
10
10
  class BaseEMInvoker(ABC, metaclass=abc.ABCMeta):
@@ -16,12 +16,17 @@ class BaseEMInvoker(ABC, metaclass=abc.ABCMeta):
16
16
  model_id (str): The model ID of the embedding model.
17
17
  model_provider (str): The provider of the embedding model.
18
18
  model_name (str): The name of the embedding model.
19
- default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
19
+ default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the
20
+ embedding model. Defaults to None, in which case an empty dictionary is used.
20
21
  retry_config (RetryConfig): The retry configuration for the embedding model.
22
+ Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
23
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
24
+ Defaults to None, in which case no truncation is applied.
21
25
  """
22
26
  default_hyperparameters: Incomplete
23
27
  retry_config: Incomplete
24
- def __init__(self, model_id: ModelId, default_hyperparameters: dict[str, Any] | None = None, supported_attachments: set[str] | None = None, retry_config: RetryConfig | None = None) -> None:
28
+ truncation_config: Incomplete
29
+ def __init__(self, model_id: ModelId, default_hyperparameters: dict[str, Any] | None = None, supported_attachments: set[str] | None = None, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
25
30
  """Initializes a new instance of the BaseEMInvoker class.
26
31
 
27
32
  Args:
@@ -32,6 +37,8 @@ class BaseEMInvoker(ABC, metaclass=abc.ABCMeta):
32
37
  in which case an empty set is used (indicating that no attachments are supported).
33
38
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
34
39
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
40
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
41
+ Defaults to None, in which case no truncation is applied.
35
42
  """
36
43
  @property
37
44
  def model_id(self) -> str:
@@ -3,7 +3,7 @@ from gllm_core.utils.retry import RetryConfig as RetryConfig
3
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
- from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
+ from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig, Vector as Vector
7
7
  from typing import Any
8
8
 
9
9
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -17,7 +17,8 @@ class GoogleEMInvoker(BaseEMInvoker):
17
17
  model_name (str): The name of the embedding model.
18
18
  client_params (dict[str, Any]): The Google client instance init parameters.
19
19
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
20
- retry_config (RetryConfig | None): The retry configuration for the language model.
20
+ retry_config (RetryConfig): The retry configuration for the embedding model.
21
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
21
22
 
22
23
  Initialization:
23
24
  The `GoogleEMInvoker` can use either Google Gen AI or Google Vertex AI.
@@ -98,7 +99,7 @@ class GoogleEMInvoker(BaseEMInvoker):
98
99
  ```
99
100
  '''
100
101
  client_params: Incomplete
101
- 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, retry_config: RetryConfig | None = None) -> None:
102
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
102
103
  '''Initializes a new instance of the GoogleEMInvoker class.
103
104
 
104
105
  Args:
@@ -117,6 +118,8 @@ class GoogleEMInvoker(BaseEMInvoker):
117
118
  Defaults to None.
118
119
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
119
120
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
121
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
122
+ Defaults to None, in which case no truncation is applied.
120
123
 
121
124
  Note:
122
125
  If neither `api_key` nor `credentials_path` is provided, Google Gen AI will be used by default.
@@ -3,7 +3,7 @@ from gllm_core.utils.retry import RetryConfig
3
3
  from gllm_inference.constants import INVOKER_DEFAULT_TIMEOUT as INVOKER_DEFAULT_TIMEOUT, INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
4
4
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.em_invoker.schema.langchain import Key as Key
6
- from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
+ from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig, Vector as Vector
7
7
  from gllm_inference.utils import load_langchain_model as load_langchain_model, parse_model_data as parse_model_data
8
8
  from langchain_core.embeddings import Embeddings as Embeddings
9
9
  from typing import Any
@@ -19,9 +19,10 @@ class LangChainEMInvoker(BaseEMInvoker):
19
19
  model_name (str): The name of the embedding model.
20
20
  em (Embeddings): The instance to interact with an embedding model defined using LangChain's Embeddings.
21
21
  retry_config (RetryConfig): The retry configuration for the embedding model.
22
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
22
23
  """
23
24
  model: Incomplete
24
- def __init__(self, model: Embeddings | 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, retry_config: RetryConfig | None = None) -> None:
25
+ def __init__(self, model: Embeddings | 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
25
26
  '''Initializes a new instance of the LangChainEMInvoker class.
26
27
 
27
28
  Args:
@@ -38,4 +39,6 @@ class LangChainEMInvoker(BaseEMInvoker):
38
39
  Defaults to None.
39
40
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
40
41
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
42
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
43
+ Defaults to None, in which case no truncation is applied.
41
44
  '''
@@ -3,7 +3,7 @@ from gllm_core.utils.retry import RetryConfig as RetryConfig
3
3
  from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
4
4
  from gllm_inference.em_invoker.openai_em_invoker import OpenAIEMInvoker as OpenAIEMInvoker
5
5
  from gllm_inference.em_invoker.schema.openai_compatible import Key as Key
6
- from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider
6
+ from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig
7
7
  from typing import Any
8
8
 
9
9
  class OpenAICompatibleEMInvoker(OpenAIEMInvoker):
@@ -16,6 +16,8 @@ class OpenAICompatibleEMInvoker(OpenAIEMInvoker):
16
16
  client (AsyncOpenAI): The OpenAI client instance.
17
17
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
18
18
  retry_config (RetryConfig): The retry configuration for the embedding model.
19
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
20
+
19
21
 
20
22
  When to use:
21
23
  The `OpenAICompatibleEMInvoker` is designed to interact with endpoints that are compatible with OpenAI\'s
@@ -76,7 +78,7 @@ class OpenAICompatibleEMInvoker(OpenAIEMInvoker):
76
78
  ```
77
79
  '''
78
80
  client: Incomplete
79
- 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, retry_config: RetryConfig | None = None) -> None:
81
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
80
82
  """Initializes a new instance of the OpenAICompatibleEMInvoker class.
81
83
 
82
84
  Args:
@@ -89,4 +91,6 @@ class OpenAICompatibleEMInvoker(OpenAIEMInvoker):
89
91
  Defaults to None.
90
92
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
91
93
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
94
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
95
+ Defaults to None, in which case no truncation is applied.
92
96
  """
@@ -4,6 +4,7 @@ from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_P
4
4
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.em_invoker.schema.openai import Key as Key
6
6
  from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
7
+ from gllm_inference.schema.config import TruncationConfig as TruncationConfig
7
8
  from typing import Any
8
9
 
9
10
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -18,6 +19,7 @@ class OpenAIEMInvoker(BaseEMInvoker):
18
19
  client (AsyncOpenAI): The client for the OpenAI API.
19
20
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
20
21
  retry_config (RetryConfig): The retry configuration for the embedding model.
22
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
21
23
 
22
24
  Input types:
23
25
  The `OpenAIEMInvoker` only supports text inputs.
@@ -70,7 +72,7 @@ class OpenAIEMInvoker(BaseEMInvoker):
70
72
  ```
71
73
  '''
72
74
  client: Incomplete
73
- 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, retry_config: RetryConfig | None = None) -> None:
75
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
74
76
  """Initializes a new instance of the OpenAIEMInvoker class.
75
77
 
76
78
  Args:
@@ -83,4 +85,6 @@ class OpenAIEMInvoker(BaseEMInvoker):
83
85
  Defaults to None.
84
86
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
85
87
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
88
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
89
+ Defaults to None, in which case no truncation is applied.
86
90
  """
@@ -3,7 +3,7 @@ from gllm_core.utils.retry import RetryConfig as RetryConfig
3
3
  from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
4
4
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.em_invoker.schema.twelvelabs import InputType as InputType, Key as Key, OutputType as OutputType
6
- from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
+ 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
7
7
  from typing import Any
8
8
 
9
9
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -18,6 +18,7 @@ class TwelveLabsEMInvoker(BaseEMInvoker):
18
18
  client (Client): The client for the TwelveLabs API.
19
19
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
20
20
  retry_config (RetryConfig): The retry configuration for the embedding model.
21
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
21
22
 
22
23
  Input types:
23
24
  The `TwelveLabsEMInvoker` supports the following input types: text, audio, and image.
@@ -83,7 +84,7 @@ class TwelveLabsEMInvoker(BaseEMInvoker):
83
84
  ```
84
85
  '''
85
86
  client: Incomplete
86
- 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, retry_config: RetryConfig | None = None) -> None:
87
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
87
88
  """Initializes a new instance of the TwelveLabsEMInvoker class.
88
89
 
89
90
  Args:
@@ -96,4 +97,6 @@ class TwelveLabsEMInvoker(BaseEMInvoker):
96
97
  Defaults to None.
97
98
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
98
99
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
100
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
101
+ Defaults to None, in which case no truncation is applied.
99
102
  """
@@ -3,7 +3,7 @@ from gllm_core.utils.retry import RetryConfig as RetryConfig
3
3
  from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
4
4
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.em_invoker.schema.voyage import InputType as InputType, Key as Key
6
- from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
+ 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
7
7
  from typing import Any
8
8
 
9
9
  SUPPORTED_ATTACHMENTS: Incomplete
@@ -19,6 +19,7 @@ class VoyageEMInvoker(BaseEMInvoker):
19
19
  client (Client): The client for the Voyage API.
20
20
  default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
21
21
  retry_config (RetryConfig): The retry configuration for the embedding model.
22
+ truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
22
23
 
23
24
  Input types:
24
25
  The `VoyageEMInvoker` supports the following input types: text, image, and a tuple containing text and image.
@@ -85,7 +86,7 @@ class VoyageEMInvoker(BaseEMInvoker):
85
86
  ```
86
87
  '''
87
88
  client: Incomplete
88
- 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, retry_config: RetryConfig | None = None) -> None:
89
+ 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, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
89
90
  """Initializes a new instance of the VoyageEMInvoker class.
90
91
 
91
92
  Args:
@@ -98,4 +99,6 @@ class VoyageEMInvoker(BaseEMInvoker):
98
99
  Defaults to None.
99
100
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
100
101
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
102
+ truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
103
+ Defaults to None, in which case no truncation is applied.
101
104
  """
@@ -14,16 +14,15 @@ class Key:
14
14
  """Defines valid keys in LM invokers JSON schema."""
15
15
  ADDITIONAL_PROPERTIES: str
16
16
  ANY_OF: str
17
+ ARGS_SCHEMA: str
17
18
  ARUN: str
19
+ COROUTINE: str
18
20
  DATA_TYPE: str
19
21
  DATA_VALUE: str
20
22
  DEFAULT: str
21
23
  DESCRIPTION: str
22
24
  FUNC: str
23
- FUNCTION: str
24
- META: str
25
25
  NAME: str
26
- PARAMETERS: str
27
26
  PROPERTIES: str
28
27
  REQUIRED: str
29
28
  TITLE: str
@@ -1,6 +1,7 @@
1
1
  from gllm_inference.schema.attachment import Attachment as Attachment
2
2
  from gllm_inference.schema.code_exec_result import CodeExecResult as CodeExecResult
3
- from gllm_inference.schema.enums import AttachmentType as AttachmentType, EmitDataType as EmitDataType, MessageRole as MessageRole
3
+ from gllm_inference.schema.config import TruncationConfig as TruncationConfig
4
+ from gllm_inference.schema.enums import AttachmentType as AttachmentType, EmitDataType as EmitDataType, MessageRole as MessageRole, TruncateSide as TruncateSide
4
5
  from gllm_inference.schema.lm_output import LMOutput as LMOutput
5
6
  from gllm_inference.schema.message import Message as Message
6
7
  from gllm_inference.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider
@@ -10,4 +11,4 @@ from gllm_inference.schema.tool_call import ToolCall as ToolCall
10
11
  from gllm_inference.schema.tool_result import ToolResult as ToolResult
11
12
  from gllm_inference.schema.type_alias import EMContent as EMContent, ErrorResponse as ErrorResponse, MessageContent as MessageContent, ResponseSchema as ResponseSchema, Vector as Vector
12
13
 
13
- __all__ = ['Attachment', 'AttachmentType', 'CodeExecResult', 'EMContent', 'EmitDataType', 'ErrorResponse', 'InputTokenDetails', 'MessageContent', 'LMOutput', 'ModelId', 'ModelProvider', 'Message', 'MessageRole', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'TokenUsage', 'ToolCall', 'ToolResult', 'Vector']
14
+ __all__ = ['Attachment', 'AttachmentType', 'CodeExecResult', 'EMContent', 'EmitDataType', 'ErrorResponse', 'InputTokenDetails', 'MessageContent', 'LMOutput', 'ModelId', 'ModelProvider', 'Message', 'MessageRole', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector']
@@ -0,0 +1,15 @@
1
+ from gllm_inference.schema.enums import TruncateSide as TruncateSide
2
+ from pydantic import BaseModel
3
+
4
+ class TruncationConfig(BaseModel):
5
+ """Configuration for text truncation behavior.
6
+
7
+ Attributes:
8
+ max_length (int): Maximum length of text content. Required.
9
+ truncate_side (TruncateSide | None): Side to truncate from when max_length is exceeded.
10
+ 1. TruncateSide.RIGHT: Keep the beginning of the text, truncate from the end (default)
11
+ 2. TruncateSide.LEFT: Keep the end of the text, truncate from the beginning
12
+ If None, defaults to TruncateSide.RIGHT
13
+ """
14
+ max_length: int
15
+ truncate_side: TruncateSide | None
@@ -22,3 +22,8 @@ class MessageRole(StrEnum):
22
22
  SYSTEM = 'system'
23
23
  USER = 'user'
24
24
  ASSISTANT = 'assistant'
25
+
26
+ class TruncateSide(StrEnum):
27
+ """Enumeration for truncation sides."""
28
+ RIGHT = 'RIGHT'
29
+ LEFT = 'LEFT'
Binary file
gllm_inference.pyi CHANGED
@@ -42,6 +42,7 @@ import gllm_inference.request_processor.LMRequestProcessor
42
42
  import gllm_core.utils.imports
43
43
  import gllm_inference.schema.ModelId
44
44
  import gllm_inference.schema.ModelProvider
45
+ import gllm_inference.schema.TruncationConfig
45
46
  import openai
46
47
  import asyncio
47
48
  import enum
@@ -51,6 +52,7 @@ import gllm_inference.exceptions.parse_error_message
51
52
  import gllm_inference.schema.Attachment
52
53
  import gllm_inference.schema.AttachmentType
53
54
  import gllm_inference.schema.EMContent
55
+ import gllm_inference.schema.TruncateSide
54
56
  import google
55
57
  import google.auth
56
58
  import google.genai
@@ -97,8 +99,6 @@ import litellm
97
99
  import inspect
98
100
  import time
99
101
  import jsonschema
100
- import langchain_core.utils
101
- import langchain_core.utils.function_calling
102
102
  import gllm_inference.schema.MessageContent
103
103
  import gllm_inference.utils.validate_string_enum
104
104
  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.15
3
+ Version: 0.5.17
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
@@ -10,15 +10,15 @@ gllm_inference/catalog/lm_request_processor_catalog.pyi,sha256=GemCEjFRHNChtNOfb
10
10
  gllm_inference/catalog/prompt_builder_catalog.pyi,sha256=iViWB4SaezzjQY4UY1YxeoXUNxqxa2cTJGaD9JSx4Q8,3279
11
11
  gllm_inference/constants.pyi,sha256=kvYdaD0afopdfvijkyTSq1e5dsUKiN232wA9KlcPGs8,325
12
12
  gllm_inference/em_invoker/__init__.pyi,sha256=pmbsjmsqXwfe4WPykMnrmasKrYuylJWnf2s0pbo0ioM,997
13
- gllm_inference/em_invoker/azure_openai_em_invoker.pyi,sha256=QimqPII-KN9OgsfH1Iubn_tCHhtWjPQ5rilZoT6Ir-U,4688
14
- gllm_inference/em_invoker/bedrock_em_invoker.pyi,sha256=haqfFHUn7UrULGNj9XuM13FfcmjVY_4RgI1XpKh46s8,5176
15
- gllm_inference/em_invoker/em_invoker.pyi,sha256=KX4i0xBWR5j6z14nEL6T8at3StKfdf3miQ4xixtYhZk,4424
16
- gllm_inference/em_invoker/google_em_invoker.pyi,sha256=c0XJuLS4ji-Y9aHmbb8PRLwrbH6QA2WtdS1-2HbWFq8,6306
13
+ gllm_inference/em_invoker/azure_openai_em_invoker.pyi,sha256=g1I3Aexg5VeDeU_zbZWCVgca2fhrUztVrpbzS5GBBYI,5072
14
+ gllm_inference/em_invoker/bedrock_em_invoker.pyi,sha256=EbXyj_U0NK9QSnq9HSeCHJ1Hw7xg2Twqj4wcbkHuvng,5560
15
+ gllm_inference/em_invoker/em_invoker.pyi,sha256=l_jnFRrfoVatVwKawpPA018bM0U6wMc8j_DVxkL8T4s,5133
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
18
  gllm_inference/em_invoker/langchain/em_invoker_embeddings.pyi,sha256=gEX21gJLngUh9fZo8v6Vbh0gpWFFqS2S-dGNZSrDjFQ,2409
19
- gllm_inference/em_invoker/langchain_em_invoker.pyi,sha256=sFmsRE89MIdnD8g0VSMsdLvtfZL6dfPkUtDhH_WfgLc,2823
20
- gllm_inference/em_invoker/openai_compatible_em_invoker.pyi,sha256=S5lRg3MeLoenOkeAG079I22kPaFXAFrltSoWcQSDK4I,5070
21
- gllm_inference/em_invoker/openai_em_invoker.pyi,sha256=1WTuPtu5RlZCUcBHMXR5xEkAufWCHshKA8_JW7oFakE,4321
19
+ gllm_inference/em_invoker/langchain_em_invoker.pyi,sha256=vQO5yheucM5eb7xWcwb4U7eGXASapwgOFC_SZdyysHA,3207
20
+ gllm_inference/em_invoker/openai_compatible_em_invoker.pyi,sha256=zEYOBDXKQhvcMGer9DYDu50_3KRDjYyN8-JgpBIFPOI,5456
21
+ gllm_inference/em_invoker/openai_em_invoker.pyi,sha256=0TDIQa-5UwsPcVxgkze-QJJWrt-ToakAKbuAk9TW5SM,4746
22
22
  gllm_inference/em_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  gllm_inference/em_invoker/schema/bedrock.pyi,sha256=6xP5T5jxane_Ecrb-6zf_X678Tj3svQUNy0SgHQArRM,443
24
24
  gllm_inference/em_invoker/schema/google.pyi,sha256=lPzJ-f18qVar6dctdN4eQWrxWrOFHC9zJ4cuLXXMytw,153
@@ -27,8 +27,8 @@ 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=YGWQNxv3AJ9BpN6HrQSnATiW_p0dRakkqy-JgxNIlf4,5165
31
- gllm_inference/em_invoker/voyage_em_invoker.pyi,sha256=R8IPBOEhIN84ukof-VkTPxPNbmbkwR_imTa5u6Qyjt0,5235
30
+ gllm_inference/em_invoker/twelevelabs_em_invoker.pyi,sha256=l_3AUwhPlEE9gheq4sqI3o8OATt-kHwemQGdCSwaXfg,5549
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
34
34
  gllm_inference/exceptions/exceptions.pyi,sha256=ViXvIzm7tLcstjqfwC6nPziDg0UAmoUAWZVWrAJyp3w,4763
@@ -40,7 +40,7 @@ gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=c4H3TOz0LIhWjokCCdQ4asi
40
40
  gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=I3plg_oVuTl0hiShFBmCYPclP4gWbzU61xUSgon24Ew,17102
41
41
  gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=bBGOxJfjnzOtDR4kH4PuCiOCKEPu8rTqzZodTXCHQ2k,13522
42
42
  gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=HHwW7i8ryXHI23JZQwscyva6aPmPOB13Muhf7gaaMUM,13376
43
- gllm_inference/lm_invoker/lm_invoker.pyi,sha256=YjMqbJymd_5U8MOulGXxJDSWSoEx4CebwlWnwt4Wyc4,7988
43
+ gllm_inference/lm_invoker/lm_invoker.pyi,sha256=Sd-ywxgPcIzyI5eA7XoqdkYG9hntEnihJfj6Ack7qr0,7975
44
44
  gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=JemahodhaUsC2gsI7YSxnW4X3uX1cU4YCFdIvdWWY88,15203
45
45
  gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=SEHWAwpT8KmIQukurXtXOU2xyU2rp_HtM2SARsBF3dU,19892
46
46
  gllm_inference/lm_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -78,10 +78,11 @@ gllm_inference/prompt_formatter/prompt_formatter.pyi,sha256=hAc6rxWc6JSYdD-OypLi
78
78
  gllm_inference/request_processor/__init__.pyi,sha256=giEme2WFQhgyKiBZHhSet0_nKSCHwGy-_2p6NRzg0Zc,231
79
79
  gllm_inference/request_processor/lm_request_processor.pyi,sha256=0fy1HyILCVDw6y46E-7tLnQTRYx4ppeRMe0QP6t9Jyw,5990
80
80
  gllm_inference/request_processor/uses_lm_mixin.pyi,sha256=znBG4AWWm_H70Qqrc1mO4ohmWotX9id81Fqe-x9Qa6Q,2371
81
- gllm_inference/schema/__init__.pyi,sha256=Mg9aKyvShNaB4XmqLWcZZ0arSNJhT2g1hhIqP1IBuaM,1376
81
+ gllm_inference/schema/__init__.pyi,sha256=bYdXkfqkNAKEr48xaOKKQTbt2zLcCPiLCdSl2UTEIfE,1521
82
82
  gllm_inference/schema/attachment.pyi,sha256=9zgAjGXBjLfzPGaKi68FMW6b5mXdEA352nDe-ynOSvY,3385
83
83
  gllm_inference/schema/code_exec_result.pyi,sha256=WQ-ARoGM9r6nyRX-A0Ro1XKiqrc9R3jRYXZpu_xo5S4,573
84
- gllm_inference/schema/enums.pyi,sha256=SQ9mXt8j7uK333uUnUHRs-mkRxf0Z5NCtkAkgQZPIb4,629
84
+ gllm_inference/schema/config.pyi,sha256=NVmjQK6HipIE0dKSfx12hgIC0O-S1HEcAc-TWlXAF5A,689
85
+ gllm_inference/schema/enums.pyi,sha256=XmvxE7A-A8bX6hTikiAo_v66Z3hjMvhJGau1OUy9QDk,746
85
86
  gllm_inference/schema/lm_output.pyi,sha256=WP2LQrY0D03OJtFoaW_dGoJ_-yFUh2HbVlllgjzpYv4,1992
86
87
  gllm_inference/schema/message.pyi,sha256=jJV6A0ihEcun2OhzyMtNkiHnf7d6v5R-GdpTBGfJ0AQ,2272
87
88
  gllm_inference/schema/model_id.pyi,sha256=BIteIsEM19VIj_6wBkwKl_xd_iUpe21C7FIKh5BRC5I,5628
@@ -94,8 +95,8 @@ gllm_inference/utils/__init__.pyi,sha256=RBTWDu1TDPpTd17fixcPYFv2L_vp4-IAOX0Isxg
94
95
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
95
96
  gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
96
97
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
97
- gllm_inference.cp311-win_amd64.pyd,sha256=4sBk7Ow25QwQLyXmfBPudyUJCoaTtIaRK1SlS_AESjQ,2920960
98
- gllm_inference.pyi,sha256=YGR7XxIbifZDVu3Ghk4SlqF8mb2UPWoR7pEXwJEloik,3570
99
- gllm_inference_binary-0.5.15.dist-info/METADATA,sha256=XkQGzgIhVc0VbsLTeDbn4Q1uVo8V1L_47CZC4kjNgyo,4608
100
- gllm_inference_binary-0.5.15.dist-info/WHEEL,sha256=-FZBVKyKauScY3vLa8vJR6hBCpAJfFykw2MOwlNKr1g,98
101
- gllm_inference_binary-0.5.15.dist-info/RECORD,,
98
+ gllm_inference.cp311-win_amd64.pyd,sha256=GBFXH9usDVTlWMN3_ppWCnwcA5DwnqICDNSc8BOxnMc,2960384
99
+ gllm_inference.pyi,sha256=6sd9bx3d5vTSkIextq6A1p7j7PyKO_RyuQb90eX-ZR4,3585
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=-FZBVKyKauScY3vLa8vJR6hBCpAJfFykw2MOwlNKr1g,98
102
+ gllm_inference_binary-0.5.17.dist-info/RECORD,,