InputHandler
Sub classes
| Name |
Children |
Inherits |
DefaultInputHandler llmling_models.models.input_model.input_handlers Default input handler using standard input. |
|
|
Base classes
| Name |
Children |
Inherits |
Protocol typing Base class for protocol classes. |
|
|
⋔ Inheritance diagram
graph TD
3617281302["input_handlers.InputHandler"]
1073422405["typing.Protocol"]
3481597255["typing.Generic"]
2751680898["builtins.object"]
1073422405 --> 3617281302
3481597255 --> 1073422405
2751680898 --> 3481597255
🛈 DocStrings
Bases: Protocol
Protocol for input handlers.
Source code in src/llmling_models/models/input_model/input_handlers.py
| @runtime_checkable
class InputHandler(Protocol):
"""Protocol for input handlers."""
def get_input(self, prompt: str) -> str | Awaitable[str]:
"""Get single input response. Can be sync or async."""
...
def stream_input(self, prompt: str) -> AsyncIterator[str] | Awaitable[AsyncIterator[str]]:
"""Stream input character by character. Can be sync or async."""
...
def format_messages(
self,
messages: list[ModelMessage],
*,
prompt_template: str,
show_system: bool,
) -> str:
"""Format messages for display."""
...
|
format_messages(messages: list[ModelMessage], *, prompt_template: str, show_system: bool) -> str
Format messages for display.
Source code in src/llmling_models/models/input_model/input_handlers.py
| def format_messages(
self,
messages: list[ModelMessage],
*,
prompt_template: str,
show_system: bool,
) -> str:
"""Format messages for display."""
...
|
get_input(prompt: str) -> str | Awaitable[str]
Get single input response. Can be sync or async.
Source code in src/llmling_models/models/input_model/input_handlers.py
| def get_input(self, prompt: str) -> str | Awaitable[str]:
"""Get single input response. Can be sync or async."""
...
|
stream_input(prompt: str) -> AsyncIterator[str] | Awaitable[AsyncIterator[str]]
Stream input character by character. Can be sync or async.
Source code in src/llmling_models/models/input_model/input_handlers.py
| def stream_input(self, prompt: str) -> AsyncIterator[str] | Awaitable[AsyncIterator[str]]:
"""Stream input character by character. Can be sync or async."""
...
|
:fa-brands-github: Show source on GitHub