gllm-inference-binary 0.5.51__cp311-cp311-win_amd64.whl → 0.5.66__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.
- gllm_inference/builder/build_lm_invoker.pyi +10 -1
- gllm_inference/constants.pyi +0 -1
- gllm_inference/em_invoker/cohere_em_invoker.pyi +1 -2
- gllm_inference/lm_invoker/__init__.pyi +2 -1
- gllm_inference/lm_invoker/anthropic_lm_invoker.pyi +95 -109
- gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi +92 -109
- gllm_inference/lm_invoker/batch/batch_operations.pyi +2 -1
- gllm_inference/lm_invoker/bedrock_lm_invoker.pyi +51 -65
- gllm_inference/lm_invoker/datasaur_lm_invoker.pyi +36 -36
- gllm_inference/lm_invoker/google_lm_invoker.pyi +195 -110
- gllm_inference/lm_invoker/langchain_lm_invoker.pyi +52 -64
- gllm_inference/lm_invoker/litellm_lm_invoker.pyi +86 -106
- gllm_inference/lm_invoker/lm_invoker.pyi +20 -1
- gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi +87 -107
- gllm_inference/lm_invoker/openai_lm_invoker.pyi +235 -185
- gllm_inference/lm_invoker/portkey_lm_invoker.pyi +104 -68
- gllm_inference/lm_invoker/schema/google.pyi +12 -0
- gllm_inference/lm_invoker/schema/openai.pyi +22 -0
- gllm_inference/lm_invoker/sea_lion_lm_invoker.pyi +48 -0
- gllm_inference/lm_invoker/xai_lm_invoker.pyi +94 -131
- gllm_inference/model/__init__.pyi +2 -1
- gllm_inference/model/lm/sea_lion_lm.pyi +16 -0
- gllm_inference/prompt_builder/prompt_builder.pyi +6 -2
- gllm_inference/schema/__init__.pyi +4 -3
- gllm_inference/schema/attachment.pyi +20 -6
- gllm_inference/schema/enums.pyi +14 -1
- gllm_inference/schema/events.pyi +2 -2
- gllm_inference/schema/formatter.pyi +31 -0
- gllm_inference/schema/lm_output.pyi +245 -23
- gllm_inference/schema/model_id.pyi +1 -1
- gllm_inference/utils/validation.pyi +3 -0
- gllm_inference.cp311-win_amd64.pyd +0 -0
- gllm_inference.pyi +5 -6
- {gllm_inference_binary-0.5.51.dist-info → gllm_inference_binary-0.5.66.dist-info}/METADATA +5 -5
- {gllm_inference_binary-0.5.51.dist-info → gllm_inference_binary-0.5.66.dist-info}/RECORD +37 -34
- {gllm_inference_binary-0.5.51.dist-info → gllm_inference_binary-0.5.66.dist-info}/WHEEL +0 -0
- {gllm_inference_binary-0.5.51.dist-info → gllm_inference_binary-0.5.66.dist-info}/top_level.txt +0 -0
|
@@ -102,49 +102,138 @@ class PortkeyLMInvoker(OpenAIChatCompletionsLMInvoker):
|
|
|
102
102
|
result = await lm_invoker.invoke([text, image])
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
Text output:
|
|
106
|
+
The `PortkeyLMInvoker` generates text outputs by default.
|
|
107
|
+
Text outputs are stored in the `outputs` attribute of the `LMOutput` object and can be accessed
|
|
108
|
+
via the `texts` (all text outputs) or `text` (first text output) properties.
|
|
109
|
+
|
|
110
|
+
Output example:
|
|
111
|
+
```python
|
|
112
|
+
LMOutput(outputs=[LMOutputItem(type="text", output="Hello, there!")])
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Structured output:
|
|
116
|
+
The `PortkeyLMInvoker` can be configured to generate structured outputs.
|
|
117
|
+
This feature can be enabled by providing a schema to the `response_schema` parameter.
|
|
118
|
+
|
|
119
|
+
Structured outputs are stored in the `outputs` attribute of the `LMOutput` object and can be accessed
|
|
120
|
+
via the `structureds` (all structured outputs) or `structured` (first structured output) properties.
|
|
121
|
+
|
|
122
|
+
The schema must either be one of the following:
|
|
123
|
+
1. A Pydantic BaseModel class
|
|
124
|
+
The structured output will be a Pydantic model.
|
|
125
|
+
2. A JSON schema dictionary
|
|
126
|
+
JSON dictionary schema must be compatible with Pydantic\'s JSON schema, especially for complex schemas.
|
|
127
|
+
Thus, it is recommended to create the JSON schema using Pydantic\'s `model_json_schema` method.
|
|
128
|
+
The structured output will be a dictionary.
|
|
129
|
+
|
|
130
|
+
Usage example:
|
|
131
|
+
```python
|
|
132
|
+
class Animal(BaseModel):
|
|
133
|
+
name: str
|
|
134
|
+
color: str
|
|
135
|
+
|
|
136
|
+
json_schema = Animal.model_json_schema()
|
|
137
|
+
|
|
138
|
+
lm_invoker = PortkeyLMInvoker(..., response_schema=Animal) # Using Pydantic BaseModel class
|
|
139
|
+
lm_invoker = PortkeyLMInvoker(..., response_schema=json_schema) # Using JSON schema dictionary
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Output example:
|
|
143
|
+
```python
|
|
144
|
+
# Using Pydantic BaseModel class outputs a Pydantic model
|
|
145
|
+
LMOutput(outputs=[LMOutputItem(type="structured", output=Animal(name="dog", color="white"))])
|
|
146
|
+
|
|
147
|
+
# Using JSON schema dictionary outputs a dictionary
|
|
148
|
+
LMOutput(outputs=[LMOutputItem(type="structured", output={"name": "dog", "color": "white"})])
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
When structured output is enabled, streaming is disabled.
|
|
152
|
+
|
|
105
153
|
Tool calling:
|
|
106
|
-
|
|
154
|
+
The `PortkeyLMInvoker` can be configured to call tools to perform certain tasks.
|
|
155
|
+
This feature can be enabled by providing a list of `Tool` objects to the `tools` parameter.
|
|
156
|
+
|
|
157
|
+
Tool calls outputs are stored in the `outputs` attribute of the `LMOutput` object and
|
|
158
|
+
can be accessed via the `tool_calls` property.
|
|
107
159
|
|
|
160
|
+
Usage example:
|
|
108
161
|
```python
|
|
109
162
|
lm_invoker = PortkeyLMInvoker(..., tools=[tool_1, tool_2])
|
|
110
163
|
```
|
|
164
|
+
|
|
111
165
|
Output example:
|
|
112
166
|
```python
|
|
113
167
|
LMOutput(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
ToolCall(id="123", name="tool_1", args={"key": "value"}),
|
|
168
|
+
outputs=[
|
|
169
|
+
LMOutputItem(type="text", output="I\'m using tools..."),
|
|
170
|
+
LMOutputItem(type="tool_call", output=ToolCall(id="123", name="tool_1", args={"key": "value"})),
|
|
171
|
+
LMOutputItem(type="tool_call", output=ToolCall(id="456", name="tool_2", args={"key": "value"})),
|
|
117
172
|
]
|
|
118
173
|
)
|
|
119
174
|
```
|
|
120
175
|
|
|
121
|
-
|
|
122
|
-
The `
|
|
176
|
+
Thinking:
|
|
177
|
+
The `PortkeyLMInvoker` can be configured to perform step-by-step thinking process before answering.
|
|
178
|
+
This feature can be enabled by setting the `thinking` parameter to `True`.
|
|
123
179
|
|
|
180
|
+
Thinking outputs are stored in the `outputs` attribute of the `LMOutput` object
|
|
181
|
+
and can be accessed via the `thinkings` property.
|
|
182
|
+
|
|
183
|
+
Usage example:
|
|
124
184
|
```python
|
|
125
|
-
|
|
126
|
-
name: str
|
|
127
|
-
color: str
|
|
128
|
-
lm_invoker = PortkeyLMInvoker(..., response_schema=Animal)
|
|
185
|
+
lm_invoker = PortkeyLMInvoker(..., thinking=True, thinking_budget=1024)
|
|
129
186
|
```
|
|
187
|
+
|
|
130
188
|
Output example:
|
|
131
189
|
```python
|
|
132
|
-
LMOutput(
|
|
190
|
+
LMOutput(
|
|
191
|
+
outputs=[
|
|
192
|
+
LMOutputItem(type="thinking", output=Reasoning(type="thinking", reasoning="I\'m thinking...", ...)),
|
|
193
|
+
LMOutputItem(type="text", output="Golden retriever is a good dog breed."),
|
|
194
|
+
]
|
|
195
|
+
)
|
|
133
196
|
```
|
|
134
197
|
|
|
198
|
+
Streaming output example:
|
|
199
|
+
```python
|
|
200
|
+
{"type": "thinking_start", "value": "", ...}
|
|
201
|
+
{"type": "thinking", "value": "I\'m ", ...}
|
|
202
|
+
{"type": "thinking", "value": "thinking...", ...}
|
|
203
|
+
{"type": "thinking_end", "value": "", ...}
|
|
204
|
+
{"type": "response", "value": "Golden retriever ", ...}
|
|
205
|
+
{"type": "response", "value": "is a good dog breed.", ...}
|
|
206
|
+
```
|
|
207
|
+
Note: By default, the thinking token will be streamed with the legacy `EventType.DATA` event type.
|
|
208
|
+
To use the new simplified streamed event format, set the `simplify_events` parameter to `True` during
|
|
209
|
+
LM invoker initialization. The legacy event format support will be removed in v0.6.
|
|
210
|
+
|
|
211
|
+
The amount of tokens allocated for the thinking process can be set via the `thinking_budget` parameter.
|
|
212
|
+
For more information, please refer to the following documentation:
|
|
213
|
+
https://portkey.ai/docs/product/ai-gateway/multimodal-capabilities/thinking-mode.
|
|
214
|
+
|
|
215
|
+
Thinking is only available for certain models depending on capabilities
|
|
216
|
+
|
|
135
217
|
Analytics tracking:
|
|
136
|
-
|
|
218
|
+
The `PortkeyLMInvoker` can be configured to output additional information about the invocation.
|
|
219
|
+
This feature can be enabled by setting the `output_analytics` parameter to `True`.
|
|
220
|
+
|
|
221
|
+
When enabled, the following attributes will be stored in the output:
|
|
222
|
+
1. `token_usage`: The token usage.
|
|
223
|
+
2. `duration`: The duration in seconds.
|
|
224
|
+
3. `finish_details`: The details about how the generation finished.
|
|
137
225
|
|
|
226
|
+
Output example:
|
|
138
227
|
```python
|
|
139
228
|
LMOutput(
|
|
140
|
-
|
|
229
|
+
outputs=[...],
|
|
141
230
|
token_usage=TokenUsage(input_tokens=100, output_tokens=50),
|
|
142
231
|
duration=0.729,
|
|
143
|
-
finish_details={"
|
|
232
|
+
finish_details={"stop_reason": "end_turn"},
|
|
144
233
|
)
|
|
145
234
|
```
|
|
146
235
|
|
|
147
|
-
|
|
236
|
+
When streaming is enabled, token usage is not supported.
|
|
148
237
|
|
|
149
238
|
Retry and timeout:
|
|
150
239
|
The `PortkeyLMInvoker` supports retry and timeout configuration.
|
|
@@ -154,8 +243,6 @@ class PortkeyLMInvoker(OpenAIChatCompletionsLMInvoker):
|
|
|
154
243
|
Retry config examples:
|
|
155
244
|
```python
|
|
156
245
|
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
246
|
retry_config = RetryConfig(max_retries=5, timeout=10.0) # 5 max retries, 10.0 seconds timeout
|
|
160
247
|
```
|
|
161
248
|
|
|
@@ -163,57 +250,6 @@ class PortkeyLMInvoker(OpenAIChatCompletionsLMInvoker):
|
|
|
163
250
|
```python
|
|
164
251
|
lm_invoker = PortkeyLMInvoker(..., retry_config=retry_config)
|
|
165
252
|
```
|
|
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
253
|
'''
|
|
218
254
|
model_kwargs: Incomplete
|
|
219
255
|
thinking: Incomplete
|
|
@@ -7,8 +7,10 @@ class Key:
|
|
|
7
7
|
FUNCTION: str
|
|
8
8
|
FUNCTION_CALL: str
|
|
9
9
|
HTTP_OPTIONS: str
|
|
10
|
+
ID: str
|
|
10
11
|
NAME: str
|
|
11
12
|
RETRY_OPTIONS: str
|
|
13
|
+
STATUS: str
|
|
12
14
|
SYSTEM_INSTRUCTION: str
|
|
13
15
|
THINKING_CONFIG: str
|
|
14
16
|
TIMEOUT: str
|
|
@@ -16,9 +18,19 @@ class Key:
|
|
|
16
18
|
RESPONSE_SCHEMA: str
|
|
17
19
|
RESPONSE_MIME_TYPE: str
|
|
18
20
|
VERTEXAI: str
|
|
21
|
+
CUSTOM_REQUEST_IDS: str
|
|
19
22
|
|
|
20
23
|
class InputType:
|
|
21
24
|
"""Defines valid input types in Google."""
|
|
22
25
|
APPLICATION_JSON: str
|
|
23
26
|
MODEL: str
|
|
24
27
|
USER: str
|
|
28
|
+
|
|
29
|
+
class JobState:
|
|
30
|
+
"""Defines valid output types in Google."""
|
|
31
|
+
JOB_STATE_CANCELLED: str
|
|
32
|
+
JOB_STATE_EXPIRED: str
|
|
33
|
+
JOB_STATE_FAILED: str
|
|
34
|
+
JOB_STATE_PENDING: str
|
|
35
|
+
JOB_STATE_RUNNING: str
|
|
36
|
+
JOB_STATE_SUCCEEDED: str
|
|
@@ -7,9 +7,11 @@ class Key:
|
|
|
7
7
|
ARGS: str
|
|
8
8
|
ARGUMENTS: str
|
|
9
9
|
BASE_URL: str
|
|
10
|
+
BODY: str
|
|
10
11
|
CALL_ID: str
|
|
11
12
|
CONTAINER: str
|
|
12
13
|
CONTENT: str
|
|
14
|
+
CUSTOM_ID: str
|
|
13
15
|
DEFAULT: str
|
|
14
16
|
DEFS: str
|
|
15
17
|
DESCRIPTION: str
|
|
@@ -18,17 +20,24 @@ class Key:
|
|
|
18
20
|
FILENAME: str
|
|
19
21
|
FORMAT: str
|
|
20
22
|
ID: str
|
|
23
|
+
IMAGE_GENERATION_CALL: str
|
|
21
24
|
IMAGE_URL: str
|
|
22
25
|
INCLUDE: str
|
|
23
26
|
INCOMPLETE_DETAILS: str
|
|
27
|
+
INPUT: str
|
|
24
28
|
INSTRUCTIONS: str
|
|
25
29
|
JSON_SCHEMA: str
|
|
26
30
|
MAX_RETRIES: str
|
|
31
|
+
METHOD: str
|
|
32
|
+
METHOD_POST: str
|
|
33
|
+
MODEL: str
|
|
27
34
|
NAME: str
|
|
28
35
|
OUTPUT: str
|
|
36
|
+
OUTPUTS: str
|
|
29
37
|
PARAMETERS: str
|
|
30
38
|
REASON: str
|
|
31
39
|
REASONING: str
|
|
40
|
+
REFUSAL: str
|
|
32
41
|
ROLE: str
|
|
33
42
|
SCHEMA: str
|
|
34
43
|
REQUIRE_APPROVAL: str
|
|
@@ -45,6 +54,8 @@ class Key:
|
|
|
45
54
|
TOOL_NAME: str
|
|
46
55
|
TOOLS: str
|
|
47
56
|
TYPE: str
|
|
57
|
+
URL: str
|
|
58
|
+
USAGE: str
|
|
48
59
|
|
|
49
60
|
class InputType:
|
|
50
61
|
"""Defines valid input types in OpenAI."""
|
|
@@ -54,6 +65,7 @@ class InputType:
|
|
|
54
65
|
FUNCTION: str
|
|
55
66
|
FUNCTION_CALL: str
|
|
56
67
|
FUNCTION_CALL_OUTPUT: str
|
|
68
|
+
IMAGE_GENERATION: str
|
|
57
69
|
INPUT_FILE: str
|
|
58
70
|
INPUT_IMAGE: str
|
|
59
71
|
INPUT_TEXT: str
|
|
@@ -69,21 +81,30 @@ class InputType:
|
|
|
69
81
|
|
|
70
82
|
class OutputType:
|
|
71
83
|
"""Defines valid output types in OpenAI."""
|
|
84
|
+
CANCELLED: str
|
|
85
|
+
CANCELLING: str
|
|
72
86
|
CODE_INTERPRETER_CALL: str
|
|
73
87
|
CODE_INTERPRETER_CALL_DELTA: str
|
|
74
88
|
CODE_INTERPRETER_CALL_DONE: str
|
|
75
89
|
CODE_INTERPRETER_CALL_IN_PROGRESS: str
|
|
76
90
|
COMPLETED: str
|
|
91
|
+
COMPLETED_BATCH: str
|
|
77
92
|
CONTAINER_FILE_CITATION: str
|
|
93
|
+
EXPIRED: str
|
|
94
|
+
FAILED: str
|
|
95
|
+
FINALIZING: str
|
|
78
96
|
FIND_IN_PAGE: str
|
|
79
97
|
FUNCTION_CALL: str
|
|
80
98
|
IMAGE: str
|
|
99
|
+
IMAGE_GENERATION_CALL: str
|
|
81
100
|
INCOMPLETE: str
|
|
101
|
+
IN_PROGRESS: str
|
|
82
102
|
ITEM_DONE: str
|
|
83
103
|
MCP_CALL: str
|
|
84
104
|
MCP_LIST_TOOLS: str
|
|
85
105
|
MESSAGE: str
|
|
86
106
|
OPEN_PAGE: str
|
|
107
|
+
PROCESSED: str
|
|
87
108
|
REASONING: str
|
|
88
109
|
REASONING_ADDED: str
|
|
89
110
|
REASONING_DELTA: str
|
|
@@ -91,6 +112,7 @@ class OutputType:
|
|
|
91
112
|
REFUSAL: str
|
|
92
113
|
SEARCH: str
|
|
93
114
|
TEXT_DELTA: str
|
|
115
|
+
VALIDATING: str
|
|
94
116
|
WEB_SEARCH_CALL: str
|
|
95
117
|
|
|
96
118
|
class ReasoningEffort(StrEnum):
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from gllm_core.schema.tool import Tool as Tool
|
|
3
|
+
from gllm_core.utils import RetryConfig as RetryConfig
|
|
4
|
+
from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
|
|
5
|
+
from gllm_inference.lm_invoker.openai_chat_completions_lm_invoker import OpenAIChatCompletionsLMInvoker as OpenAIChatCompletionsLMInvoker
|
|
6
|
+
from gllm_inference.lm_invoker.schema.openai_chat_completions import Key as Key
|
|
7
|
+
from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, ResponseSchema as ResponseSchema
|
|
8
|
+
from langchain_core.tools import Tool as LangChainTool
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
SEA_LION_URL: str
|
|
12
|
+
SUPPORTED_ATTACHMENTS: Incomplete
|
|
13
|
+
|
|
14
|
+
class SeaLionLMInvoker(OpenAIChatCompletionsLMInvoker):
|
|
15
|
+
"""A language model invoker to interact with SEA-LION API.
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
model_id (str): The model ID of the language model.
|
|
19
|
+
model_provider (str): The provider of the language model.
|
|
20
|
+
model_name (str): The name of the language model.
|
|
21
|
+
client_kwargs (dict[str, Any]): The keyword arguments for the OpenAI client.
|
|
22
|
+
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
|
|
23
|
+
tools (list[Tool]): The list of tools provided to the model to enable tool calling.
|
|
24
|
+
response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
|
|
25
|
+
structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
|
|
26
|
+
output_analytics (bool): Whether to output the invocation analytics.
|
|
27
|
+
retry_config (RetryConfig | None): The retry configuration for the language model.
|
|
28
|
+
"""
|
|
29
|
+
client_kwargs: Incomplete
|
|
30
|
+
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, tools: list[Tool | LangChainTool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None) -> None:
|
|
31
|
+
"""Initializes a new instance of the SeaLionLMInvoker class.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
model_name (str): The name of the SEA-LION language model.
|
|
35
|
+
api_key (str | None, optional): The API key for authenticating with the SEA-LION API.
|
|
36
|
+
Defaults to None, in which case the `SEA_LION_API_KEY` environment variable will be used.
|
|
37
|
+
model_kwargs (dict[str, Any] | None, optional): Additional model parameters. Defaults to None.
|
|
38
|
+
default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
|
|
39
|
+
Defaults to None.
|
|
40
|
+
tools (list[Tool | LangChainTool] | None, optional): Tools provided to the model to enable tool calling.
|
|
41
|
+
Defaults to None.
|
|
42
|
+
response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
|
|
43
|
+
output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
|
|
44
|
+
dictionary. Defaults to None.
|
|
45
|
+
output_analytics (bool, optional): Whether to output the invocation analytics. Defaults to False.
|
|
46
|
+
retry_config (RetryConfig | None, optional): The retry configuration for the language model.
|
|
47
|
+
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
|
|
48
|
+
"""
|