Skip to main content

agrag.agents.model.build_chat_model

build_chat_model(config:LLMClientConfig) -> Any

Translate one LLMClientConfig into a LangChain chat model.

Covers anthropic, openai, openai-generic (mapped to ChatOpenAI with base_url set), and google-ai. The remaining LLMProvider values are valid for BAML but have no agent-side mapping yet.

Parameters:

  • config (LLMClientConfig) – The provider, model, api_key, and base_url to use.

Returns:

  • Any – A constructed, ready-to-call BaseChatModel.

Raises: