LangChain & LangGraph Integration
Integrate Setu models with LangChain Python and LangChain.js chains, retrieval-augmented generation (RAG), and multi-actor agent graphs.
Python Integration
bash
pip install langchain-openaipython
import os
from langchain_openai import ChatOpenAI
from langchain_core.messages import HumanMessage, SystemMessage
llm = ChatOpenAI(
model="quantum-lite",
openai_api_key=os.environ.get("SUPREME_API_KEY"),
openai_api_base="https://supremeai.services/api/setu/v1",
temperature=0.7
)
messages = [
SystemMessage(content="You are an expert tutor in mathematics and engineering."),
HumanMessage(content="What is Euler's formula?")
]
response = llm.invoke(messages)
print(response.content)JavaScript / TypeScript Integration
typescript
import { ChatOpenAI } from '@langchain/openai';
const model = new ChatOpenAI({
model: 'quantum-lite',
apiKey: process.env.SUPREME_API_KEY,
configuration: {
baseURL: 'https://supremeai.services/api/setu/v1',
},
});
const res = await model.invoke('Explain how DNS works in simple terms.');
console.log(res.content);