gllm-inference-binary 0.4.62__cp311-cp311-manylinux_2_31_x86_64.whl → 0.5.1__cp311-cp311-manylinux_2_31_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gllm-inference-binary might be problematic. Click here for more details.

Files changed (85) hide show
  1. gllm_inference/builder/build_lm_request_processor.pyi +1 -4
  2. gllm_inference/catalog/catalog.pyi +34 -38
  3. gllm_inference/catalog/lm_request_processor_catalog.pyi +4 -10
  4. gllm_inference/catalog/prompt_builder_catalog.pyi +25 -37
  5. gllm_inference/constants.pyi +0 -3
  6. gllm_inference/em_invoker/__init__.pyi +1 -4
  7. gllm_inference/em_invoker/em_invoker.pyi +6 -25
  8. gllm_inference/em_invoker/google_em_invoker.pyi +1 -1
  9. gllm_inference/em_invoker/langchain/__init__.pyi +1 -2
  10. gllm_inference/em_invoker/langchain_em_invoker.pyi +2 -12
  11. gllm_inference/em_invoker/openai_em_invoker.pyi +1 -1
  12. gllm_inference/em_invoker/twelevelabs_em_invoker.pyi +2 -18
  13. gllm_inference/em_invoker/voyage_em_invoker.pyi +2 -5
  14. gllm_inference/lm_invoker/__init__.pyi +1 -4
  15. gllm_inference/lm_invoker/anthropic_lm_invoker.pyi +7 -29
  16. gllm_inference/lm_invoker/azure_openai_lm_invoker.pyi +5 -18
  17. gllm_inference/lm_invoker/bedrock_lm_invoker.pyi +6 -14
  18. gllm_inference/lm_invoker/datasaur_lm_invoker.pyi +7 -14
  19. gllm_inference/lm_invoker/google_lm_invoker.pyi +7 -21
  20. gllm_inference/lm_invoker/langchain_lm_invoker.pyi +8 -21
  21. gllm_inference/lm_invoker/litellm_lm_invoker.pyi +6 -13
  22. gllm_inference/lm_invoker/lm_invoker.pyi +17 -18
  23. gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi +8 -22
  24. gllm_inference/lm_invoker/openai_lm_invoker.pyi +18 -24
  25. gllm_inference/prompt_builder/__init__.pyi +1 -6
  26. gllm_inference/prompt_builder/prompt_builder.pyi +9 -102
  27. gllm_inference/prompt_formatter/agnostic_prompt_formatter.pyi +4 -4
  28. gllm_inference/prompt_formatter/huggingface_prompt_formatter.pyi +4 -4
  29. gllm_inference/prompt_formatter/llama_prompt_formatter.pyi +3 -3
  30. gllm_inference/prompt_formatter/mistral_prompt_formatter.pyi +3 -3
  31. gllm_inference/prompt_formatter/openai_prompt_formatter.pyi +4 -4
  32. gllm_inference/prompt_formatter/prompt_formatter.pyi +4 -4
  33. gllm_inference/request_processor/lm_request_processor.pyi +12 -25
  34. gllm_inference/request_processor/uses_lm_mixin.pyi +4 -10
  35. gllm_inference/schema/__init__.pyi +11 -4
  36. gllm_inference/schema/attachment.pyi +76 -0
  37. gllm_inference/schema/code_exec_result.pyi +14 -0
  38. gllm_inference/schema/enums.pyi +9 -9
  39. gllm_inference/schema/lm_output.pyi +36 -0
  40. gllm_inference/schema/message.pyi +52 -0
  41. gllm_inference/schema/model_id.pyi +1 -1
  42. gllm_inference/schema/reasoning.pyi +15 -0
  43. gllm_inference/schema/token_usage.pyi +11 -0
  44. gllm_inference/schema/tool_call.pyi +14 -0
  45. gllm_inference/schema/tool_result.pyi +11 -0
  46. gllm_inference/schema/type_alias.pyi +6 -8
  47. gllm_inference/utils/__init__.pyi +2 -3
  48. gllm_inference/utils/validation.pyi +12 -0
  49. gllm_inference.cpython-311-x86_64-linux-gnu.so +0 -0
  50. gllm_inference.pyi +8 -42
  51. {gllm_inference_binary-0.4.62.dist-info → gllm_inference_binary-0.5.1.dist-info}/METADATA +1 -8
  52. gllm_inference_binary-0.5.1.dist-info/RECORD +93 -0
  53. gllm_inference/builder/model_id.pyi +0 -13
  54. gllm_inference/catalog/component_map.pyi +0 -8
  55. gllm_inference/em_invoker/google_generativeai_em_invoker.pyi +0 -32
  56. gllm_inference/em_invoker/google_vertexai_em_invoker.pyi +0 -34
  57. gllm_inference/em_invoker/langchain/tei_embeddings.pyi +0 -71
  58. gllm_inference/em_invoker/tei_em_invoker.pyi +0 -48
  59. gllm_inference/lm_invoker/google_generativeai_lm_invoker.pyi +0 -51
  60. gllm_inference/lm_invoker/google_vertexai_lm_invoker.pyi +0 -54
  61. gllm_inference/lm_invoker/tgi_lm_invoker.pyi +0 -34
  62. gllm_inference/multimodal_em_invoker/__init__.pyi +0 -4
  63. gllm_inference/multimodal_em_invoker/google_vertexai_multimodal_em_invoker.pyi +0 -52
  64. gllm_inference/multimodal_em_invoker/multimodal_em_invoker.pyi +0 -35
  65. gllm_inference/multimodal_em_invoker/twelvelabs_multimodal_em_invoker.pyi +0 -49
  66. gllm_inference/multimodal_lm_invoker/__init__.pyi +0 -7
  67. gllm_inference/multimodal_lm_invoker/anthropic_multimodal_lm_invoker.pyi +0 -44
  68. gllm_inference/multimodal_lm_invoker/azure_openai_multimodal_lm_invoker.pyi +0 -41
  69. gllm_inference/multimodal_lm_invoker/google_generativeai_multimodal_lm_invoker.pyi +0 -30
  70. gllm_inference/multimodal_lm_invoker/google_vertexai_multimodal_lm_invoker.pyi +0 -67
  71. gllm_inference/multimodal_lm_invoker/multimodal_lm_invoker.pyi +0 -51
  72. gllm_inference/multimodal_lm_invoker/openai_multimodal_lm_invoker.pyi +0 -43
  73. gllm_inference/multimodal_prompt_builder/__init__.pyi +0 -3
  74. gllm_inference/multimodal_prompt_builder/multimodal_prompt_builder.pyi +0 -57
  75. gllm_inference/prompt_builder/agnostic_prompt_builder.pyi +0 -34
  76. gllm_inference/prompt_builder/huggingface_prompt_builder.pyi +0 -44
  77. gllm_inference/prompt_builder/llama_prompt_builder.pyi +0 -41
  78. gllm_inference/prompt_builder/mistral_prompt_builder.pyi +0 -41
  79. gllm_inference/prompt_builder/openai_prompt_builder.pyi +0 -35
  80. gllm_inference/schema/model_io.pyi +0 -178
  81. gllm_inference/utils/openai_multimodal_lm_helper.pyi +0 -36
  82. gllm_inference/utils/retry.pyi +0 -4
  83. gllm_inference/utils/utils.pyi +0 -142
  84. gllm_inference_binary-0.4.62.dist-info/RECORD +0 -115
  85. {gllm_inference_binary-0.4.62.dist-info → gllm_inference_binary-0.5.1.dist-info}/WHEEL +0 -0
