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 implementations

  • RemoteLLMModel - OpenAI-compatible remote client

  • FakeLLMModel - Fake model for testing and development

  • ResponseStream - Streaming response handler

  • OpenAIResponseStream - OpenAI-specific streaming handler

  • LLMTask - Task wrapper with conversation history management

  • load_llm_model_from_config() - Load model from configuration

  • load_llm_model() - Load model by name, instance, or default

  • LLMModelTyping - 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)