gllm-inference-binary 0.5.45__cp312-cp312-macosx_13_0_x86_64.whl → 0.5.47__cp312-cp312-macosx_13_0_x86_64.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,5 +1,5 @@
1
1
  from _typeshed import Incomplete
2
- from gllm_inference.lm_invoker import AnthropicLMInvoker as AnthropicLMInvoker, AzureOpenAILMInvoker as AzureOpenAILMInvoker, BedrockLMInvoker as BedrockLMInvoker, DatasaurLMInvoker as DatasaurLMInvoker, GoogleLMInvoker as GoogleLMInvoker, LangChainLMInvoker as LangChainLMInvoker, LiteLLMLMInvoker as LiteLLMLMInvoker, OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker, OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker, OpenAILMInvoker as OpenAILMInvoker, XAILMInvoker as XAILMInvoker
2
+ from gllm_inference.lm_invoker import AnthropicLMInvoker as AnthropicLMInvoker, AzureOpenAILMInvoker as AzureOpenAILMInvoker, BedrockLMInvoker as BedrockLMInvoker, DatasaurLMInvoker as DatasaurLMInvoker, GoogleLMInvoker as GoogleLMInvoker, LangChainLMInvoker as LangChainLMInvoker, LiteLLMLMInvoker as LiteLLMLMInvoker, OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker, OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker, OpenAILMInvoker as OpenAILMInvoker, PortkeyLMInvoker as PortkeyLMInvoker, XAILMInvoker as XAILMInvoker
3
3
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
4
4
  from gllm_inference.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider
5
5
  from typing import Any
@@ -14,11 +14,15 @@ class Key:
14
14
  AZURE_DEPLOYMENT: str
15
15
  AZURE_ENDPOINT: str
16
16
  BASE_URL: str
17
+ CONFIG: str
18
+ CUSTOM_HOST: str
17
19
  CREDENTIALS_PATH: str
18
20
  MODEL_ID: str
19
21
  MODEL_KWARGS: str
20
22
  MODEL_NAME: str
21
23
  MODEL_CLASS_PATH: str
24
+ PORTKEY_API_KEY: str
25
+ PROVIDER: str
22
26
  SECRET_ACCESS_KEY: str
23
27
 
24
28
  def build_lm_invoker(model_id: str | ModelId, credentials: str | dict[str, Any] | None = None, config: dict[str, Any] | None = None) -> BaseLMInvoker:
