gllm-inference-binary 0.5.60__cp312-cp312-manylinux_2_31_x86_64.whl → 0.5.63__cp312-cp312-manylinux_2_31_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.
- gllm_inference/builder/build_lm_invoker.pyi +10 -1
- gllm_inference/lm_invoker/__init__.pyi +2 -1
- gllm_inference/lm_invoker/anthropic_lm_invoker.pyi +3 -1
- gllm_inference/lm_invoker/google_lm_invoker.pyi +6 -2
- gllm_inference/lm_invoker/sea_lion_lm_invoker.pyi +48 -0
- 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 +2 -1
- gllm_inference/schema/formatter.pyi +31 -0
- gllm_inference/schema/model_id.pyi +1 -0
- gllm_inference.cpython-312-x86_64-linux-gnu.so +0 -0
- gllm_inference.pyi +3 -1
- {gllm_inference_binary-0.5.60.dist-info → gllm_inference_binary-0.5.63.dist-info}/METADATA +2 -2
- {gllm_inference_binary-0.5.60.dist-info → gllm_inference_binary-0.5.63.dist-info}/RECORD +17 -14
- {gllm_inference_binary-0.5.60.dist-info → gllm_inference_binary-0.5.63.dist-info}/WHEEL +0 -0
- {gllm_inference_binary-0.5.60.dist-info → gllm_inference_binary-0.5.63.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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
|
|
1
|
+
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, SeaLionLMInvoker as SeaLionLMInvoker, XAILMInvoker as XAILMInvoker
|
|
2
2
|
from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
|
|
3
3
|
from gllm_inference.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider
|
|
4
4
|
from typing import Any
|
|
@@ -119,6 +119,15 @@ def build_lm_invoker(model_id: str | ModelId, credentials: str | dict[str, Any]
|
|
|
119
119
|
```
|
|
120
120
|
The credentials can also be provided through the `AZURE_OPENAI_API_KEY` environment variable.
|
|
121
121
|
|
|
122
|
+
# Using SEA-LION
|
|
123
|
+
```python
|
|
124
|
+
lm_invoker = build_lm_invoker(
|
|
125
|
+
model_id="sea-lion/aisingapore/Qwen-SEA-LION-v4-32B-IT",
|
|
126
|
+
credentials="sk-..."
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
The credentials can also be provided through the `SEA_LION_API_KEY` environment variable.
|
|
130
|
+
|
|
122
131
|
# Using LangChain
|
|
123
132
|
```python
|
|
124
133
|
lm_invoker = build_lm_invoker(
|
|
@@ -9,6 +9,7 @@ from gllm_inference.lm_invoker.openai_chat_completions_lm_invoker import OpenAIC
|
|
|
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
11
|
from gllm_inference.lm_invoker.portkey_lm_invoker import PortkeyLMInvoker as PortkeyLMInvoker
|
|
12
|
+
from gllm_inference.lm_invoker.sea_lion_lm_invoker import SeaLionLMInvoker as SeaLionLMInvoker
|
|
12
13
|
from gllm_inference.lm_invoker.xai_lm_invoker import XAILMInvoker as XAILMInvoker
|
|
13
14
|
|
|
14
|
-
__all__ = ['AnthropicLMInvoker', 'AzureOpenAILMInvoker', 'BedrockLMInvoker', 'DatasaurLMInvoker', 'GoogleLMInvoker', 'LangChainLMInvoker', 'LiteLLMLMInvoker', 'OpenAIChatCompletionsLMInvoker', 'OpenAICompatibleLMInvoker', 'OpenAILMInvoker', 'PortkeyLMInvoker', 'XAILMInvoker']
|
|
15
|
+
__all__ = ['AnthropicLMInvoker', 'AzureOpenAILMInvoker', 'BedrockLMInvoker', 'DatasaurLMInvoker', 'GoogleLMInvoker', 'LangChainLMInvoker', 'LiteLLMLMInvoker', 'OpenAIChatCompletionsLMInvoker', 'OpenAICompatibleLMInvoker', 'OpenAILMInvoker', 'PortkeyLMInvoker', 'SeaLionLMInvoker', 'XAILMInvoker']
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
from _typeshed import Incomplete
|
|
2
|
+
from anthropic.types import ContentBlockStopEvent as ContentBlockStopEvent, Message as Message, RawContentBlockDeltaEvent as RawContentBlockDeltaEvent, RawContentBlockStartEvent as RawContentBlockStartEvent
|
|
2
3
|
from gllm_core.event import EventEmitter as EventEmitter
|
|
3
4
|
from gllm_core.schema.tool import Tool as Tool
|
|
4
5
|
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
5
6
|
from gllm_inference.constants import INVOKER_PROPAGATED_MAX_RETRIES as INVOKER_PROPAGATED_MAX_RETRIES
|
|
6
7
|
from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
|
|
7
8
|
from gllm_inference.lm_invoker.schema.anthropic import InputType as InputType, Key as Key, OutputType as OutputType
|
|
8
|
-
from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, BatchStatus as BatchStatus, LMInput as LMInput, LMOutput as LMOutput,
|
|
9
|
+
from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, BatchStatus as BatchStatus, LMInput as LMInput, LMOutput as LMOutput, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, ThinkingEvent as ThinkingEvent, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
|
|
9
10
|
from langchain_core.tools import Tool as LangChainTool
|
|
11
|
+
from pydantic import BaseModel as BaseModel
|
|
10
12
|
from typing import Any
|
|
11
13
|
|
|
12
14
|
SUPPORTED_ATTACHMENTS: Incomplete
|
|
@@ -8,6 +8,7 @@ from gllm_inference.exceptions.provider_error_map import GOOGLE_ERROR_MAPPING as
|
|
|
8
8
|
from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
|
|
9
9
|
from gllm_inference.lm_invoker.schema.google import InputType as InputType, JobState as JobState, Key as Key
|
|
10
10
|
from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, BatchStatus as BatchStatus, LMInput as LMInput, LMOutput as LMOutput, Message as Message, MessageRole as MessageRole, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, ThinkingEvent as ThinkingEvent, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
|
|
11
|
+
from google.genai.types import GenerateContentResponse as GenerateContentResponse
|
|
11
12
|
from langchain_core.tools import Tool as LangChainTool
|
|
12
13
|
from typing import Any
|
|
13
14
|
|
|
@@ -15,9 +16,12 @@ SUPPORTED_ATTACHMENTS: Incomplete
|
|
|
15
16
|
DEFAULT_THINKING_BUDGET: int
|
|
16
17
|
REQUIRE_THINKING_MODEL_PREFIX: Incomplete
|
|
17
18
|
IMAGE_GENERATION_MODELS: Incomplete
|
|
18
|
-
YOUTUBE_URL_PATTERN: Incomplete
|
|
19
19
|
BATCH_STATUS_MAP: Incomplete
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
class URLPattern:
|
|
22
|
+
"""Defines specific Google related URL patterns."""
|
|
23
|
+
GOOGLE_FILE: Incomplete
|
|
24
|
+
YOUTUBE: Incomplete
|
|
21
25
|
|
|
22
26
|
class GoogleLMInvoker(BaseLMInvoker):
|
|
23
27
|
'''A language model invoker to interact with Google language models.
|
|
@@ -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
|
+
"""
|
|
@@ -7,6 +7,7 @@ from gllm_inference.model.em.voyage_em import VoyageEM as VoyageEM
|
|
|
7
7
|
from gllm_inference.model.lm.anthropic_lm import AnthropicLM as AnthropicLM
|
|
8
8
|
from gllm_inference.model.lm.google_lm import GoogleLM as GoogleLM
|
|
9
9
|
from gllm_inference.model.lm.openai_lm import OpenAILM as OpenAILM
|
|
10
|
+
from gllm_inference.model.lm.sea_lion_lm import SeaLionLM as SeaLionLM
|
|
10
11
|
from gllm_inference.model.lm.xai_lm import XAILM as XAILM
|
|
11
12
|
|
|
12
|
-
__all__ = ['AnthropicLM', 'CohereEM', 'GoogleEM', 'GoogleLM', 'JinaEM', 'OpenAIEM', 'OpenAILM', 'TwelveLabsEM', 'VoyageEM', 'XAILM']
|
|
13
|
+
__all__ = ['AnthropicLM', 'CohereEM', 'GoogleEM', 'GoogleLM', 'JinaEM', 'OpenAIEM', 'OpenAILM', 'SeaLionLM', 'TwelveLabsEM', 'VoyageEM', 'XAILM']
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class SeaLionLM:
|
|
2
|
+
'''Defines SEA-LION language model names constants.
|
|
3
|
+
|
|
4
|
+
Usage example:
|
|
5
|
+
```python
|
|
6
|
+
from gllm_inference.model import SeaLionLM
|
|
7
|
+
from gllm_inference.lm_invoker import SeaLionLMInvoker
|
|
8
|
+
|
|
9
|
+
lm_invoker = SeaLionLMInvoker(SeaLionLM.GEMMA_SEA_LION_V4_27B_IT)
|
|
10
|
+
response = await lm_invoker.invoke("Hello, world!")
|
|
11
|
+
```
|
|
12
|
+
'''
|
|
13
|
+
GEMMA_SEA_LION_V4_27B_IT: str
|
|
14
|
+
LLAMA_SEA_LION_V3_5_70B_R: str
|
|
15
|
+
LLAMA_SEA_LION_V3_70B_IT: str
|
|
16
|
+
QWEN_SEA_LION_V4_32B_IT: str
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from _typeshed import Incomplete
|
|
2
2
|
from gllm_inference.prompt_builder.format_strategy import JinjaFormatStrategy as JinjaFormatStrategy, StringFormatStrategy as StringFormatStrategy
|
|
3
|
-
from gllm_inference.schema import JinjaEnvType as JinjaEnvType, Message as Message, MessageContent as MessageContent, MessageRole as MessageRole
|
|
3
|
+
from gllm_inference.schema import HistoryFormatter as HistoryFormatter, JinjaEnvType as JinjaEnvType, Message as Message, MessageContent as MessageContent, MessageRole as MessageRole
|
|
4
4
|
from jinja2.sandbox import SandboxedEnvironment as SandboxedEnvironment
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
@@ -13,13 +13,15 @@ class PromptBuilder:
|
|
|
13
13
|
prompt_key_set (set[str]): A set of expected keys that must be present in the prompt templates.
|
|
14
14
|
key_defaults (dict[str, str]): Default values for the keys in the prompt templates.
|
|
15
15
|
strategy (BasePromptFormattingStrategy): The format strategy to be used for formatting the prompt.
|
|
16
|
+
history_formatter (HistoryFormatter): The history formatter to be used for formatting the history.
|
|
16
17
|
"""
|
|
17
18
|
key_defaults: Incomplete
|
|
18
19
|
system_template: Incomplete
|
|
19
20
|
user_template: Incomplete
|
|
21
|
+
history_formatter: Incomplete
|
|
20
22
|
strategy: Incomplete
|
|
21
23
|
prompt_key_set: Incomplete
|
|
22
|
-
def __init__(self, system_template: str = '', user_template: str = '', key_defaults: dict[str, str] | None = None, ignore_extra_keys: bool | None = None, use_jinja: bool = False, jinja_env: JinjaEnvType | SandboxedEnvironment =
|
|
24
|
+
def __init__(self, system_template: str = '', user_template: str = '', key_defaults: dict[str, str] | None = None, ignore_extra_keys: bool | None = None, history_formatter: HistoryFormatter | None = None, use_jinja: bool | None = False, jinja_env: JinjaEnvType | SandboxedEnvironment | None = None) -> None:
|
|
23
25
|
"""Initializes a new instance of the PromptBuilder class.
|
|
24
26
|
|
|
25
27
|
Args:
|
|
@@ -32,6 +34,8 @@ class PromptBuilder:
|
|
|
32
34
|
Defaults to None, in which case no default values will be assigned to the keys.
|
|
33
35
|
ignore_extra_keys (bool | None, optional): Deprecated parameter. Will be removed in v0.6. Extra keys
|
|
34
36
|
will always raise a warning only instead of raising an error.
|
|
37
|
+
history_formatter (HistoryFormatter | None, optional): The history formatter to be used for formatting
|
|
38
|
+
the history. Defaults to None, in which case the history will be used as is.
|
|
35
39
|
use_jinja (bool, optional): Whether to use Jinja for rendering the prompt templates.
|
|
36
40
|
Defaults to False.
|
|
37
41
|
jinja_env (JinjaEnvType | SandboxedEnvironment, optional): The environment for Jinja rendering.
|
|
@@ -4,6 +4,7 @@ from gllm_inference.schema.code_exec_result import CodeExecResult as CodeExecRes
|
|
|
4
4
|
from gllm_inference.schema.config import TruncationConfig as TruncationConfig
|
|
5
5
|
from gllm_inference.schema.enums import AttachmentType as AttachmentType, BatchStatus as BatchStatus, EmitDataType as EmitDataType, JinjaEnvType as JinjaEnvType, LMEventType as LMEventType, LMEventTypeSuffix as LMEventTypeSuffix, LMOutputType as LMOutputType, MessageRole as MessageRole, TruncateSide as TruncateSide
|
|
6
6
|
from gllm_inference.schema.events import ActivityEvent as ActivityEvent, CodeEvent as CodeEvent, ThinkingEvent as ThinkingEvent
|
|
7
|
+
from gllm_inference.schema.formatter import HistoryFormatter as HistoryFormatter
|
|
7
8
|
from gllm_inference.schema.lm_input import LMInput as LMInput
|
|
8
9
|
from gllm_inference.schema.lm_output import LMOutput as LMOutput, LMOutputData as LMOutputData, LMOutputItem as LMOutputItem
|
|
9
10
|
from gllm_inference.schema.mcp import MCPCall as MCPCall, MCPServer as MCPServer
|
|
@@ -15,4 +16,4 @@ from gllm_inference.schema.tool_call import ToolCall as ToolCall
|
|
|
15
16
|
from gllm_inference.schema.tool_result import ToolResult as ToolResult
|
|
16
17
|
from gllm_inference.schema.type_alias import EMContent as EMContent, MessageContent as MessageContent, ResponseSchema as ResponseSchema, Vector as Vector
|
|
17
18
|
|
|
18
|
-
__all__ = ['Activity', 'ActivityEvent', 'Attachment', 'AttachmentType', 'BatchStatus', 'CodeEvent', 'CodeExecResult', 'EMContent', 'EmitDataType', 'InputTokenDetails', 'JinjaEnvType', 'LMEventType', 'LMEventTypeSuffix', 'LMInput', 'LMOutput', 'LMOutputItem', 'LMOutputData', 'LMOutputType', 'MCPCall', 'MCPCallActivity', 'MCPListToolsActivity', 'MCPServer', 'Message', 'MessageContent', 'MessageRole', 'ModelId', 'ModelProvider', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'ThinkingEvent', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector', 'WebSearchActivity']
|
|
19
|
+
__all__ = ['Activity', 'ActivityEvent', 'Attachment', 'AttachmentType', 'BatchStatus', 'CodeEvent', 'CodeExecResult', 'EMContent', 'EmitDataType', 'HistoryFormatter', 'InputTokenDetails', 'JinjaEnvType', 'LMEventType', 'LMEventTypeSuffix', 'LMInput', 'LMOutput', 'LMOutputItem', 'LMOutputData', 'LMOutputType', 'MCPCall', 'MCPCallActivity', 'MCPListToolsActivity', 'MCPServer', 'Message', 'MessageContent', 'MessageRole', 'ModelId', 'ModelProvider', 'OutputTokenDetails', 'Reasoning', 'ResponseSchema', 'ThinkingEvent', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector', 'WebSearchActivity']
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from gllm_inference.schema.enums import MessageRole as MessageRole
|
|
2
|
+
from gllm_inference.schema.message import Message as Message
|
|
3
|
+
from gllm_inference.schema.type_alias import MessageContent as MessageContent
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
class HistoryFormatter(BaseModel):
|
|
7
|
+
"""Configuration for history formatting.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
prefix_user_message (str): Prefix for user messages.
|
|
11
|
+
suffix_user_message (str): Suffix for user messages.
|
|
12
|
+
prefix_assistant_message (str): Prefix for assistant messages.
|
|
13
|
+
suffix_assistant_message (str): Suffix for assistant messages.
|
|
14
|
+
"""
|
|
15
|
+
prefix_user_message: str
|
|
16
|
+
suffix_user_message: str
|
|
17
|
+
prefix_assistant_message: str
|
|
18
|
+
suffix_assistant_message: str
|
|
19
|
+
def format_history(self, history: list[Message]) -> list[Message]:
|
|
20
|
+
"""Formats a list of messages based on their roles.
|
|
21
|
+
|
|
22
|
+
This method formats each message in the history list by applying the appropriate
|
|
23
|
+
formatting based on the message role (user or assistant). Other message types
|
|
24
|
+
are added to the result without modification.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
history (list[Message]): The list of messages to format.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
list[Message]: A new list containing the formatted messages.
|
|
31
|
+
"""
|
|
Binary file
|
gllm_inference.pyi
CHANGED
|
@@ -33,6 +33,7 @@ import gllm_inference.lm_invoker.OpenAIChatCompletionsLMInvoker
|
|
|
33
33
|
import gllm_inference.lm_invoker.OpenAICompatibleLMInvoker
|
|
34
34
|
import gllm_inference.lm_invoker.OpenAILMInvoker
|
|
35
35
|
import gllm_inference.lm_invoker.PortkeyLMInvoker
|
|
36
|
+
import gllm_inference.lm_invoker.SeaLionLMInvoker
|
|
36
37
|
import gllm_inference.lm_invoker.XAILMInvoker
|
|
37
38
|
import gllm_inference.prompt_builder.PromptBuilder
|
|
38
39
|
import gllm_inference.output_parser.JSONOutputParser
|
|
@@ -82,6 +83,7 @@ import voyageai
|
|
|
82
83
|
import voyageai.client_async
|
|
83
84
|
import http
|
|
84
85
|
import http.HTTPStatus
|
|
86
|
+
import __future__
|
|
85
87
|
import uuid
|
|
86
88
|
import gllm_core.constants
|
|
87
89
|
import gllm_core.event
|
|
@@ -113,7 +115,6 @@ import time
|
|
|
113
115
|
import jsonschema
|
|
114
116
|
import gllm_inference.lm_invoker.batch.BatchOperations
|
|
115
117
|
import gllm_inference.schema.MessageContent
|
|
116
|
-
import __future__
|
|
117
118
|
import gllm_inference.schema.ActivityEvent
|
|
118
119
|
import gllm_inference.schema.CodeEvent
|
|
119
120
|
import gllm_inference.schema.CodeExecResult
|
|
@@ -135,6 +136,7 @@ import jinja2.sandbox
|
|
|
135
136
|
import gllm_inference.schema.JinjaEnvType
|
|
136
137
|
import gllm_inference.prompt_builder.format_strategy.JinjaFormatStrategy
|
|
137
138
|
import gllm_inference.prompt_builder.format_strategy.StringFormatStrategy
|
|
139
|
+
import gllm_inference.schema.HistoryFormatter
|
|
138
140
|
import transformers
|
|
139
141
|
import gllm_inference.prompt_formatter.HuggingFacePromptFormatter
|
|
140
142
|
import traceback
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: gllm-inference-binary
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.63
|
|
4
4
|
Summary: A library containing components related to model inferences in Gen AI applications.
|
|
5
|
-
Author-email: Henry Wicaksono <henry.wicaksono@gdplabs.id>,
|
|
5
|
+
Author-email: Henry Wicaksono <henry.wicaksono@gdplabs.id>, "Delfia N. A. Putri" <delfia.n.a.putri@gdplabs.id>
|
|
6
6
|
Requires-Python: <3.14,>=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Requires-Dist: poetry<3.0.0,>=2.1.3
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
gllm_inference.cpython-312-x86_64-linux-gnu.so,sha256=
|
|
2
|
-
gllm_inference.pyi,sha256=
|
|
1
|
+
gllm_inference.cpython-312-x86_64-linux-gnu.so,sha256=iPgGCPemKy3NrzvcfgDsI8IACiCxj1pHnP2qo_tM2dA,5815544
|
|
2
|
+
gllm_inference.pyi,sha256=jCxjKwYXb3t6yZrf6m7uD29V9KPXyWb8U04-lru4-JA,5173
|
|
3
3
|
gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
gllm_inference/constants.pyi,sha256=tBFhwE1at2gXMJ1bBM32eVIRgCJlB1uzg7ItXGx3RQE,316
|
|
5
5
|
gllm_inference/builder/__init__.pyi,sha256=usz2lvfwO4Yk-ZGKXbCWG1cEr3nlQXxMNDNC-2yc1NM,500
|
|
6
6
|
gllm_inference/builder/_build_invoker.pyi,sha256=v__-YT0jGmLqEsgl7Abk9we-wYWcyVFvlRN_Uu4vVak,848
|
|
7
7
|
gllm_inference/builder/build_em_invoker.pyi,sha256=0IVcRGaciPBAFcgvGRC4-Kje_PPXOSug77LqxRc-x_U,5749
|
|
8
|
-
gllm_inference/builder/build_lm_invoker.pyi,sha256=
|
|
8
|
+
gllm_inference/builder/build_lm_invoker.pyi,sha256=o4dIL90wDu94y_fIeUs2ei5Qkk1zZo5_nYBqL2EiHAE,9195
|
|
9
9
|
gllm_inference/builder/build_lm_request_processor.pyi,sha256=KbQkcPa8C-yzyelht4mWLP8kDmh17itAT3tn8ZJB6pg,4144
|
|
10
10
|
gllm_inference/builder/build_output_parser.pyi,sha256=_Lrq-bh1oPsb_Nwkkr_zyEUwIOMysRFZkvEtEM29LZM,936
|
|
11
11
|
gllm_inference/catalog/__init__.pyi,sha256=JBkPGTyiiZ30GECzJBW-mW8LekWyY2qyzal3eW7ynaM,287
|
|
@@ -40,12 +40,12 @@ gllm_inference/exceptions/__init__.pyi,sha256=Upcuj7od2lkbdueQ0iMT2ktFYYi-KKTynT
|
|
|
40
40
|
gllm_inference/exceptions/error_parser.pyi,sha256=IOfa--NpLUW5E9Qq0mwWi6ZpTAbUyyNe6iAqunBNGLI,1999
|
|
41
41
|
gllm_inference/exceptions/exceptions.pyi,sha256=Bv996qLa_vju0Qjf4GewMxdkq8CV9LRZb0S6289DldA,5725
|
|
42
42
|
gllm_inference/exceptions/provider_error_map.pyi,sha256=XPLWU42-r8MHZgg5ZkE80Gdqg3p8Z_JHvq_Na03iTqY,1243
|
|
43
|
-
gllm_inference/lm_invoker/__init__.pyi,sha256=
|
|
44
|
-
gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=
|
|
43
|
+
gllm_inference/lm_invoker/__init__.pyi,sha256=dvwZQhO-7bHDOouXBXxujux9QQbu10ux-0vAsJI1DeI,1603
|
|
44
|
+
gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=_by_rLLdBpnpIyniBVCOEhjur5HzdBJ1UYoXdpxb8Lw,15409
|
|
45
45
|
gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=drtMgbDzBQJrWXLiI2t5PNy7HtcW5Kuj0XR2b6rltjc,12936
|
|
46
46
|
gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=9Gz0U2c94UM9SOt-_e89_NqT_bDQ6wECRiJ9VTwsqfw,10739
|
|
47
47
|
gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=IqvDxBzwEf2z34FZcLKIH404y386Rnk5gsj2TcAm424,7878
|
|
48
|
-
gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=
|
|
48
|
+
gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=DrMIhGhWolSBH26jTkx9zaXTVcRBqxBwNWgzI3InODE,20063
|
|
49
49
|
gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=OzISl89C2s-qB6VxNlMgf5dFRC-ooj30YCFfsZzcX4s,11887
|
|
50
50
|
gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=0PZYitAljAjzyympqqNyN5fMyoakmqr1XIz1PE6NNc4,11176
|
|
51
51
|
gllm_inference/lm_invoker/lm_invoker.pyi,sha256=pJ0-s37NqTHdFD7IijvNzJnQ7JXgrGxsEaXuS8cxz3s,8487
|
|
@@ -53,6 +53,7 @@ gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi,sha256=47lMyuzW
|
|
|
53
53
|
gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=i5pMpZf4-r_7FQ1qfsqcjpc98sI-cPiqheuTfTEKxJs,4192
|
|
54
54
|
gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=OytpncpkOLdaSyFQ41GLh4_MioEbpsX0WiA8zc70Q6s,22313
|
|
55
55
|
gllm_inference/lm_invoker/portkey_lm_invoker.pyi,sha256=ewxzRT-ekmvCFeb7ij840s4p18AO_LAKA-UP0ot12hs,14940
|
|
56
|
+
gllm_inference/lm_invoker/sea_lion_lm_invoker.pyi,sha256=ElV7iKYWnI3J1CUYuHtvOTsJByMY_l2WF4Rc7IJsBjw,3485
|
|
56
57
|
gllm_inference/lm_invoker/xai_lm_invoker.pyi,sha256=SVIsRGcqbRnR9sqoLYWwigoEumDib5m4cTaTJT98Uz4,12765
|
|
57
58
|
gllm_inference/lm_invoker/batch/__init__.pyi,sha256=W4W-_yfk7lL20alREJai6GnwuQvdlKRfwQCX4mQK4XI,127
|
|
58
59
|
gllm_inference/lm_invoker/batch/batch_operations.pyi,sha256=cEdRVHAb5uiIPnlQudtaNzQ9kszI7cH6nD9mpMYQLco,5445
|
|
@@ -66,7 +67,7 @@ gllm_inference/lm_invoker/schema/openai.pyi,sha256=PS4QrNYa1NPq0s-3r8FI22a2Td0n7
|
|
|
66
67
|
gllm_inference/lm_invoker/schema/openai_chat_completions.pyi,sha256=8byBRZ4xyTidIQJsZqiSjp5t1X875Obe-aEbT0yYfuA,1199
|
|
67
68
|
gllm_inference/lm_invoker/schema/portkey.pyi,sha256=NeRjHNd84HgE_ur2F3Cv6Jx30v6V7eQvI_iJiq4kuME,631
|
|
68
69
|
gllm_inference/lm_invoker/schema/xai.pyi,sha256=cWnbJmDtllqRH3NXpQbiXgkNBcUXr8ksDSDywcgJebE,632
|
|
69
|
-
gllm_inference/model/__init__.pyi,sha256=
|
|
70
|
+
gllm_inference/model/__init__.pyi,sha256=1gesoNUUHutpN2-DYmVrG5LZhpeSW96ciON3SjVEqqM,894
|
|
70
71
|
gllm_inference/model/em/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
71
72
|
gllm_inference/model/em/cohere_em.pyi,sha256=fArRlV08NwbsJ_h6vpWr94XxUVBtbqW1Jh8s42LRXCo,488
|
|
72
73
|
gllm_inference/model/em/google_em.pyi,sha256=ZPN5LmReO0bcTfnZixFooUTzgD-daNFPzfxzZ-5WzQQ,471
|
|
@@ -78,12 +79,13 @@ gllm_inference/model/lm/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
78
79
|
gllm_inference/model/lm/anthropic_lm.pyi,sha256=dWfG-M_gD644yJ-LK_T8HnAT649j3Vx7TVof03XQimE,611
|
|
79
80
|
gllm_inference/model/lm/google_lm.pyi,sha256=cMV5zYX8uwUF7pErv4pXnXD2G52umo3sxKwbSx7nFhQ,511
|
|
80
81
|
gllm_inference/model/lm/openai_lm.pyi,sha256=u11zvvIS7-XaHKZ33cZxGQmT6cZ4DqK9Do8l7gFOUTc,618
|
|
82
|
+
gllm_inference/model/lm/sea_lion_lm.pyi,sha256=k0xG5JGrecBDlNKWwNZb4BG0Ath_tGfy4fudr51-10w,492
|
|
81
83
|
gllm_inference/model/lm/xai_lm.pyi,sha256=2ZEQ_--e_zsb23zZQ8bKdQShU7zChx5TrDKF8EpwEpU,506
|
|
82
84
|
gllm_inference/output_parser/__init__.pyi,sha256=WQOOgsYnPk8vd-SOhFMMaVTzy4gkYrOAyT5gnAxv0A0,129
|
|
83
85
|
gllm_inference/output_parser/json_output_parser.pyi,sha256=uulh91uQLMSb4ZXZhHYi9W9w7zGnmrOweEkL6wdDJN8,2933
|
|
84
86
|
gllm_inference/output_parser/output_parser.pyi,sha256=Yzk7F26pH8Uc7FQZo4G6l67YkfppefUvaV9cNK-HyDs,948
|
|
85
87
|
gllm_inference/prompt_builder/__init__.pyi,sha256=kshfBMvwIwiIvjxiGG5BrJZNvpPa8rhtkbHo5FPifBg,117
|
|
86
|
-
gllm_inference/prompt_builder/prompt_builder.pyi,sha256=
|
|
88
|
+
gllm_inference/prompt_builder/prompt_builder.pyi,sha256=qJ6L81KMLdZvS2MmOGGjrJ9btmWwVPoRVl3NQxHq3fw,5010
|
|
87
89
|
gllm_inference/prompt_builder/format_strategy/__init__.pyi,sha256=QhORHac3ySOPmL9k9kmCKL70vtaUtwkZEtGoRNWNuA8,308
|
|
88
90
|
gllm_inference/prompt_builder/format_strategy/format_strategy.pyi,sha256=JSUl_7Ka08oDZPpslymkUa8pDzqNGIK2TlcVANspqrY,2273
|
|
89
91
|
gllm_inference/prompt_builder/format_strategy/jinja_format_strategy.pyi,sha256=IAezLUiKSJMaoDyleo8pFnFqq8rBM_Q-lNXuAGvwXhI,2225
|
|
@@ -109,18 +111,19 @@ gllm_inference/realtime_chat/output_streamer/output_streamer.pyi,sha256=GPAw1wPS
|
|
|
109
111
|
gllm_inference/request_processor/__init__.pyi,sha256=hVnfdNZnkTBJHnmLtN3Na4ANP0yK6AstWdIizVr2Apo,227
|
|
110
112
|
gllm_inference/request_processor/lm_request_processor.pyi,sha256=VnYc8E3Iayyhw-rPnGPfTKuO3ohgFsS8HPrZJeyES5I,5889
|
|
111
113
|
gllm_inference/request_processor/uses_lm_mixin.pyi,sha256=Yu0XPNuHxq1tWBviHTPw1oThojneFwGHepvGjBXxKQA,6382
|
|
112
|
-
gllm_inference/schema/__init__.pyi,sha256=
|
|
114
|
+
gllm_inference/schema/__init__.pyi,sha256=OOZE9H4DgUqOsk5_01hXb5opkAwBmp1TvhqcV2SrqJY,2505
|
|
113
115
|
gllm_inference/schema/activity.pyi,sha256=JnO2hqj91P5Tc6qb4pbkEMrHer2u5owiCvhl-igcQKQ,2303
|
|
114
116
|
gllm_inference/schema/attachment.pyi,sha256=oCopoxiPgGSkCRdPsqmjcMofTawfbdCDxaPdo6mits0,4509
|
|
115
117
|
gllm_inference/schema/code_exec_result.pyi,sha256=ZTHh6JtRrPIdQ059P1UAiD2L-tAO1_S5YcMsAXfJ5A0,559
|
|
116
118
|
gllm_inference/schema/config.pyi,sha256=rAL_UeXyQeXVk1P2kqd8vFWOMwmKenfpQLtvMP74t9s,674
|
|
117
119
|
gllm_inference/schema/enums.pyi,sha256=rLTlnhtdTIKT_Q8p-ukKpCMhRk9NbqcR_ylZ0-8UivA,2111
|
|
118
120
|
gllm_inference/schema/events.pyi,sha256=XQEy5SqYoutq2DguwCCTGi5DHrlnDai6nJElAYsj1gk,4638
|
|
121
|
+
gllm_inference/schema/formatter.pyi,sha256=qPQ1oSnmSgr7yBsBBMe-aehLLk9lKI9OPZ8Og-EbzdI,1281
|
|
119
122
|
gllm_inference/schema/lm_input.pyi,sha256=A5pjz1id6tP9XRNhzQrbmzd66C_q3gzo0UP8rCemz6Q,193
|
|
120
123
|
gllm_inference/schema/lm_output.pyi,sha256=ec5ErE68PVthNHhHlaVHsiAN3nn03yBqRR7HVabsf68,11401
|
|
121
124
|
gllm_inference/schema/mcp.pyi,sha256=Vwu8E2BDl6FvvnI42gIyY3Oki1BdwRE3Uh3aV0rmhQU,1014
|
|
122
125
|
gllm_inference/schema/message.pyi,sha256=VP9YppKj2mo1esl9cy6qQO9m2mMHUjTmfGDdyUor880,2220
|
|
123
|
-
gllm_inference/schema/model_id.pyi,sha256=
|
|
126
|
+
gllm_inference/schema/model_id.pyi,sha256=MuH0KyFjI1uC9v7PoIU6Uuk6wPdpmczVrHZj0r5EcZk,5842
|
|
124
127
|
gllm_inference/schema/reasoning.pyi,sha256=SlTuiDw87GdnAn-I6YOPIJRhEBiwQljM46JohG05guQ,562
|
|
125
128
|
gllm_inference/schema/token_usage.pyi,sha256=1GTQVORV0dBNmD_jix8aVaUqxMKFF04KpLP7y2urqbk,2950
|
|
126
129
|
gllm_inference/schema/tool_call.pyi,sha256=zQaVxCnkVxOfOEhBidqohU85gb4PRwnwBiygKaunamk,389
|
|
@@ -131,7 +134,7 @@ gllm_inference/utils/io_utils.pyi,sha256=7kUTacHAVRYoemFUOjCH7-Qmw-YsQGd6rGYxjf_
|
|
|
131
134
|
gllm_inference/utils/langchain.pyi,sha256=VluQiHkGigDdqLUbhB6vnXiISCP5hHqV0qokYY6dC1A,1164
|
|
132
135
|
gllm_inference/utils/validation.pyi,sha256=W9RQddN90F8SJMu_HXEQyQTDMBaRL-bo7fOosZWK7oY,438
|
|
133
136
|
gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
|
|
134
|
-
gllm_inference_binary-0.5.
|
|
135
|
-
gllm_inference_binary-0.5.
|
|
136
|
-
gllm_inference_binary-0.5.
|
|
137
|
-
gllm_inference_binary-0.5.
|
|
137
|
+
gllm_inference_binary-0.5.63.dist-info/METADATA,sha256=Y3KOF-WUqiTMIOhmAywrGG13jUcxCQDpvAbuYjahFYE,5817
|
|
138
|
+
gllm_inference_binary-0.5.63.dist-info/WHEEL,sha256=nvMz4aD6kW281G6ZJCbqAgYrkKc1h4b3not015Wcvhc,108
|
|
139
|
+
gllm_inference_binary-0.5.63.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
|
|
140
|
+
gllm_inference_binary-0.5.63.dist-info/RECORD,,
|
|
File without changes
|
{gllm_inference_binary-0.5.60.dist-info → gllm_inference_binary-0.5.63.dist-info}/top_level.txt
RENAMED
|
File without changes
|