DocumentationNeuronDB Documentation
Documentation Branch: You are viewing documentation for the main branch (3.0.0-devel). Select a branch to view its documentation:

Complete RAG Support

Complete RAG Support

End-to-end Retrieval Augmented Generation pipeline.

Basic RAG

Complete RAG workflow:

-- RAG query
SELECT rag_query(
    'What is machine learning?',     -- query
    'documents',                     -- source table
    'content',                       -- text column
    'embedding',                     -- embedding column
    5,                               -- top K retrieved
    'gpt-4'                          -- LLM model
) AS answer;

RAG with Context

Add additional context:

-- RAG with custom context
SELECT rag_query_with_context(
    'query text',
    'documents',
    'content',
    'embedding',
    5,
    'gpt-4',
    '{"system_prompt": "You are a helpful assistant"}'::jsonb
) AS answer;

Learn More

For detailed documentation on RAG pipelines, prompt engineering, context management, and evaluation, visit:

RAG Documentation