Class: Responder
- Inherits:
-
Object
- Object
- Responder
- Defined in:
- lib/responder.rb
Instance Method Summary collapse
- #call(question, top_k = 10) ⇒ Object
-
#initialize(vector_store:, llm: MistralAPI.new, file:, embedding_creator: MistralEmbeddingCreator.new) ⇒ Responder
constructor
A new instance of Responder.
Constructor Details
#initialize(vector_store:, llm: MistralAPI.new, file:, embedding_creator: MistralEmbeddingCreator.new) ⇒ Responder
Returns a new instance of Responder.
14 15 16 17 18 19 |
# File 'lib/responder.rb', line 14 def initialize(vector_store:, llm: MistralAPI.new, file:, embedding_creator: MistralEmbeddingCreator.new) @vector_store = vector_store @llm = llm @file = file @embedding_creator = end |
Instance Method Details
#call(question, top_k = 10) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/responder.rb', line 21 def call(question, top_k=10) = (question) results = process_similarity(question, top_k) context = fetch_context(, top_k) merged_text = merge_texts(results, context) prompt = construct_prompt(question, merged_text) generate_response(prompt) end |