@@ -1,7 +1,6 @@
1
1
  from _typeshed import Incomplete
2
2
  from gllm_inference.builder.build_lm_invoker import build_lm_invoker as build_lm_invoker
3
3
  from gllm_inference.builder.build_output_parser import build_output_parser as build_output_parser
4
- from gllm_inference.output_parser.output_parser import BaseOutputParser as BaseOutputParser
5
4
  from gllm_inference.prompt_builder import PromptBuilder as PromptBuilder
6
5
  from gllm_inference.request_processor.lm_request_processor import LMRequestProcessor as LMRequestProcessor
7
6
  from gllm_inference.schema.model_id import ModelId as ModelId
@@ -9,7 +8,7 @@ from typing import Any
9
8
 
10
9
  logger: Incomplete
11
10
 
12
- def build_lm_request_processor(model_id: str | ModelId, credentials: str | dict[str, Any] | None = None, config: dict[str, Any] | None = None, system_template: str = '', user_template: str = '', output_parser_type: str = 'none', output_parser: BaseOutputParser | None = None) -> LMRequestProcessor:
11
+ def build_lm_request_processor(model_id: str | ModelId, credentials: str | dict[str, Any] | None = None, config: dict[str, Any] | None = None, system_template: str = '', user_template: str = '', output_parser_type: str = 'none') -> LMRequestProcessor:
13
12
  '''Build a language model invoker based on the provided configurations.
14
13
 
15
14
  Args:
@@ -32,8 +31,6 @@ def build_lm_request_processor(model_id: str | ModelId, credentials: str | dict[
32
31
  Defaults to an empty string.
33
32
  output_parser_type (str, optional): The type of output parser to use. Supports "json" and "none".
34
33
  Defaults to "none".
35
- output_parser (BaseOutputParser | None, optional): Deprecated parameter to pass an output parser.
36
- Will be removed in v0.5.0. Defaults to None.
37
34
 
38
35
  Returns:
39
36
  LMRequestProcessor: The initialized language model request processor.
@@ -13,46 +13,42 @@ class BaseCatalog(ABC, BaseModel, Generic[T], arbitrary_types_allowed=True, meta
13
13
  Attributes:
14
14
  components (dict[str, T]): A dictionary containing the components.
15
15
 
16
- Load from Google Sheets using client email and private key example:
17
- ```python
18
- catalog = BaseCatalog.from_gsheets(
19
- sheet_id="...",
20
- worksheet_id="...",
21
- client_email="...",
22
- private_key="...",
23
- )
24
-
25
- component = catalog.name
26
- ```
27
-
28
- Load from Google Sheets using credential file example:
29
- ```python
30
- catalog = BaseCatalog.from_gsheets(
31
- sheet_id="...",
32
- worksheet_id="...",
33
- credential_file_path="...",
34
- )
35
-
36
- component = catalog.name
37
- ```
38
-
39
- Load from CSV example:
40
- ```python
41
- catalog = BaseCatalog.from_csv(csv_path="...")
42
-
43
- component = catalog.name
44
- ```
45
-
46
- Load from records example:
47
- ```python
48
- catalog = BaseCatalog.from_records(
49
- records=[
16
+ Initialization:
17
+ # Example 1: Load from Google Sheets using client email and private key
18
+ ```python
19
+ catalog = BaseCatalog.from_gsheets(
20
+ sheet_id="...",
21
+ worksheet_id="...",
22
+ client_email="...",
23
+ private_key="...",
24
+ )
25
+ component = catalog.name
26
+ ```
27
+
28
+ # Example 2: Load from Google Sheets using credential file
29
+ ```python
30
+ catalog = BaseCatalog.from_gsheets(
31
+ sheet_id="...",
32
+ worksheet_id="...",
33
+ credential_file_path="...",
34
+ )
35
+ component = catalog.name
36
+ ```
37
+
38
+ # Example 3: Load from CSV
39
+ ```python
40
+ catalog = BaseCatalog.from_csv(csv_path="...")
41
+ component = catalog.name
42
+ ```
43
+
44
+ # Example 4: Load from records
45
+ ```python
46
+ records = [
50
47
  {"name": "...", "col_1": "...", "col_2": "..."},
51
48
  {"name": "...", "col_1": "...", "col_2": "..."},
52
- ],
53
- )
54
-
55
- component = catalog.name
49
+ ]
50
+ catalog = BaseCatalog.from_records(records=records)
51
+ component = catalog.name
56
52
  ```
57
53
  '''
