gllm-inference-binary 0.5.45__cp313-cp313-win_amd64.whl → 0.5.47__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.
@@ -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.cp313-win_amd64.pyd,sha256=tAwGqwenK1geHt_I26Ee6y1xY14Ta__bFkQhIiWiIeo,3739648
2
- gllm_inference.pyi,sha256=d_2YUYVy-BJvaYSyEgXSn5QBfMPFlDbdo3TmDKkRodI,5143
1
+ gllm_inference.cp313-win_amd64.pyd,sha256=Rw9RPvGn34ccThSX5Uq7YbA_TRjLuDffgzVre52ajKQ,3824128
2
+ gllm_inference.pyi,sha256=1WeCtSLoqo97eCY-WiMP-LF9UUJG_pT5NTESuCoStRg,5211
3
3
  gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  gllm_inference/constants.pyi,sha256=PncjVw-mkzcJ3ln1ohvVZGdJ-TD-VZy1Ygn4Va8Z7i0,350
5
5
  gllm_inference/builder/__init__.pyi,sha256=-bw1uDx7CAM7pkvjvb1ZXku9zXlQ7aEAyC83KIn3bz8,506
6
6
  gllm_inference/builder/build_em_invoker.pyi,sha256=3vO_pLokR4BAZflOMu6qzXoKx6vibT16uwJETH5Y_yc,6283
7
- gllm_inference/builder/build_lm_invoker.pyi,sha256=HvQICF-qvOTzfXZUqhi7rlwcpkMZpxaC-8QZmhnXKzI,7466
7
+ gllm_inference/builder/build_lm_invoker.pyi,sha256=mGMFjTmflPjfz9gRhnLzfdAnumSGfLuXFt4W76ZHSJw,9520
8
8
  gllm_inference/builder/build_lm_request_processor.pyi,sha256=H7Rg88e7PTTCtuyY64r333moTmh4-ypOwgnG10gkEdY,4232
9
9
  gllm_inference/builder/build_output_parser.pyi,sha256=sgSTrzUmSRxPzUUum0fDU7A3NXYoYhpi6bEx4Q2XMnA,965
10
10
  gllm_inference/catalog/__init__.pyi,sha256=HWgPKWIzprpMHRKe_qN9BZSIQhVhrqiyjLjIXwvj1ho,291
@@ -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=HoNgVi0T21aFd1JrCnSLu4yryv8k8RnYdR3-tIdHFgA,498
30
30
  gllm_inference/em_invoker/schema/cohere.pyi,sha256=Wio6h0sbY93GygqETtflRaaucFzYSeLZRg7jyxMDK0s,567
31
31
  gllm_inference/em_invoker/schema/google.pyi,sha256=bzdtu4DFH2kATLybIeNl_Lznj99H-6u2Fvx3Zx52oZg,190
32
- gllm_inference/em_invoker/schema/jina.pyi,sha256=EFo4d8HuzPEZDV5F0PwUIkYPrCTEiCqHq17ICzYxKeg,739
32
+ gllm_inference/em_invoker/schema/jina.pyi,sha256=B38heufA7nwWt_f93qY_aQVieuOSOH35Xotf3p_3BKc,770
33
33
  gllm_inference/em_invoker/schema/langchain.pyi,sha256=SZ13HDcvAOGmDTi2b72H6Y1J5GePR21JdnM6gYrwcGs,117
34
34
  gllm_inference/em_invoker/schema/openai.pyi,sha256=rNRqN62y5wHOKlr4T0n0m41ikAnSrD72CTnoHxo6kEM,146
35
35
  gllm_inference/em_invoker/schema/openai_compatible.pyi,sha256=A9MOeBhI-IPuvewOk4YYOAGtgyKohERx6-9cEYtbwvs,157
@@ -39,7 +39,7 @@ gllm_inference/exceptions/__init__.pyi,sha256=nXOqwsuwUgsnBcJEANVuxbZ1nDfcJ6-pKU
39
39
  gllm_inference/exceptions/error_parser.pyi,sha256=4aiJZhBzBOqlhdmpvaCvildGy7_XxlJzQpe3PzGt8eE,2040
40
40
  gllm_inference/exceptions/exceptions.pyi,sha256=6y3ECgHAStqMGgQv8Dv-Ui-5PDD07mSj6qaRZeSWea4,5857
41
41
  gllm_inference/exceptions/provider_error_map.pyi,sha256=vWa4ZIHn7qIghECGvO-dS2KzOmf3c10GRWKZ4YDPnSQ,1267
