hbllmutils.model
Large Language Model (LLM) client package initialization.
This module defines the public API for the hbllmutils.model package by
exposing the core LLM abstractions, remote model client, streaming handlers,
task helper, and configuration loaders. It provides a single import surface for
applications that need to interact with OpenAI-compatible endpoints, simulate
responses for testing, or manage conversation tasks.
The module contains the following main components:
LLMModel- Abstract interface for LLM implementationsRemoteLLMModel- OpenAI-compatible remote clientFakeLLMModel- Fake model for testing and developmentResponseStream- Streaming response handlerOpenAIResponseStream- OpenAI-specific streaming handlerLLMTask- Task wrapper with conversation history managementload_llm_model_from_config()- Load model from configurationload_llm_model()- Load model by name, instance, or defaultLLMModelTyping- Type alias for model inputs
Example:
>>> from hbllmutils.model import RemoteLLMModel, LLMTask
>>> model = RemoteLLMModel(
... base_url="https://api.openai.com/v1",
... api_token="your-key",
... model_name="gpt-3.5-turbo"
... )
>>> task = LLMTask(model)
>>> response = task.ask("Hello!")
>>> print(response)