58
54
  components: dict[str, T]
@@ -1,12 +1,6 @@
1
1
  from _typeshed import Incomplete
2
- from gllm_inference.builder import build_lm_request_processor as build_lm_request_processor, build_output_parser as build_output_parser
3
- from gllm_inference.catalog.catalog import BaseCatalog as BaseCatalog, logger as logger
4
- from gllm_inference.catalog.component_map import LM_INVOKER_TYPE_MAP as LM_INVOKER_TYPE_MAP, PROMPT_BUILDER_TYPE_MAP as PROMPT_BUILDER_TYPE_MAP
5
- from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
6
- from gllm_inference.multimodal_lm_invoker.multimodal_lm_invoker import BaseMultimodalLMInvoker as BaseMultimodalLMInvoker
7
- from gllm_inference.multimodal_prompt_builder.multimodal_prompt_builder import MultimodalPromptBuilder as MultimodalPromptBuilder
8
- from gllm_inference.output_parser.output_parser import BaseOutputParser as BaseOutputParser
9
- from gllm_inference.prompt_builder.prompt_builder import BasePromptBuilder as BasePromptBuilder, PromptBuilder as PromptBuilder
2
+ from gllm_inference.builder import build_lm_request_processor as build_lm_request_processor
3
+ from gllm_inference.catalog.catalog import BaseCatalog as BaseCatalog
10
4
  from gllm_inference.request_processor import LMRequestProcessor as LMRequestProcessor
11
5
 
12
6
  MODEL_ID_ENV_VAR_REGEX_PATTERN: str
@@ -67,8 +61,8 @@ class LMRequestProcessorCatalog(BaseCatalog[LMRequestProcessor]):
67
61
 
68
62
  Template Format Example:
69
63
  # Example 1: Google Sheets
70
- For an example of how a Google Sheets file can be formatted to be loaded using LMRequestProcessorCatalog,
71
- see: https://docs.google.com/spreadsheets/d/1CX9i45yEinv1UdB3s6uHNMj7mxr2-s1NFHfFDvMsq0E/edit?usp=drive_link
64
+ For an example of how a Google Sheets file can be formatted to be loaded using LMRequestProcessorCatalog, see:
65
+ https://docs.google.com/spreadsheets/d/1CX9i45yEinv1UdB3s6uHNMj7mxr2-s1NFHfFDvMsq0E/edit?usp=drive_link
72
66
 
73
67
  # Example 2: CSV
74
68
  For an example of how a CSV file can be formatted to be loaded using LMRequestProcessorCatalog, see:
@@ -1,18 +1,14 @@
1
1
  from _typeshed import Incomplete
2
- from gllm_inference.catalog.catalog import BaseCatalog as BaseCatalog, logger as logger
3
- from gllm_inference.catalog.component_map import PROMPT_BUILDER_TYPE_MAP as PROMPT_BUILDER_TYPE_MAP
4
- from gllm_inference.multimodal_prompt_builder import MultimodalPromptBuilder as MultimodalPromptBuilder
5
- from gllm_inference.prompt_builder.prompt_builder import BasePromptBuilder as BasePromptBuilder, PromptBuilder as PromptBuilder
2
+ from gllm_inference.catalog.catalog import BaseCatalog as BaseCatalog
3
+ from gllm_inference.prompt_builder.prompt_builder import PromptBuilder as PromptBuilder
6
4
 
7
- PROMPT_BUILDER_MODEL_PARAM_MAP: Incomplete
8
5
  PROMPT_BUILDER_REQUIRED_COLUMNS: Incomplete
9
6
 
