This repository was archived by the owner on Jun 3, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ Claude model factory.
3+ """
4+
5+ from langchain_anthropic import ChatAnthropic
6+ from langchain_core .language_models import BaseChatModel
7+
8+ from src .config import settings
9+
10+
11+ def build_claude_model (
12+ model_name : str | None = None ,
13+ temperature : float | None = None ,
14+ ) -> BaseChatModel :
15+ api_key = settings .claude_api_key
16+ if not api_key :
17+ raise ValueError ("CLAUDE_API_KEY is not set" )
18+
19+ return ChatAnthropic (
20+ model = model_name or settings .claude_model ,
21+ api_key = api_key ,
22+ temperature = temperature if temperature is not None else settings .temperature ,
23+ )
Original file line number Diff line number Diff line change @@ -39,15 +39,8 @@ def _build_gemini(**kw) -> BaseChatModel:
3939
4040
4141def _build_claude (** kw ) -> BaseChatModel :
42- from langchain_anthropic import ChatAnthropic
43- api_key = settings .claude_api_key
44- if not api_key :
45- raise ValueError ("CLAUDE_API_KEY is not set" )
46- return ChatAnthropic (
47- model = kw .get ("model_name" ) or settings .claude_model ,
48- api_key = api_key ,
49- temperature = kw .get ("temperature" ) if kw .get ("temperature" ) is not None else settings .temperature ,
50- )
42+ from src .models .claude import build_claude_model
43+ return build_claude_model (** kw )
5144
5245
5346def _build_openai (** kw ) -> BaseChatModel :
You can’t perform that action at this time.
0 commit comments