42
- gllm_inference/lm_invoker/__init__.pyi,sha256=jG1xc5fTOeIgeKKVYSnsMzQThKk9kTW38yO_MYtv540,1387
42
+ gllm_inference/lm_invoker/__init__.pyi,sha256=L2nlkj13WwWbDYEBtM0mlAj0-UbSilMjVLpCJ_0Eock,1502
43
43
  gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=JSgKUk9d1ZHlitv_ZjHlAk2hIW-J7u6yslVHflIeUro,16726
44
44
  gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=FYfRNPG-oD4wIfitjTHnGib1uMZL7Pid0gbrRsymAHU,14601
45
45
  gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=dsNxj3ZfHxUplg6nBLgxVGooGYq1QP89gYzCnmRCz3g,11810
@@ -51,6 +51,7 @@ gllm_inference/lm_invoker/lm_invoker.pyi,sha256=PS4cJ5VLNfHqeTgCerY-c1Xaa7ktdWAi
51
51
  gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi,sha256=uYJFgi4tJGab77232IC1gdoU9h9AqoClIUj6tM6O47s,15177
52
52
  gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=T9sShA_9fgEuaaAuT2gJZq_EYNbEhf3IkWwMCwfszY8,4244
53
53
  gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=10iKCyleqHNbJc8M1rj3ogRcNlNxcVgyk0v6TcS6gf4,23452
54
+ gllm_inference/lm_invoker/portkey_lm_invoker.pyi,sha256=BmZ5TFiQx3-6Ijf6J2ICzP6SCfnOFUVTPRLijv85oU0,13465
54
55
  gllm_inference/lm_invoker/xai_lm_invoker.pyi,sha256=gyi12K7M9HkjNX6pU6NVv5Uq3-aHErixO-PVhHjioo8,14632
55
56
  gllm_inference/lm_invoker/batch/__init__.pyi,sha256=vJOTHRJ83oq8Bq0UsMdID9_HW5JAxr06gUs4aPRZfEE,130
56
57
  gllm_inference/lm_invoker/batch/batch_operations.pyi,sha256=o2U17M41RKVFW6j_oxy-SxU1JqUtVt75pKRxrqXzorE,5499
@@ -62,17 +63,21 @@ gllm_inference/lm_invoker/schema/google.pyi,sha256=elXHrUMS46pbTsulk7hBXVVFcT022
62
63
  gllm_inference/lm_invoker/schema/langchain.pyi,sha256=2OJOUQPlGdlUbIOTDOyiWDBOMm3MoVX-kU2nK0zQsF0,452
63
64
  gllm_inference/lm_invoker/schema/openai.pyi,sha256=TsCr8_SM5kK2JyROeXtmH13n46TgKjLMc0agYlYUSZc,2328
64
65
  gllm_inference/lm_invoker/schema/openai_chat_completions.pyi,sha256=nNPb7ETC9IrJwkV5wfbGf6Co3-qdq4lhcXz0l_qYCE4,1261
66
+ gllm_inference/lm_invoker/schema/portkey.pyi,sha256=V2q4JIwDAR7BidqfmO01u1_1mLOMtm5OCon6sN2zNt0,662
65
67
  gllm_inference/lm_invoker/schema/xai.pyi,sha256=jpC6ZSBDUltzm9GjD6zvSFIPwqizn_ywLnjvwSa7KuU,663
66
- gllm_inference/model/__init__.pyi,sha256=JKQB0wVSVYD-_tdRkG7N_oEVAKGCcoBw0BUOUMLieFo,602
68
+ gllm_inference/model/__init__.pyi,sha256=e9Jq5V2iVPpjBh_bOEBoXdsU2LleAxKfJ0r-1rZJ5R0,822
67
69
  gllm_inference/model/em/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
70
+ gllm_inference/model/em/cohere_em.pyi,sha256=uF1AmDO-skQteYqzxJ3DK10SqgfdW0oW9L8Ym34eU04,505
68
71
  gllm_inference/model/em/google_em.pyi,sha256=c53H-KNdNOK9ppPLyOSkmCA890eF5FsMd05upkPIzF0,487
72
+ gllm_inference/model/em/jina_em.pyi,sha256=wo3EcKxOqMUnVMgH7Q1Ak8UzaumzhNGuhrtS1KrlXjw,649
69
73
  gllm_inference/model/em/openai_em.pyi,sha256=b6ID1JsLZH9OAo9E37CkbgWNR_eI65eKXK6TYi_0ndA,457
70
74
  gllm_inference/model/em/twelvelabs_em.pyi,sha256=5R2zkKDiEatdATFzF8TOoKW9XRkOsOoNGY5lORimueo,413
71
75
  gllm_inference/model/em/voyage_em.pyi,sha256=kTInLttWfPqCNfBX-TK5VMMaFfPxwqqudBw1kz4hnxk,551
72
76
  gllm_inference/model/lm/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
- gllm_inference/model/lm/anthropic_lm.pyi,sha256=3rppksDF4nVAR3Konoj6nRi_T8vSaFPxLub1CzJh7Us,578
74
- gllm_inference/model/lm/google_lm.pyi,sha256=yv5nXnLxuCGDUsh7QP9furSx-6sZj6FQi-pJ9lZbHAk,496
77
+ gllm_inference/model/lm/anthropic_lm.pyi,sha256=ccUpxddakurLFHivl5UzJxgODLhcFgx8XC7CKa-99NE,633
78
+ gllm_inference/model/lm/google_lm.pyi,sha256=OLuoqT0FnJOLsNalulBMEXuCYAXoF8Y7vjfSBgjaJxA,529
75
79
  gllm_inference/model/lm/openai_lm.pyi,sha256=yj3AJj1xDYRkNIPHX2enw46AJ9wArPZruKsxg1ME9Rg,645
80
+ gllm_inference/model/lm/xai_lm.pyi,sha256=O3G9Lj1Ii31CyCDrwYVkPPJN6X8V-WBF9xILUPUE-qY,525
76
81
  gllm_inference/output_parser/__init__.pyi,sha256=dhAeRTBxc6CfS8bhnHjbtrnyqJ1iyffvUZkGp4UrJNM,132
77
82
  gllm_inference/output_parser/json_output_parser.pyi,sha256=YtgQh8Uzy8W_Tgh8DfuR7VFFS7qvLEasiTwRfaGZZEU,2993
78
83
  gllm_inference/output_parser/output_parser.pyi,sha256=-Xu5onKCBDqShcO-VrQh5icqAmXdihGc3rkZxL93swg,975
@@ -114,7 +119,7 @@ gllm_inference/schema/lm_input.pyi,sha256=HxQiZgY7zcXh_Dw8nK8LSeBTZEHMPZVwmPmnfg
114
119
  gllm_inference/schema/lm_output.pyi,sha256=DIV8BiIOPaSnMKxzKzH_Mp7j7-MScWCvmllegJDLqFg,2479
115
120
  gllm_inference/schema/mcp.pyi,sha256=4SgQ83pEowfWm2p-w9lupV4NayqqVBOy7SuYxIFeWRs,1045
116
121
  gllm_inference/schema/message.pyi,sha256=jJV6A0ihEcun2OhzyMtNkiHnf7d6v5R-GdpTBGfJ0AQ,2272
117
- gllm_inference/schema/model_id.pyi,sha256=3PeAHrCyMAZJPCa7CfaArmOHdh2oDdUu6lkyx9mKG9g,5819
122
+ gllm_inference/schema/model_id.pyi,sha256=Y9YjIOB5dRhs8EskAxoruFAzX0P3eu_xKD1huRM787M,5844
118
123
  gllm_inference/schema/reasoning.pyi,sha256=jbPxkDRHt0Vt-zdcc8lTT1l2hIE1Jm3HIHeNd0hfXGo,577
119
124
  gllm_inference/schema/token_usage.pyi,sha256=WJiGQyz5qatzBK2b-sABLCyTRLCBbAvxCRcqSJOzu-8,3025
120
125
  gllm_inference/schema/tool_call.pyi,sha256=OWT9LUqs_xfUcOkPG0aokAAqzLYYDkfnjTa0zOWvugk,403
@@ -125,7 +130,7 @@ gllm_inference/utils/io_utils.pyi,sha256=Eg7dvHWdXslTKdjh1j3dG50i7r35XG2zTmJ9XXv
125
130
  gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
126
131
  gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
127
132
  gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
128
- gllm_inference_binary-0.5.45.dist-info/METADATA,sha256=RLBqUxp1nnQSWcpsyb5R3g0PWAmQ3Q5k4fQl8jLjJIs,5852
129
- gllm_inference_binary-0.5.45.dist-info/WHEEL,sha256=O_u6PJIQ2pIcyIInxVQ9r-yArMuUZbBIaF1kpYVkYxA,96
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=1JStZjTbPf51eWVkFu16JBAqbK1e1VohgrqCC5VcnIc,5945
134
+ gllm_inference_binary-0.5.47.dist-info/WHEEL,sha256=O_u6PJIQ2pIcyIInxVQ9r-yArMuUZbBIaF1kpYVkYxA,96
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,,