gllm-inference-binary 0.5.34__cp311-cp311-win_amd64.whl → 0.5.36__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.

Files changed (32) hide show
  1. gllm_inference/builder/build_em_invoker.pyi +10 -13
  2. gllm_inference/builder/build_lm_invoker.pyi +30 -17
  3. gllm_inference/builder/build_lm_request_processor.pyi +2 -7
  4. gllm_inference/catalog/lm_request_processor_catalog.pyi +2 -2
  5. gllm_inference/constants.pyi +1 -0
  6. gllm_inference/em_invoker/openai_compatible_em_invoker.pyi +5 -60
  7. gllm_inference/em_invoker/openai_em_invoker.pyi +34 -6
  8. gllm_inference/lm_invoker/__init__.pyi +2 -1
  9. gllm_inference/lm_invoker/langchain_lm_invoker.pyi +3 -3
  10. gllm_inference/lm_invoker/litellm_lm_invoker.pyi +1 -1
  11. gllm_inference/lm_invoker/openai_chat_completions_lm_invoker.pyi +278 -0
  12. gllm_inference/lm_invoker/openai_compatible_lm_invoker.pyi +9 -226
  13. gllm_inference/lm_invoker/openai_lm_invoker.pyi +30 -6
  14. gllm_inference/lm_invoker/schema/{openai_compatible.pyi → openai_chat_completions.pyi} +2 -2
  15. gllm_inference/realtime_chat/__init__.pyi +3 -0
  16. gllm_inference/realtime_chat/google_realtime_chat.pyi +205 -0
  17. gllm_inference/realtime_chat/input_streamer/__init__.pyi +4 -0
  18. gllm_inference/realtime_chat/input_streamer/input_streamer.pyi +36 -0
  19. gllm_inference/realtime_chat/input_streamer/keyboard_input_streamer.pyi +27 -0
  20. gllm_inference/realtime_chat/input_streamer/linux_mic_input_streamer.pyi +36 -0
  21. gllm_inference/realtime_chat/output_streamer/__init__.pyi +4 -0
  22. gllm_inference/realtime_chat/output_streamer/console_output_streamer.pyi +21 -0
  23. gllm_inference/realtime_chat/output_streamer/linux_speaker_output_streamer.pyi +42 -0
  24. gllm_inference/realtime_chat/output_streamer/output_streamer.pyi +33 -0
  25. gllm_inference/realtime_chat/realtime_chat.pyi +28 -0
  26. gllm_inference/schema/model_id.pyi +30 -25
  27. gllm_inference.cp311-win_amd64.pyd +0 -0
  28. gllm_inference.pyi +6 -0
  29. {gllm_inference_binary-0.5.34.dist-info → gllm_inference_binary-0.5.36.dist-info}/METADATA +1 -1
  30. {gllm_inference_binary-0.5.34.dist-info → gllm_inference_binary-0.5.36.dist-info}/RECORD +32 -20
  31. {gllm_inference_binary-0.5.34.dist-info → gllm_inference_binary-0.5.36.dist-info}/WHEEL +0 -0
  32. {gllm_inference_binary-0.5.34.dist-info → gllm_inference_binary-0.5.36.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,205 @@
1
+ import asyncio
2
+ import logging
3
+ from _typeshed import Incomplete
4
+ from gllm_inference.constants import GOOGLE_SCOPES as GOOGLE_SCOPES
5
+ from gllm_inference.realtime_chat.input_streamer import KeyboardInputStreamer as KeyboardInputStreamer
6
+ from gllm_inference.realtime_chat.input_streamer.input_streamer import BaseInputStreamer as BaseInputStreamer
7
+ from gllm_inference.realtime_chat.output_streamer import ConsoleOutputStreamer as ConsoleOutputStreamer
8
+ from gllm_inference.realtime_chat.output_streamer.output_streamer import BaseOutputStreamer as BaseOutputStreamer
9
+ from gllm_inference.realtime_chat.realtime_chat import BaseRealtimeChat as BaseRealtimeChat
10
+ from pydantic import BaseModel
11
+ from typing import Literal
12
+
13
+ DEFAULT_POST_OUTPUT_AUDIO_DELAY: float
14
+ LIVE_CONNECT_CONFIG: Incomplete
15
+
16
+ class GoogleIOStreamerState(BaseModel):
17
+ '''[BETA] Defines the state of the GoogleIOStreamer with thread-safe properties.
18
+
19
+ Attributes:
20
+ is_streaming_output (bool): Whether the output is streaming.
21
+ console_mode (Literal["input", "user", "assistant"]): The current console mode.
22
+ terminated (bool): Whether the conversation is terminated.
23
+ '''
24
+ is_streaming_output: bool
25
+ console_mode: Literal['input', 'user', 'assistant']
26
+ terminated: bool
27
+ async def set_streaming_output(self, value: bool) -> None:
28
+ """Thread-safe setter for is_streaming_output.
29
+
30
+ Args:
31
+ value (bool): The value to set for is_streaming_output.
32
+ """
33
+ async def get_streaming_output(self) -> bool:
34
+ """Thread-safe getter for is_streaming_output.
35
+
36
+ Returns:
37
+ bool: The value of is_streaming_output.
38
+ """
39
+ async def set_console_mode(self, value: Literal['input', 'user', 'assistant']) -> None:
40
+ '''Thread-safe setter for console_mode.
41
+
42
+ Args:
43
+ value (Literal["input", "user", "assistant"]): The value to set for console_mode.
44
+ '''
45
+ async def get_console_mode(self) -> Literal['input', 'user', 'assistant']:
46
+ '''Thread-safe getter for console_mode.
47
+
48
+ Returns:
49
+ Literal["input", "user", "assistant"]: The value of console_mode.
50
+ '''
51
+ async def set_terminated(self, value: bool) -> None:
52
+ """Thread-safe setter for terminated.
53
+
54
+ Args:
55
+ value (bool): The value to set for terminated.
56
+ """
57
+ async def get_terminated(self) -> bool:
58
+ """Thread-safe getter for terminated.
59
+
60
+ Returns:
61
+ bool: The value of terminated.
62
+ """
63
+
64
+ class GoogleIOStreamer:
65
+ """[BETA] Defines the GoogleIOStreamer.
66
+
67
+ This class manages the realtime conversation lifecycle.
68
+ It handles the IO operations between the model and the input/output streamers.
69
+
70
+ Attributes:
71
+ session (AsyncSession): The session of the GoogleIOStreamer.
72
+ task_group (asyncio.TaskGroup): The task group of the GoogleIOStreamer.
73
+ input_queue (asyncio.Queue): The input queue of the GoogleIOStreamer.
74
+ output_queue (asyncio.Queue): The output queue of the GoogleIOStreamer.
75
+ input_streamers (list[BaseInputStreamer]): The input streamers of the GoogleIOStreamer.
76
+ output_streamers (list[BaseOutputStreamer]): The output streamers of the GoogleIOStreamer.
77
+ post_output_audio_delay (float): The delay in seconds to post the output audio.
78
+ """
79
+ session: AsyncSession
80
+ task_group: Incomplete
81
+ input_queue: Incomplete
82
+ output_queue: Incomplete
83
+ state: Incomplete
84
+ input_streamers: Incomplete
85
+ output_streamers: Incomplete
86
+ post_output_audio_delay: Incomplete
87
+ def __init__(self, session: AsyncSession, task_group: asyncio.TaskGroup, input_queue: asyncio.Queue, output_queue: asyncio.Queue, input_streamers: list[BaseInputStreamer], output_streamers: list[BaseOutputStreamer], post_output_audio_delay: float, logger: logging.Logger) -> None:
88
+ """Initializes a new instance of the GoogleIOStreamer class.
89
+
90
+ Args:
91
+ session (AsyncSession): The session of the GoogleIOStreamer.
92
+ task_group (asyncio.TaskGroup): The task group of the GoogleIOStreamer.
93
+ input_queue (asyncio.Queue): The input queue of the GoogleIOStreamer.
94
+ output_queue (asyncio.Queue): The output queue of the GoogleIOStreamer.
95
+ input_streamers (list[BaseInputStreamer]): The input streamers of the GoogleIOStreamer.
96
+ output_streamers (list[BaseOutputStreamer]): The output streamers of the GoogleIOStreamer.
97
+ post_output_audio_delay (float): The delay in seconds to post the output audio.
98
+ logger (logging.Logger): The logger of the GoogleIOStreamer.
99
+ """
100
+ async def start(self) -> None:
101
+ """Processes the realtime conversation.
102
+
103
+ This method is used to start the realtime conversation.
104
+ It initializes the input and output streamers, creates the necessary tasks, and starts the conversation.
105
+ When the conversation is terminated, it cleans up the input and output streamers.
106
+ """
107
+
108
+ class GoogleRealtimeChat(BaseRealtimeChat):
109
+ '''[BETA] A realtime chat module to interact with Gemini Live models.
110
+
111
+ Warning:
112
+ The \'GoogleRealtimeChat\' class is currently in beta and may be subject to changes in the future.
113
+ It is intended only for quick prototyping in local environments.
114
+ Please avoid using it in production environments.
115
+
116
+ Attributes:
117
+ model_name (str): The name of the language model.
118
+ client_params (dict[str, Any]): The Google client instance init parameters.
119
+
120
+ Basic usage:
121
+ The `GoogleRealtimeChat` can be used as started as follows:
122
+ ```python
123
+ realtime_chat = GoogleRealtimeChat(model_name="gemini-live-2.5-flash-preview")
124
+ await realtime_chat.invoke()
125
+ ```
126
+
127
+ Custom IO streamers:
128
+ The `GoogleRealtimeChat` can be used with custom IO streamers.
129
+ ```python
130
+ input_streamers = [KeyboardInputStreamer(), LinuxMicInputStreamer()]
131
+ output_streamers = [ConsoleOutputStreamer(), LinuxSpeakerOutputStreamer()]
132
+ realtime_chat = GoogleRealtimeChat(model_name="gemini-live-2.5-flash-preview")
133
+ await realtime_chat.start(input_streamers=input_streamers, output_streamers=output_streamers)
134
+ ```
135
+
136
+ In the above example, we added a capability to use a Linux system microphone and speaker,
137
+ allowing realtime audio input and output to the model.
138
+
139
+ Authentication:
140
+ The `GoogleRealtimeChat` can use either Google Gen AI or Google Vertex AI.
141
+
142
+ Google Gen AI is recommended for quick prototyping and development.
143
+ It requires a Gemini API key for authentication.
144
+
145
+ Usage example:
146
+ ```python
147
+ realtime_chat = GoogleRealtimeChat(
148
+ model_name="gemini-live-2.5-flash-preview",
149
+ api_key="your_api_key"
150
+ )
151
+ ```
152
+
153
+ Google Vertex AI is recommended to build production-ready applications.
154
+ It requires a service account JSON file for authentication.
155
+
156
+ Usage example:
157
+ ```python
158
+ realtime_chat = GoogleRealtimeChat(
159
+ model_name="gemini-live-2.5-flash-preview",
160
+ credentials_path="path/to/service_account.json"
161
+ )
162
+ ```
163
+
164
+ If neither `api_key` nor `credentials_path` is provided, Google Gen AI will be used by default.
165
+ The `GOOGLE_API_KEY` environment variable will be used for authentication.
166
+ '''
167
+ model_name: Incomplete
168
+ client_params: Incomplete
169
+ def __init__(self, model_name: str, api_key: str | None = None, credentials_path: str | None = None, project_id: str | None = None, location: str = 'us-central1') -> None:
170
+ '''Initializes a new instance of the GoogleRealtimeChat class.
171
+
172
+ Args:
173
+ model_name (str): The name of the model to use.
174
+ api_key (str | None, optional): Required for Google Gen AI authentication. Cannot be used together
175
+ with `credentials_path`. Defaults to None.
176
+ credentials_path (str | None, optional): Required for Google Vertex AI authentication. Path to the service
177
+ account credentials JSON file. Cannot be used together with `api_key`. Defaults to None.
178
+ project_id (str | None, optional): The Google Cloud project ID for Vertex AI. Only used when authenticating
179
+ with `credentials_path`. Defaults to None, in which case it will be loaded from the credentials file.
180
+ location (str, optional): The location of the Google Cloud project for Vertex AI. Only used when
181
+ authenticating with `credentials_path`. Defaults to "us-central1".
182
+
183
+ Note:
184
+ If neither `api_key` nor `credentials_path` is provided, Google Gen AI will be used by default.
185
+ The `GOOGLE_API_KEY` environment variable will be used for authentication.
186
+ '''
187
+ async def start(self, input_streamers: list[BaseInputStreamer] | None = None, output_streamers: list[BaseOutputStreamer] | None = None, post_output_audio_delay: float = ...) -> None:
188
+ """Starts the realtime conversation using the provided input and output streamers.
189
+
190
+ This method is used to start the realtime conversation using a `GoogleIOStreamer`.
191
+ The streamers are responsible for handling the input and output of the conversation.
192
+
193
+ Args:
194
+ input_streamers (list[BaseInputStreamer] | None, optional): The input streamers to use.
195
+ Defaults to None, in which case a `KeyboardInputStreamer` will be used.
196
+ output_streamers (list[BaseOutputStreamer] | None, optional): The output streamers to use.
197
+ Defaults to None, in which case a `ConsoleOutputStreamer` will be used.
198
+ post_output_audio_delay (float, optional): The delay in seconds to post the output audio.
199
+ Defaults to 0.5 seconds.
200
+
201
+ Raises:
202
+ ValueError: If the `input_streamers` or `output_streamers` is an empty list.
203
+ ValueError: If the `post_output_audio_delay` is not greater than 0.
204
+ Exception: If the conversation fails to process.
205
+ """
@@ -0,0 +1,4 @@
1
+ from gllm_inference.realtime_chat.input_streamer.keyboard_input_streamer import KeyboardInputStreamer as KeyboardInputStreamer
2
+ from gllm_inference.realtime_chat.input_streamer.linux_mic_input_streamer import LinuxMicInputStreamer as LinuxMicInputStreamer
3
+
4
+ __all__ = ['KeyboardInputStreamer', 'LinuxMicInputStreamer']
@@ -0,0 +1,36 @@
1
+ import abc
2
+ import asyncio
3
+ from abc import ABC, abstractmethod
4
+ from pydantic import BaseModel as BaseModel
5
+
6
+ class BaseInputStreamer(ABC, metaclass=abc.ABCMeta):
7
+ """[BETA] A base class for input streamers.
8
+
9
+ Attributes:
10
+ state (BaseModel | None): The state of the input streamer.
11
+ input_queue (asyncio.Queue | None): The queue to put the input events.
12
+ """
13
+ state: BaseModel | None
14
+ input_queue: asyncio.Queue | None
15
+ async def initialize(self, state: BaseModel, input_queue: asyncio.Queue) -> None:
16
+ """Initializes the input streamer.
17
+
18
+ Args:
19
+ input_queue (asyncio.Queue): The queue to put the input events.
20
+ state (BaseModel): The state of the input streamer.
21
+ """
22
+ @abstractmethod
23
+ async def stream_input(self) -> None:
24
+ """Streams the input from a certain source.
25
+
26
+ This method must be implemented by subclasses to define the logic for streaming the input.
27
+
28
+ Raises:
29
+ NotImplementedError: If the method is not implemented in a subclass.
30
+ """
31
+ async def close(self) -> None:
32
+ """Closes the input streamer.
33
+
34
+ This method is used to close the input streamer.
35
+ It is used to clean up the input streamer.
36
+ """
@@ -0,0 +1,27 @@
1
+ import asyncio
2
+ from _typeshed import Incomplete
3
+ from gllm_inference.realtime_chat.input_streamer.input_streamer import BaseInputStreamer as BaseInputStreamer
4
+
5
+ DEFAULT_QUIT_CMD: str
6
+
7
+ class KeyboardInputStreamer(BaseInputStreamer):
8
+ """[BETA] A keyboard input streamer that reads the input text from the keyboard.
9
+
10
+ Attributes:
11
+ state (BaseModel): The state of the input streamer.
12
+ input_queue (asyncio.Queue): The queue to put the input events.
13
+ quit_cmd (str): The command to quit the conversation.
14
+ """
15
+ record_process: asyncio.subprocess.Process | None
16
+ quit_cmd: Incomplete
17
+ def __init__(self, quit_cmd: str = ...) -> None:
18
+ """Initializes the KeyboardInputStreamer.
19
+
20
+ Args:
21
+ quit_cmd (str, optional): The command to quit the conversation. Defaults to DEFAULT_QUIT_CMD.
22
+ """
23
+ async def stream_input(self) -> None:
24
+ """Streams the input from the keyboard.
25
+
26
+ This method is used to stream the input text from the keyboard to the input queue.
27
+ """
@@ -0,0 +1,36 @@
1
+ import asyncio
2
+ from _typeshed import Incomplete
3
+ from gllm_inference.realtime_chat.input_streamer.input_streamer import BaseInputStreamer as BaseInputStreamer
4
+
5
+ SEND_SAMPLE_RATE: int
6
+ CHANNELS: int
7
+ RECORD_CMD: Incomplete
8
+ CHUNK_DURATION: float
9
+ CHUNK_SIZE: Incomplete
10
+
11
+ class LinuxMicInputStreamer(BaseInputStreamer):
12
+ """[BETA] A Linux microphone input streamer that reads the input audio from the microphone.
13
+
14
+ Attributes:
15
+ state (BaseModel): The state of the input streamer.
16
+ input_queue (asyncio.Queue): The queue to put the input events.
17
+ record_process (asyncio.subprocess.Process | None): The process to record the input audio.
18
+ """
19
+ record_process: asyncio.subprocess.Process | None
20
+ def __init__(self) -> None:
21
+ """Initializes the LinuxMicInputStreamer.
22
+
23
+ Raises:
24
+ OSError: If the current system is not Linux.
25
+ """
26
+ async def stream_input(self) -> None:
27
+ """Streams the input audio from the Linux system microphone.
28
+
29
+ This method is used to stream the recorded input audio from the Linux system microphone to the input queue.
30
+ """
31
+ async def close(self) -> None:
32
+ """Closes the LinuxMicInputStreamer.
33
+
34
+ This method is used to close the LinuxMicInputStreamer.
35
+ It is used to clean up the recording process.
36
+ """
@@ -0,0 +1,4 @@
1
+ from gllm_inference.realtime_chat.output_streamer.console_output_streamer import ConsoleOutputStreamer as ConsoleOutputStreamer
2
+ from gllm_inference.realtime_chat.output_streamer.linux_speaker_output_streamer import LinuxSpeakerOutputStreamer as LinuxSpeakerOutputStreamer
3
+
4
+ __all__ = ['ConsoleOutputStreamer', 'LinuxSpeakerOutputStreamer']
@@ -0,0 +1,21 @@
1
+ from gllm_inference.realtime_chat.output_streamer.output_streamer import BaseOutputStreamer as BaseOutputStreamer
2
+ from typing import Any
3
+
4
+ USER_HEADER: str
5
+ ASSISTANT_HEADER: str
6
+ FOOTER: str
7
+
8
+ class ConsoleOutputStreamer(BaseOutputStreamer):
9
+ """[BETA] A console output streamer that prints the output to the console.
10
+
11
+ Attributes:
12
+ state (BaseModel): The state of the output streamer.
13
+ """
14
+ async def handle(self, data: dict[str, Any]) -> None:
15
+ """Handles the output events.
16
+
17
+ This method is used to handle the text output events and print them to the console.
18
+
19
+ Args:
20
+ data (dict[str, Any]): The output events.
21
+ """
@@ -0,0 +1,42 @@
1
+ import asyncio
2
+ from _typeshed import Incomplete
3
+ from gllm_inference.realtime_chat.output_streamer.output_streamer import BaseOutputStreamer as BaseOutputStreamer
4
+ from pydantic import BaseModel as BaseModel
5
+ from typing import Any
6
+
7
+ PLAY_AUDIO_SAMPLE_RATE: int
8
+ CHANNELS: int
9
+ PLAY_CMD: Incomplete
10
+ OUTPUT_AUDIO_DELAY: float
11
+
12
+ class LinuxSpeakerOutputStreamer(BaseOutputStreamer):
13
+ """[BETA] A Linux speaker output streamer that plays the output audio through the speakers.
14
+
15
+ Attributes:
16
+ state (BaseModel): The state of the output streamer.
17
+ play_process (asyncio.subprocess.Process | None): The process to play the output audio.
18
+ """
19
+ play_process: asyncio.subprocess.Process | None
20
+ async def initialize(self, state: BaseModel) -> None:
21
+ """Initializes the LinuxSpeakerOutputStreamer.
22
+
23
+ Args:
24
+ state (BaseModel): The state of the output streamer.
25
+
26
+ Raises:
27
+ OSError: If the current system is not Linux.
28
+ """
29
+ async def handle(self, data: dict[str, Any]) -> None:
30
+ """Handles the output events.
31
+
32
+ This method is used to handle the audio output events and play them through the Linux system speakers.
33
+
34
+ Args:
35
+ data (dict[str, Any]): The output events.
36
+ """
37
+ async def close(self) -> None:
38
+ """Closes the LinuxSpeakerOutputStreamer.
39
+
40
+ This method is used to close the LinuxSpeakerOutputStreamer.
41
+ It is used to clean up playing process.
42
+ """
@@ -0,0 +1,33 @@
1
+ import abc
2
+ from abc import ABC, abstractmethod
3
+ from pydantic import BaseModel as BaseModel
4
+ from typing import Any
5
+
6
+ class BaseOutputStreamer(ABC, metaclass=abc.ABCMeta):
7
+ """[BETA] A base class for output streamers.
8
+
9
+ Attributes:
10
+ state (BaseModel | None): The state of the output streamer.
11
+ """
12
+ state: BaseModel | None
13
+ async def initialize(self, state: BaseModel) -> None:
14
+ """Initializes the output streamer.
15
+
16
+ Args:
17
+ state (BaseModel): The state of the output streamer.
18
+ """
19
+ @abstractmethod
20
+ async def handle(self, data: dict[str, Any]) -> None:
21
+ """Handles output events streamed from the model.
22
+
23
+ This method must be implemented by subclasses to define the logic for handling the output events.
24
+
25
+ Raises:
26
+ NotImplementedError: If the method is not implemented in a subclass.
27
+ """
28
+ async def close(self) -> None:
29
+ """Closes the output streamer.
30
+
31
+ This method is used to close the output streamer.
32
+ It is used to clean up the output streamer.
33
+ """
@@ -0,0 +1,28 @@
1
+ import abc
2
+ from abc import ABC, abstractmethod
3
+ from gllm_inference.realtime_chat.input_streamer.input_streamer import BaseInputStreamer as BaseInputStreamer
4
+ from gllm_inference.realtime_chat.output_streamer.output_streamer import BaseOutputStreamer as BaseOutputStreamer
5
+
6
+ class BaseRealtimeChat(ABC, metaclass=abc.ABCMeta):
7
+ """[BETA] A base class for realtime chat modules.
8
+
9
+ The `BaseRealtimeChat` class provides a framework for processing real-time conversations.
10
+ """
11
+ def __init__(self) -> None:
12
+ """Initializes a new instance of the BaseRealtimeChat class."""
13
+ @abstractmethod
14
+ async def start(self, input_streamers: list[BaseInputStreamer] | None = None, output_streamers: list[BaseOutputStreamer] | None = None) -> None:
15
+ """Starts the real-time conversation using the provided input and output streamers.
16
+
17
+ This abstract method must be implemented by subclasses to define the logic
18
+ for starting the real-time conversation.
19
+
20
+ Args:
21
+ input_streamers (list[BaseInputStreamer] | None, optional): The input streamers to use.
22
+ Defaults to None.
23
+ output_streamers (list[BaseOutputStreamer] | None, optional): The output streamers to use.
24
+ Defaults to None.
25
+
26
+ Raises:
27
+ NotImplementedError: If the method is not implemented in a subclass.
28
+ """
@@ -1,3 +1,4 @@
1
+ from _typeshed import Incomplete
1
2
  from enum import StrEnum
2
3
  from gllm_inference.utils import validate_string_enum as validate_string_enum
3
4
  from pydantic import BaseModel
@@ -16,11 +17,15 @@ class ModelProvider(StrEnum):
16
17
  LANGCHAIN = 'langchain'
17
18
  LITELLM = 'litellm'
18
19
  OPENAI = 'openai'
20
+ OPENAI_CHAT_COMPLETIONS = 'openai-chat-completions'
19
21
  OPENAI_COMPATIBLE = 'openai-compatible'
20
22
  TWELVELABS = 'twelvelabs'
21
23
  VOYAGE = 'voyage'
22
24
  XAI = 'xai'
23
25
 
26
+ OPTIONAL_PATH_PROVIDERS: Incomplete
27
+ PATH_SUPPORTING_PROVIDERS: Incomplete
28
+
24
29
  class ModelId(BaseModel):
25
30
  '''Defines a representation of a valid model id.
26
31
 
@@ -32,7 +37,7 @@ class ModelId(BaseModel):
32
37
  Provider-specific examples:
33
38
  # Using Anthropic
34
39
  ```python
35
- model_id = ModelId.from_string("anthropic/claude-3-5-sonnet-latest")
40
+ model_id = ModelId.from_string("anthropic/claude-sonnet-4-20250514")
36
41
  ```
37
42
 
38
43
  # Using Bedrock
@@ -47,22 +52,32 @@ class ModelId(BaseModel):
47
52
 
48
53
  # Using Google
49
54
  ```python
50
- model_id = ModelId.from_string("google/gemini-1.5-flash")
55
+ model_id = ModelId.from_string("google/gemini-2.5-flash-lite")
51
56
  ```
52
57
 
53
58
  # Using OpenAI
54
59
  ```python
55
- model_id = ModelId.from_string("openai/gpt-4o-mini")
60
+ model_id = ModelId.from_string("openai/gpt-5-nano")
56
61
  ```
57
62
 
58
- # Using Azure OpenAI
63
+ # Using OpenAI with Chat Completions API
59
64
  ```python
60
- model_id = ModelId.from_string("azure-openai/https://my-resource.openai.azure.com/openai/v1:my-deployment")
65
+ model_id = ModelId.from_string("openai-chat-completions/gpt-5-nano")
66
+ ```
67
+
68
+ # Using OpenAI Responses API-compatible endpoints (e.g. SGLang)
69
+ ```python
70
+ model_id = ModelId.from_string("openai/https://my-sglang-url:8000/v1:my-model-name")
61
71
  ```
62
72
 
63
- # Using OpenAI compatible endpoints (e.g. Groq)
73
+ # Using OpenAI Chat Completions API-compatible endpoints (e.g. Groq)
64
74
  ```python
65
- model_id = ModelId.from_string("openai-compatible/https://api.groq.com/openai/v1:llama3-8b-8192")
75
+ model_id = ModelId.from_string("openai-chat-completions/https://api.groq.com/openai/v1:llama3-8b-8192")
76
+ ```
77
+
78
+ # Using Azure OpenAI
79
+ ```python
80
+ model_id = ModelId.from_string("azure-openai/https://my-resource.openai.azure.com/openai/v1:my-deployment")
66
81
  ```
67
82
 
68
83
  # Using Voyage
@@ -89,7 +104,7 @@ class ModelId(BaseModel):
89
104
  For the list of supported providers, please refer to the following page:
90
105
  https://docs.litellm.ai/docs/providers/
91
106
 
92
- # Using XAI
107
+ # Using xAI
93
108
  ```python
94
109
  model_id = ModelId.from_string("xai/grok-4-0709")
95
110
  ```
@@ -99,9 +114,9 @@ class ModelId(BaseModel):
99
114
  Custom model name validation example:
100
115
  ```python
101
116
  validation_map = {
102
- ModelProvider.ANTHROPIC: {"claude-3-5-sonnet-latest"},
103
- ModelProvider.GOOGLE: {"gemini-1.5-flash", "gemini-1.5-pro"},
104
- ModelProvider.OPENAI: {"gpt-4o", "gpt-4o-mini"},
117
+ ModelProvider.ANTHROPIC: {"claude-sonnet-4-20250514"},
118
+ ModelProvider.GOOGLE: {"gemini-2.5-flash-lite"},
119
+ ModelProvider.OPENAI: {"gpt-4.1-nano", "gpt-5-nano"},
105
120
  }
106
121
 
107
122
  model_id = ModelId.from_string("...", validation_map)
@@ -115,13 +130,8 @@ class ModelId(BaseModel):
115
130
  """Parse a model id string into a ModelId object.
116
131
 
117
132
  Args:
118
- model_id (str): The model id to parse. Must be in the the following format:
119
- 1. For `azure-openai` provider: `azure-openai/azure-endpoint:azure-deployment`.
120
- 2. For `openai-compatible` provider: `openai-compatible/base-url:model-name`.
121
- 3. For `langchain` provider: `langchain/<package>.<class>:model-name`.
122
- 4. For `litellm` provider: `litellm/provider/model-name`.
123
- 5. For `datasaur` provider: `datasaur/base-url`.
124
- 6. For other providers: `provider/model-name`.
133
+ model_id (str): The model id to parse. Must be in the format defined in the following page:
134
+ https://gdplabs.gitbook.io/sdk/resources/supported-models
125
135
  validation_map (dict[str, set[str]] | None, optional): An optional dictionary that maps provider names to
126
136
  sets of valid model names. For the defined model providers, the model names will be validated against
127
137
  the set of valid model names. For the undefined model providers, the model name will not be validated.
@@ -137,11 +147,6 @@ class ModelId(BaseModel):
137
147
  """Convert the ModelId object to a string.
138
148
 
139
149
  Returns:
140
- str: The string representation of the ModelId object. The format is as follows:
141
- 1. For `azure-openai` provider: `azure-openai/azure-endpoint:azure-deployment`.
142
- 2. For `openai-compatible` provider: `openai-compatible/base-url:model-name`.
143
- 3. For `langchain` provider: `langchain/<package>.<class>:model-name`.
144
- 4. For `litellm` provider: `litellm/provider/model-name`.
145
- 5. For `datasaur` provider: `datasaur/base-url`.
146
- 6. For other providers: `provider/model-name`.
150
+ str: The string representation of the ModelId object. The format is defined in the following page:
151
+ https://gdplabs.gitbook.io/sdk/resources/supported-models
147
152
  """
Binary file
gllm_inference.pyi CHANGED
@@ -27,6 +27,7 @@ import gllm_inference.lm_invoker.DatasaurLMInvoker
27
27
  import gllm_inference.lm_invoker.GoogleLMInvoker
28
28
  import gllm_inference.lm_invoker.LangChainLMInvoker
29
29
  import gllm_inference.lm_invoker.LiteLLMLMInvoker
30
+ import gllm_inference.lm_invoker.OpenAIChatCompletionsLMInvoker
30
31
  import gllm_inference.lm_invoker.OpenAICompatibleLMInvoker
31
32
  import gllm_inference.lm_invoker.OpenAILMInvoker
32
33
  import gllm_inference.lm_invoker.XAILMInvoker
@@ -121,6 +122,11 @@ import xai_sdk.proto.v5
121
122
  import xai_sdk.proto.v5.chat_pb2
122
123
  import transformers
123
124
  import gllm_inference.prompt_formatter.HuggingFacePromptFormatter
125
+ import logging
126
+ import traceback
127
+ import gllm_inference.realtime_chat.input_streamer.KeyboardInputStreamer
128
+ import gllm_inference.realtime_chat.output_streamer.ConsoleOutputStreamer
129
+ import google.genai.live
124
130
  import gllm_core.utils.logger_manager
125
131
  import mimetypes
126
132
  import uuid
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gllm-inference-binary
3
- Version: 0.5.34
3
+ Version: 0.5.36
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