Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4005: Add a procedure for RAG #4077

Merged
merged 1 commit into from
May 29, 2024
Merged

Fixes #4005: Add a procedure for RAG #4077

merged 1 commit into from
May 29, 2024

Conversation

vga91
Copy link
Collaborator

@vga91 vga91 commented May 16, 2024

Fixes #4005

Added a procedure for RAG you pass the user question plus a graph pattern (paths) and relevant attributes and it creates a prompt to answer the user question using the data on those paths and executes that with the llm provider and returns the answer

Retrieval-augmented generation (RAG) is a technique that reduces hallucinations and enhances the accuracy and reliability of generative AI models with facts fetched from external sources.
See here: https://aws.amazon.com/it/what-is/retrieval-augmented-generation/

Changes

  • Created apoc.ml.rag(paths, attributes, question, conf) procedure
  • paths can be a list of paths to retrieve and augment the prompt, it can also be a matching query or a vector index name
  • attributes is the list of relevant attributes useful to retrieve and augment the prompt
  • question is the user question
  • conf can have
    • getLabelTypes (to add label/rel names to the useful info),
    • embeddings to retrieve entities from vector node/rel indexes
    • topK to retrieve k result in case of vector index search
    • prompt to customize the base prompt to be augmented with the context
    • apiKey

@vga91 vga91 marked this pull request as ready for review May 28, 2024 16:02
@RobertoSannino RobertoSannino merged commit 0051cb7 into dev May 29, 2024
5 checks passed
@RobertoSannino RobertoSannino deleted the issue-4005 branch May 29, 2024 09:58
vga91 added a commit that referenced this pull request May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants