LLM Integration
LLM Module
LLM Implementation
- openchatbi.llm.llm.list_llm_providers() list[str][source]
List configured LLM provider names (if any).
- openchatbi.llm.llm.get_embedding_model(provider: str | None = None)[source]
Get embedding model from config (optionally scoped to a provider).
- openchatbi.llm.llm.get_default_llm(provider: str | None = None)[source]
Get default LLM from config (optionally scoped to a provider).
- openchatbi.llm.llm.get_llm(provider: str | None = None)[source]
Get the chat model to use (alias for get_default_llm).
- openchatbi.llm.llm.get_text2sql_llm(provider: str | None = None)[source]
Get text2sql LLM from config (optionally scoped to a provider).
- openchatbi.llm.llm.get_analysis_llm(provider: str | None = None)[source]
Get the data analysis LLM from config (optionally scoped to a provider).
Falls back to the default LLM when no dedicated analysis_llm is configured.
- openchatbi.llm.llm.call_llm_chat_model_with_retry(chat_model: BaseChatModel, messages, streaming_tokens=False, bound_tools=None, parallel_tool_call=False, metadata: dict | None = None)[source]
Calls a language model chat endpoint with retry logic.
Retries up to 3 times if there are errors or invalid tool calls.
- Parameters:
chat_model – The chat model to invoke.
messages (list) – List of messages to send to the model.
streaming_tokens (bool, optional) – flag to indicate whether or not to show streaming tokens in UI.
bound_tools (list, optional) – List of valid tool names that can be called.
parallel_tool_call (bool, optional) – whether or not to call multiple tools in parallel.
- Returns:
The model response or None if all retries failed.
- Return type:
AIMessage or None