10
- class PromptBuilderCatalog(BaseCatalog[BasePromptBuilder | MultimodalPromptBuilder | PromptBuilder]):
7
+ class PromptBuilderCatalog(BaseCatalog[PromptBuilder]):
11
8
  '''Loads multiple prompt builders from certain sources.
12
9
 
13
10
  Attributes:
14
- components (dict[str, BasePromptBuilder | MultimodalPromptBuilder | PromptBuilder]):
15
- Dictionary of the loaded prompt builders.
11
+ components (dict[str, PromptBuilder]): Dictionary of the loaded prompt builders.
16
12
 
17
13
  Initialization:
18
14
  # Example 1: Load from Google Sheets using client email and private key
@@ -23,7 +19,6 @@ class PromptBuilderCatalog(BaseCatalog[BasePromptBuilder | MultimodalPromptBuild
23
19
  client_email="...",
24
20
  private_key="...",
25
21
  )
26
-
27
22
  prompt_builder = catalog.name
28
23
  ```
29
24
 
@@ -34,42 +29,38 @@ class PromptBuilderCatalog(BaseCatalog[BasePromptBuilder | MultimodalPromptBuild
34
29
  worksheet_id="...",
35
30
  credential_file_path="...",
36
31
  )
37
-
38
32
  prompt_builder = catalog.name
39
33
  ```
40
34
 
41
35
  # Example 3: Load from CSV
42
36
  ```python
43
37
  catalog = PromptBuilderCatalog.from_csv(csv_path="...")
44
-
45
38
  prompt_builder = catalog.name
46
39
  ```
47
40
 
48
41
  # Example 4: Load from records
49
42
  ```python
50
- catalog = PromptBuilderCatalog.from_records(
51
- records=[
52
- {
53
- "name": "summarize",
54
- "system": "You are an AI expert\\nSummarize the following context.\\n\\nContext:\\n```{context}```",
55
- "user": ""
56
- },
57
- {
58
- "name": "transform_query",
59
- "system": "",
60
- "user": "Transform the following query into a simpler form.\\n\\nQuery:\\n```{query}```"
61
- },
62
- {
63
- "name": "draft_document",
64
- "system": (
65
- "You are an AI expert.\\nDraft a document following the provided format and context.\\n\\n"
66
- "Format:\\n```{format}```\\n\\nContext:\\n```{context}```"
67
- ),
68
- "user": "User instruction:\\n{query}"
69
- },
70
- ]
71
- )
72
-
43
+ records=[
44
+ {
45
+ "name": "summarize",
46
+ "system": "You are an AI expert\\nSummarize the following context.\\n\\nContext:\\n```{context}```",
47
+ "user": ""
48
+ },
49
+ {
50
+ "name": "transform_query",
51
+ "system": "",
52
+ "user": "Transform the following query into a simpler form.\\n\\nQuery:\\n```{query}```"
53
+ },
54
+ {
55
+ "name": "draft_document",
56
+ "system": (
57
+ "You are an AI expert.\\nDraft a document following the provided format and context.\\n\\n"
58
+ "Format:\\n```{format}```\\n\\nContext:\\n```{context}```"
59
+ ),
60
+ "user": "User instruction:\\n{query}"
61
+ },
62
+ ]
63
+ catalog = PromptBuilderCatalog.from_records(records=records)
73
64
  prompt_builder = catalog.answer_question
74
65
  ```
75
66
 
@@ -91,7 +82,4 @@ class PromptBuilderCatalog(BaseCatalog[BasePromptBuilder | MultimodalPromptBuild
91
82
 
92
83
  Important Notes:
93
84
  1. At least one of the `system` and `user` columns must be filled.
94
-
95
- WARNING: The use of BasePromptBuilder | MultimodalPromptBuilder is deprecated and will be removed in version 0.5.0.
96
- Please use PromptBuilder instead.
97
85
  '''
@@ -1,10 +1,7 @@
1
1
  from _typeshed import Incomplete
2
2
 
3
- ALL_EXTENSIONS: str
4
3
  DEFAULT_AZURE_OPENAI_API_VERSION: str
5
4
  DOCUMENT_MIME_TYPES: Incomplete
6
5
  GOOGLE_SCOPES: Incomplete
7
6
  HEX_REPR_LENGTH: int
8
- MESSAGE_TUPLE_LENGTH: int
9
- DEFAULT_CONTENT_PLACEHOLDER_TYPE: str
10
7
  HTTP_STATUS_CODE_PATTERNS: Incomplete
@@ -1,12 +1,9 @@
1
1
  from gllm_inference.em_invoker.azure_openai_em_invoker import AzureOpenAIEMInvoker as AzureOpenAIEMInvoker
2
2
  from gllm_inference.em_invoker.google_em_invoker import GoogleEMInvoker as GoogleEMInvoker
3
- from gllm_inference.em_invoker.google_generativeai_em_invoker import GoogleGenerativeAIEMInvoker as GoogleGenerativeAIEMInvoker
4
- from gllm_inference.em_invoker.google_vertexai_em_invoker import GoogleVertexAIEMInvoker as GoogleVertexAIEMInvoker
5
3
  from gllm_inference.em_invoker.langchain_em_invoker import LangChainEMInvoker as LangChainEMInvoker
6
4
  from gllm_inference.em_invoker.openai_compatible_em_invoker import OpenAICompatibleEMInvoker as OpenAICompatibleEMInvoker
7
5
  from gllm_inference.em_invoker.openai_em_invoker import OpenAIEMInvoker as OpenAIEMInvoker
8
- from gllm_inference.em_invoker.tei_em_invoker import TEIEMInvoker as TEIEMInvoker
9
6
  from gllm_inference.em_invoker.twelevelabs_em_invoker import TwelveLabsEMInvoker as TwelveLabsEMInvoker
10
7
  from gllm_inference.em_invoker.voyage_em_invoker import VoyageEMInvoker as VoyageEMInvoker
11
8
 
12
- __all__ = ['AzureOpenAIEMInvoker', 'GoogleEMInvoker', 'GoogleGenerativeAIEMInvoker', 'GoogleVertexAIEMInvoker', 'LangChainEMInvoker', 'OpenAIEMInvoker', 'OpenAICompatibleEMInvoker', 'TEIEMInvoker', 'TwelveLabsEMInvoker', 'VoyageEMInvoker']
9
+ __all__ = ['AzureOpenAIEMInvoker', 'GoogleEMInvoker', 'LangChainEMInvoker', 'OpenAIEMInvoker', 'OpenAICompatibleEMInvoker', 'TwelveLabsEMInvoker', 'VoyageEMInvoker']
@@ -2,14 +2,11 @@ import abc
2
2
  from _typeshed import Incomplete
3
3
  from abc import ABC
4
4
  from gllm_core.utils.retry import RetryConfig
5
- from gllm_inference.constants import ALL_EXTENSIONS as ALL_EXTENSIONS, DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES
5
+ from gllm_inference.constants import DOCUMENT_MIME_TYPES as DOCUMENT_MIME_TYPES
6
6
  from gllm_inference.exceptions import parse_error_message as parse_error_message
7
7
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, Vector as Vector
8
- from langchain_core.embeddings import Embeddings as Embeddings
9
8
  from typing import Any
10
9
 
11
- DEPRECATED_DETAILS: str
12
-
13
10
  class BaseEMInvoker(ABC, metaclass=abc.ABCMeta):
14
11
  """A base class for embedding model invokers used in Gen AI applications.
15
12
 
@@ -24,22 +21,18 @@ class BaseEMInvoker(ABC, metaclass=abc.ABCMeta):
24
21
  """
25
22
  default_hyperparameters: Incomplete
26
23
  retry_config: Incomplete
27
- def __init__(self, model_id: ModelId, default_hyperparameters: dict[str, Any] | None = None, valid_extensions_map: dict[str, set[str]] | None = None, retry_config: RetryConfig | None = None, langchain_kwargs: dict[str, Any] | None = None) -> None:
28
- '''Initializes a new instance of the BaseEMInvoker class.
24
+ def __init__(self, model_id: ModelId, default_hyperparameters: dict[str, Any] | None = None, supported_attachments: set[str] | None = None, retry_config: RetryConfig | None = None) -> None:
25
+ """Initializes a new instance of the BaseEMInvoker class.
29
26
 
30
27
  Args:
31
28
  model_id (ModelId): The model ID of the embedding model.
32
29
  default_hyperparameters (dict[str, Any] | None, optional): Default hyperparameters for invoking the
33
30
  embedding model. Defaults to None, in which case an empty dictionary is used.
34
- valid_extensions_map (dict[str, set[str]] | None, optional): A dictionary mapping for validating the
35
- content type of the multimodal inputs. They keys are the mime types (e.g. "image") and the values are
36
- the set of valid file extensions for the corresponding mime type. Defaults to None, in which case an
37
- empty dictionary is used.
31
+ supported_attachments (set[str] | None, optional): A set of supported attachment types. Defaults to None,
32
+ in which case an empty set is used (indicating that no attachments are supported).
38
33
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
39
34
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
40
- langchain_kwargs (dict[str, Any] | None, optional): Additional keyword arguments to initiate the LangChain
41
- embedding model. Defaults to None.
42
- '''
35
+ """
43
36
  @property
44
37
  def model_id(self) -> str:
45
38
  """The model ID of the embedding model.
@@ -88,15 +81,3 @@ class BaseEMInvoker(ABC, metaclass=abc.ABCMeta):
88
81
  TimeoutError: If the invocation times out.
89
82
  ValueError: If the input content is invalid.
90
83
  """
91
- def to_langchain(self) -> Embeddings:
92
- """Converts the current embedding model invoker to an instance of LangChain `Embeddings` object.
93
-
94
- This method converts the EM invoker to an instance of LangChain's `Embeddings` object.
95
- This method requires the appropriate `langchain-<provider>` package to be installed.
96
-
97
- Returns:
98
- Embeddings: An instance of LangChain `Embeddings` object.
99
-
100
- Raises:
101
- ValueError: If `langchain_module_name` or `langchain_class_name` is missing.
102
- """
@@ -5,7 +5,7 @@ from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
5
5
  from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
6
  from typing import Any
7
7
 
8
- VALID_EXTENSIONS_MAP: Incomplete
8
+ SUPPORTED_ATTACHMENTS: Incomplete
9
9
 
10
10
  class GoogleEMInvoker(BaseEMInvoker):
11
11
  '''An embedding model invoker to interact with Google embedding models.
@@ -1,4 +1,3 @@
1
1
  from gllm_inference.em_invoker.langchain.em_invoker_embeddings import EMInvokerEmbeddings as EMInvokerEmbeddings
2
- from gllm_inference.em_invoker.langchain.tei_embeddings import TEIEmbeddings as TEIEmbeddings
3
2
 
4
- __all__ = ['EMInvokerEmbeddings', 'TEIEmbeddings']
3
+ __all__ = ['EMInvokerEmbeddings']
@@ -6,7 +6,7 @@ from gllm_inference.utils import load_langchain_model as load_langchain_model, p
6
6
  from langchain_core.embeddings import Embeddings as Embeddings
7
7
  from typing import Any
8
8
 
9
- VALID_EXTENSIONS_MAP: Incomplete
9
+ SUPPORTED_ATTACHMENTS: Incomplete
10
10
 
11
11
  class LangChainEMInvoker(BaseEMInvoker):
12
12
  """A language model invoker to interact with LangChain's Embeddings.
@@ -19,7 +19,7 @@ class LangChainEMInvoker(BaseEMInvoker):
19
19
  retry_config (RetryConfig): The retry configuration for the embedding model.
