Skip to content

Commit 9a15a87

Browse files
committed
Use dynamic models to make the LLM call
1 parent 6a63a69 commit 9a15a87

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

cx-agent-backend/src/infrastructure/adapters/langgraph_agent_service.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,16 @@ def __init__(
3737

3838
def _create_agent(self, agent_type: AgentType, model: str) -> any:
3939
"""Create agent with specific model."""
40-
llm = self._llm_service.model
40+
from langchain_openai import ChatOpenAI
41+
42+
# Create LLM with the specified model
43+
llm = ChatOpenAI(
44+
api_key=self._llm_service.api_key,
45+
base_url=self._llm_service.base_url,
46+
model=model,
47+
temperature=0.7,
48+
streaming=True,
49+
)
4150

4251
prompts = {
4352
AgentType.CUSTOMER_SERVICE: "You are a helpful customer service agent.",

cx-agent-backend/src/infrastructure/adapters/openai_llm_service.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class OpenAILLMService(LLMService):
1111
"""OpenAI implementation of LLM service."""
1212

1313
def __init__(self, api_key: str, model: str, base_url: str | None = None):
14+
self.api_key = api_key
15+
self.base_url = base_url
1416
self.model = ChatOpenAI(
1517
api_key=api_key,
1618
base_url=base_url,

0 commit comments

Comments
 (0)