We'd like to expose the ask() method so that you can utilize the RAG (Retrieval Augmented Generation) flow when operating on the ActiveRecord model.
Steps
In the Langchain::ActiveRecord::Hooks class, similar to the similarity_search() method we should expose the ask() method.
This method should be just forwarding the ask() method along to the vectorsearch provider. You can see how the ask() method works by looking at any of the implementations inside of the vectorsearch/* classes.
Expected behavior:
Recipe.ask(question: "...")
# Top results are fetched from the vectorsearch DB and inserted as a context
# LLM produces a response
Motivation
We'd like to expose the
ask()
method so that you can utilize the RAG (Retrieval Augmented Generation) flow when operating on the ActiveRecord model.Steps
In the
Langchain::ActiveRecord::Hooks
class, similar to the similarity_search() method we should expose theask()
method. This method should be just forwarding theask()
method along to the vectorsearch provider. You can see how theask()
method works by looking at any of the implementations inside of thevectorsearch/*
classes.Expected behavior: