feat: Interface to validate response_source (#8894)
- This PR adds a UI to validate the response source quality quickly. It also helps to test with sample questions and update responses in the database when missing. Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -25,4 +25,9 @@ class ResponseSource < ApplicationRecord
|
||||
has_many :responses, dependent: :destroy_async
|
||||
|
||||
accepts_nested_attributes_for :response_documents
|
||||
|
||||
def get_responses(query)
|
||||
embedding = Openai::EmbeddingsService.new.get_embedding(query)
|
||||
responses.active.nearest_neighbors(:embedding, embedding, distance: 'cosine').first(5)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user