@@ -157,6 +161,61 @@ def build_lm_invoker(model_id: str | ModelId, credentials: str | dict[str, Any]
157
161
  For the list of supported providers, please refer to the following page:
158
162
  https://docs.litellm.ai/docs/providers/
159
163
 
164
+ # Using Portkey
165
+ Portkey supports multiple authentication methods with strict precedence order.
166
+ Authentication methods are mutually exclusive and cannot be combined.
167
+
168
+ ## Config ID Authentication (Highest Precedence)
169
+ ```python
170
+ lm_invoker = build_lm_invoker(
171
+ model_id="portkey/any-model",
172
+ credentials="portkey-api-key",
173
+ config={"config": "pc-openai-4f6905"}
174
+ )
175
+ ```
176
+
177
+ ## Model Catalog Authentication (Combined Format)
178
+ ```python
179
+ lm_invoker = build_lm_invoker(
180
+ model_id="portkey/@openai-custom/gpt-4o",
181
+ credentials="portkey-api-key"
182
+ )
183
+ ```
184
+
185
+ ## Model Catalog Authentication (Separate Parameters)
186
+ ```python
187
+ lm_invoker = build_lm_invoker(
188
+ model_id="portkey/gpt-4o",
189
+ credentials="portkey-api-key",
190
+ config={"provider": "@openai-custom"}
191
+ )
192
+ ```
193
+
194
+ ## Direct Provider Authentication
195
+ ```python
196
+ lm_invoker = build_lm_invoker(
197
+ model_id="portkey/gpt-4o",
198
+ credentials={
199
+ "portkey_api_key": "portkey-api-key",
200
+ "api_key": "sk-...", # Provider\'s API key
201
+ "provider": "openai" # Direct provider (no \'@\' prefix)
202
+ }
203
+ )
204
+ ```
205
+
206
+ ## Custom Host Override
207
+ ```python
208
+ lm_invoker = build_lm_invoker(
209
+ model_id="portkey/@custom-provider/gpt-4o",
210
+ credentials="portkey-api-key",
211
+ config={"custom_host": "https://your-custom-endpoint.com"}
212
+ )
213
+ ```
214
+
215
+ The Portkey API key can also be provided through the `PORTKEY_API_KEY` environment variable.
216
+ For more details on authentication methods, please refer to:
217
+ https://portkey.ai/docs/product/ai-gateway/universal-api
218
+
160
219
  # Using xAI
161
220
  ```python
162
221
  lm_invoker = build_lm_invoker(
@@ -9,6 +9,7 @@ class Key(StrEnum):
9
9
  """Defines key constants used in the Jina AI API payloads."""
10
10
  DATA = 'data'
11
11
  EMBEDDING = 'embedding'
12
+ EMBEDDINGS = 'embeddings'
12
13
  ERROR = 'error'
13
14
  IMAGE_URL = 'image_url'
14
15
  INPUT = 'input'
@@ -8,6 +8,7 @@ from gllm_inference.lm_invoker.litellm_lm_invoker import LiteLLMLMInvoker as Lit
8
8
  from gllm_inference.lm_invoker.openai_chat_completions_lm_invoker import OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker
9
9
  from gllm_inference.lm_invoker.openai_compatible_lm_invoker import OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker
10
10
  from gllm_inference.lm_invoker.openai_lm_invoker import OpenAILMInvoker as OpenAILMInvoker
11
+ from gllm_inference.lm_invoker.portkey_lm_invoker import PortkeyLMInvoker as PortkeyLMInvoker
11
12
  from gllm_inference.lm_invoker.xai_lm_invoker import XAILMInvoker as XAILMInvoker
12
13
 
13
- __all__ = ['AnthropicLMInvoker', 'AzureOpenAILMInvoker', 'BedrockLMInvoker', 'DatasaurLMInvoker', 'GoogleLMInvoker', 'LangChainLMInvoker', 'LiteLLMLMInvoker', 'OpenAIChatCompletionsLMInvoker', 'OpenAICompatibleLMInvoker', 'OpenAILMInvoker', 'XAILMInvoker']
14
+ __all__ = ['AnthropicLMInvoker', 'AzureOpenAILMInvoker', 'BedrockLMInvoker', 'DatasaurLMInvoker', 'GoogleLMInvoker', 'LangChainLMInvoker', 'LiteLLMLMInvoker', 'OpenAIChatCompletionsLMInvoker', 'OpenAICompatibleLMInvoker', 'OpenAILMInvoker', 'PortkeyLMInvoker', 'XAILMInvoker']
@@ -0,0 +1,260 @@
1
+ from _typeshed import Incomplete
2
+ from gllm_core.event import EventEmitter as EventEmitter
3
+ from gllm_core.schema.tool import Tool as Tool
4
+ from gllm_core.utils.retry import RetryConfig as RetryConfig
5
+ from gllm_inference.constants import SECONDS_TO_MILLISECONDS as SECONDS_TO_MILLISECONDS
6
+ from gllm_inference.lm_invoker.openai_chat_completions_lm_invoker import OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker
7
+ from gllm_inference.lm_invoker.schema.portkey import InputType as InputType, Key as Key
8
+ from gllm_inference.schema import AttachmentType as AttachmentType, LMOutput as LMOutput, ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema
9
+ from langchain_core.tools import Tool as LangChainTool
10
+ from typing import Any
11
+
12
+ MIN_THINKING_BUDGET: int
13
+ SUPPORTED_ATTACHMENTS: Incomplete
14
+ VALID_AUTH_METHODS: str
15
+ logger: Incomplete
16
+
17
+ class PortkeyLMInvoker(OpenAIChatCompletionsLMInvoker):
18
+ '''A language model invoker to interact with Portkey\'s Universal API.
19
+
20
+ This class provides support for Portkey’s Universal AI Gateway, which enables unified access to
21
+ multiple providers (e.g., OpenAI, Anthropic, Google, Cohere, Bedrock) via a single API key.
22
+ The `PortkeyLMInvoker` is compatible with all Portkey model routing configurations, including
23
+ model catalog entries, direct providers, and pre-defined configs.
24
+
25
+ Attributes:
26
+ model_id (str): The model ID of the language model.
27
+ model_provider (str): The provider of the language model.
28
+ model_name (str): The catalog name of the language model.
29
+ client_kwargs (dict[str, Any]): The keyword arguments for the Portkey client.
30
+ default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
31
+ tools (list[Tool]): The list of tools provided to the model to enable tool calling.
32
+ response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
33
+ structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
34
+ output_analytics (bool): Whether to output the invocation analytics.
35
+ retry_config (RetryConfig): The retry configuration for the language model.
36
+ thinking (bool): Whether to enable thinking mode for supported models.
37
+ thinking_budget (int): The maximum reasoning token budget for thinking mode.
38
+
39
+ Basic usage:
40
+ The `PortkeyLMInvoker` supports multiple authentication methods with strict precedence order.
41
+ Authentication methods are mutually exclusive and cannot be combined.
42
+
43
+ **Authentication Precedence (Highest to Lowest):**
44
+ 1. **Config ID Authentication (Highest precedence)**
45
+ Use a pre-configured routing setup from Portkey’s dashboard.
46
+ ```python
47
+ lm_invoker = PortkeyLMInvoker(
48
+ portkey_api_key="<your-portkey-api-key>",
49
+ config="pc-openai-4f6905",
50
+ )
51
+ ```
52
+
53
+ 2. **Model Catalog Authentication**
54
+ Provider name must match the provider name set in the model catalog.
55
+ More details to set up the model catalog can be found in https://portkey.ai/docs/product/model-catalog#model-catalog.
56
+ There are two ways to specify the model name:
57
+
58
+ 2.1. Using Combined Model Name Format
59
+ Specify the `model_name` in \'@provider-name/model-name\' format.
60
+ ```python
61
+ lm_invoker = PortkeyLMInvoker(
62
+ portkey_api_key="<your-portkey-api-key>",
63
+ model_name="@openai-custom/gpt-4o"
64
+ )
65
+ ```
66
+
67
+ 2.2. Using Separate Provider and Model Name Parameters
68
+ Specify the `provider` in \'@provider-name\' format and `model_name` separately.
69
+ ```python
70
+ lm_invoker = PortkeyLMInvoker(
71
+ portkey_api_key="<your-portkey-api-key>",
72
+ provider="@openai-custom",
73
+ model_name="gpt-4o",
74
+ )
75
+ ```
76
+
77
+ 3. **Direct Provider Authentication**
78
+ Use the `provider` in \'provider-name\' format and `model_name` parameters.
79
+ ```python
80
+ lm_invoker = PortkeyLMInvoker(
81
+ portkey_api_key="<your-portkey-api-key>",
82
+ provider="openai",
83
+ model_name="gpt-4o",
84
+ api_key="sk-...",
85
+ )
86
+ ```
87
+
88
+ Custom Host:
89
+ You can also use the `custom_host` parameter to override the default host. This is available
90
+ for all authentication methods except for Config ID authentication.
91
+ ```python
92
+ lm_invoker = PortkeyLMInvoker(..., custom_host="https://your-custom-endpoint.com")
93
+ ```
94
+
95
+ Input types:
96
+ The `PortkeyLMInvoker` supports text, image, document, and audio inputs.
97
+ Non-text inputs can be passed as an `Attachment` object with the `user` role.
98
+
99
+ ```python
100
+ text = "What animal is in this image?"
101
+ image = Attachment.from_path("path/to/image.png")
102
+ result = await lm_invoker.invoke([text, image])
103
+ ```
104
+
105
+ Tool calling:
106
+ Tools can be provided via the `tools` parameter to enable tool invocation.
107
+
108
+ ```python
109
+ lm_invoker = PortkeyLMInvoker(..., tools=[tool_1, tool_2])
110
+ ```
111
+ Output example:
112
+ ```python
113
+ LMOutput(
114
+ response="Let me call the tools...",
115
+ tool_calls=[
116
+ ToolCall(id="123", name="tool_1", args={"key": "value"}),
117
+ ]
118
+ )
119
+ ```
120
+
121
+ Structured output:
122
+ The `response_schema` parameter enables structured responses (Pydantic BaseModel or JSON schema).
123
+
124
+ ```python
125
+ class Animal(BaseModel):
126
+ name: str
127
+ color: str
128
+ lm_invoker = PortkeyLMInvoker(..., response_schema=Animal)
129
+ ```
130
+ Output example:
131
+ ```python
132
+ LMOutput(structured_output=Animal(name="Golden retriever", color="Golden"))
133
+ ```
134
+
135
+ Analytics tracking:
136
+ When `output_analytics=True`, the invoker includes token usage, duration, and finish details.
137
+
138
+ ```python
139
+ LMOutput(
140
+ response="Golden retriever is a good dog breed.",
141
+ token_usage=TokenUsage(input_tokens=100, output_tokens=50),
142
+ duration=0.729,
143
+ finish_details={"finish_reason": "stop"},
144
+ )
145
+ ```
146
+
147
+ **Note:** When streaming is enabled, token usage analytics are not supported and will be `None`.
148
+
149
+ Retry and timeout:
150
+ The `PortkeyLMInvoker` supports retry and timeout configuration.
151
+ By default, the max retries is set to 0 and the timeout is set to 30.0 seconds.
152
+ They can be customized by providing a custom `RetryConfig` object to the `retry_config` parameter.
153
+
154
+ Retry config examples:
155
+ ```python
156
+ retry_config = RetryConfig(max_retries=0, timeout=None) # No retry, no timeout
157
+ retry_config = RetryConfig(max_retries=0, timeout=10.0) # No retry, 10.0 seconds timeout
158
+ retry_config = RetryConfig(max_retries=5, timeout=None) # 5 max retries, no timeout
159
+ retry_config = RetryConfig(max_retries=5, timeout=10.0) # 5 max retries, 10.0 seconds timeout
160
+ ```
161
+
162
+ Usage example:
163
+ ```python
164
+ lm_invoker = PortkeyLMInvoker(..., retry_config=retry_config)
165
+ ```
166
+
167
+ Thinking:
168
+ The `thinking` parameter enables enhanced reasoning capability for supported models.
169
+ Thinking mode allocates additional “reasoning tokens” up to `thinking_budget` (minimum 1024).
170
+ When enabled, the model’s reasoning trace is stored in the `reasoning` attribute.
171
+
172
+ ```python
173
+ lm_invoker = PortkeyLMInvoker(..., thinking=True, thinking_budget=1024)
174
+ ```
175
+ Output example:
176
+ ```python
177
+ LMOutput(
178
+ response="Golden retriever is a good dog breed.",
179
+ reasoning=[Reasoning(reasoning="Let me think about it...")],
180
+ )
181
+ ```
182
+
183
+ Streaming output example:
184
+ ```python
185
+ {"type": "thinking_start", "value": ""}
186
+ {"type": "thinking", "value": "Let me think "}
187
+ {"type": "thinking", "value": "about it..."}
188
+ {"type": "thinking_end", "value": ""}
189
+ {"type": "response", "value": "Golden retriever "}
190
+ {"type": "response", "value": "is a good dog breed."}
191
+ ```
192
+
193
+ Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
194
+ To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
195
+ LM invoker initialization. The legacy event format support will be removed in v0.6.
196
+
197
+ When thinking is enabled, the amount of tokens allocated for the thinking process can be set via the
198
+ `thinking_budget` parameter. The `thinking_budget`:
199
+ 1. Must be a positive integer.
200
+ 2. Must be at least 1024.
201
+ 3. Must be less than or equal to the model\'s maximum context length.
202
+ For more information, please refer to https://portkey.ai/docs/product/ai-gateway/multimodal-capabilities/thinking-mode
203
+
204
+ Setting reasoning-related parameters for non-reasoning models will raise an error.
205
+
206
+ Output types:
207
+ The output of the `PortkeyLMInvoker` can either be:
208
+ 1. `str`: A simple text response.
209
+ 2. `LMOutput`: A structured response model that may contain:
210
+ 2.1. response (str)
211
+ 2.2. tool_calls (list[ToolCall])
212
+ 2.3. structured_output (dict[str, Any] | BaseModel | None)
213
+ 2.4. token_usage (TokenUsage | None)
214
+ 2.5. duration (float | None)
215
+ 2.6. finish_details (dict[str, Any] | None)
216
+ 2.7. reasoning (list[Reasoning])
217
+ '''
218
+ model_kwargs: Incomplete
219
+ thinking: Incomplete
220
+ thinking_budget: Incomplete
221
+ client_kwargs: Incomplete
222
+ client: Incomplete
223
+ def __init__(self, model_name: str | None = None, portkey_api_key: str | None = None, provider: str | None = None, api_key: str | None = None, config: str | None = None, custom_host: 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 | None = None, thinking_budget: int | None = None, simplify_events: bool = False) -> None:
224
+ """Initializes a new instance of the PortkeyLMInvoker class.
225
+
226
+ Args:
227
+ model_name (str | None, optional): The name of the model to use. Acceptable formats:
228
+ 1. 'model' for direct authentication,
229
+ 2. '@provider-slug/model' for model catalog authentication.
230
+ Defaults to None.
231
+ portkey_api_key (str | None, optional): The Portkey API key. Defaults to None, in which
232
+ case the `PORTKEY_API_KEY` environment variable will be used.
233
+ provider (str | None, optional): Provider name or catalog slug. Acceptable formats:
234
+ 1. '@provider-slug' for model catalog authentication (no api_key needed),
235
+ 2. 'provider' for direct authentication (requires api_key).
236
+ Will be combined with model_name if model name is not in the format '@provider-slug/model'.
237
+ Defaults to None.
238
+ api_key (str | None, optional): Provider's API key for direct authentication.
239
+ Must be used with 'provider' parameter (without '@' prefix). Not needed for catalog providers.
240
+ Defaults to None.
241
+ config (str | None, optional): Portkey config ID for complex routing configurations,
242
+ load balancing, or fallback scenarios. Defaults to None.
243
+ custom_host (str | None, optional): Custom host URL for self-hosted or custom endpoints.
244
+ Can be combined with catalog providers. Defaults to None.
245
+ model_kwargs (dict[str, Any] | None, optional): Additional model parameters and authentication.
246
+ Defaults to None.
247
+ default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for model
248
+ invocation (temperature, max_tokens, etc.). Defaults to None.
249
+ tools (list[Tool | LangChainTool] | None, optional): Tools for enabling tool calling functionality.
250
+ Defaults to None.
251
+ response_schema (ResponseSchema | None, optional): Schema for structured output generation.
252
+ Defaults to None.
253
+ output_analytics (bool, optional): Whether to output detailed invocation analytics including
254
+ token usage and timing. Defaults to False.
255
+ retry_config (RetryConfig | None, optional): Configuration for retry behavior on failures.
256
+ Defaults to None.
257
+ thinking (bool | None, optional): Whether to enable thinking mode. Defaults to None.
258
+ thinking_budget (int | None, optional): Thinking budget in tokens. Defaults to None.
259
+ simplify_events (bool, optional): Whether to use simplified event schemas. Defaults to False.
260
+ """
@@ -0,0 +1,31 @@
1
+ class Key:
2
+ """Valid keys in Portkey."""
3
+ AUTHORIZATION: str
4
+ BUDGET_TOKENS: str
5
+ CONFIG: str
6
+ CONTENT: str
7
+ CONTENT_BLOCKS: str
8
+ CUSTOM_HOST: str
9
+ DELTA: str
10
+ MAX_RETRIES: str
11
+ MODEL: str
12
+ PROVIDER: str
13
+ PROVIDER_MODEL: str
14
+ REQUEST_TIMEOUT: str
15
+ RESPONSE_FORMAT: str
16
+ STRICT_OPEN_AI_COMPLIANCE: str
17
+ THINKING: str
18
+ TOOLS: str
19
+ TYPE: str
20
+ USAGE: str
21
+
22
+ class InputType:
23
+ """Valid input types in Portkey."""
24
+ ENABLED: str
25
+
26
+ class AuthConfig:
27
+ """Authentication configuration keys."""
28
+ CONFIG: str
29
+ MODEL: str
30
+ PROVIDER_AUTH: str
31
+ PROVIDER_CUSTOM_HOST: str
@@ -1,9 +1,12 @@
1
+ from gllm_inference.model.em.cohere_em import CohereEM as CohereEM
1
2
  from gllm_inference.model.em.google_em import GoogleEM as GoogleEM
3
+ from gllm_inference.model.em.jina_em import JinaEM as JinaEM
2
4
  from gllm_inference.model.em.openai_em import OpenAIEM as OpenAIEM
3
5
  from gllm_inference.model.em.twelvelabs_em import TwelveLabsEM as TwelveLabsEM
4
6
  from gllm_inference.model.em.voyage_em import VoyageEM as VoyageEM
5
7
  from gllm_inference.model.lm.anthropic_lm import AnthropicLM as AnthropicLM
6
8
  from gllm_inference.model.lm.google_lm import GoogleLM as GoogleLM
7
9
  from gllm_inference.model.lm.openai_lm import OpenAILM as OpenAILM
10
+ from gllm_inference.model.lm.xai_lm import XAILM as XAILM
8
11
 
9
- __all__ = ['AnthropicLM', 'GoogleEM', 'GoogleLM', 'OpenAIEM', 'OpenAILM', 'TwelveLabsEM', 'VoyageEM']
12
+ __all__ = ['AnthropicLM', 'CohereEM', 'GoogleEM', 'GoogleLM', 'JinaEM', 'OpenAIEM', 'OpenAILM', 'TwelveLabsEM', 'VoyageEM', 'XAILM']
@@ -0,0 +1,17 @@
1
+ class CohereEM:
2
+ '''Defines Cohere embedding model names constants.
3
+
4
+ Usage example:
5
+ ```python
6
+ from gllm_inference.model import CohereEM
7
+ from gllm_inference.em_invoker import CohereEMInvoker
8
+
9
+ em_invoker = CohereEMInvoker(CohereEM.EMBED_V4_0)
10
+ result = await em_invoker.invoke("Hello, world!")
11
+ ```
12
+ '''
13
+ EMBED_V4_0: str
14
+ EMBED_ENGLISH_V3_0: str
15
+ EMBED_ENGLISH_LIGHT_V3_0: str
16
+ EMBED_MULTILINGUAL_V3_0: str
17
+ EMBED_MULTILINGUAL_LIGHT_V3_0: str
@@ -0,0 +1,22 @@
1
+ class JinaEM:
2
+ '''Defines Jina embedding model names constants.
3
+
4
+ Usage example:
5
+ ```python
6
+ from gllm_inference.model import JinaEM
7
+ from gllm_inference.em_invoker import JinaEMInvoker
8
+
9
+ em_invoker = JinaEMInvoker(JinaEM.JINA_EMBEDDINGS_V4)
10
+ result = await em_invoker.invoke("Hello, world!")
11
+ ```
12
+ '''
13
+ JINA_EMBEDDINGS_V4: str
14
+ JINA_EMBEDDINGS_V3: str
15
+ JINA_EMBEDDINGS_V2_BASE_EN: str
16
+ JINA_EMBEDDINGS_V2_BASE_CODE: str
17
+ JINA_CLIP_V2: str
18
+ JINA_CLIP_V1: str
19
+ JINA_CODE_EMBEDDINGS_1_5B: str
20
+ JINA_CODE_EMBEDDINGS_0_5B: str
21
+ JINA_COLBERT_V2: str
22
+ JINA_COLBERT_V1_EN: str
@@ -12,9 +12,11 @@ class AnthropicLM:
12
12
  '''
13
13
  CLAUDE_OPUS_4_1: str
14
14
  CLAUDE_OPUS_4: str
15
+ CLAUDE_SONNET_4_5: str
15
16
  CLAUDE_SONNET_4: str
16
17
  CLAUDE_SONNET_3_7: str
17
18
  CLAUDE_SONNET_3_5: str
19
+ CLAUDE_HAIKU_4_5: str
18
20
  CLAUDE_HAIKU_3_5: str
19
21
  CLAUDE_OPUS_3: str
20
22
  CLAUDE_HAIKU_3: str
@@ -12,6 +12,7 @@ class GoogleLM:
12
12
  '''
13
13
  GEMINI_2_5_PRO: str
14
14
  GEMINI_2_5_FLASH: str
15
+ GEMINI_2_5_FLASH_IMAGE: str
15
16
  GEMINI_2_5_FLASH_LITE: str
16
17
  GEMINI_2_0_FLASH: str
17
18
  GEMINI_2_0_FLASH_LITE: str
@@ -0,0 +1,19 @@
1
+ class XAILM:
2
+ '''Defines XAI language model names constants.
3
+
4
+ Usage example:
5
+ ```python
6
+ from gllm_inference.model import XAILM
7
+ from gllm_inference.lm_invoker import XAILMInvoker
8
+
9
+ lm_invoker = XAILMInvoker(XAILM.GROK_4_FAST_REASONING)
10
+ response = await lm_invoker.invoke("Hello, world!")
11
+ ```
12
+ '''
13
+ GROK_CODE_FAST_1: str
14
+ GROK_4_FAST_REASONING: str
15
+ GROK_4_FAST_NON_REASONING: str
16
+ GROK_4_0709: str
17
+ GROK_3_MINI: str
18
+ GROK_3: str
19
+ GROK_2_VISION_1212: str
@@ -19,6 +19,7 @@ class ModelProvider(StrEnum):
19
19
  LANGCHAIN = 'langchain'
20
20
  LITELLM = 'litellm'
21
21
  OPENAI = 'openai'
22
+ PORTKEY = 'portkey'
22
23
  OPENAI_CHAT_COMPLETIONS = 'openai-chat-completions'
23
24
  OPENAI_COMPATIBLE = 'openai-compatible'
24
25
  TWELVELABS = 'twelvelabs'
Binary file
gllm_inference.pyi CHANGED
@@ -32,6 +32,7 @@ import gllm_inference.lm_invoker.LiteLLMLMInvoker
32
32
  import gllm_inference.lm_invoker.OpenAIChatCompletionsLMInvoker
33
33
  import gllm_inference.lm_invoker.OpenAICompatibleLMInvoker
34
34
  import gllm_inference.lm_invoker.OpenAILMInvoker
35
+ import gllm_inference.lm_invoker.PortkeyLMInvoker
35
36
  import gllm_inference.lm_invoker.XAILMInvoker
36
37
  import gllm_inference.prompt_builder.PromptBuilder
37
38
  import gllm_inference.output_parser.JSONOutputParser
@@ -125,6 +126,8 @@ import gllm_inference.schema.MCPCallActivity
125
126
  import gllm_inference.schema.MCPListToolsActivity
126
127
  import gllm_inference.schema.MCPServer
127
128
  import gllm_inference.schema.WebSearchActivity
129
+ import logging
130
+ import portkey_ai
128
131
  import xai_sdk
129
132
  import xai_sdk.chat
130
133
  import xai_sdk.search
@@ -138,7 +141,6 @@ import gllm_inference.prompt_builder.format_strategy.JinjaFormatStrategy
138
141
  import gllm_inference.prompt_builder.format_strategy.StringFormatStrategy
139
142
  import transformers
140
143
  import gllm_inference.prompt_formatter.HuggingFacePromptFormatter
141
- import logging
142
144
  import traceback
143
145
  import gllm_inference.realtime_chat.input_streamer.KeyboardInputStreamer
144
146
  import gllm_inference.realtime_chat.output_streamer.ConsoleOutputStreamer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.45
3
+ Version: 0.5.47
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
@@ -39,10 +39,12 @@ Requires-Dist: google-genai<=1.36,>=1.23; extra == "google"
39
39
  Provides-Extra: huggingface
40
40
  Requires-Dist: huggingface-hub<0.31.0,>=0.30.0; extra == "huggingface"
41
41
  Requires-Dist: transformers<5.0.0,>=4.52.0; extra == "huggingface"
42
- Provides-Extra: openai
43
- Requires-Dist: openai<2.0.0,>=1.98.0; extra == "openai"
44
42
  Provides-Extra: litellm
45
43
  Requires-Dist: litellm<2.0.0,>=1.69.2; extra == "litellm"
44
+ Provides-Extra: openai
45
+ Requires-Dist: openai<2.0.0,>=1.98.0; extra == "openai"
46
+ Provides-Extra: portkey-ai
47
+ Requires-Dist: portkey-ai<2.0.0,>=1.14.4; extra == "portkey-ai"
46
48
  Provides-Extra: twelvelabs
47
49
  Requires-Dist: twelvelabs<0.5.0,>=0.4.4; extra == "twelvelabs"
48
50
  Provides-Extra: voyage
@@ -1,10 +1,10 @@
1
- gllm_inference.cpython-312-darwin.so,sha256=tsyFwXkV7N5gHW9PC44Q4em10yzk6_UGK5_YYLqBSYQ,5303176
2
- gllm_inference.pyi,sha256=mlp8HQ3h_dutd5vdOEFyF6Z1algaWVEoX2VuYNONg1U,5123
1
+ gllm_inference.cpython-312-darwin.so,sha256=mGzlKqR5FkhnsZY2soxTFO64jCylRp1a2Y8WD0yetn0,5429576
2
+ gllm_inference.pyi,sha256=B-sC5mJR6Fp9xIJIf0D3JL5VLFlc3ACmMJN7Zkc6gb4,5191
3
3
  gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  gllm_inference/constants.pyi,sha256=viU-ACRbVSGvsCJ0FQmuR1yhyl-BzoHDVIWo5cwHmF0,337
5
5
  gllm_inference/builder/__init__.pyi,sha256=usz2lvfwO4Yk-ZGKXbCWG1cEr3nlQXxMNDNC-2yc1NM,500
6
6
  gllm_inference/builder/build_em_invoker.pyi,sha256=YunCB3g7gRSYVDRayjz38QCw77_el2e-0iqdOH6KS1Y,6138
7
- gllm_inference/builder/build_lm_invoker.pyi,sha256=3hiIurQ3TC7kEZPflJ6_byCNnEdcd5BEIz07ii4TAzY,7292
7
+ gllm_inference/builder/build_lm_invoker.pyi,sha256=NRSk4EqTNv_trja71HUnl52NQNP0khaOZeTKlknEG94,9287
8
8
  gllm_inference/builder/build_lm_request_processor.pyi,sha256=KbQkcPa8C-yzyelht4mWLP8kDmh17itAT3tn8ZJB6pg,4144
9
9
  gllm_inference/builder/build_output_parser.pyi,sha256=_Lrq-bh1oPsb_Nwkkr_zyEUwIOMysRFZkvEtEM29LZM,936
10
10
  gllm_inference/catalog/__init__.pyi,sha256=JBkPGTyiiZ30GECzJBW-mW8LekWyY2qyzal3eW7ynaM,287
@@ -29,7 +29,7 @@ gllm_inference/em_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
29
29
  gllm_inference/em_invoker/schema/bedrock.pyi,sha256=AHFW8uYOTS7RtqV1RmtY-XQK1xpMgsHxWg4RZhVgI_8,476
30
30
  gllm_inference/em_invoker/schema/cohere.pyi,sha256=UTbTtePRR1zJMsM09SiTZSZZP0IaUGaODvc7ZqH9S8c,547
31
31
  gllm_inference/em_invoker/schema/google.pyi,sha256=ovDlvinu99QJhIxMkvVUoGBEFkkEoAZhadSuk0nI9N8,181
32
- gllm_inference/em_invoker/schema/jina.pyi,sha256=hD7ZJeoZzg-2bhYIjxCAi7dbavbA785ezRDay7cZy7o,711
32
+ gllm_inference/em_invoker/schema/jina.pyi,sha256=vE1ySd8OTDM35saEZos7UCdPwHeX66iuHkZ3RchSZKA,741
33
33
  gllm_inference/em_invoker/schema/langchain.pyi,sha256=edcUvc1IHoSMFwqV83uqWqd0U3fLhkyWQjVknvjHI8U,112
34
34
  gllm_inference/em_invoker/schema/openai.pyi,sha256=Q_dsEcodkOXYXPdrkOkW0LnuLhfeq8tEbtZAGMz2ajA,139
35
35
  gllm_inference/em_invoker/schema/openai_compatible.pyi,sha256=gmvGtsWoOMBelke_tZjC6dKimFBW9f4Vrgv0Ig0OM9Q,150
@@ -39,7 +39,7 @@ gllm_inference/exceptions/__init__.pyi,sha256=Upcuj7od2lkbdueQ0iMT2ktFYYi-KKTynT
39
39
  gllm_inference/exceptions/error_parser.pyi,sha256=IOfa--NpLUW5E9Qq0mwWi6ZpTAbUyyNe6iAqunBNGLI,1999
40
40
  gllm_inference/exceptions/exceptions.pyi,sha256=Bv996qLa_vju0Qjf4GewMxdkq8CV9LRZb0S6289DldA,5725
41
41
  gllm_inference/exceptions/provider_error_map.pyi,sha256=XPLWU42-r8MHZgg5ZkE80Gdqg3p8Z_JHvq_Na03iTqY,1243
42
- gllm_inference/lm_invoker/__init__.pyi,sha256=IGF3h8Z7Yr0bLrkDMRTDVPNBU6Y3liJabW3acjstJDY,1374
42
+ gllm_inference/lm_invoker/__init__.pyi,sha256=Ze9CxgGYguyz8BAU87_2JM-D4OZjlYAqktLI_B2tj_s,1488
43
43
  gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=tsO9WJRj7l4auLc2vxftMX-niWJ9dlYwUIeiTL2FtIo,16392
44
44
  gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=6aqQdwVNLO9bDNrqcO8s75IJAN2hLSGvhO6VeDyz44w,14347
45
45
  gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=8tM3zeoRwdy9ctaG8ANTsFHBdo-g63YQoU8NQsNysFw,11585
@@ -51,6 +51,7 @@ gllm_inference/lm_invoker/lm_invoker.pyi,sha256=YfwlV5uJwwoC0uJ54qsF2PZ5eoX85kUW
51
51
  gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi,sha256=zdHK-YmfplLmvwi1VASm2zvqqyLMoVSMHh2ggqaHIDA,14905
52
52
  gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=i5pMpZf4-r_7FQ1qfsqcjpc98sI-cPiqheuTfTEKxJs,4192
53
53
  gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=YplNfGRnLAv9puh_9hhCiQ3HbVD3XIZAkyvBR06qCpg,23019
54
+ gllm_inference/lm_invoker/portkey_lm_invoker.pyi,sha256=yI6pN_a5J2uZA3Q9LxniXy6vg8g8ySUzhvpK09PTDgQ,13205
54
55
  gllm_inference/lm_invoker/xai_lm_invoker.pyi,sha256=eovp5rwHykcsoT3-TDo5YU6Kt-azfH_IIIFqmkAsD74,14343
55
56
  gllm_inference/lm_invoker/batch/__init__.pyi,sha256=W4W-_yfk7lL20alREJai6GnwuQvdlKRfwQCX4mQK4XI,127
56
57
  gllm_inference/lm_invoker/batch/batch_operations.pyi,sha256=Oo7hoyPSfPZdy1mXvSdvtRndvq-XTIbPIjEoGvJj5C0,5372
@@ -62,17 +63,21 @@ gllm_inference/lm_invoker/schema/google.pyi,sha256=AIsNgq0ZZuicHmx4bL7z6q-946T05
62
63
  gllm_inference/lm_invoker/schema/langchain.pyi,sha256=rZcIxuvABI4pKfyVvkRBRqfJJogZ67EFPydpubHt49c,429
63
64
  gllm_inference/lm_invoker/schema/openai.pyi,sha256=J_rT5Z3rx0hLIae-me1ENeemOESpavcRmYI5pgpkhhk,2222
64
65
  gllm_inference/lm_invoker/schema/openai_chat_completions.pyi,sha256=8byBRZ4xyTidIQJsZqiSjp5t1X875Obe-aEbT0yYfuA,1199
66
+ gllm_inference/lm_invoker/schema/portkey.pyi,sha256=NeRjHNd84HgE_ur2F3Cv6Jx30v6V7eQvI_iJiq4kuME,631
65
67
  gllm_inference/lm_invoker/schema/xai.pyi,sha256=cWnbJmDtllqRH3NXpQbiXgkNBcUXr8ksDSDywcgJebE,632
66
- gllm_inference/model/__init__.pyi,sha256=qClHIgljqhPPCKlGTKmHsWgYb4_hADybxtC2q1U8a5Q,593
68
+ gllm_inference/model/__init__.pyi,sha256=LTeBCSJJwCSd5Qrg7RZCXcp9fURNVNXFR5akk1ZZrTk,810
67
69
  gllm_inference/model/em/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
+ gllm_inference/model/em/cohere_em.pyi,sha256=fArRlV08NwbsJ_h6vpWr94XxUVBtbqW1Jh8s42LRXCo,488
68
71
  gllm_inference/model/em/google_em.pyi,sha256=ZPN5LmReO0bcTfnZixFooUTzgD-daNFPzfxzZ-5WzQQ,471
72
+ gllm_inference/model/em/jina_em.pyi,sha256=txEvDI61nhDRUMgvFzpoe-f0onpUAs1j9HPDN01IHxg,627
69
73
  gllm_inference/model/em/openai_em.pyi,sha256=KcWpMmxNqS28r4zT4H2TIADHr7e7f3VSI1MPzjJXH9k,442
70
74
  gllm_inference/model/em/twelvelabs_em.pyi,sha256=pf9YfTfTPAceBoe1mA5VgtCroHZi5k42mEz-mGSD5QM,400
71
75
  gllm_inference/model/em/voyage_em.pyi,sha256=CEfXjLNZamfhsLyAxIkDXND2Jk4GzwXK5puK9yKJDyE,531
72
76
  gllm_inference/model/lm/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- gllm_inference/model/lm/anthropic_lm.pyi,sha256=36j7T5FguUr8ZNTCgMJE8NF2JZZGyl9JRahvf0hBMw4,558
74
- gllm_inference/model/lm/google_lm.pyi,sha256=Zy0EHiyqPjfQxmzrsfZzOKKjJWfOf3WX-xz0sqqum-U,479
77
+ gllm_inference/model/lm/anthropic_lm.pyi,sha256=dWfG-M_gD644yJ-LK_T8HnAT649j3Vx7TVof03XQimE,611
78
+ gllm_inference/model/lm/google_lm.pyi,sha256=cMV5zYX8uwUF7pErv4pXnXD2G52umo3sxKwbSx7nFhQ,511
75
79
  gllm_inference/model/lm/openai_lm.pyi,sha256=u11zvvIS7-XaHKZ33cZxGQmT6cZ4DqK9Do8l7gFOUTc,618
80
+ gllm_inference/model/lm/xai_lm.pyi,sha256=2ZEQ_--e_zsb23zZQ8bKdQShU7zChx5TrDKF8EpwEpU,506
76
81
  gllm_inference/output_parser/__init__.pyi,sha256=WQOOgsYnPk8vd-SOhFMMaVTzy4gkYrOAyT5gnAxv0A0,129
77
82
  gllm_inference/output_parser/json_output_parser.pyi,sha256=uulh91uQLMSb4ZXZhHYi9W9w7zGnmrOweEkL6wdDJN8,2933
78
83
  gllm_inference/output_parser/output_parser.pyi,sha256=Yzk7F26pH8Uc7FQZo4G6l67YkfppefUvaV9cNK-HyDs,948
@@ -114,7 +119,7 @@ gllm_inference/schema/lm_input.pyi,sha256=A5pjz1id6tP9XRNhzQrbmzd66C_q3gzo0UP8rC
114
119
  gllm_inference/schema/lm_output.pyi,sha256=1SZi6vIWvmrZlVQ59WeQUKO5VhKrLHsSRDYslEH9d7o,2435
115
120
  gllm_inference/schema/mcp.pyi,sha256=Vwu8E2BDl6FvvnI42gIyY3Oki1BdwRE3Uh3aV0rmhQU,1014
116
121
  gllm_inference/schema/message.pyi,sha256=VP9YppKj2mo1esl9cy6qQO9m2mMHUjTmfGDdyUor880,2220
117
- gllm_inference/schema/model_id.pyi,sha256=L2bbG6p3HyKn1naecgc8SNGBaqeH8i9CcUDgd-whP-A,5652
122
+ gllm_inference/schema/model_id.pyi,sha256=U2hiFraeO_occF0Wk3Wn0zTo7sUCwz1_C42ns5sP7Ek,5676
118
123
  gllm_inference/schema/reasoning.pyi,sha256=SlTuiDw87GdnAn-I6YOPIJRhEBiwQljM46JohG05guQ,562
119
124
  gllm_inference/schema/token_usage.pyi,sha256=1GTQVORV0dBNmD_jix8aVaUqxMKFF04KpLP7y2urqbk,2950
120
125
  gllm_inference/schema/tool_call.pyi,sha256=zQaVxCnkVxOfOEhBidqohU85gb4PRwnwBiygKaunamk,389
@@ -125,7 +130,7 @@ gllm_inference/utils/io_utils.pyi,sha256=7kUTacHAVRYoemFUOjCH7-Qmw-YsQGd6rGYxjf_
125
130
  gllm_inference/utils/langchain.pyi,sha256=VluQiHkGigDdqLUbhB6vnXiISCP5hHqV0qokYY6dC1A,1164
126
131
  gllm_inference/utils/validation.pyi,sha256=toxBtRp-VItC_X7sNi-GDd7sjibBdWMrR0q01OI2D7k,385
127
132
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
128
- gllm_inference_binary-0.5.45.dist-info/METADATA,sha256=6RduOcMdvkHJ5vP5HV2XDX2e5YKMWOFLajSFrJE121U,5716
129
- gllm_inference_binary-0.5.45.dist-info/WHEEL,sha256=ar3KUKk5QtasLek_3_fVX4zgPzX-lxtBGErPgJ515rA,105
130
- gllm_inference_binary-0.5.45.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
131
- gllm_inference_binary-0.5.45.dist-info/RECORD,,
133
+ gllm_inference_binary-0.5.47.dist-info/METADATA,sha256=854eSHs9JvlLiEy9fpq84ZoiPbsSth9jX1dJ5o49Jmo,5807
134
+ gllm_inference_binary-0.5.47.dist-info/WHEEL,sha256=ar3KUKk5QtasLek_3_fVX4zgPzX-lxtBGErPgJ515rA,105
135
+ gllm_inference_binary-0.5.47.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
136
+ gllm_inference_binary-0.5.47.dist-info/RECORD,,