AI Integration
Set up the AIEngine to query your graph with natural language and highlight relevant nodes.
AI Integration
The AI engine builds graph context, sends it to an LLM, and parses the response to highlight relevant nodes.
import { useInferaGraph } from '@inferagraph/react';
import { useState } from 'react';
function AskAboutAbraham() {
const { aiEngine } = useInferaGraph();
const [answer, setAnswer] = useState('');
async function handleAsk() {
const result = await aiEngine.query(
'Who was Abraham\'s wife?'
);
setAnswer(result.answer);
// result.highlightedNodeIds → ['abraham', 'sarah']
}
return (
<div>
<button onClick={handleAsk}>Ask</button>
<p>{answer}</p>
</div>
);
}