Developer guide: AI retrieval
Retrieve database information for an AI answer.
This example searches a graph of research papers. LightningDB finds papers relevant to a topic and gathers information about their authors and related work for an AI application.
Example: find research about machine learning.
The request finds ten relevant papers and follows up to three relationship steps from each match. In this sample graph, the relationships connect papers and researchers.
Find machine learning papers
curl http://localhost:7475/v1/rag \
-H 'Content-Type: application/json' \
--data '{
"query": "machine learning papers",
"k": 10,
"hops": 3
}'
k sets the number of matches. hops sets how far to explore their connections.
Relevant papers and related information
hits- The research papers matched to your topic, ordered by relevance.
documents- A description of each matched paper, including its authors and related work. Your AI application can use this text when preparing an answer.
subgraph_nodes- The number of records reached while following relationships from the matched papers.
This explains the response fields; the actual papers and relationships depend on the data you load.
Connect your existing AI tools.
The Python package includes LangChain and LlamaIndex integrations for passing retrieved database information to an AI application.
Start with a local graph
Evaluate LightningDB, start the database, and run the example above.
Plan your evaluation →