gllm-inference-binary 0.4.62__cp311-cp311-win_amd64.whl → 0.5.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gllm-inference-binary might be problematic. Click here for more details.
- gllm_inference/builder/build_lm_request_processor.pyi +1 -4
- gllm_inference/catalog/catalog.pyi +34 -38
- gllm_inference/catalog/lm_request_processor_catalog.pyi +4 -10
- gllm_inference/catalog/prompt_builder_catalog.pyi +25 -37
- gllm_inference/constants.pyi +0 -3
- gllm_inference/em_invoker/__init__.pyi +1 -4
- gllm_inference/em_invoker/em_invoker.pyi +6 -25
- gllm_inference/em_invoker/google_em_invoker.pyi +1 -1
- gllm_inference/em_invoker/langchain/__init__.pyi +1 -2
- gllm_inference/em_invoker/langchain_em_invoker.pyi +2 -12
- gllm_inference/em_invoker/openai_em_invoker.pyi +1 -1
- gllm_inference/em_invoker/twelevelabs_em_invoker.pyi +2 -18
- gllm_inference/em_invoker/voyage_em_invoker.pyi +2 -5
- gllm_inference/lm_invoker/__init__.pyi +1 -4
- gllm_inference/lm_invoker/anthropic_lm_invoker.pyi +7 -29
- gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi +5 -18
- gllm_inference/lm_invoker/bedrock_lm_invoker.pyi +6 -14
- gllm_inference/lm_invoker/datasaur_lm_invoker.pyi +7 -14
- gllm_inference/lm_invoker/google_lm_invoker.pyi +7 -21
- gllm_inference/lm_invoker/langchain_lm_invoker.pyi +8 -21
- gllm_inference/lm_invoker/litellm_lm_invoker.pyi +6 -13
- gllm_inference/lm_invoker/lm_invoker.pyi +17 -18
- gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi +8 -22
- gllm_inference/lm_invoker/openai_lm_invoker.pyi +18 -24
- gllm_inference/prompt_builder/__init__.pyi +1 -6
- gllm_inference/prompt_builder/prompt_builder.pyi +9 -102
- gllm_inference/prompt_formatter/agnostic_prompt_formatter.pyi +4 -4
- gllm_inference/prompt_formatter/huggingface_prompt_formatter.pyi +4 -4
- gllm_inference/prompt_formatter/llama_prompt_formatter.pyi +3 -3
- gllm_inference/prompt_formatter/mistral_prompt_formatter.pyi +3 -3
- gllm_inference/prompt_formatter/openai_prompt_formatter.pyi +4 -4
- gllm_inference/prompt_formatter/prompt_formatter.pyi +4 -4
- gllm_inference/request_processor/lm_request_processor.pyi +12 -25
- gllm_inference/request_processor/uses_lm_mixin.pyi +4 -10
- gllm_inference/schema/__init__.pyi +11 -4
- gllm_inference/schema/attachment.pyi +76 -0
- gllm_inference/schema/code_exec_result.pyi +14 -0
- gllm_inference/schema/enums.pyi +9 -9
- gllm_inference/schema/lm_output.pyi +36 -0
- gllm_inference/schema/message.pyi +52 -0
- gllm_inference/schema/model_id.pyi +1 -1
- gllm_inference/schema/reasoning.pyi +15 -0
- gllm_inference/schema/token_usage.pyi +11 -0
- gllm_inference/schema/tool_call.pyi +14 -0
- gllm_inference/schema/tool_result.pyi +11 -0
- gllm_inference/schema/type_alias.pyi +6 -8
- gllm_inference/utils/__init__.pyi +2 -3
- gllm_inference/utils/validation.pyi +12 -0
- gllm_inference.cp311-win_amd64.pyd +0 -0
- gllm_inference.pyi +8 -42
- {gllm_inference_binary-0.4.62.dist-info → gllm_inference_binary-0.5.0.dist-info}/METADATA +1 -7
- gllm_inference_binary-0.5.0.dist-info/RECORD +93 -0
- gllm_inference/builder/model_id.pyi +0 -13
- gllm_inference/catalog/component_map.pyi +0 -8
- gllm_inference/em_invoker/google_generativeai_em_invoker.pyi +0 -32
- gllm_inference/em_invoker/google_vertexai_em_invoker.pyi +0 -34
- gllm_inference/em_invoker/langchain/tei_embeddings.pyi +0 -71
- gllm_inference/em_invoker/tei_em_invoker.pyi +0 -48
- gllm_inference/lm_invoker/google_generativeai_lm_invoker.pyi +0 -51
- gllm_inference/lm_invoker/google_vertexai_lm_invoker.pyi +0 -54
- gllm_inference/lm_invoker/tgi_lm_invoker.pyi +0 -34
- gllm_inference/multimodal_em_invoker/__init__.pyi +0 -4
- gllm_inference/multimodal_em_invoker/google_vertexai_multimodal_em_invoker.pyi +0 -52
- gllm_inference/multimodal_em_invoker/multimodal_em_invoker.pyi +0 -35
- gllm_inference/multimodal_em_invoker/twelvelabs_multimodal_em_invoker.pyi +0 -49
- gllm_inference/multimodal_lm_invoker/__init__.pyi +0 -7
- gllm_inference/multimodal_lm_invoker/anthropic_multimodal_lm_invoker.pyi +0 -44
- gllm_inference/multimodal_lm_invoker/azure_openai_multimodal_lm_invoker.pyi +0 -41
- gllm_inference/multimodal_lm_invoker/google_generativeai_multimodal_lm_invoker.pyi +0 -30
- gllm_inference/multimodal_lm_invoker/google_vertexai_multimodal_lm_invoker.pyi +0 -67
- gllm_inference/multimodal_lm_invoker/multimodal_lm_invoker.pyi +0 -51
- gllm_inference/multimodal_lm_invoker/openai_multimodal_lm_invoker.pyi +0 -43
- gllm_inference/multimodal_prompt_builder/__init__.pyi +0 -3
- gllm_inference/multimodal_prompt_builder/multimodal_prompt_builder.pyi +0 -57
- gllm_inference/prompt_builder/agnostic_prompt_builder.pyi +0 -34
- gllm_inference/prompt_builder/huggingface_prompt_builder.pyi +0 -44
- gllm_inference/prompt_builder/llama_prompt_builder.pyi +0 -41
- gllm_inference/prompt_builder/mistral_prompt_builder.pyi +0 -41
- gllm_inference/prompt_builder/openai_prompt_builder.pyi +0 -35
- gllm_inference/schema/model_io.pyi +0 -178
- gllm_inference/utils/openai_multimodal_lm_helper.pyi +0 -36
- gllm_inference/utils/retry.pyi +0 -4
- gllm_inference/utils/utils.pyi +0 -142
- gllm_inference_binary-0.4.62.dist-info/RECORD +0 -115
- {gllm_inference_binary-0.4.62.dist-info → gllm_inference_binary-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
3
|
+
class TokenUsage(BaseModel):
|
|
4
|
+
"""Defines the token usage data structure of a language model.
|
|
5
|
+
|
|
6
|
+
Attributes:
|
|
7
|
+
input_tokens (int): The number of input tokens.
|
|
8
|
+
output_tokens (int): The number of output tokens.
|
|
9
|
+
"""
|
|
10
|
+
input_tokens: int
|
|
11
|
+
output_tokens: int
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
class ToolCall(BaseModel):
|
|
5
|
+
"""Defines a tool call request when a language model decides to invoke a tool.
|
|
6
|
+
|
|
7
|
+
Attributes:
|
|
8
|
+
id (str): The ID of the tool call.
|
|
9
|
+
name (str): The name of the tool.
|
|
10
|
+
args (dict[str, Any]): The arguments of the tool call.
|
|
11
|
+
"""
|
|
12
|
+
id: str
|
|
13
|
+
name: str
|
|
14
|
+
args: dict[str, Any]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from pydantic import BaseModel
|
|
2
|
+
|
|
3
|
+
class ToolResult(BaseModel):
|
|
4
|
+
"""Defines a tool result to be sent back to the language model.
|
|
5
|
+
|
|
6
|
+
Attributes:
|
|
7
|
+
id (str): The ID of the tool call.
|
|
8
|
+
output (str): The output of the tool call.
|
|
9
|
+
"""
|
|
10
|
+
id: str
|
|
11
|
+
output: str
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
from aiohttp import ClientResponse
|
|
2
|
-
from gllm_inference.schema.
|
|
3
|
-
from gllm_inference.schema.
|
|
2
|
+
from gllm_inference.schema.code_exec_result import Attachment as Attachment
|
|
3
|
+
from gllm_inference.schema.reasoning import Reasoning as Reasoning
|
|
4
|
+
from gllm_inference.schema.tool_call import ToolCall as ToolCall
|
|
5
|
+
from gllm_inference.schema.tool_result import ToolResult as ToolResult
|
|
4
6
|
from httpx import Response as HttpxResponse
|
|
5
7
|
from pydantic import BaseModel
|
|
6
8
|
from requests import Response
|
|
7
9
|
from typing import Any
|
|
8
10
|
|
|
11
|
+
ErrorResponse = Response | HttpxResponse | ClientResponse | str | dict[str, Any]
|
|
9
12
|
ResponseSchema = dict[str, Any] | type[BaseModel]
|
|
10
|
-
|
|
11
|
-
MultimodalPrompt = list[tuple[PromptRole, list[MultimodalContent]]]
|
|
12
|
-
MultimodalOutput = str | LMOutput
|
|
13
|
+
MessageContent = str | Attachment | ToolCall | ToolResult | Reasoning
|
|
13
14
|
EMContent = str | Attachment | tuple[str | Attachment, ...]
|
|
14
15
|
Vector = list[float]
|
|
15
|
-
UnimodalContent = str | list[str | ToolCall] | list[ToolResult]
|
|
16
|
-
UnimodalPrompt = list[tuple[PromptRole, UnimodalContent]]
|
|
17
|
-
ErrorResponse = Response | HttpxResponse | ClientResponse | str | dict[str, Any]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from gllm_inference.utils.langchain import load_langchain_model as load_langchain_model, parse_model_data as parse_model_data
|
|
2
|
-
from gllm_inference.utils.
|
|
3
|
-
from gllm_inference.utils.utils import get_basic_auth_headers as get_basic_auth_headers, get_mime_type as get_mime_type, get_prompt_keys as get_prompt_keys, invoke_google_multimodal_lm as invoke_google_multimodal_lm, is_local_file_path as is_local_file_path, is_remote_file_path as is_remote_file_path, is_valid_extension as is_valid_extension, load_google_vertexai_project_id as load_google_vertexai_project_id, preprocess_tei_input as preprocess_tei_input, validate_prompt_builder_kwargs as validate_prompt_builder_kwargs, validate_string_enum as validate_string_enum
|
|
2
|
+
from gllm_inference.utils.validation import validate_string_enum as validate_string_enum
|
|
4
3
|
|
|
5
|
-
__all__ = ['
|
|
4
|
+
__all__ = ['load_langchain_model', 'parse_model_data', 'validate_string_enum']
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
|
|
3
|
+
def validate_string_enum(enum_type: type[StrEnum], value: str) -> None:
|
|
4
|
+
"""Validates that the provided value is a valid string enum value.
|
|
5
|
+
|
|
6
|
+
Args:
|
|
7
|
+
enum_type (type[StrEnum]): The type of the string enum.
|
|
8
|
+
value (str): The value to validate.
|
|
9
|
+
|
|
10
|
+
Raises:
|
|
11
|
+
ValueError: If the provided value is not a valid string enum value.
|
|
12
|
+
"""
|
|
Binary file
|
gllm_inference.pyi
CHANGED
|
@@ -34,19 +34,6 @@ import json
|
|
|
34
34
|
import abc
|
|
35
35
|
import pandas
|
|
36
36
|
import pydantic
|
|
37
|
-
import gllm_inference.lm_invoker.GoogleGenerativeAILMInvoker
|
|
38
|
-
import gllm_inference.lm_invoker.GoogleVertexAILMInvoker
|
|
39
|
-
import gllm_inference.lm_invoker.TGILMInvoker
|
|
40
|
-
import gllm_inference.multimodal_lm_invoker.AnthropicMultimodalLMInvoker
|
|
41
|
-
import gllm_inference.multimodal_lm_invoker.GoogleGenerativeAIMultimodalLMInvoker
|
|
42
|
-
import gllm_inference.multimodal_lm_invoker.GoogleVertexAIMultimodalLMInvoker
|
|
43
|
-
import gllm_inference.multimodal_lm_invoker.OpenAIMultimodalLMInvoker
|
|
44
|
-
import gllm_inference.multimodal_prompt_builder.MultimodalPromptBuilder
|
|
45
|
-
import gllm_inference.prompt_builder.AgnosticPromptBuilder
|
|
46
|
-
import gllm_inference.prompt_builder.HuggingFacePromptBuilder
|
|
47
|
-
import gllm_inference.prompt_builder.LlamaPromptBuilder
|
|
48
|
-
import gllm_inference.prompt_builder.MistralPromptBuilder
|
|
49
|
-
import gllm_inference.prompt_builder.OpenAIPromptBuilder
|
|
50
37
|
import re
|
|
51
38
|
import gllm_core.utils.retry
|
|
52
39
|
import gllm_inference.request_processor.LMRequestProcessor
|
|
@@ -54,9 +41,6 @@ import gllm_core.utils.imports
|
|
|
54
41
|
import gllm_inference.schema.ModelId
|
|
55
42
|
import gllm_inference.schema.ModelProvider
|
|
56
43
|
import openai
|
|
57
|
-
import importlib
|
|
58
|
-
import langchain_core
|
|
59
|
-
import langchain_core.embeddings
|
|
60
44
|
import gllm_inference.exceptions.parse_error_message
|
|
61
45
|
import gllm_inference.schema.Attachment
|
|
62
46
|
import gllm_inference.schema.AttachmentType
|
|
@@ -70,13 +54,10 @@ import asyncio
|
|
|
70
54
|
import concurrent
|
|
71
55
|
import concurrent.futures
|
|
72
56
|
import concurrent.futures.ThreadPoolExecutor
|
|
73
|
-
import
|
|
74
|
-
import
|
|
75
|
-
import huggingface_hub
|
|
57
|
+
import langchain_core
|
|
58
|
+
import langchain_core.embeddings
|
|
76
59
|
import gllm_inference.utils.load_langchain_model
|
|
77
60
|
import gllm_inference.utils.parse_model_data
|
|
78
|
-
import gllm_inference.em_invoker.langchain.TEIEmbeddings
|
|
79
|
-
import gllm_inference.utils.get_basic_auth_headers
|
|
80
61
|
import io
|
|
81
62
|
import twelvelabs
|
|
82
63
|
import base64
|
|
@@ -99,7 +80,7 @@ import langchain_core.utils
|
|
|
99
80
|
import langchain_core.utils.function_calling
|
|
100
81
|
import gllm_inference.schema.EmitDataType
|
|
101
82
|
import gllm_inference.schema.LMOutput
|
|
102
|
-
import gllm_inference.schema.
|
|
83
|
+
import gllm_inference.schema.Message
|
|
103
84
|
import gllm_inference.schema.Reasoning
|
|
104
85
|
import gllm_inference.schema.ResponseSchema
|
|
105
86
|
import gllm_inference.schema.TokenUsage
|
|
@@ -108,36 +89,21 @@ import gllm_inference.schema.ToolResult
|
|
|
108
89
|
import anthropic
|
|
109
90
|
import aioboto3
|
|
110
91
|
import gllm_core.schema
|
|
111
|
-
import gllm_inference.schema.
|
|
92
|
+
import gllm_inference.schema.MessageRole
|
|
112
93
|
import langchain_core.language_models
|
|
113
94
|
import langchain_core.messages
|
|
114
|
-
import gllm_inference.schema.MultimodalOutput
|
|
115
95
|
import litellm
|
|
116
|
-
import pathlib
|
|
117
96
|
import time
|
|
118
97
|
import jsonschema
|
|
119
|
-
import gllm_inference.schema.
|
|
120
|
-
import gllm_inference.schema.MultimodalContent
|
|
121
|
-
import gllm_inference.utils.is_local_file_path
|
|
122
|
-
import gllm_inference.utils.is_remote_file_path
|
|
98
|
+
import gllm_inference.schema.MessageContent
|
|
123
99
|
import gllm_inference.utils.validate_string_enum
|
|
124
100
|
import gllm_inference.schema.CodeExecResult
|
|
125
|
-
import gllm_inference.utils.get_mime_type
|
|
126
|
-
import gllm_inference.utils.load_google_vertexai_project_id
|
|
127
|
-
import vertexai
|
|
128
|
-
import vertexai.vision_models
|
|
129
|
-
import gllm_inference.utils.invoke_google_multimodal_lm
|
|
130
|
-
import vertexai.generative_models
|
|
131
|
-
import gllm_inference.utils.get_prompt_keys
|
|
132
|
-
import gllm_inference.utils.validate_prompt_builder_kwargs
|
|
133
|
-
import gllm_inference.prompt_formatter.AgnosticPromptFormatter
|
|
134
|
-
import gllm_inference.prompt_formatter.HuggingFacePromptFormatter
|
|
135
|
-
import gllm_inference.prompt_formatter.OpenAIPromptFormatter
|
|
136
101
|
import transformers
|
|
102
|
+
import gllm_inference.prompt_formatter.HuggingFacePromptFormatter
|
|
137
103
|
import gllm_core.utils.logger_manager
|
|
138
104
|
import mimetypes
|
|
139
105
|
import uuid
|
|
106
|
+
import pathlib
|
|
140
107
|
import filetype
|
|
141
108
|
import magic
|
|
142
|
-
import
|
|
143
|
-
import urllib.parse
|
|
109
|
+
import importlib
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: gllm-inference-binary
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: A library containing components related to model inferences in Gen AI applications.
|
|
5
5
|
Author: Henry Wicaksono
|
|
6
6
|
Author-email: henry.wicaksono@gdplabs.id
|
|
@@ -12,8 +12,6 @@ Provides-Extra: anthropic
|
|
|
12
12
|
Provides-Extra: bedrock
|
|
13
13
|
Provides-Extra: datasaur
|
|
14
14
|
Provides-Extra: google
|
|
15
|
-
Provides-Extra: google-genai
|
|
16
|
-
Provides-Extra: google-vertexai
|
|
17
15
|
Provides-Extra: huggingface
|
|
18
16
|
Provides-Extra: litellm
|
|
19
17
|
Provides-Extra: openai
|
|
@@ -30,10 +28,6 @@ Requires-Dist: huggingface-hub (>=0.30.0,<0.31.0) ; extra == "huggingface"
|
|
|
30
28
|
Requires-Dist: jinja2 (>=3.1.4,<4.0.0)
|
|
31
29
|
Requires-Dist: jsonschema (>=4.24.0,<5.0.0)
|
|
32
30
|
Requires-Dist: langchain (>=0.3.0,<0.4.0)
|
|
33
|
-
Requires-Dist: langchain-google-genai (==2.0.8) ; extra == "google-genai"
|
|
34
|
-
Requires-Dist: langchain-google-vertexai (==2.0.21) ; extra == "google-vertexai"
|
|
35
|
-
Requires-Dist: langchain-openai (>=0.3.12,<0.4.0) ; extra == "openai"
|
|
36
|
-
Requires-Dist: langchain-voyageai (>=0.1.6,<0.2.0) ; (python_version < "3.13") and (extra == "voyage")
|
|
37
31
|
Requires-Dist: libmagic (>=1.0,<2.0) ; sys_platform == "win32"
|
|
38
32
|
Requires-Dist: litellm (>=1.69.2,<2.0.0) ; extra == "litellm"
|
|
39
33
|
Requires-Dist: openai (>=1.98.0,<2.0.0) ; extra == "datasaur" or extra == "openai"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
gllm_inference/builder/__init__.pyi,sha256=-bw1uDx7CAM7pkvjvb1ZXku9zXlQ7aEAyC83KIn3bz8,506
|
|
3
|
+
gllm_inference/builder/build_em_invoker.pyi,sha256=PGRHlmiQ-GUTDC51PwYFjVkXRxeN0immnaSBOI06Uno,5474
|
|
4
|
+
gllm_inference/builder/build_lm_invoker.pyi,sha256=6dQha47M19hllF5ID5xUeiNPmbWUpKyNbG9D78qFGck,6618
|
|
5
|
+
gllm_inference/builder/build_lm_request_processor.pyi,sha256=1fyvGMeza_c4hXnrETNFawYYUINyvaaBsVPJY0LnlkU,4183
|
|
6
|
+
gllm_inference/builder/build_output_parser.pyi,sha256=sgSTrzUmSRxPzUUum0fDU7A3NXYoYhpi6bEx4Q2XMnA,965
|
|
7
|
+
gllm_inference/catalog/__init__.pyi,sha256=HWgPKWIzprpMHRKe_qN9BZSIQhVhrqiyjLjIXwvj1ho,291
|
|
8
|
+
gllm_inference/catalog/catalog.pyi,sha256=eWPqgQKi-SJGHabi_XOTEKpAj96OSRypKsb5ZEC1VWU,4911
|
|
9
|
+
gllm_inference/catalog/lm_request_processor_catalog.pyi,sha256=ymRYDQ0VY3Pmh--IeZBIZPkNqY76YoPrakLryU_txF8,4699
|
|
10
|
+
gllm_inference/catalog/prompt_builder_catalog.pyi,sha256=ONWUArce7jNA1SmQWixYf-mTfVpD4kCARxiTqitQlB0,3244
|
|
11
|
+
gllm_inference/constants.pyi,sha256=RkQRpsKwIZEUKg97VbHe1q51QJHWU5yOzW7GvZGAgE4,196
|
|
12
|
+
gllm_inference/em_invoker/__init__.pyi,sha256=eZifmg3ZS3YdFUwbGPTurrfF4oV_MAPvqErJe7oTpZI,882
|
|
13
|
+
gllm_inference/em_invoker/azure_openai_em_invoker.pyi,sha256=Qt3w0xtQuTTKrpbcu20Wx_PqA0LSK8fTIahfT5jRZ4A,4553
|
|
14
|
+
gllm_inference/em_invoker/em_invoker.pyi,sha256=xM7NRSk-kajUlO1qa7QgZnpQCfbxuU_uUYU_9RR7qOA,4367
|
|
15
|
+
gllm_inference/em_invoker/google_em_invoker.pyi,sha256=qjQzqW26Yjg-os4o4MIW3BbCkdeQee2ImlkUqsR5Kxg,6185
|
|
16
|
+
gllm_inference/em_invoker/langchain/__init__.pyi,sha256=aOTlRvS9aG1tBErjsmhe75s4Sq-g2z9ArfGqNW7QyEs,151
|
|
17
|
+
gllm_inference/em_invoker/langchain/em_invoker_embeddings.pyi,sha256=gEX21gJLngUh9fZo8v6Vbh0gpWFFqS2S-dGNZSrDjFQ,2409
|
|
18
|
+
gllm_inference/em_invoker/langchain_em_invoker.pyi,sha256=twHLZsHzQroCiCv23aNaHZm9mC40VfFWWreY6CnUBbQ,2611
|
|
19
|
+
gllm_inference/em_invoker/openai_compatible_em_invoker.pyi,sha256=XBwtLoiVO8v7axqaPozGNMb8YH9k2Cri7gyoPclSLu8,4887
|
|
20
|
+
gllm_inference/em_invoker/openai_em_invoker.pyi,sha256=qI9xscX5Uj1iMRfn7jRfXs0nFj6BZCHC1yY2PO_Iwcg,4149
|
|
21
|
+
gllm_inference/em_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
gllm_inference/em_invoker/schema/twelvelabs.pyi,sha256=E7sl1OumEzx_Dj8SeiJ6i8AFuRKzAmRVGfIRCk3gv_0,349
|
|
23
|
+
gllm_inference/em_invoker/schema/voyage.pyi,sha256=mL0D2lqqudL1S-eVF5K4uBt0xuMjvYtVrQzLx0-6gq0,230
|
|
24
|
+
gllm_inference/em_invoker/twelevelabs_em_invoker.pyi,sha256=iWkWHeJcnkfpLr8fLEqjWQ_Yk31tmYLuwQLm1lJFzDQ,5057
|
|
25
|
+
gllm_inference/em_invoker/voyage_em_invoker.pyi,sha256=2ggFjDHRO3lSzY1qK8Bi26Q9QBaNQcU01oe1v8t7meI,5127
|
|
26
|
+
gllm_inference/exceptions/__init__.pyi,sha256=2F05RytXZIKaOJScb1pD0O0bATIQHVeEAYYNX4y5N2A,981
|
|
27
|
+
gllm_inference/exceptions/error_parser.pyi,sha256=ggmh8DJXdwFJInNLrP24WVJt_4raxbAVxzXRQgBpndA,2441
|
|
28
|
+
gllm_inference/exceptions/exceptions.pyi,sha256=ViXvIzm7tLcstjqfwC6nPziDg0UAmoUAWZVWrAJyp3w,4763
|
|
29
|
+
gllm_inference/lm_invoker/__init__.pyi,sha256=g-wu6W6ly_WAVPLDWKjt4J5cMo-CJ1x5unuObVSUnug,1115
|
|
30
|
+
gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=QPS-qtKoILxLei1TLrVEINX54R-q5QEFRyN1mukJPYs,14930
|
|
31
|
+
gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=sUhN3ZSjQTv0zs2Nu7Tzx5A2lwYpH0Ur-32R8_wb6rE,14653
|
|
32
|
+
gllm_inference/lm_invoker/bedrock_lm_invoker.pyi,sha256=lDMaiplHlDS2NLYKoosBdym8qYmNo6nCmRioAJI-isA,12525
|
|
33
|
+
gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=-BlIPdxzR1TUYKKOcKgF_Pcv1cTAzlP2oI7K88I1i_E,9209
|
|
34
|
+
gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=vDmrGVVcyhlnA2eVHjU7JhIRU2Fsyj6iVftUWHgUG9s,16697
|
|
35
|
+
gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=woQHlUi0FqzbWP5gCizMY9GW9uyymzRWfE0vPimWjs0,13268
|
|
36
|
+
gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=1cJkcOnmAl1NwJjzHEltNTlLiauJKW9Y2j5PJyK7-U8,13278
|
|
37
|
+
gllm_inference/lm_invoker/lm_invoker.pyi,sha256=F7T_UORX5BDLNmrxCbsX49dW3pxVZKTD2R6Tn7Y4IPU,7697
|
|
38
|
+
gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=Kk0v73-Wq-hHlKtHDI7L-DLaI8qwbO_TDg_OimKIS3Q,14909
|
|
39
|
+
gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=-_wsmnMvGYNOK_vLwDVbybwpgJreOoYW9usZnORmPhM,19679
|
|
40
|
+
gllm_inference/lm_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
+
gllm_inference/lm_invoker/schema/anthropic.pyi,sha256=MJHHyqMGQgj9tURyewuVlmxHxiAzU9qzmJEiK5IUoWw,1020
|
|
42
|
+
gllm_inference/lm_invoker/schema/bedrock.pyi,sha256=H3attoGWhBA725W4FpXw7Mty46N9jHKjw9PT-0lMEJs,975
|
|
43
|
+
gllm_inference/lm_invoker/schema/datasaur.pyi,sha256=mEuWs18VO4KQ6ZTcrlW2BJwphoDe4D5iJfn-GAelvCM,202
|
|
44
|
+
gllm_inference/lm_invoker/schema/google.pyi,sha256=AJQsFGKzowXfpSvorSco90aWXqgw9N0M8fInn_JN-X4,464
|
|
45
|
+
gllm_inference/lm_invoker/schema/langchain.pyi,sha256=qYiQvzUw0xZa4ii-qyRCFTuIY7j0MREY6QgV1_DfkGk,391
|
|
46
|
+
gllm_inference/lm_invoker/schema/openai.pyi,sha256=CNkIGljwRyQYx0krONX1ik9hwBiN45t9vBk-ZY45rP4,1989
|
|
47
|
+
gllm_inference/lm_invoker/schema/openai_compatible.pyi,sha256=WiWEFoPQ0PEAx6EW-P8Nk6O7RF5I9i_hItEHtOl_F4A,1074
|
|
48
|
+
gllm_inference/model/__init__.pyi,sha256=JKQB0wVSVYD-_tdRkG7N_oEVAKGCcoBw0BUOUMLieFo,602
|
|
49
|
+
gllm_inference/model/em/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
+
gllm_inference/model/em/google_em.pyi,sha256=c53H-KNdNOK9ppPLyOSkmCA890eF5FsMd05upkPIzF0,487
|
|
51
|
+
gllm_inference/model/em/openai_em.pyi,sha256=b6ID1JsLZH9OAo9E37CkbgWNR_eI65eKXK6TYi_0ndA,457
|
|
52
|
+
gllm_inference/model/em/twelvelabs_em.pyi,sha256=5R2zkKDiEatdATFzF8TOoKW9XRkOsOoNGY5lORimueo,413
|
|
53
|
+
gllm_inference/model/em/voyage_em.pyi,sha256=kTInLttWfPqCNfBX-TK5VMMaFfPxwqqudBw1kz4hnxk,551
|
|
54
|
+
gllm_inference/model/lm/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
+
gllm_inference/model/lm/anthropic_lm.pyi,sha256=3rppksDF4nVAR3Konoj6nRi_T8vSaFPxLub1CzJh7Us,578
|
|
56
|
+
gllm_inference/model/lm/google_lm.pyi,sha256=yv5nXnLxuCGDUsh7QP9furSx-6sZj6FQi-pJ9lZbHAk,496
|
|
57
|
+
gllm_inference/model/lm/openai_lm.pyi,sha256=yj3AJj1xDYRkNIPHX2enw46AJ9wArPZruKsxg1ME9Rg,645
|
|
58
|
+
gllm_inference/output_parser/__init__.pyi,sha256=dhAeRTBxc6CfS8bhnHjbtrnyqJ1iyffvUZkGp4UrJNM,132
|
|
59
|
+
gllm_inference/output_parser/json_output_parser.pyi,sha256=YtgQh8Uzy8W_Tgh8DfuR7VFFS7qvLEasiTwRfaGZZEU,2993
|
|
60
|
+
gllm_inference/output_parser/output_parser.pyi,sha256=-Xu5onKCBDqShcO-VrQh5icqAmXdihGc3rkZxL93swg,975
|
|
61
|
+
gllm_inference/prompt_builder/__init__.pyi,sha256=mPsbiafzSNHsgN-CuzjhgZpfXfi1pPC3_gdsq2p0EM4,120
|
|
62
|
+
gllm_inference/prompt_builder/prompt_builder.pyi,sha256=tX4wfs3P5C-ti5zT1zW3Rw2wS2VEc-PIQcyZcyR8QL0,2934
|
|
63
|
+
gllm_inference/prompt_formatter/__init__.pyi,sha256=q5sPPrnoCf-4tMGowh7hXxs63uyWfaZyEI-wjLBTGsA,747
|
|
64
|
+
gllm_inference/prompt_formatter/agnostic_prompt_formatter.pyi,sha256=qp4L3x7XK7oZaSYP8B4idewKpPioB4XELeKVV-dNi-Q,2067
|
|
65
|
+
gllm_inference/prompt_formatter/huggingface_prompt_formatter.pyi,sha256=kH60A_3DnHd3BrqbgS_FqQTCTHIjC9BTsk6_FNgcZw8,2784
|
|
66
|
+
gllm_inference/prompt_formatter/llama_prompt_formatter.pyi,sha256=m3m3gXLXbk1LMfWn7a6raKlnSjgMQJNlGsE6FlijogA,2907
|
|
67
|
+
gllm_inference/prompt_formatter/mistral_prompt_formatter.pyi,sha256=bpRXB26qw1REnnY1PqVm8D-Eo-dWYMVLb0s31-g0g_Y,2703
|
|
68
|
+
gllm_inference/prompt_formatter/openai_prompt_formatter.pyi,sha256=xGpytprs5W1TogHFYbsYxBPClIuQc0tXfZSzR9ypRC4,1321
|
|
69
|
+
gllm_inference/prompt_formatter/prompt_formatter.pyi,sha256=hAc6rxWc6JSYdD-OypLixGKXlPA8djE7zJqZpVKXcOs,1176
|
|
70
|
+
gllm_inference/request_processor/__init__.pyi,sha256=giEme2WFQhgyKiBZHhSet0_nKSCHwGy-_2p6NRzg0Zc,231
|
|
71
|
+
gllm_inference/request_processor/lm_request_processor.pyi,sha256=rInXhC95BvQnw9q98KZWpjPH8Q_TV4zC2ycNjypEBZ4,5516
|
|
72
|
+
gllm_inference/request_processor/uses_lm_mixin.pyi,sha256=znBG4AWWm_H70Qqrc1mO4ohmWotX9id81Fqe-x9Qa6Q,2371
|
|
73
|
+
gllm_inference/schema/__init__.pyi,sha256=-ldt0xJQJirVNdwLFev3bmzmFRw9HSUWBRmmIVH7uyU,1251
|
|
74
|
+
gllm_inference/schema/attachment.pyi,sha256=FML2m4-LZYjBIeQaTwJqrcihGpxboJqEtjs2zqLfrCk,2886
|
|
75
|
+
gllm_inference/schema/code_exec_result.pyi,sha256=WQ-ARoGM9r6nyRX-A0Ro1XKiqrc9R3jRYXZpu_xo5S4,573
|
|
76
|
+
gllm_inference/schema/enums.pyi,sha256=SQ9mXt8j7uK333uUnUHRs-mkRxf0Z5NCtkAkgQZPIb4,629
|
|
77
|
+
gllm_inference/schema/lm_output.pyi,sha256=WP2LQrY0D03OJtFoaW_dGoJ_-yFUh2HbVlllgjzpYv4,1992
|
|
78
|
+
gllm_inference/schema/message.pyi,sha256=jJV6A0ihEcun2OhzyMtNkiHnf7d6v5R-GdpTBGfJ0AQ,2272
|
|
79
|
+
gllm_inference/schema/model_id.pyi,sha256=3prO19l-FCSecRupe93ruXe91-Xw3GJOpbuQ66bijo0,5368
|
|
80
|
+
gllm_inference/schema/reasoning.pyi,sha256=jbPxkDRHt0Vt-zdcc8lTT1l2hIE1Jm3HIHeNd0hfXGo,577
|
|
81
|
+
gllm_inference/schema/token_usage.pyi,sha256=Eevs8S-yXoM7kQkkzhXHEvORU8DMGzdQynAamqtIoX4,323
|
|
82
|
+
gllm_inference/schema/tool_call.pyi,sha256=OWT9LUqs_xfUcOkPG0aokAAqzLYYDkfnjTa0zOWvugk,403
|
|
83
|
+
gllm_inference/schema/tool_result.pyi,sha256=IJsU3n8y0Q9nFMEiq4RmLEIHueSiim0Oz_DlhKrTqto,287
|
|
84
|
+
gllm_inference/schema/type_alias.pyi,sha256=qAljeBoeQEfT601maGe_mEpXD9inNzbGte1i6joQafc,740
|
|
85
|
+
gllm_inference/utils/__init__.pyi,sha256=RBTWDu1TDPpTd17fixcPYFv2L_vp4-IAOX0IsxgCsD4,299
|
|
86
|
+
gllm_inference/utils/langchain.pyi,sha256=4AwFiVAO0ZpdgmqeC4Pb5NJwBt8vVr0MSUqLeCdTscc,1194
|
|
87
|
+
gllm_inference/utils/validation.pyi,sha256=-RdMmb8afH7F7q4Ao7x6FbwaDfxUHn3hA3WiOgzB-3s,397
|
|
88
|
+
gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
|
|
89
|
+
gllm_inference.cp311-win_amd64.pyd,sha256=NbilnEE09naGylSCBYaCYS_AQxJNtQy-eMaIfmjbWlU,2643968
|
|
90
|
+
gllm_inference.pyi,sha256=VEcscbPCJ-6lXU4jV3YYXwwumk9kWxpCAsS84ssKG6o,3295
|
|
91
|
+
gllm_inference_binary-0.5.0.dist-info/METADATA,sha256=cC_ZGodtt4N7PUIMLwyp7QQ3Vx7gcHfh7mxh8aPJQwE,4568
|
|
92
|
+
gllm_inference_binary-0.5.0.dist-info/WHEEL,sha256=-FZBVKyKauScY3vLa8vJR6hBCpAJfFykw2MOwlNKr1g,98
|
|
93
|
+
gllm_inference_binary-0.5.0.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from gllm_inference.schema.model_id import ModelId as _ModelId
|
|
3
|
-
from typing import Any
|
|
4
|
-
|
|
5
|
-
logger: Incomplete
|
|
6
|
-
|
|
7
|
-
class ModelId(_ModelId):
|
|
8
|
-
"""Deprecated: Use gllm_inference.schema.ModelId instead."""
|
|
9
|
-
@classmethod
|
|
10
|
-
def from_string(cls, *args: Any, **kwargs: Any) -> None:
|
|
11
|
-
"""Deprecated: Use gllm_inference.schema.ModelId.from_string instead."""
|
|
12
|
-
|
|
13
|
-
ModelProvider: Incomplete
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from gllm_inference.lm_invoker import AnthropicLMInvoker as AnthropicLMInvoker, AzureOpenAILMInvoker as AzureOpenAILMInvoker, BedrockLMInvoker as BedrockLMInvoker, DatasaurLMInvoker as DatasaurLMInvoker, GoogleGenerativeAILMInvoker as GoogleGenerativeAILMInvoker, GoogleLMInvoker as GoogleLMInvoker, GoogleVertexAILMInvoker as GoogleVertexAILMInvoker, LangChainLMInvoker as LangChainLMInvoker, OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker, OpenAILMInvoker as OpenAILMInvoker, TGILMInvoker as TGILMInvoker
|
|
3
|
-
from gllm_inference.multimodal_lm_invoker import AnthropicMultimodalLMInvoker as AnthropicMultimodalLMInvoker, GoogleGenerativeAIMultimodalLMInvoker as GoogleGenerativeAIMultimodalLMInvoker, GoogleVertexAIMultimodalLMInvoker as GoogleVertexAIMultimodalLMInvoker, OpenAIMultimodalLMInvoker as OpenAIMultimodalLMInvoker
|
|
4
|
-
from gllm_inference.multimodal_prompt_builder import MultimodalPromptBuilder as MultimodalPromptBuilder
|
|
5
|
-
from gllm_inference.prompt_builder import AgnosticPromptBuilder as AgnosticPromptBuilder, HuggingFacePromptBuilder as HuggingFacePromptBuilder, LlamaPromptBuilder as LlamaPromptBuilder, MistralPromptBuilder as MistralPromptBuilder, OpenAIPromptBuilder as OpenAIPromptBuilder, PromptBuilder as PromptBuilder
|
|
6
|
-
|
|
7
|
-
PROMPT_BUILDER_TYPE_MAP: Incomplete
|
|
8
|
-
LM_INVOKER_TYPE_MAP: Incomplete
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
2
|
-
from gllm_inference.em_invoker.google_em_invoker import GoogleEMInvoker as GoogleEMInvoker
|
|
3
|
-
from typing import Any
|
|
4
|
-
|
|
5
|
-
DEPRECATION_MESSAGE: str
|
|
6
|
-
|
|
7
|
-
class GoogleGenerativeAIEMInvoker(GoogleEMInvoker):
|
|
8
|
-
"""An embedding model invoker to interact with Google Generative AI embedding models.
|
|
9
|
-
|
|
10
|
-
This class has been deprecated as Google Generative AI is now supported through `GoogleEMInvoker`.
|
|
11
|
-
This class is maintained for backward compatibility and will be removed in version 0.5.0.
|
|
12
|
-
|
|
13
|
-
Attributes:
|
|
14
|
-
model_id (str): The model ID of the embedding model.
|
|
15
|
-
model_provider (str): The provider of the embedding model.
|
|
16
|
-
model_name (str): The name of the embedding model.
|
|
17
|
-
client_params (dict[str, Any]): The Google client instance init parameters.
|
|
18
|
-
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
|
|
19
|
-
retry_config (RetryConfig | None): The retry configuration for the language model.
|
|
20
|
-
"""
|
|
21
|
-
def __init__(self, model_name: str, api_key: str, task_type: str | None = None, model_kwargs: Any = None, retry_config: RetryConfig | None = None) -> None:
|
|
22
|
-
"""Initializes a new instance of the GoogleGenerativeAIEMInvoker class.
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
model_name (str): The name of the Google Generative AI model to be used.
|
|
26
|
-
api_key (str): The API key for accessing the Google Generative AI model.
|
|
27
|
-
task_type (str | None, optional): The type of task to be performed by the embedding model. Defaults to None.
|
|
28
|
-
model_kwargs (Any, optional): Additional keyword arguments to initiate the embedding model.
|
|
29
|
-
Defaults to None.
|
|
30
|
-
retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
|
|
31
|
-
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
|
|
32
|
-
"""
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
2
|
-
from gllm_inference.em_invoker.google_em_invoker import GoogleEMInvoker as GoogleEMInvoker
|
|
3
|
-
from typing import Any
|
|
4
|
-
|
|
5
|
-
DEPRECATION_MESSAGE: str
|
|
6
|
-
|
|
7
|
-
class GoogleVertexAIEMInvoker(GoogleEMInvoker):
|
|
8
|
-
"""An embedding model invoker to interact with Google Vertex AI embedding models.
|
|
9
|
-
|
|
10
|
-
This class has been deprecated as Google Vertex AI is now supported through `GoogleEMInvoker`.
|
|
11
|
-
This class is maintained for backward compatibility and will be removed in version 0.5.0.
|
|
12
|
-
|
|
13
|
-
Attributes:
|
|
14
|
-
model_id (str): The model ID of the embedding model.
|
|
15
|
-
model_provider (str): The provider of the embedding model.
|
|
16
|
-
model_name (str): The name of the embedding model.
|
|
17
|
-
client_params (dict[str, Any]): The Google client instance init parameters.
|
|
18
|
-
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
|
|
19
|
-
retry_config (RetryConfig | None): The retry configuration for the language model.
|
|
20
|
-
"""
|
|
21
|
-
def __init__(self, model_name: str, credentials_path: str, project_id: str | None = None, location: str = 'us-central1', model_kwargs: Any = None, retry_config: RetryConfig | None = None) -> None:
|
|
22
|
-
'''Initializes a new instance of the GoogleVertexAIEMInvoker class.
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
model_name (str): The name of the multimodal embedding model to be used.
|
|
26
|
-
credentials_path (str): The path to the Google Cloud service account credentials JSON file.
|
|
27
|
-
project_id (str | None, optional): The Google Cloud project ID. Defaults to None, in which case the
|
|
28
|
-
project ID will be loaded from the credentials file.
|
|
29
|
-
location (str, optional): The location of the Google Cloud project. Defaults to "us-central1".
|
|
30
|
-
model_kwargs (Any, optional): Additional keyword arguments to initiate the Google Vertex AI model.
|
|
31
|
-
Defaults to None.
|
|
32
|
-
retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
|
|
33
|
-
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
|
|
34
|
-
'''
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
from gllm_inference.schema import Vector as Vector
|
|
2
|
-
from gllm_inference.utils import preprocess_tei_input as preprocess_tei_input
|
|
3
|
-
from langchain_core.embeddings import Embeddings
|
|
4
|
-
from pydantic import BaseModel
|
|
5
|
-
from typing import Any
|
|
6
|
-
from typing_extensions import Self
|
|
7
|
-
|
|
8
|
-
class TEIEmbeddings(BaseModel, Embeddings):
|
|
9
|
-
'''A custom LangChain `Embeddings` class to interact with Text Embeddings Inference (TEI).
|
|
10
|
-
|
|
11
|
-
Attributes:
|
|
12
|
-
url (str): The URL of the TEI service that hosts the embedding model.
|
|
13
|
-
api_key (str | None, optional): The API key to the TEI service. Defaults to None.
|
|
14
|
-
client (InferenceClient): The client instance to interact with the TEI service.
|
|
15
|
-
query_prefix (str): The additional prefix to be added when embedding a query.
|
|
16
|
-
document_prefix (str): The additional prefix to be added when embedding documents.
|
|
17
|
-
|
|
18
|
-
Initialize with URL and API key example:
|
|
19
|
-
```python
|
|
20
|
-
from gllm_inference.em_invoker.langchain import TEIEmbeddings
|
|
21
|
-
|
|
22
|
-
embeddings = TEIEmbeddings(url="<url-to-tei-service>", api_key="<my-api-key>")
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Initialize with only URL example:
|
|
26
|
-
```python
|
|
27
|
-
from gllm_inference.em_invoker.langchain import TEIEmbeddings
|
|
28
|
-
|
|
29
|
-
embeddings = TEIEmbeddings(url="<url-to-tei-service>")
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Initialize with client example:
|
|
33
|
-
```python
|
|
34
|
-
from gllm_inference.em_invoker.langchain import TEIEmbeddings
|
|
35
|
-
from huggingface_hub import InferenceClient
|
|
36
|
-
|
|
37
|
-
client = InferenceClient(model="<url-to-tei-service>", api_key="<my-api-key>")
|
|
38
|
-
embeddings = TEIEmbeddings(client=client)
|
|
39
|
-
```
|
|
40
|
-
'''
|
|
41
|
-
url: str | None
|
|
42
|
-
api_key: str | None
|
|
43
|
-
client: Any
|
|
44
|
-
query_prefix: str
|
|
45
|
-
document_prefix: str
|
|
46
|
-
def validate_environment(self) -> Self:
|
|
47
|
-
"""Validates that the TEI service URL and python package exists in environment.
|
|
48
|
-
|
|
49
|
-
The validation is done in the following order:
|
|
50
|
-
1. If neither `url` nor `client` is provided, an error will be raised.
|
|
51
|
-
2. If an invalid `client` is provided, an error will be raised.
|
|
52
|
-
3. If `url` is provided, it will be used to initialize the TEI service, along with an optional `api_key`.
|
|
53
|
-
"""
|
|
54
|
-
def embed_documents(self, texts: list[str]) -> list[Vector]:
|
|
55
|
-
"""Embed documents using TEI's hosted embedding model.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
texts (list[str]): The list of texts to embed.
|
|
59
|
-
|
|
60
|
-
Returns:
|
|
61
|
-
list[Vector]: List of embeddings, one for each text.
|
|
62
|
-
"""
|
|
63
|
-
def embed_query(self, text: str) -> Vector:
|
|
64
|
-
"""Embed query using TEI's hosted embedding model.
|
|
65
|
-
|
|
66
|
-
Args:
|
|
67
|
-
text (str): The text to embed.
|
|
68
|
-
|
|
69
|
-
Returns:
|
|
70
|
-
Vector: Embeddings for the text.
|
|
71
|
-
"""
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from _typeshed import Incomplete
|
|
2
|
-
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
3
|
-
from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
|
|
4
|
-
from gllm_inference.em_invoker.langchain import TEIEmbeddings as TEIEmbeddings
|
|
5
|
-
from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
|
|
6
|
-
from gllm_inference.utils import get_basic_auth_headers as get_basic_auth_headers, preprocess_tei_input as preprocess_tei_input
|
|
7
|
-
|
|
8
|
-
DEPRECATION_MESSAGE: str
|
|
9
|
-
|
|
10
|
-
class TEIEMInvoker(BaseEMInvoker):
|
|
11
|
-
"""An embedding model invoker to interact with embedding models hosted in Text Embeddings Inference (TEI).
|
|
12
|
-
|
|
13
|
-
The `TEIEMInvoker` class is responsible for invoking an embedding model in Text Embeddings Inference (TEI).
|
|
14
|
-
It uses the embedding model to transform a text or a list of input text into their vector representations.
|
|
15
|
-
|
|
16
|
-
Attributes:
|
|
17
|
-
model_id (str): The model ID of the embedding model.
|
|
18
|
-
model_provider (str): The provider of the embedding model.
|
|
19
|
-
model_name (str): The name of the embedding model.
|
|
20
|
-
client (AsyncInferenceClient): The client instance to interact with the TEI service.
|
|
21
|
-
query_prefix (str): The additional prefix to be added when embedding a query.
|
|
22
|
-
document_prefix (str): The additional prefix to be added when embedding documents.
|
|
23
|
-
retry_config (RetryConfig): The retry configuration for the embedding model.
|
|
24
|
-
"""
|
|
25
|
-
client: Incomplete
|
|
26
|
-
query_prefix: Incomplete
|
|
27
|
-
document_prefix: Incomplete
|
|
28
|
-
def __init__(self, url: str, username: str = '', password: str = '', api_key: str | None = None, query_prefix: str = '', document_prefix: str = '', retry_config: RetryConfig | None = None) -> None:
|
|
29
|
-
"""Initializes a new instance of the TEIEMInvoker class.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
url (str): The URL of the TEI service.
|
|
33
|
-
username (str, optional): The username for Basic Authentication. Defaults to an empty string.
|
|
34
|
-
password (str, optional): The password for Basic Authentication. Defaults to an empty string.
|
|
35
|
-
api_key (str | None, optional): The API key for the TEI service. Defaults to None.
|
|
36
|
-
query_prefix (str, optional): The additional prefix to be added when embedding a query.
|
|
37
|
-
Defaults to an empty string.
|
|
38
|
-
document_prefix (str, optional): The additional prefix to be added when embedding documents.
|
|
39
|
-
Defaults to an empty string.
|
|
40
|
-
retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
|
|
41
|
-
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
|
|
42
|
-
"""
|
|
43
|
-
def to_langchain(self) -> TEIEmbeddings:
|
|
44
|
-
"""Converts the current embedding model invoker to an instance of LangChain `TEIEmbeddings` object.
|
|
45
|
-
|
|
46
|
-
Returns:
|
|
47
|
-
TEIEmbeddings: An instance of LangChain `TEIEmbeddings` object.
|
|
48
|
-
"""
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
2
|
-
from gllm_inference.lm_invoker.google_lm_invoker import GoogleLMInvoker as GoogleLMInvoker
|
|
3
|
-
from gllm_inference.schema import ResponseSchema as ResponseSchema
|
|
4
|
-
from langchain_core.tools import Tool as Tool
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
DEPRECATION_MESSAGE: str
|
|
8
|
-
|
|
9
|
-
class GoogleGenerativeAILMInvoker(GoogleLMInvoker):
|
|
10
|
-
"""A language model invoker to interact with Google Gen AI language models.
|
|
11
|
-
|
|
12
|
-
This class has been deprecated as Google Generative AI is now supported through `GoogleLMInvoker`.
|
|
13
|
-
This class is maintained for backward compatibility and will be removed in version 0.5.0.
|
|
14
|
-
|
|
15
|
-
Attributes:
|
|
16
|
-
model_id (str): The model ID of the language model.
|
|
17
|
-
model_provider (str): The provider of the language model.
|
|
18
|
-
model_name (str): The name of the language model.
|
|
19
|
-
client (Client): The Google client instance.
|
|
20
|
-
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
|
|
21
|
-
tools (list[Any]): The list of tools provided to the model to enable tool calling.
|
|
22
|
-
response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
|
|
23
|
-
structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
|
|
24
|
-
output_analytics (bool): Whether to output the invocation analytics.
|
|
25
|
-
retry_config (RetryConfig | None): The retry configuration for the language model.
|
|
26
|
-
"""
|
|
27
|
-
def __init__(self, model_name: str, api_key: str, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, bind_tools_params: dict[str, Any] | None = None, with_structured_output_params: dict[str, Any] | None = None) -> None:
|
|
28
|
-
"""Initializes a new instance of the GoogleGenerativeAILMInvoker class.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
model_name (str): The name of the multimodal language model to be used.
|
|
32
|
-
api_key (str): The API key for authenticating with Google Gen AI.
|
|
33
|
-
model_kwargs (dict[str, Any] | None, optional): Additional keyword arguments for the Google Generative AI
|
|
34
|
-
client.
|
|
35
|
-
default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
|
|
36
|
-
Defaults to None.
|
|
37
|
-
tools (list[Tool] | None, optional): Tools provided to the language model to enable tool calling.
|
|
38
|
-
Defaults to None.
|
|
39
|
-
response_schema (ResponseSchema | None, optional): The schema of the response. If provided, the model will
|
|
40
|
-
output a structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema
|
|
41
|
-
dictionary. Defaults to None.
|
|
42
|
-
output_analytics (bool, optional): Whether to output the invocation analytics. Defaults to False.
|
|
43
|
-
retry_config (RetryConfig | None, optional): The retry configuration for the language model.
|
|
44
|
-
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
|
|
45
|
-
bind_tools_params (dict[str, Any] | None, optional): Deprecated parameter to add tool calling capability.
|
|
46
|
-
If provided, must at least include the `tools` key that is equivalent to the `tools` parameter.
|
|
47
|
-
Retained for backward compatibility. Defaults to None.
|
|
48
|
-
with_structured_output_params (dict[str, Any] | None, optional): Deprecated parameter to instruct the
|
|
49
|
-
model to produce output with a certain schema. If provided, must at least include the `schema` key that
|
|
50
|
-
is equivalent to the `response_schema` parameter. Retained for backward compatibility. Defaults to None.
|
|
51
|
-
"""
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
2
|
-
from gllm_inference.lm_invoker.google_lm_invoker import GoogleLMInvoker as GoogleLMInvoker
|
|
3
|
-
from gllm_inference.schema import ResponseSchema as ResponseSchema
|
|
4
|
-
from langchain_core.tools import Tool as Tool
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
DEPRECATION_MESSAGE: str
|
|
8
|
-
|
|
9
|
-
class GoogleVertexAILMInvoker(GoogleLMInvoker):
|
|
10
|
-
"""A language model invoker to interact with Google Vertex AI language models.
|
|
11
|
-
|
|
12
|
-
This class has been deprecated as Google Vertex AI is now supported through `GoogleLMInvoker`.
|
|
13
|
-
This class is maintained for backward compatibility and will be removed in version 0.5.0.
|
|
14
|
-
|
|
15
|
-
Attributes:
|
|
16
|
-
model_id (str): The model ID of the language model.
|
|
17
|
-
model_provider (str): The provider of the language model.
|
|
18
|
-
model_name (str): The name of the language model.
|
|
19
|
-
client (Client): The Google client instance.
|
|
20
|
-
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the model.
|
|
21
|
-
tools (list[Any]): The list of tools provided to the model to enable tool calling.
|
|
22
|
-
response_schema (ResponseSchema | None): The schema of the response. If provided, the model will output a
|
|
23
|
-
structured response as defined by the schema. Supports both Pydantic BaseModel and JSON schema dictionary.
|
|
24
|
-
output_analytics (bool): Whether to output the invocation analytics.
|
|
25
|
-
retry_config (RetryConfig | None): The retry configuration for the language model.
|
|
26
|
-
"""
|
|
27
|
-
def __init__(self, model_name: str, credentials_path: str, project_id: str | None = None, location: str = 'us-central1', model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, bind_tools_params: dict[str, Any] | None = None, with_structured_output_params: dict[str, Any] | None = None) -> None:
|
|
28
|
-
'''Initializes a new instance of the GoogleVertexAILMInvoker class.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
model_name (str): The name of the multimodal language model to be used.
|
|
32
|
-
credentials_path (str): The path to the Google Cloud service account credentials JSON file.
|
|
33
|
-
project_id (str | None, optional): The Google Cloud project ID. Defaults to None, in which case the
|
|
34
|
-
project ID will be loaded from the credentials file.
|
|
35
|
-
location (str, optional): The location of the Google Cloud project. Defaults to "us-central1".
|
|
36
|
-
model_kwargs (dict[str, Any] | None, optional): Additional keyword arguments for the Google Vertex AI
|
|
37
|
-
client.
|
|
38
|
-
default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
|
|
39
|
-
Defaults to None.
|
|
40
|
-
tools (list[Tool] | None, optional): Tools provided to the language 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 is used.
|
|
48
|
-
bind_tools_params (dict[str, Any] | None, optional): Deprecated parameter to add tool calling capability.
|
|
49
|
-
If provided, must at least include the `tools` key that is equivalent to the `tools` parameter.
|
|
50
|
-
Retained for backward compatibility. Defaults to None.
|
|
51
|
-
with_structured_output_params (dict[str, Any] | None, optional): Deprecated parameter to instruct the
|
|
52
|
-
model to produce output with a certain schema. If provided, must at least include the `schema` key that
|
|
53
|
-
is equivalent to the `response_schema` parameter. Retained for backward compatibility. Defaults to None.
|
|
54
|
-
'''
|