gllm-inference-binary 0.5.41__cp311-cp311-macosx_13_0_x86_64.whl → 0.5.44__cp311-cp311-macosx_13_0_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gllm-inference-binary might be problematic. Click here for more details.
- gllm_inference/builder/build_em_invoker.pyi +13 -2
- gllm_inference/constants.pyi +4 -2
- gllm_inference/em_invoker/__init__.pyi +3 -1
- gllm_inference/em_invoker/cohere_em_invoker.pyi +128 -0
- gllm_inference/em_invoker/jina_em_invoker.pyi +103 -0
- gllm_inference/em_invoker/schema/cohere.pyi +20 -0
- gllm_inference/em_invoker/schema/jina.pyi +28 -0
- gllm_inference/exceptions/provider_error_map.pyi +1 -0
- gllm_inference/lm_invoker/lm_invoker.pyi +1 -1
- gllm_inference/schema/__init__.pyi +2 -2
- gllm_inference/schema/activity.pyi +13 -11
- gllm_inference/schema/enums.pyi +10 -0
- gllm_inference/schema/events.pyi +57 -42
- gllm_inference/schema/model_id.pyi +15 -0
- gllm_inference.cpython-311-darwin.so +0 -0
- gllm_inference.pyi +10 -6
- {gllm_inference_binary-0.5.41.dist-info → gllm_inference_binary-0.5.44.dist-info}/METADATA +4 -2
- {gllm_inference_binary-0.5.41.dist-info → gllm_inference_binary-0.5.44.dist-info}/RECORD +20 -16
- {gllm_inference_binary-0.5.41.dist-info → gllm_inference_binary-0.5.44.dist-info}/WHEEL +0 -0
- {gllm_inference_binary-0.5.41.dist-info → gllm_inference_binary-0.5.44.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from _typeshed import Incomplete
|
|
2
|
-
from gllm_inference.em_invoker import AzureOpenAIEMInvoker as AzureOpenAIEMInvoker, BedrockEMInvoker as BedrockEMInvoker, GoogleEMInvoker as GoogleEMInvoker, LangChainEMInvoker as LangChainEMInvoker, OpenAICompatibleEMInvoker as OpenAICompatibleEMInvoker, OpenAIEMInvoker as OpenAIEMInvoker, TwelveLabsEMInvoker as TwelveLabsEMInvoker, VoyageEMInvoker as VoyageEMInvoker
|
|
2
|
+
from gllm_inference.em_invoker import AzureOpenAIEMInvoker as AzureOpenAIEMInvoker, BedrockEMInvoker as BedrockEMInvoker, CohereEMInvoker as CohereEMInvoker, GoogleEMInvoker as GoogleEMInvoker, JinaEMInvoker as JinaEMInvoker, LangChainEMInvoker as LangChainEMInvoker, OpenAICompatibleEMInvoker as OpenAICompatibleEMInvoker, OpenAIEMInvoker as OpenAIEMInvoker, TwelveLabsEMInvoker as TwelveLabsEMInvoker, VoyageEMInvoker as VoyageEMInvoker
|
|
3
3
|
from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
|
|
4
|
-
from gllm_inference.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider
|
|
4
|
+
from gllm_inference.schema.model_id import ModelId as ModelId, ModelProvider as ModelProvider, OPTIONAL_PATH_PROVIDERS as OPTIONAL_PATH_PROVIDERS
|
|
5
5
|
from typing import Any
|
|
6
6
|
|
|
7
7
|
PROVIDER_TO_EM_INVOKER_MAP: dict[str, type[BaseEMInvoker]]
|
|
@@ -71,6 +71,16 @@ def build_em_invoker(model_id: str | ModelId, credentials: str | dict[str, Any]
|
|
|
71
71
|
```
|
|
72
72
|
Providing credentials through environment variable is not supported for Google Vertex AI.
|
|
73
73
|
|
|
74
|
+
# Using Jina
|
|
75
|
+
```python
|
|
76
|
+
em_invoker = build_em_invoker(
|
|
77
|
+
model_id="jina/jina-embeddings-v2-large",
|
|
78
|
+
credentials="jina-api-key"
|
|
79
|
+
)
|
|
80
|
+
```
|
|
81
|
+
The credentials can also be provided through the `JINA_API_KEY` environment variable. For the list of supported
|
|
82
|
+
models, please refer to the following page: https://jina.ai/models
|
|
83
|
+
|
|
74
84
|
# Using OpenAI
|
|
75
85
|
```python
|
|
76
86
|
em_invoker = build_em_invoker(
|
|
@@ -128,6 +138,7 @@ def build_em_invoker(model_id: str | ModelId, credentials: str | dict[str, Any]
|
|
|
128
138
|
variables credentials, please refer to the following page:
|
|
129
139
|
https://python.langchain.com/docs/integrations/text_embedding/
|
|
130
140
|
|
|
141
|
+
|
|
131
142
|
Security warning:
|
|
132
143
|
Please provide the EM invoker credentials ONLY to the `credentials` parameter. Do not put any kind of
|
|
133
144
|
credentials in the `config` parameter as the content of the `config` parameter will be logged.
|
gllm_inference/constants.pyi
CHANGED
|
@@ -2,10 +2,12 @@ from _typeshed import Incomplete
|
|
|
2
2
|
|
|
3
3
|
AZURE_OPENAI_URL_SUFFIX: str
|
|
4
4
|
DOCUMENT_MIME_TYPES: Incomplete
|
|
5
|
+
EMBEDDING_ENDPOINT: str
|
|
5
6
|
GOOGLE_SCOPES: Incomplete
|
|
6
7
|
GRPC_ENABLE_RETRIES_KEY: str
|
|
7
|
-
INVOKER_PROPAGATED_MAX_RETRIES: int
|
|
8
|
-
INVOKER_DEFAULT_TIMEOUT: float
|
|
9
8
|
HEX_REPR_LENGTH: int
|
|
9
|
+
INVOKER_DEFAULT_TIMEOUT: float
|
|
10
|
+
INVOKER_PROPAGATED_MAX_RETRIES: int
|
|
11
|
+
JINA_DEFAULT_URL: str
|
|
10
12
|
OPENAI_DEFAULT_URL: str
|
|
11
13
|
SECONDS_TO_MILLISECONDS: int
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from gllm_inference.em_invoker.azure_openai_em_invoker import AzureOpenAIEMInvoker as AzureOpenAIEMInvoker
|
|
2
2
|
from gllm_inference.em_invoker.bedrock_em_invoker import BedrockEMInvoker as BedrockEMInvoker
|
|
3
|
+
from gllm_inference.em_invoker.cohere_em_invoker import CohereEMInvoker as CohereEMInvoker
|
|
3
4
|
from gllm_inference.em_invoker.google_em_invoker import GoogleEMInvoker as GoogleEMInvoker
|
|
5
|
+
from gllm_inference.em_invoker.jina_em_invoker import JinaEMInvoker as JinaEMInvoker
|
|
4
6
|
from gllm_inference.em_invoker.langchain_em_invoker import LangChainEMInvoker as LangChainEMInvoker
|
|
5
7
|
from gllm_inference.em_invoker.openai_compatible_em_invoker import OpenAICompatibleEMInvoker as OpenAICompatibleEMInvoker
|
|
6
8
|
from gllm_inference.em_invoker.openai_em_invoker import OpenAIEMInvoker as OpenAIEMInvoker
|
|
7
9
|
from gllm_inference.em_invoker.twelevelabs_em_invoker import TwelveLabsEMInvoker as TwelveLabsEMInvoker
|
|
8
10
|
from gllm_inference.em_invoker.voyage_em_invoker import VoyageEMInvoker as VoyageEMInvoker
|
|
9
11
|
|
|
10
|
-
__all__ = ['AzureOpenAIEMInvoker', 'BedrockEMInvoker', 'GoogleEMInvoker', 'LangChainEMInvoker', 'OpenAIEMInvoker', 'OpenAICompatibleEMInvoker', 'TwelveLabsEMInvoker', 'VoyageEMInvoker']
|
|
12
|
+
__all__ = ['AzureOpenAIEMInvoker', 'BedrockEMInvoker', 'CohereEMInvoker', 'GoogleEMInvoker', 'JinaEMInvoker', 'LangChainEMInvoker', 'OpenAIEMInvoker', 'OpenAICompatibleEMInvoker', 'TwelveLabsEMInvoker', 'VoyageEMInvoker']
|
|
@@ -0,0 +1,128 @@
|
|
|
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.schema.cohere import CohereInputType as CohereInputType, Key as Key
|
|
5
|
+
from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig, Vector as Vector
|
|
6
|
+
from gllm_inference.utils import validate_string_enum as validate_string_enum
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
SUPPORTED_ATTACHMENTS: Incomplete
|
|
10
|
+
MULTIMODAL_MODEL_VERSION: Incomplete
|
|
11
|
+
|
|
12
|
+
class CohereEMInvoker(BaseEMInvoker):
|
|
13
|
+
'''An embedding model invoker to interact with Cohere embedding models.
|
|
14
|
+
|
|
15
|
+
Attributes:
|
|
16
|
+
model_id (str): The model ID of the embedding model.
|
|
17
|
+
model_provider (str): The provider of the embedding model (Cohere).
|
|
18
|
+
model_name (str): The name of the Cohere embedding model.
|
|
19
|
+
client (AsyncClient): The asynchronous client for the Cohere API.
|
|
20
|
+
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
|
|
21
|
+
retry_config (RetryConfig): The retry configuration for the embedding model.
|
|
22
|
+
truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
|
|
23
|
+
input_type (CohereInputType): The input type for the embedding model. Supported values include:
|
|
24
|
+
1. `CohereInputType.SEARCH_DOCUMENT`,
|
|
25
|
+
2. `CohereInputType.SEARCH_QUERY`,
|
|
26
|
+
3. `CohereInputType.CLASSIFICATION`,
|
|
27
|
+
4. `CohereInputType.CLUSTERING`,
|
|
28
|
+
5. `CohereInputType.IMAGE`.
|
|
29
|
+
|
|
30
|
+
Initialization:
|
|
31
|
+
You can initialize the `CohereEMInvoker` as follows:
|
|
32
|
+
```python
|
|
33
|
+
em_invoker = CohereEMInvoker(
|
|
34
|
+
model_name="embed-english-v4.0",
|
|
35
|
+
input_type="search_document"
|
|
36
|
+
)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Note: The `input_type` parameter can be one of the following:
|
|
40
|
+
1. "search_document"
|
|
41
|
+
2. "search_query"
|
|
42
|
+
3. "classification"
|
|
43
|
+
4. "clustering"
|
|
44
|
+
5. "image"
|
|
45
|
+
|
|
46
|
+
This parameter is optional and defaults to "search_document". For more information about
|
|
47
|
+
input_type, please refer to https://docs.cohere.com/docs/embeddings#the-input_type-parameter.
|
|
48
|
+
|
|
49
|
+
Input types:
|
|
50
|
+
The `CohereEMInvoker` supports the following input types: text and image.
|
|
51
|
+
Non-text inputs must be passed as an `Attachment` object.
|
|
52
|
+
|
|
53
|
+
Output format:
|
|
54
|
+
The `CohereEMInvoker` can embed either:
|
|
55
|
+
1. A single content.
|
|
56
|
+
1. A single content is either a text or an image.
|
|
57
|
+
2. The output will be a `Vector`, representing the embedding of the content.
|
|
58
|
+
|
|
59
|
+
# Example 1: Embedding a text content.
|
|
60
|
+
```python
|
|
61
|
+
text = "What animal is in this image?"
|
|
62
|
+
result = await em_invoker.invoke(text)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
# Example 2: Embedding an image content.
|
|
66
|
+
```python
|
|
67
|
+
image = Attachment.from_path("path/to/local/image.png")
|
|
68
|
+
result = await em_invoker.invoke(image)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The above examples will return a `Vector` with a size of (embedding_size,).
|
|
72
|
+
|
|
73
|
+
2. A list of contents.
|
|
74
|
+
1. A list of contents is a list that consists of any of the above single contents.
|
|
75
|
+
2. The output will be a `list[Vector]`, where each element is a `Vector` representing the
|
|
76
|
+
embedding of each single content.
|
|
77
|
+
|
|
78
|
+
# Example: Embedding a list of contents.
|
|
79
|
+
```python
|
|
80
|
+
text = "What animal is in this image?"
|
|
81
|
+
image = Attachment.from_path("path/to/local/image.png")
|
|
82
|
+
result = await em_invoker.invoke([text, image])
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The above examples will return a `list[Vector]` with a size of (2, embedding_size).
|
|
86
|
+
|
|
87
|
+
Retry and timeout:
|
|
88
|
+
The `CohereEMInvoker` supports retry and timeout configuration.
|
|
89
|
+
By default, the max retries is set to 0 and the timeout is set to 30.0 seconds.
|
|
90
|
+
They can be customized by providing a custom `RetryConfig` object to the `retry_config` parameter.
|
|
91
|
+
|
|
92
|
+
Retry config examples:
|
|
93
|
+
```python
|
|
94
|
+
retry_config = RetryConfig(max_retries=0, timeout=None) # No retry, no timeout
|
|
95
|
+
retry_config = RetryConfig(max_retries=0, timeout=10.0) # No retry, 10.0 seconds timeout
|
|
96
|
+
retry_config = RetryConfig(max_retries=5, timeout=None) # 5 max retries, no timeout
|
|
97
|
+
retry_config = RetryConfig(max_retries=5, timeout=10.0) # 5 max retries, 10.0 seconds timeout
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Usage example:
|
|
101
|
+
```python
|
|
102
|
+
em_invoker = CohereEMInvoker(..., retry_config=retry_config)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
'''
|
|
106
|
+
input_type: Incomplete
|
|
107
|
+
client: Incomplete
|
|
108
|
+
def __init__(self, model_name: str, api_key: str | None = None, base_url: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None, input_type: CohereInputType = ...) -> None:
|
|
109
|
+
'''Initializes a new instance of the CohereEMInvoker class.
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
model_name (str): The name of the Cohere embedding model to be used.
|
|
113
|
+
api_key (str | None, optional): The API key for authenticating with Cohere. Defaults to None, in which
|
|
114
|
+
case the `COHERE_API_KEY` environment variable will be used.
|
|
115
|
+
base_url (str | None, optional): The base URL for a custom Cohere-compatible endpoint.
|
|
116
|
+
Defaults to None, in which case Cohere\'s default URL will be used.
|
|
117
|
+
model_kwargs (dict[str, Any] | None, optional): Additional keyword arguments for the Cohere client.
|
|
118
|
+
Defaults to None.
|
|
119
|
+
default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
|
|
120
|
+
Defaults to None.
|
|
121
|
+
retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
|
|
122
|
+
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
|
|
123
|
+
truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
|
|
124
|
+
Defaults to None, in which case no truncation is applied.
|
|
125
|
+
input_type (CohereInputType, optional): The input type for the embedding model.
|
|
126
|
+
Defaults to `CohereInputType.SEARCH_DOCUMENT`. Valid values are: "search_document", "search_query",
|
|
127
|
+
"classification", "clustering", and "image".
|
|
128
|
+
'''
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
|
+
from gllm_core.utils.retry import RetryConfig as RetryConfig
|
|
3
|
+
from gllm_inference.constants import EMBEDDING_ENDPOINT as EMBEDDING_ENDPOINT, JINA_DEFAULT_URL as JINA_DEFAULT_URL
|
|
4
|
+
from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
|
|
5
|
+
from gllm_inference.em_invoker.schema.jina import InputType as InputType, Key as Key
|
|
6
|
+
from gllm_inference.exceptions import BaseInvokerError as BaseInvokerError, ProviderInternalError as ProviderInternalError
|
|
7
|
+
from gllm_inference.exceptions.error_parser import convert_http_status_to_base_invoker_error as convert_http_status_to_base_invoker_error
|
|
8
|
+
from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, TruncationConfig as TruncationConfig, Vector as Vector
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
SUPPORTED_ATTACHMENTS: Incomplete
|
|
12
|
+
MULTIMODAL_MODELS: Incomplete
|
|
13
|
+
|
|
14
|
+
class JinaEMInvoker(BaseEMInvoker):
|
|
15
|
+
'''An embedding model invoker to interact with Jina AI embedding models.
|
|
16
|
+
|
|
17
|
+
Attributes:
|
|
18
|
+
model_id (str): The model ID of the embedding model.
|
|
19
|
+
model_provider (str): The provider of the embedding model.
|
|
20
|
+
model_name (str): The name of the embedding model.
|
|
21
|
+
client (AsyncClient): The client for the Jina AI API.
|
|
22
|
+
default_hyperparameters (dict[str, Any]): Default hyperparameters for invoking the embedding model.
|
|
23
|
+
retry_config (RetryConfig): The retry configuration for the embedding model.
|
|
24
|
+
truncation_config (TruncationConfig | None): The truncation configuration for the embedding model.
|
|
25
|
+
|
|
26
|
+
Input types:
|
|
27
|
+
The `JinaEMInvoker` supports the following input types: text and image.
|
|
28
|
+
Non-text inputs must be passed as a `Attachment` object.
|
|
29
|
+
|
|
30
|
+
Output format:
|
|
31
|
+
The `JinaEMInvoker` can embed either:
|
|
32
|
+
1. A single content.
|
|
33
|
+
1. A single content is either a text or an image.
|
|
34
|
+
2. The output will be a `Vector`, representing the embedding of the content.
|
|
35
|
+
|
|
36
|
+
# Example 1: Embedding a text content.
|
|
37
|
+
```python
|
|
38
|
+
text = "What animal is in this image?"
|
|
39
|
+
result = await em_invoker.invoke(text)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
# Example 2: Embedding an image content.
|
|
43
|
+
```python
|
|
44
|
+
image = Attachment.from_path("path/to/local/image.png")
|
|
45
|
+
result = await em_invoker.invoke(image)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The above examples will return a `Vector` with a size of (embedding_size,).
|
|
49
|
+
|
|
50
|
+
2. A list of contents.
|
|
51
|
+
1. A list of contents is a list that consists of any of the above single contents.
|
|
52
|
+
2. The output will be a `list[Vector]`, where each element is a `Vector` representing the
|
|
53
|
+
embedding of each single content.
|
|
54
|
+
|
|
55
|
+
# Example: Embedding a list of contents.
|
|
56
|
+
```python
|
|
57
|
+
text = "What animal is in this image?"
|
|
58
|
+
image = Attachment.from_path("path/to/local/image.png")
|
|
59
|
+
result = await em_invoker.invoke([text, image])
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The above examples will return a `list[Vector]` with a size of (2, embedding_size).
|
|
63
|
+
|
|
64
|
+
Retry and timeout:
|
|
65
|
+
The `JinaEMInvoker` supports retry and timeout configuration.
|
|
66
|
+
By default, the max retries is set to 0 and the timeout is set to 30.0 seconds.
|
|
67
|
+
They can be customized by providing a custom `RetryConfig` object to the `retry_config` parameter.
|
|
68
|
+
|
|
69
|
+
Retry config examples:
|
|
70
|
+
```python
|
|
71
|
+
retry_config = RetryConfig(max_retries=0, timeout=None) # No retry, no timeout
|
|
72
|
+
retry_config = RetryConfig(max_retries=0, timeout=10.0) # No retry, 10.0 seconds timeout
|
|
73
|
+
retry_config = RetryConfig(max_retries=5, timeout=None) # 5 max retries, no timeout
|
|
74
|
+
retry_config = RetryConfig(max_retries=5, timeout=10.0) # 5 max retries, 10.0 seconds timeout
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Usage example:
|
|
78
|
+
```python
|
|
79
|
+
em_invoker = JinaEMInvoker(..., retry_config=retry_config)
|
|
80
|
+
```
|
|
81
|
+
'''
|
|
82
|
+
client: Incomplete
|
|
83
|
+
model_kwargs: Incomplete
|
|
84
|
+
def __init__(self, model_name: str, api_key: str | None = None, base_url: str = ..., model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, retry_config: RetryConfig | None = None, truncation_config: TruncationConfig | None = None) -> None:
|
|
85
|
+
'''Initializes a new instance of the JinaEMInvoker class.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
model_name (str): The name of the Jina embedding model to be used.
|
|
89
|
+
api_key (str | None, optional): The API key for authenticating with Jina AI.
|
|
90
|
+
Defaults to None, in which case the `JINA_API_KEY` environment variable will be used.
|
|
91
|
+
base_url (str, optional): The base URL for the Jina AI API. Defaults to "https://api.jina.ai/v1".
|
|
92
|
+
model_kwargs (dict[str, Any] | None, optional): Additional keyword arguments for the HTTP client.
|
|
93
|
+
Defaults to None.
|
|
94
|
+
default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the model.
|
|
95
|
+
Defaults to None.
|
|
96
|
+
retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
|
|
97
|
+
Defaults to None, in which case a default config with no retry and 30.0 seconds timeout will be used.
|
|
98
|
+
truncation_config (TruncationConfig | None, optional): Configuration for text truncation behavior.
|
|
99
|
+
Defaults to None, in which case no truncation is applied.
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
ValueError: If neither `api_key` nor `JINA_API_KEY` environment variable is provided.
|
|
103
|
+
'''
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
|
|
3
|
+
class Key(StrEnum):
|
|
4
|
+
"""Defines valid keys in Cohere."""
|
|
5
|
+
BASE_URL = 'base_url'
|
|
6
|
+
IMAGE_URL = 'image_url'
|
|
7
|
+
INPUT_TYPE = 'input_type'
|
|
8
|
+
MAX_RETRIES = 'max_retries'
|
|
9
|
+
MODEL = 'model'
|
|
10
|
+
TIMEOUT = 'timeout'
|
|
11
|
+
TYPE = 'type'
|
|
12
|
+
URL = 'url'
|
|
13
|
+
|
|
14
|
+
class CohereInputType(StrEnum):
|
|
15
|
+
"""Defines valid embedding input types for Cohere embedding API."""
|
|
16
|
+
CLASSIFICATION = 'classification'
|
|
17
|
+
CLUSTERING = 'clustering'
|
|
18
|
+
IMAGE = 'image'
|
|
19
|
+
SEARCH_DOCUMENT = 'search_document'
|
|
20
|
+
SEARCH_QUERY = 'search_query'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from enum import StrEnum
|
|
2
|
+
|
|
3
|
+
class InputType(StrEnum):
|
|
4
|
+
"""Defines the supported input types for the Jina AI embedding API."""
|
|
5
|
+
IMAGE_URL = 'image_url'
|
|
6
|
+
TEXT = 'text'
|
|
7
|
+
|
|
8
|
+
class Key(StrEnum):
|
|
9
|
+
"""Defines key constants used in the Jina AI API payloads."""
|
|
10
|
+
DATA = 'data'
|
|
11
|
+
EMBEDDING = 'embedding'
|
|
12
|
+
ERROR = 'error'
|
|
13
|
+
IMAGE_URL = 'image_url'
|
|
14
|
+
INPUT = 'input'
|
|
15
|
+
JSON = 'json'
|
|
16
|
+
MESSAGE = 'message'
|
|
17
|
+
MODEL = 'model'
|
|
18
|
+
RESPONSE = 'response'
|
|
19
|
+
STATUS = 'status'
|
|
20
|
+
TASK = 'task'
|
|
21
|
+
TEXT = 'text'
|
|
22
|
+
TYPE = 'type'
|
|
23
|
+
URL = 'url'
|
|
24
|
+
|
|
25
|
+
class OutputType(StrEnum):
|
|
26
|
+
"""Defines the expected output types returned by the Jina AI embedding API."""
|
|
27
|
+
DATA = 'data'
|
|
28
|
+
EMBEDDING = 'embedding'
|
|
@@ -13,6 +13,7 @@ class ExtendedHTTPStatus(IntEnum):
|
|
|
13
13
|
HTTP_STATUS_TO_EXCEPTION_MAP: dict[int, type[BaseInvokerError]]
|
|
14
14
|
ANTHROPIC_ERROR_MAPPING: Incomplete
|
|
15
15
|
BEDROCK_ERROR_MAPPING: Incomplete
|
|
16
|
+
COHERE_ERROR_MAPPING: Incomplete
|
|
16
17
|
GOOGLE_ERROR_MAPPING: Incomplete
|
|
17
18
|
LANGCHAIN_ERROR_CODE_MAPPING: Incomplete
|
|
18
19
|
LITELLM_ERROR_MAPPING: Incomplete
|
|
@@ -7,7 +7,7 @@ from gllm_core.utils import RetryConfig
|
|
|
7
7
|
from gllm_inference.constants import DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES, INVOKER_DEFAULT_TIMEOUT as INVOKER_DEFAULT_TIMEOUT
|
|
8
8
|
from gllm_inference.exceptions import BaseInvokerError as BaseInvokerError, convert_to_base_invoker_error as convert_to_base_invoker_error
|
|
9
9
|
from gllm_inference.lm_invoker.batch import BatchOperations as BatchOperations
|
|
10
|
-
from gllm_inference.schema import
|
|
10
|
+
from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, BatchStatus as BatchStatus, LMEventType as LMEventType, LMInput as LMInput, LMOutput as LMOutput, Message as Message, MessageContent as MessageContent, MessageRole as MessageRole, ModelId as ModelId, Reasoning as Reasoning, ResponseSchema as ResponseSchema, ToolCall as ToolCall, ToolResult as ToolResult
|
|
11
11
|
from langchain_core.tools import Tool as LangChainTool
|
|
12
12
|
from typing import Any
|
|
13
13
|
|
|
@@ -2,7 +2,7 @@ from gllm_inference.schema.activity import Activity as Activity, MCPCallActivity
|
|
|
2
2
|
from gllm_inference.schema.attachment import Attachment as Attachment
|
|
3
3
|
from gllm_inference.schema.code_exec_result import CodeExecResult as CodeExecResult
|
|
4
4
|
from gllm_inference.schema.config import TruncationConfig as TruncationConfig
|
|
5
|
-
from gllm_inference.schema.enums import AttachmentType as AttachmentType, BatchStatus as BatchStatus, EmitDataType as EmitDataType, MessageRole as MessageRole, TruncateSide as TruncateSide
|
|
5
|
+
from gllm_inference.schema.enums import AttachmentType as AttachmentType, BatchStatus as BatchStatus, EmitDataType as EmitDataType, LMEventType as LMEventType, MessageRole as MessageRole, TruncateSide as TruncateSide
|
|
6
6
|
from gllm_inference.schema.events import ActivityEvent as ActivityEvent, CodeEvent as CodeEvent, ThinkingEvent as ThinkingEvent
|
|
7
7
|
from gllm_inference.schema.lm_input import LMInput as LMInput
|
|
8
8
|
from gllm_inference.schema.lm_output import LMOutput as LMOutput
|
|
@@ -15,4 +15,4 @@ from gllm_inference.schema.tool_call import ToolCall as ToolCall
|
|
|
15
15
|
from gllm_inference.schema.tool_result import ToolResult as ToolResult
|
|
16
16
|
from gllm_inference.schema.type_alias import EMContent as EMContent, MessageContent as MessageContent, ResponseSchema as ResponseSchema, Vector as Vector
|
|
17
17
|
|
|
18
|
-
__all__ = ['Activity', 'ActivityEvent', 'Attachment', 'AttachmentType', 'BatchStatus', 'CodeEvent', 'CodeExecResult', 'EMContent', 'EmitDataType', 'InputTokenDetails', 'LMInput', 'LMOutput', 'MCPCall', 'MCPCallActivity', 'MCPListToolsActivity', 'MCPServer', 'Message', 'MessageContent', 'MessageRole', 'ModelId', 'ModelProvider', 'OutputTokenDetails', 'Reasoning', 'ThinkingEvent', 'ResponseSchema', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector', 'WebSearchActivity']
|
|
18
|
+
__all__ = ['Activity', 'ActivityEvent', 'Attachment', 'AttachmentType', 'BatchStatus', 'CodeEvent', 'CodeExecResult', 'EMContent', 'EmitDataType', 'LMEventType', 'InputTokenDetails', 'LMInput', 'LMOutput', 'MCPCall', 'MCPCallActivity', 'MCPListToolsActivity', 'MCPServer', 'Message', 'MessageContent', 'MessageRole', 'ModelId', 'ModelProvider', 'OutputTokenDetails', 'Reasoning', 'ThinkingEvent', 'ResponseSchema', 'TokenUsage', 'ToolCall', 'ToolResult', 'TruncateSide', 'TruncationConfig', 'Vector', 'WebSearchActivity']
|
|
@@ -4,12 +4,13 @@ from pydantic import BaseModel
|
|
|
4
4
|
from typing import Literal
|
|
5
5
|
|
|
6
6
|
WEB_SEARCH_VISIBLE_FIELDS: Incomplete
|
|
7
|
+
WebSearchActivityTypes: Incomplete
|
|
7
8
|
|
|
8
9
|
class Activity(BaseModel):
|
|
9
10
|
"""Base schema for any activity.
|
|
10
11
|
|
|
11
12
|
Attributes:
|
|
12
|
-
type (str): The type of activity being performed.
|
|
13
|
+
type (str): The type of activity being performed. Defaults to an empty string.
|
|
13
14
|
"""
|
|
14
15
|
type: str
|
|
15
16
|
|
|
@@ -17,9 +18,10 @@ class MCPListToolsActivity(Activity):
|
|
|
17
18
|
"""Schema for listing tools in MCP.
|
|
18
19
|
|
|
19
20
|
Attributes:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
type (Literal[ActivityType.MCP_LIST_TOOLS]): The type of activity being performed.
|
|
22
|
+
Defaults to ActivityType.MCP_LIST_TOOLS.
|
|
23
|
+
server_name (str): The name of the MCP server. Defaults to an empty string.
|
|
24
|
+
tools (list[dict[str, str]] | None): The tools in the MCP server. Defaults to None.
|
|
23
25
|
"""
|
|
24
26
|
type: Literal[ActivityType.MCP_LIST_TOOLS]
|
|
25
27
|
server_name: str
|
|
@@ -29,10 +31,10 @@ class MCPCallActivity(Activity):
|
|
|
29
31
|
"""Schema for MCP tool call.
|
|
30
32
|
|
|
31
33
|
Attributes:
|
|
34
|
+
type (Literal[ActivityType.MCP_CALL]): The type of activity being performed. Defaults to ActivityType.MCP_CALL.
|
|
32
35
|
server_name (str): The name of the MCP server.
|
|
33
36
|
tool_name (str): The name of the tool.
|
|
34
37
|
args (dict[str, str]): The arguments of the tool.
|
|
35
|
-
type (str): The type of activity being performed.
|
|
36
38
|
"""
|
|
37
39
|
type: Literal[ActivityType.MCP_CALL]
|
|
38
40
|
server_name: str
|
|
@@ -43,16 +45,16 @@ class WebSearchActivity(Activity):
|
|
|
43
45
|
"""Schema for web search tool call.
|
|
44
46
|
|
|
45
47
|
Attributes:
|
|
46
|
-
type (
|
|
47
|
-
|
|
48
|
-
url (str): The URL of the page.
|
|
49
|
-
|
|
48
|
+
type (WebSearchActivityTypes): The type of activity being performed. Defaults to ActivityType.SEARCH.
|
|
49
|
+
query (str | None): The query of the web search. Defaults to None.
|
|
50
|
+
url (str | None): The URL of the page. Defaults to None.
|
|
51
|
+
pattern (str | None): The pattern of the web search. Defaults to None.
|
|
50
52
|
sources (list[dict[str, str]] | None): The sources of the web search.
|
|
51
53
|
"""
|
|
52
|
-
type:
|
|
54
|
+
type: WebSearchActivityTypes
|
|
55
|
+
query: str | None
|
|
53
56
|
url: str | None
|
|
54
57
|
pattern: str | None
|
|
55
|
-
query: str | None
|
|
56
58
|
sources: list[dict[str, str]] | None
|
|
57
59
|
def model_dump(self, *args, **kwargs) -> dict[str, str]:
|
|
58
60
|
"""Serialize the activity for display.
|
gllm_inference/schema/enums.pyi
CHANGED
|
@@ -14,6 +14,16 @@ class BatchStatus(StrEnum):
|
|
|
14
14
|
FINISHED = 'finished'
|
|
15
15
|
UNKNOWN = 'unknown'
|
|
16
16
|
|
|
17
|
+
class LMEventType(StrEnum):
|
|
18
|
+
"""Defines event types to be emitted by the LM invoker."""
|
|
19
|
+
ACTIVITY = 'activity'
|
|
20
|
+
CODE_START = 'code_start'
|
|
21
|
+
CODE = 'code'
|
|
22
|
+
CODE_END = 'code_end'
|
|
23
|
+
THINKING_START = 'thinking_start'
|
|
24
|
+
THINKING = 'thinking'
|
|
25
|
+
THINKING_END = 'thinking_end'
|
|
26
|
+
|
|
17
27
|
class EmitDataType(StrEnum):
|
|
18
28
|
"""Defines valid data types for emitting events."""
|
|
19
29
|
ACTIVITY = 'activity'
|
gllm_inference/schema/events.pyi
CHANGED
|
@@ -1,108 +1,123 @@
|
|
|
1
|
-
from
|
|
1
|
+
from _typeshed import Incomplete
|
|
2
2
|
from gllm_core.schema import Event
|
|
3
3
|
from gllm_inference.schema.activity import Activity as Activity
|
|
4
|
-
from gllm_inference.schema.enums import
|
|
5
|
-
from typing import Literal
|
|
4
|
+
from gllm_inference.schema.enums import LMEventType as LMEventType
|
|
5
|
+
from typing import Any, Literal
|
|
6
|
+
|
|
7
|
+
CodeEventType: Incomplete
|
|
8
|
+
ThinkingEventType: Incomplete
|
|
6
9
|
|
|
7
10
|
class ActivityEvent(Event):
|
|
8
|
-
"""Event schema for model-triggered activities (e.g. web search, MCP).
|
|
11
|
+
"""Event schema for model-triggered activities (e.g. web search, MCP call, etc.).
|
|
9
12
|
|
|
10
13
|
Attributes:
|
|
11
|
-
id (str): The
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
id (str): The ID of the activity event. Defaults to None.
|
|
15
|
+
value (dict[str, Any]): The value of the activity event.
|
|
16
|
+
level (EventLevel): The severity level of the activity event. Defaults to EventLevel.INFO.
|
|
17
|
+
type (Literal[EventType.ACTIVITY]): The type of the activity event. Defaults to EventType.ACTIVITY.
|
|
18
|
+
timestamp (datetime): The timestamp of the activity event. Defaults to the current timestamp.
|
|
19
|
+
metadata (dict[str, Any]): The metadata of the activity event. Defaults to an empty dictionary.
|
|
15
20
|
"""
|
|
16
|
-
|
|
17
|
-
type: Literal[
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
value: dict[str, Any]
|
|
22
|
+
type: Literal[LMEventType.ACTIVITY]
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_activity(cls, id_: str | None = None, activity: Activity | None = None) -> ActivityEvent:
|
|
25
|
+
"""Create an activity event from an Activity object.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
id_ (str | None, optional): The ID of the activity event. Defaults to None.
|
|
29
|
+
activity (Activity | None, optional): The activity object to create the event from.
|
|
30
|
+
Defaults to None, in which case the value will be an empty dictionary.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
ActivityEvent: The activity event.
|
|
34
|
+
"""
|
|
20
35
|
|
|
21
36
|
class CodeEvent(Event):
|
|
22
|
-
"""Event schema for model-
|
|
37
|
+
"""Event schema for model-generated code to be executed.
|
|
23
38
|
|
|
24
39
|
Attributes:
|
|
25
|
-
id (str): The
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
id (str): The ID of the code event. Defaults to None.
|
|
41
|
+
value (str): The value of the code event. Defaults to an empty string.
|
|
42
|
+
level (EventLevel): The severity level of the code event. Defaults to EventLevel.INFO.
|
|
43
|
+
type (CodeEventType): The type of the code event. Defaults to EventType.CODE.
|
|
44
|
+
timestamp (datetime): The timestamp of the code event. Defaults to the current timestamp.
|
|
45
|
+
metadata (dict[str, Any]): The metadata of the code event. Defaults to an empty dictionary.
|
|
29
46
|
"""
|
|
30
|
-
id: str
|
|
31
|
-
type: Literal[EmitDataType.CODE, EmitDataType.CODE_START, EmitDataType.CODE_END]
|
|
32
47
|
value: str
|
|
33
|
-
|
|
48
|
+
type: CodeEventType
|
|
34
49
|
@classmethod
|
|
35
|
-
def start(cls, id_: str | None =
|
|
50
|
+
def start(cls, id_: str | None = None) -> CodeEvent:
|
|
36
51
|
"""Create a code start event.
|
|
37
52
|
|
|
38
53
|
Args:
|
|
39
|
-
id_ (str | None): The
|
|
54
|
+
id_ (str | None, optional): The ID of the code event. Defaults to None.
|
|
40
55
|
|
|
41
56
|
Returns:
|
|
42
57
|
CodeEvent: The code start event.
|
|
43
58
|
"""
|
|
44
59
|
@classmethod
|
|
45
|
-
def content(cls, id_: str | None =
|
|
60
|
+
def content(cls, id_: str | None = None, value: str = '') -> CodeEvent:
|
|
46
61
|
"""Create a code content event.
|
|
47
62
|
|
|
48
63
|
Args:
|
|
49
|
-
id_ (str | None): The
|
|
50
|
-
value (str): The code content.
|
|
64
|
+
id_ (str | None, optional): The ID of the code event. Defaults to None.
|
|
65
|
+
value (str, optional): The code content. Defaults to an empty string.
|
|
51
66
|
|
|
52
67
|
Returns:
|
|
53
68
|
CodeEvent: The code value event.
|
|
54
69
|
"""
|
|
55
70
|
@classmethod
|
|
56
|
-
def end(cls, id_: str | None =
|
|
71
|
+
def end(cls, id_: str | None = None) -> CodeEvent:
|
|
57
72
|
"""Create a code end event.
|
|
58
73
|
|
|
59
74
|
Args:
|
|
60
|
-
id_ (str | None): The
|
|
75
|
+
id_ (str | None, optional): The ID of the code event. Defaults to None.
|
|
61
76
|
|
|
62
77
|
Returns:
|
|
63
78
|
CodeEvent: The code end event.
|
|
64
79
|
"""
|
|
65
80
|
|
|
66
81
|
class ThinkingEvent(Event):
|
|
67
|
-
"""Event schema for model thinking.
|
|
82
|
+
"""Event schema for model-generated thinking.
|
|
68
83
|
|
|
69
84
|
Attributes:
|
|
70
|
-
id (str): The
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
85
|
+
id (str): The ID of the thinking event. Defaults to None.
|
|
86
|
+
value (str): The value of the thinking event. Defaults to an empty string.
|
|
87
|
+
level (EventLevel): The severity level of the thinking event. Defaults to EventLevel.INFO.
|
|
88
|
+
type (ThinkingEventType): The type of the thinking event. Defaults to EventType.THINKING.
|
|
89
|
+
timestamp (datetime): The timestamp of the thinking event. Defaults to the current timestamp.
|
|
90
|
+
metadata (dict[str, Any]): The metadata of the thinking event. Defaults to an empty dictionary.
|
|
74
91
|
"""
|
|
75
|
-
id: str
|
|
76
|
-
type: Literal[EmitDataType.THINKING, EmitDataType.THINKING_START, EmitDataType.THINKING_END]
|
|
77
92
|
value: str
|
|
78
|
-
|
|
93
|
+
type: ThinkingEventType
|
|
79
94
|
@classmethod
|
|
80
|
-
def start(cls, id_: str | None =
|
|
95
|
+
def start(cls, id_: str | None = None) -> ThinkingEvent:
|
|
81
96
|
"""Create a thinking start event.
|
|
82
97
|
|
|
83
98
|
Args:
|
|
84
|
-
id_ (str | None): The
|
|
99
|
+
id_ (str | None, optional): The ID of the thinking event. Defaults to None.
|
|
85
100
|
|
|
86
101
|
Returns:
|
|
87
102
|
ThinkingEvent: The thinking start event.
|
|
88
103
|
"""
|
|
89
104
|
@classmethod
|
|
90
|
-
def content(cls, id_: str | None =
|
|
105
|
+
def content(cls, id_: str | None = None, value: str = '') -> ThinkingEvent:
|
|
91
106
|
"""Create a thinking value event.
|
|
92
107
|
|
|
93
108
|
Args:
|
|
94
|
-
id_ (str | None): The
|
|
95
|
-
value (str): The thinking content or message.
|
|
109
|
+
id_ (str | None, optional): The ID of the thinking event. Defaults to None.
|
|
110
|
+
value (str, optional): The thinking content or message. Defaults to an empty string.
|
|
96
111
|
|
|
97
112
|
Returns:
|
|
98
113
|
ThinkingEvent: The thinking value event.
|
|
99
114
|
"""
|
|
100
115
|
@classmethod
|
|
101
|
-
def end(cls, id_: str | None =
|
|
116
|
+
def end(cls, id_: str | None = None) -> ThinkingEvent:
|
|
102
117
|
"""Create a thinking end event.
|
|
103
118
|
|
|
104
119
|
Args:
|
|
105
|
-
id_ (str | None): The
|
|
120
|
+
id_ (str | None, optional): The ID of the thinking event. Defaults to None.
|
|
106
121
|
|
|
107
122
|
Returns:
|
|
108
123
|
ThinkingEvent: The thinking end event.
|
|
@@ -12,8 +12,10 @@ class ModelProvider(StrEnum):
|
|
|
12
12
|
ANTHROPIC = 'anthropic'
|
|
13
13
|
AZURE_OPENAI = 'azure-openai'
|
|
14
14
|
BEDROCK = 'bedrock'
|
|
15
|
+
COHERE = 'cohere'
|
|
15
16
|
DATASAUR = 'datasaur'
|
|
16
17
|
GOOGLE = 'google'
|
|
18
|
+
JINA = 'jina'
|
|
17
19
|
LANGCHAIN = 'langchain'
|
|
18
20
|
LITELLM = 'litellm'
|
|
19
21
|
OPENAI = 'openai'
|
|
@@ -45,6 +47,11 @@ class ModelId(BaseModel):
|
|
|
45
47
|
model_id = ModelId.from_string("bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0")
|
|
46
48
|
```
|
|
47
49
|
|
|
50
|
+
# Using Cohere
|
|
51
|
+
```python
|
|
52
|
+
model_id = ModelId.from_string("cohere/embed-english-v3.0")
|
|
53
|
+
```
|
|
54
|
+
|
|
48
55
|
# Using Datasaur
|
|
49
56
|
```python
|
|
50
57
|
model_id = ModelId.from_string("datasaur/https://deployment.datasaur.ai/api/deployment/teamId/deploymentId/")
|
|
@@ -55,6 +62,13 @@ class ModelId(BaseModel):
|
|
|
55
62
|
model_id = ModelId.from_string("google/gemini-2.5-flash-lite")
|
|
56
63
|
```
|
|
57
64
|
|
|
65
|
+
# Using Jina
|
|
66
|
+
```python
|
|
67
|
+
model_id = ModelId.from_string("jina/jina-embeddings-v2-large")
|
|
68
|
+
```
|
|
69
|
+
For the list of supported models, please refer to the following page:
|
|
70
|
+
https://jina.ai/models
|
|
71
|
+
|
|
58
72
|
# Using OpenAI
|
|
59
73
|
```python
|
|
60
74
|
model_id = ModelId.from_string("openai/gpt-5-nano")
|
|
@@ -94,6 +108,7 @@ class ModelId(BaseModel):
|
|
|
94
108
|
```python
|
|
95
109
|
model_id = ModelId.from_string("langchain/langchain_openai.ChatOpenAI:gpt-4o-mini")
|
|
96
110
|
```
|
|
111
|
+
|
|
97
112
|
For the list of supported providers, please refer to the following table:
|
|
98
113
|
https://python.langchain.com/docs/integrations/chat/#featured-providers
|
|
99
114
|
|
|
Binary file
|
gllm_inference.pyi
CHANGED
|
@@ -14,7 +14,9 @@ import gllm_core
|
|
|
14
14
|
import gllm_core.utils
|
|
15
15
|
import gllm_inference.em_invoker.AzureOpenAIEMInvoker
|
|
16
16
|
import gllm_inference.em_invoker.BedrockEMInvoker
|
|
17
|
+
import gllm_inference.em_invoker.CohereEMInvoker
|
|
17
18
|
import gllm_inference.em_invoker.GoogleEMInvoker
|
|
19
|
+
import gllm_inference.em_invoker.JinaEMInvoker
|
|
18
20
|
import gllm_inference.em_invoker.LangChainEMInvoker
|
|
19
21
|
import gllm_inference.em_invoker.OpenAICompatibleEMInvoker
|
|
20
22
|
import gllm_inference.em_invoker.OpenAIEMInvoker
|
|
@@ -50,16 +52,21 @@ import gllm_inference.exceptions.BaseInvokerError
|
|
|
50
52
|
import gllm_inference.exceptions.convert_http_status_to_base_invoker_error
|
|
51
53
|
import gllm_inference.schema.Vector
|
|
52
54
|
import aioboto3
|
|
53
|
-
import
|
|
54
|
-
import gllm_inference.exceptions.convert_to_base_invoker_error
|
|
55
|
+
import base64
|
|
55
56
|
import gllm_inference.schema.Attachment
|
|
56
57
|
import gllm_inference.schema.AttachmentType
|
|
57
58
|
import gllm_inference.schema.EMContent
|
|
59
|
+
import gllm_inference.utils.validate_string_enum
|
|
60
|
+
import cohere
|
|
61
|
+
import asyncio.CancelledError
|
|
62
|
+
import gllm_inference.exceptions.convert_to_base_invoker_error
|
|
58
63
|
import gllm_inference.schema.TruncateSide
|
|
59
64
|
import google
|
|
60
65
|
import google.auth
|
|
61
66
|
import google.genai
|
|
62
67
|
import google.genai.types
|
|
68
|
+
import httpx
|
|
69
|
+
import gllm_inference.exceptions.ProviderInternalError
|
|
63
70
|
import concurrent
|
|
64
71
|
import concurrent.futures
|
|
65
72
|
import concurrent.futures.ThreadPoolExecutor
|
|
@@ -71,9 +78,7 @@ import gllm_inference.utils.load_langchain_model
|
|
|
71
78
|
import gllm_inference.utils.parse_model_data
|
|
72
79
|
import openai
|
|
73
80
|
import io
|
|
74
|
-
import httpx
|
|
75
81
|
import twelvelabs
|
|
76
|
-
import base64
|
|
77
82
|
import sys
|
|
78
83
|
import voyageai
|
|
79
84
|
import voyageai.client_async
|
|
@@ -109,9 +114,8 @@ import inspect
|
|
|
109
114
|
import time
|
|
110
115
|
import jsonschema
|
|
111
116
|
import gllm_inference.lm_invoker.batch.BatchOperations
|
|
112
|
-
import gllm_inference.schema.
|
|
117
|
+
import gllm_inference.schema.LMEventType
|
|
113
118
|
import gllm_inference.schema.MessageContent
|
|
114
|
-
import gllm_inference.utils.validate_string_enum
|
|
115
119
|
import __future__
|
|
116
120
|
import gllm_inference.schema.ActivityEvent
|
|
117
121
|
import gllm_inference.schema.CodeEvent
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: gllm-inference-binary
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.44
|
|
4
4
|
Summary: A library containing components related to model inferences in Gen AI applications.
|
|
5
5
|
Author-email: Henry Wicaksono <henry.wicaksono@gdplabs.id>, Resti Febrina <resti.febrina@gdplabs.id>
|
|
6
6
|
Requires-Python: <3.14,>=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Requires-Dist: poetry<3.0.0,>=2.1.3
|
|
9
|
-
Requires-Dist: gllm-core-binary<0.4.0,>=0.3.
|
|
9
|
+
Requires-Dist: gllm-core-binary<0.4.0,>=0.3.21
|
|
10
10
|
Requires-Dist: aiohttp<4.0.0,>=3.12.14
|
|
11
11
|
Requires-Dist: filetype<2.0.0,>=1.2.0
|
|
12
12
|
Requires-Dist: httpx<0.29.0,>=0.28.0
|
|
@@ -30,6 +30,8 @@ Provides-Extra: anthropic
|
|
|
30
30
|
Requires-Dist: anthropic<0.61.0,>=0.60.0; extra == "anthropic"
|
|
31
31
|
Provides-Extra: bedrock
|
|
32
32
|
Requires-Dist: aioboto3<16.0.0,>=15.0.0; extra == "bedrock"
|
|
33
|
+
Provides-Extra: cohere
|
|
34
|
+
Requires-Dist: cohere<6.0.0,>=5.18.0; extra == "cohere"
|
|
33
35
|
Provides-Extra: datasaur
|
|
34
36
|
Requires-Dist: openai<2.0.0,>=1.98.0; extra == "datasaur"
|
|
35
37
|
Provides-Extra: google
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
gllm_inference.cpython-311-darwin.so,sha256=
|
|
2
|
-
gllm_inference.pyi,sha256=
|
|
1
|
+
gllm_inference.cpython-311-darwin.so,sha256=nhIC8jkaabVyzvYoCVRoT4CErxh5p7z0UVojf4-kEUM,5313240
|
|
2
|
+
gllm_inference.pyi,sha256=Ue4h4rmHxeDhBKu4Ofd6wTgDBxxsFhd_CxTCvtQgZpA,4898
|
|
3
3
|
gllm_inference/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
gllm_inference/constants.pyi,sha256=
|
|
4
|
+
gllm_inference/constants.pyi,sha256=viU-ACRbVSGvsCJ0FQmuR1yhyl-BzoHDVIWo5cwHmF0,337
|
|
5
5
|
gllm_inference/builder/__init__.pyi,sha256=usz2lvfwO4Yk-ZGKXbCWG1cEr3nlQXxMNDNC-2yc1NM,500
|
|
6
|
-
gllm_inference/builder/build_em_invoker.pyi,sha256=
|
|
6
|
+
gllm_inference/builder/build_em_invoker.pyi,sha256=YunCB3g7gRSYVDRayjz38QCw77_el2e-0iqdOH6KS1Y,6138
|
|
7
7
|
gllm_inference/builder/build_lm_invoker.pyi,sha256=3hiIurQ3TC7kEZPflJ6_byCNnEdcd5BEIz07ii4TAzY,7292
|
|
8
8
|
gllm_inference/builder/build_lm_request_processor.pyi,sha256=KbQkcPa8C-yzyelht4mWLP8kDmh17itAT3tn8ZJB6pg,4144
|
|
9
9
|
gllm_inference/builder/build_output_parser.pyi,sha256=_Lrq-bh1oPsb_Nwkkr_zyEUwIOMysRFZkvEtEM29LZM,936
|
|
@@ -11,11 +11,13 @@ gllm_inference/catalog/__init__.pyi,sha256=JBkPGTyiiZ30GECzJBW-mW8LekWyY2qyzal3e
|
|
|
11
11
|
gllm_inference/catalog/catalog.pyi,sha256=a4RNG1lKv51GxQpOqh47tz-PAROMPaeP2o5XNLBSZaU,4790
|
|
12
12
|
gllm_inference/catalog/lm_request_processor_catalog.pyi,sha256=WW1j8jWujnatF0c9rCk94CyobtFe3gOky2vjoGCV6nw,5424
|
|
13
13
|
gllm_inference/catalog/prompt_builder_catalog.pyi,sha256=OU8k_4HbqjZEzHZlzSM3uzGQZJmM2uGD76Csqom0CEQ,3197
|
|
14
|
-
gllm_inference/em_invoker/__init__.pyi,sha256=
|
|
14
|
+
gllm_inference/em_invoker/__init__.pyi,sha256=FHFR4k8RqtdMNZkda6A89tvWFtIoxF-t_NahDGeBQ2k,1199
|
|
15
15
|
gllm_inference/em_invoker/azure_openai_em_invoker.pyi,sha256=fE-RZ10Leerbyqp8ISXeqdU_m0kaHdlHml_nQqwFjqY,4961
|
|
16
16
|
gllm_inference/em_invoker/bedrock_em_invoker.pyi,sha256=hbKdar6Alu27gOPPASND1ptJIK1PPmj7NjgKwItnOgo,5725
|
|
17
|
+
gllm_inference/em_invoker/cohere_em_invoker.pyi,sha256=LSNVGx58JdSP2YB6CziOS_v5VuSLdARVpBBWhz8t5E4,6665
|
|
17
18
|
gllm_inference/em_invoker/em_invoker.pyi,sha256=KGjLiAWGIA3ziV50zMwSzx6lTVUbYspQCl4LFxqbDlY,5101
|
|
18
19
|
gllm_inference/em_invoker/google_em_invoker.pyi,sha256=OgIQhT2g6g09Hqr9mc2--MjV3Ti-XuHfqLTunvcqU1k,6824
|
|
20
|
+
gllm_inference/em_invoker/jina_em_invoker.pyi,sha256=WZJ8BeaqxrAGMrUtIEUy3itcOEzvRQYEwe0gazIv6ng,5651
|
|
19
21
|
gllm_inference/em_invoker/langchain_em_invoker.pyi,sha256=BhZjkYZoxQXPJjP0PgA8W0xrtwiqDkW5E6NpGit0h1E,3498
|
|
20
22
|
gllm_inference/em_invoker/openai_compatible_em_invoker.pyi,sha256=z4_jEuaprna6AJF2wXH-JgmynpVFXeb2HQZr-0ATmMw,2882
|
|
21
23
|
gllm_inference/em_invoker/openai_em_invoker.pyi,sha256=tb6cXTvAGr01MMSc96mYWDqK-EK_VCdDOQ-Be0_EZfM,6195
|
|
@@ -25,7 +27,9 @@ gllm_inference/em_invoker/langchain/__init__.pyi,sha256=VYGKE5OgU0my1RlhgzkU_A7-
|
|
|
25
27
|
gllm_inference/em_invoker/langchain/em_invoker_embeddings.pyi,sha256=VU3-Vhb9BCDhJo8PPdWHe2rBEOCs_HMXT6ZaWwjUzZE,3304
|
|
26
28
|
gllm_inference/em_invoker/schema/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
29
|
gllm_inference/em_invoker/schema/bedrock.pyi,sha256=AHFW8uYOTS7RtqV1RmtY-XQK1xpMgsHxWg4RZhVgI_8,476
|
|
30
|
+
gllm_inference/em_invoker/schema/cohere.pyi,sha256=UTbTtePRR1zJMsM09SiTZSZZP0IaUGaODvc7ZqH9S8c,547
|
|
28
31
|
gllm_inference/em_invoker/schema/google.pyi,sha256=ovDlvinu99QJhIxMkvVUoGBEFkkEoAZhadSuk0nI9N8,181
|
|
32
|
+
gllm_inference/em_invoker/schema/jina.pyi,sha256=hD7ZJeoZzg-2bhYIjxCAi7dbavbA785ezRDay7cZy7o,711
|
|
29
33
|
gllm_inference/em_invoker/schema/langchain.pyi,sha256=edcUvc1IHoSMFwqV83uqWqd0U3fLhkyWQjVknvjHI8U,112
|
|
30
34
|
gllm_inference/em_invoker/schema/openai.pyi,sha256=Q_dsEcodkOXYXPdrkOkW0LnuLhfeq8tEbtZAGMz2ajA,139
|
|
31
35
|
gllm_inference/em_invoker/schema/openai_compatible.pyi,sha256=gmvGtsWoOMBelke_tZjC6dKimFBW9f4Vrgv0Ig0OM9Q,150
|
|
@@ -34,7 +38,7 @@ gllm_inference/em_invoker/schema/voyage.pyi,sha256=HVpor0fqNy-IwapCICfsgFmqf1FJX
|
|
|
34
38
|
gllm_inference/exceptions/__init__.pyi,sha256=Upcuj7od2lkbdueQ0iMT2ktFYYi-KKTynTLAaxWDTjU,1214
|
|
35
39
|
gllm_inference/exceptions/error_parser.pyi,sha256=IOfa--NpLUW5E9Qq0mwWi6ZpTAbUyyNe6iAqunBNGLI,1999
|
|
36
40
|
gllm_inference/exceptions/exceptions.pyi,sha256=Bv996qLa_vju0Qjf4GewMxdkq8CV9LRZb0S6289DldA,5725
|
|
37
|
-
gllm_inference/exceptions/provider_error_map.pyi,sha256=
|
|
41
|
+
gllm_inference/exceptions/provider_error_map.pyi,sha256=XPLWU42-r8MHZgg5ZkE80Gdqg3p8Z_JHvq_Na03iTqY,1243
|
|
38
42
|
gllm_inference/lm_invoker/__init__.pyi,sha256=IGF3h8Z7Yr0bLrkDMRTDVPNBU6Y3liJabW3acjstJDY,1374
|
|
39
43
|
gllm_inference/lm_invoker/anthropic_lm_invoker.pyi,sha256=tsO9WJRj7l4auLc2vxftMX-niWJ9dlYwUIeiTL2FtIo,16392
|
|
40
44
|
gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi,sha256=6aqQdwVNLO9bDNrqcO8s75IJAN2hLSGvhO6VeDyz44w,14347
|
|
@@ -43,7 +47,7 @@ gllm_inference/lm_invoker/datasaur_lm_invoker.pyi,sha256=6DTnHsCFtGkwqVIlvmIZqKQ
|
|
|
43
47
|
gllm_inference/lm_invoker/google_lm_invoker.pyi,sha256=vbnh9PxtEtK740QEgqk6a7sBmtuvOPQ5_1Z3UDSonR4,17338
|
|
44
48
|
gllm_inference/lm_invoker/langchain_lm_invoker.pyi,sha256=NViXl_eGfFGVwLKjJ5OFdV78oay85YLgBZ8QVJGbaLA,12491
|
|
45
49
|
gllm_inference/lm_invoker/litellm_lm_invoker.pyi,sha256=FHAxghha7Jfjjnty0gwgmcWRdEke_tr-54PkKc9BRUU,12404
|
|
46
|
-
gllm_inference/lm_invoker/lm_invoker.pyi,sha256=
|
|
50
|
+
gllm_inference/lm_invoker/lm_invoker.pyi,sha256=YfwlV5uJwwoC0uJ54qsF2PZ5eoX85kUWV14nEiBvXTM,8501
|
|
47
51
|
gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi,sha256=zdHK-YmfplLmvwi1VASm2zvqqyLMoVSMHh2ggqaHIDA,14905
|
|
48
52
|
gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi,sha256=i5pMpZf4-r_7FQ1qfsqcjpc98sI-cPiqheuTfTEKxJs,4192
|
|
49
53
|
gllm_inference/lm_invoker/openai_lm_invoker.pyi,sha256=YplNfGRnLAv9puh_9hhCiQ3HbVD3XIZAkyvBR06qCpg,23019
|
|
@@ -95,18 +99,18 @@ gllm_inference/realtime_chat/output_streamer/output_streamer.pyi,sha256=GPAw1wPS
|
|
|
95
99
|
gllm_inference/request_processor/__init__.pyi,sha256=hVnfdNZnkTBJHnmLtN3Na4ANP0yK6AstWdIizVr2Apo,227
|
|
96
100
|
gllm_inference/request_processor/lm_request_processor.pyi,sha256=VnYc8E3Iayyhw-rPnGPfTKuO3ohgFsS8HPrZJeyES5I,5889
|
|
97
101
|
gllm_inference/request_processor/uses_lm_mixin.pyi,sha256=Yu0XPNuHxq1tWBviHTPw1oThojneFwGHepvGjBXxKQA,6382
|
|
98
|
-
gllm_inference/schema/__init__.pyi,sha256=
|
|
99
|
-
gllm_inference/schema/activity.pyi,sha256=
|
|
102
|
+
gllm_inference/schema/__init__.pyi,sha256=CSyh7FmQWkIasNderPd5xDptlu-CliGSzXbDV7j4KyA,2159
|
|
103
|
+
gllm_inference/schema/activity.pyi,sha256=JnO2hqj91P5Tc6qb4pbkEMrHer2u5owiCvhl-igcQKQ,2303
|
|
100
104
|
gllm_inference/schema/attachment.pyi,sha256=jApuzjOHJDCz4lr4MlHzBgIndh559nbWu2Xp1fk3hso,3297
|
|
101
105
|
gllm_inference/schema/code_exec_result.pyi,sha256=ZTHh6JtRrPIdQ059P1UAiD2L-tAO1_S5YcMsAXfJ5A0,559
|
|
102
106
|
gllm_inference/schema/config.pyi,sha256=rAL_UeXyQeXVk1P2kqd8vFWOMwmKenfpQLtvMP74t9s,674
|
|
103
|
-
gllm_inference/schema/enums.pyi,sha256=
|
|
104
|
-
gllm_inference/schema/events.pyi,sha256=
|
|
107
|
+
gllm_inference/schema/enums.pyi,sha256=RkHW2GQisgHBvYQ928D6olpL6GYehv65g8uoiGVsWUM,1612
|
|
108
|
+
gllm_inference/schema/events.pyi,sha256=3dJtYRuofgFDW1-kqV7PQw0WVyraEYC9je8196K-Cf8,4934
|
|
105
109
|
gllm_inference/schema/lm_input.pyi,sha256=A5pjz1id6tP9XRNhzQrbmzd66C_q3gzo0UP8rCemz6Q,193
|
|
106
110
|
gllm_inference/schema/lm_output.pyi,sha256=1SZi6vIWvmrZlVQ59WeQUKO5VhKrLHsSRDYslEH9d7o,2435
|
|
107
111
|
gllm_inference/schema/mcp.pyi,sha256=Vwu8E2BDl6FvvnI42gIyY3Oki1BdwRE3Uh3aV0rmhQU,1014
|
|
108
112
|
gllm_inference/schema/message.pyi,sha256=VP9YppKj2mo1esl9cy6qQO9m2mMHUjTmfGDdyUor880,2220
|
|
109
|
-
gllm_inference/schema/model_id.pyi,sha256=
|
|
113
|
+
gllm_inference/schema/model_id.pyi,sha256=L2bbG6p3HyKn1naecgc8SNGBaqeH8i9CcUDgd-whP-A,5652
|
|
110
114
|
gllm_inference/schema/reasoning.pyi,sha256=SlTuiDw87GdnAn-I6YOPIJRhEBiwQljM46JohG05guQ,562
|
|
111
115
|
gllm_inference/schema/token_usage.pyi,sha256=1GTQVORV0dBNmD_jix8aVaUqxMKFF04KpLP7y2urqbk,2950
|
|
112
116
|
gllm_inference/schema/tool_call.pyi,sha256=zQaVxCnkVxOfOEhBidqohU85gb4PRwnwBiygKaunamk,389
|
|
@@ -117,7 +121,7 @@ gllm_inference/utils/io_utils.pyi,sha256=7kUTacHAVRYoemFUOjCH7-Qmw-YsQGd6rGYxjf_
|
|
|
117
121
|
gllm_inference/utils/langchain.pyi,sha256=VluQiHkGigDdqLUbhB6vnXiISCP5hHqV0qokYY6dC1A,1164
|
|
118
122
|
gllm_inference/utils/validation.pyi,sha256=toxBtRp-VItC_X7sNi-GDd7sjibBdWMrR0q01OI2D7k,385
|
|
119
123
|
gllm_inference.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
|
|
120
|
-
gllm_inference_binary-0.5.
|
|
121
|
-
gllm_inference_binary-0.5.
|
|
122
|
-
gllm_inference_binary-0.5.
|
|
123
|
-
gllm_inference_binary-0.5.
|
|
124
|
+
gllm_inference_binary-0.5.44.dist-info/METADATA,sha256=ioEKrM2Qov6BNbvcQnR_WCkCwW8jeN4KuZNfXCjZbw4,5716
|
|
125
|
+
gllm_inference_binary-0.5.44.dist-info/WHEEL,sha256=s8TBzVnsSJujxqbMe-G5Vh0IPlslLTnVva4BiQ75Hjo,105
|
|
126
|
+
gllm_inference_binary-0.5.44.dist-info/top_level.txt,sha256=FpOjtN80F-qVNgbScXSEyqa0w09FYn6301iq6qt69IQ,15
|
|
127
|
+
gllm_inference_binary-0.5.44.dist-info/RECORD,,
|
|
File without changes
|
{gllm_inference_binary-0.5.41.dist-info → gllm_inference_binary-0.5.44.dist-info}/top_level.txt
RENAMED
|
File without changes
|