Client / LangGraph
Use NeoSyntropy inside LangGraph
Drop a NeoSyntropy-backed chat model into a StateGraph while LangGraph keeps ownership of state, edges, and node execution.Install the adapter
Terminalbash
pip install "neosyntropy[langgraph]"Create the model client
Pythonpython
import os
from neosyntropy.integrations.langgraph import NeoSyntropyChatModel
llm = NeoSyntropyChatModel(
api_key=os.environ["NEOSYNTROPY_API_KEY"],
model="default",
project_id=os.environ.get("NEOSYNTROPY_PROJECT_ID"),
)
reply = llm.invoke("Summarize the customer request.")
print(reply.content)Wire it into a StateGraph
Pythonpython
from typing import TypedDict
from langgraph.graph import END, StateGraph
class State(TypedDict):
request: str
summary: str
def summarize(state: State):
answer = llm.invoke(state["request"])
return {"summary": str(answer.content)}
graph = StateGraph(State)
graph.add_node("summarize", summarize)
graph.set_entry_point("summarize")
graph.add_edge("summarize", END)
app = graph.compile()
result = app.invoke({"request": "Customer asks to move invoice 2048."})