20
20
  """
21
21
  model: Incomplete
22
- def __init__(self, model: Embeddings | None = None, model_class_path: str | None = None, model_name: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, retry_config: RetryConfig | None = None, em: Embeddings | None = None) -> None:
22
+ def __init__(self, model: Embeddings | None = None, model_class_path: str | None = None, model_name: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, retry_config: RetryConfig | None = None) -> None:
23
23
  '''Initializes a new instance of the LangChainEMInvoker class.
24
24
 
25
25
  Args:
@@ -36,14 +36,4 @@ class LangChainEMInvoker(BaseEMInvoker):
36
36
  Defaults to None.
37
37
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
38
38
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
39
- em (Embeddings | None, optional): Deprecated parameter to pass the LangChain\'s Embeddings instance.
40
- Equivalent to the `model` parameter. Retained for backward compatibility. Defaults to None.
41
39
  '''
42
- def to_langchain(self) -> Embeddings:
43
- """Converts the current embedding model invoker to an instance of LangChain `Embeddings` object.
44
-
45
- This method converts the EM invoker to an instance of LangChain's `Embeddings` object.
46
-
47
- Returns:
48
- Embeddings: An instance of LangChain `Embeddings` object.
49
- """
@@ -4,7 +4,7 @@ from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
4
4
  from gllm_inference.schema import ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
5
5
  from typing import Any
6
6
 
7
- VALID_EXTENSIONS_MAP: Incomplete
7
+ SUPPORTED_ATTACHMENTS: Incomplete
8
8
 
9
9
  class OpenAIEMInvoker(BaseEMInvoker):
10
10
  '''An embedding model invoker to interact with OpenAI embedding models.
@@ -3,10 +3,9 @@ from gllm_core.utils.retry import RetryConfig as RetryConfig
3
3
  from gllm_inference.em_invoker.em_invoker import BaseEMInvoker as BaseEMInvoker
4
4
  from gllm_inference.em_invoker.schema.twelvelabs import InputType as InputType, Key as Key, OutputType as OutputType
5
5
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
- from langchain_core.embeddings import Embeddings as Embeddings
7
6
  from typing import Any
8
7
 
9
- VALID_EXTENSIONS_MAP: Incomplete
8
+ SUPPORTED_ATTACHMENTS: Incomplete
10
9
 
11
10
  class TwelveLabsEMInvoker(BaseEMInvoker):
12
11
  '''An embedding model invoker to interact with TwelveLabs embedding models.
@@ -20,10 +19,7 @@ class TwelveLabsEMInvoker(BaseEMInvoker):
20
19
  retry_config (RetryConfig): The retry configuration for the embedding model.
21
20
 
22
21
  Input types:
23
- The `TwelveLabsEMInvoker` supports the following input types:
24
- 1. Text.
25
- 2. Audio: ".mp3", ".wav", and ".flac".
26
- 3. Image: ".png", ".jpeg", and ".jpg".
22
+ The `TwelveLabsEMInvoker` supports the following input types: text, audio, and image.
27
23
  Non-text inputs must be passed as a `Attachment` object.
28
24
 
29
25
  Output format:
@@ -100,15 +96,3 @@ class TwelveLabsEMInvoker(BaseEMInvoker):
100
96
  retry_config (RetryConfig | None, optional): The retry configuration for the embedding model.
101
97
  Defaults to None, in which case a default config with no retry and 30.0 seconds timeout is used.
102
98
  """
103
- def to_langchain(self) -> Embeddings:
104
- """Converts the current embedding model invoker to an instance of LangChain `Embeddings` object.
105
-
106
- This method converts the EM invoker to an instance of LangChain's `Embeddings` object.
107
- However, the TwelveLabsEMInvoker is not supported by LangChain.
108
-
109
- Returns:
110
- Embeddings: An instance of LangChain `Embeddings` object.
111
-
112
- Raises:
113
- NotImplementedError: The TwelveLabsEMInvoker is not supported by LangChain.
114
- """
@@ -5,7 +5,7 @@ from gllm_inference.em_invoker.schema.voyage import InputType as InputType, Key
5
5
  from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EMContent as EMContent, ModelId as ModelId, ModelProvider as ModelProvider, Vector as Vector
6
6
  from typing import Any
7
7
 
8
- VALID_EXTENSIONS_MAP: Incomplete
8
+ SUPPORTED_ATTACHMENTS: Incomplete
9
9
  MAX_PYTHON_MINOR_VERSION: int
10
10
 
11
11
  class VoyageEMInvoker(BaseEMInvoker):
@@ -20,10 +20,7 @@ class VoyageEMInvoker(BaseEMInvoker):
20
20
  retry_config (RetryConfig): The retry configuration for the embedding model.
21
21
 
22
22
  Input types:
23
- The `VoyageEMInvoker` supports the following input types:
24
- 1. Text.
25
- 2. Image: ".png", ".jpeg", and ".jpg".
26
- 3. A tuple containing text and image.
23
+ The `VoyageEMInvoker` supports the following input types: text, image, and a tuple containing text and image.
27
24
  Non-text inputs must be passed as a `Attachment` object.
28
25
 
29
26
  Output format:
@@ -2,13 +2,10 @@ from gllm_inference.lm_invoker.anthropic_lm_invoker import AnthropicLMInvoker as
2
2
  from gllm_inference.lm_invoker.azure_openai_lm_invoker import AzureOpenAILMInvoker as AzureOpenAILMInvoker
3
3
  from gllm_inference.lm_invoker.bedrock_lm_invoker import BedrockLMInvoker as BedrockLMInvoker
4
4
  from gllm_inference.lm_invoker.datasaur_lm_invoker import DatasaurLMInvoker as DatasaurLMInvoker
5
- from gllm_inference.lm_invoker.google_generativeai_lm_invoker import GoogleGenerativeAILMInvoker as GoogleGenerativeAILMInvoker
6
5
  from gllm_inference.lm_invoker.google_lm_invoker import GoogleLMInvoker as GoogleLMInvoker
7
- from gllm_inference.lm_invoker.google_vertexai_lm_invoker import GoogleVertexAILMInvoker as GoogleVertexAILMInvoker
8
6
  from gllm_inference.lm_invoker.langchain_lm_invoker import LangChainLMInvoker as LangChainLMInvoker
9
7
  from gllm_inference.lm_invoker.litellm_lm_invoker import LiteLLMLMInvoker as LiteLLMLMInvoker
10
8
  from gllm_inference.lm_invoker.openai_compatible_lm_invoker import OpenAICompatibleLMInvoker as OpenAICompatibleLMInvoker
11
9
  from gllm_inference.lm_invoker.openai_lm_invoker import OpenAILMInvoker as OpenAILMInvoker
