INNER CODE UNIT · Python
Graph
mfmezger/conversational-agent-langchain · src/agent/backend/graph.py:25
class Graph:
"""The LangGraph Graph."""
def __init__(self) -> None:
"""Initialize the Graph."""
self.cfg = settings
# define models
self.llm = ChatLiteLLM(model_name=self.cfg.model_name, streaming=True)
# Initialize Cohere model for grounded generation (if API key is available)
self.cohere_llm: ChatCohere | None = None
if self.cfg.cohere_api_key:
self.cohere_llm = ChatCohere(
cohere_api_key=self.cfg.cohere_api_key,
model=self.cfg.cohere_model_name,
streaming=True,
)