12
- from gllm_inference.lm_invoker.tgi_lm_invoker import TGILMInvoker as TGILMInvoker
13
10
 
14
- __all__ = ['AnthropicLMInvoker', 'AzureOpenAILMInvoker', 'BedrockLMInvoker', 'DatasaurLMInvoker', 'GoogleGenerativeAILMInvoker', 'GoogleLMInvoker', 'GoogleVertexAILMInvoker', 'LangChainLMInvoker', 'LiteLLMLMInvoker', 'OpenAICompatibleLMInvoker', 'OpenAILMInvoker', 'TGILMInvoker']
11
+ __all__ = ['AnthropicLMInvoker', 'AzureOpenAILMInvoker', 'BedrockLMInvoker', 'DatasaurLMInvoker', 'GoogleLMInvoker', 'LangChainLMInvoker', 'LiteLLMLMInvoker', 'OpenAICompatibleLMInvoker', 'OpenAILMInvoker']
@@ -3,11 +3,11 @@ from gllm_core.event import EventEmitter as EventEmitter
3
3
  from gllm_core.utils.retry import RetryConfig as RetryConfig
4
4
  from gllm_inference.lm_invoker.lm_invoker import BaseLMInvoker as BaseLMInvoker
5
5
  from gllm_inference.lm_invoker.schema.anthropic import InputType as InputType, Key as Key, OutputType as OutputType
6
- from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EmitDataType as EmitDataType, LMOutput as LMOutput, ModelId as ModelId, ModelProvider as ModelProvider, MultimodalPrompt as MultimodalPrompt, Reasoning as Reasoning, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
6
+ from gllm_inference.schema import Attachment as Attachment, AttachmentType as AttachmentType, EmitDataType as EmitDataType, LMOutput as LMOutput, Message as Message, ModelId as ModelId, ModelProvider as ModelProvider, Reasoning as Reasoning, ResponseSchema as ResponseSchema, TokenUsage as TokenUsage, ToolCall as ToolCall, ToolResult as ToolResult
7
7
  from langchain_core.tools import Tool as Tool
8
8
  from typing import Any
9
9
 
10
- VALID_EXTENSIONS_MAP: Incomplete
10
+ SUPPORTED_ATTACHMENTS: Incomplete
11
11
  DEFAULT_MAX_TOKENS: int
12
12
  DEFAULT_THINKING_BUDGET: int
13
13
 
@@ -27,8 +27,6 @@ class AnthropicLMInvoker(BaseLMInvoker):
27
27
  retry_config (RetryConfig): The retry configuration for the language model.
28
28
  thinking (bool): Whether to enable thinking. Only allowed for thinking models.
29
29
  thinking_budget (int): The tokens allocated for the thinking process. Only allowed for thinking models.
30
- output_thinking (bool): Whether to output the thinking token. Will be removed in v0.5.0, where the thinking
31
- token will always be included in the output when thinking is enabled.
32
30
 
33
31
  Basic usage:
34
32
  The `AnthropicLMInvoker` can be used as follows:
@@ -38,21 +36,14 @@ class AnthropicLMInvoker(BaseLMInvoker):
38
36
  ```
39
37
 
40
38
  Input types:
41
- The `AnthropicLMInvoker` supports the following input types:
42
- 1. Text.
43
- 2. Document: ".pdf".
44
- 3. Image: ".jpg", ".jpeg", ".png", ".gif", and ".webp".
45
- Non-text inputs must be of valid file extensions and can be passed as an `Attachment` object.
46
-
47
- Non-text inputs can only be passed with the `user` role.
39
+ The `AnthropicLMInvoker` supports the following input types: text, image, and document.
40
+ Non-text inputs can be passed as an `Attachment` object with the `user` role.
48
41
 
49
42
  Usage example:
50
43
  ```python
51
44
  text = "What animal is in this image?"
52
45
  image = Attachment.from_path("path/to/local/image.png")
53
-
54
- prompt = [(PromptRole.USER, [text, image])]
55
- result = await lm_invoker.invoke(prompt)
46
+ result = await lm_invoker.invoke([text, image])
56
47
  ```
57
48
 
58
49
  Tool calling:
@@ -180,8 +171,6 @@ class AnthropicLMInvoker(BaseLMInvoker):
180
171
  allocate at most 1024 tokens for thinking and the remaining 1024 tokens for generating the response.
181
172
 
182
173
  When enabled, the reasoning is stored in the `reasoning` attribute in the output.
183
- **Note**: Before v0.5.0, this has to be set explicitly via the `output_thinking` parameter.
184
- Starting from v0.5.0, the reasoning will always be included in the output when thinking is enabled.
185
174
 
186
175
  Usage example:
187
176
  ```python
@@ -209,7 +198,7 @@ class AnthropicLMInvoker(BaseLMInvoker):
209
198
  ```
210
199
 
211
200
  Output types:
212
- The output of the `AnthropicLMInvoker` is of type `MultimodalOutput`, which is a type alias that can represent:
201
+ The output of the `AnthropicLMInvoker` can either be:
213
202
  1. `str`: The text response if no additional output is needed.
214
203
  2. `LMOutput`: A Pydantic model with the following attributes if any additional output is needed:
215
204
  2.1. response (str): The text response.
@@ -232,8 +221,7 @@ class AnthropicLMInvoker(BaseLMInvoker):
232
221
  client: Incomplete
233
222
  thinking: Incomplete
234
223
  thinking_budget: Incomplete
235
- output_thinking: Incomplete
236
- def __init__(self, model_name: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, thinking: bool = False, thinking_budget: int = ..., use_thinking: bool = False, output_thinking: bool = False, bind_tools_params: dict[str, Any] | None = None, with_structured_output_params: dict[str, Any] | None = None) -> None:
224
+ def __init__(self, model_name: str, api_key: str | None = None, model_kwargs: dict[str, Any] | None = None, default_hyperparameters: dict[str, Any] | None = None, tools: list[Tool] | None = None, response_schema: ResponseSchema | None = None, output_analytics: bool = False, retry_config: RetryConfig | None = None, thinking: bool = False, thinking_budget: int = ...) -> None:
237
225
  """Initializes the AnthropicLmInvoker instance.
238
226
 
239
227
  Args:
@@ -253,20 +241,10 @@ class AnthropicLMInvoker(BaseLMInvoker):
253
241
  thinking (bool, optional): Whether to enable thinking. Only allowed for thinking models. Defaults to False.
254
242
  thinking_budget (int, optional): The tokens allocated for the thinking process. Must be greater than or
255
243
  equal to 1024. Only allowed for thinking models. Defaults to DEFAULT_THINKING_BUDGET.
256
- use_thinking (bool, optional): Deprecated parameter to enable thinking. Defaults to False.
257
- output_thinking (bool, optional): Deprecated parameter to output the thinking token. Starting from v0.5.0,
258
- the thinking token will always be included in the output when thinking is enabled. Defaults to False.
259
- bind_tools_params (dict[str, Any] | None, optional): Deprecated parameter to add tool calling capability.
260
- If provided, must at least include the `tools` key that is equivalent to the `tools` parameter.
261
- Retained for backward compatibility. Defaults to None.
262
- with_structured_output_params (dict[str, Any] | None, optional): Deprecated parameter to instruct the
263
- model to produce output with a certain schema. If provided, must at least include the `schema` key that
264
- is equivalent to the `response_schema` parameter. Retained for backward compatibility. Defaults to None.
265
244
 
266
245
  Raises:
267
246
  ValueError:
268
247
  1. `thinking` is True, but the `thinking_budget` is less than 1024.
269
- 2. `thinking` is True and `tools` are provided, but `output_thinking` is False. # TODO: Remove in v0.5.0
270
248
  3. `response_schema` is provided, but `tools` or `thinking` are also provided.
271
249
  """
272
250
  def set_tools(self, tools: list[Tool]) -> None:
@@ -38,20 +38,14 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
38
38
  ```
39
39
 
40
40
  Input types:
41
- 1. Text.
42
- 2. Document: ".pdf".
43
- 3. Image: ".jpg", ".jpeg", ".png", ".gif", and ".webp".
44
- Non-text inputs must be of valid file extensions and can be passed as an `Attachment` object.
45
-
46
- Non-text inputs can only be passed with the `user` role.
41
+ The `AzureOpenAILMInvoker` supports the following input types: text, document, and image.
42
+ Non-text inputs can be passed as an `Attachment` object with the `user` role.
47
43
 
48
44
  Usage example:
49
45
  ```python
50
46
  text = "What animal is in this image?"
51
47
  image = Attachment.from_path("path/to/local/image.png")
52
-
53
- prompt = [(PromptRole.USER, [text, image])]
54
- result = await lm_invoker.invoke(prompt)
48
+ result = await lm_invoker.invoke([text, image])
55
49
  ```
56
50
 
57
51
  Tool calling:
@@ -203,8 +197,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
203
197
  Setting reasoning-related parameters for non-reasoning models will raise an error.
204
198
 
205
199
  Output types:
206
- The output of the `AzureOpenAILMInvoker` is of type `MultimodalOutput`, which is a type alias that can
207
- represent:
200
+ The output of the `AzureOpenAILMInvoker` can either be:
208
201
  1. `str`: The text response if no additional output is needed.
209
202
  2. `LMOutput`: A Pydantic model with the following attributes if any additional output is needed:
210
203
  2.1. response (str): The text response.
@@ -225,7 +218,7 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
225
218
  Defaults to an empty list.
226
219
  '''
227
220
  client: Incomplete
228
- def __init__(self, azure_endpoint: str, azure_deployment: str, api_key: str | None = None, api_version: 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, reasoning_effort: ReasoningEffort | None = None, reasoning_summary: ReasoningSummary | None = None, bind_tools_params: dict[str, Any] | None = None, with_structured_output_params: dict[str, Any] | None = None) -> None:
221
+ def __init__(self, azure_endpoint: str, azure_deployment: str, api_key: str | None = None, api_version: 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, reasoning_effort: ReasoningEffort | None = None, reasoning_summary: ReasoningSummary | None = None) -> None:
229
222
  """Initializes a new instance of the AzureOpenAILMInvoker class.
230
223
 
231
224
  Args:
@@ -250,12 +243,6 @@ class AzureOpenAILMInvoker(OpenAILMInvoker):
250
243
  for non-reasoning models. If None, the model will perform medium reasoning effort. Defaults to None.
251
244
  reasoning_summary (ReasoningSummary | None, optional): The reasoning summary level for reasoning models.
252
245
  Not allowed for non-reasoning models. If None, no summary will be generated. Defaults to None.
253
- bind_tools_params (dict[str, Any] | None, optional): Deprecated parameter to add tool calling capability.
254
- If provided, must at least include the `tools` key that is equivalent to the `tools` parameter.
255
- Retained for backward compatibility. Defaults to None.
256
- with_structured_output_params (dict[str, Any] | None, optional): Deprecated parameter to instruct the
257
- model to produce output with a certain schema. If provided, must at least include the `schema` key that
258
- is equivalent to the `response_schema` parameter. Retained for backward compatibility. Defaults to None.
259
246
 
260
247
  Raises:
261
248
  ValueError: