Class: Mindee::V2::Parsing::Search::SearchRAGDocuments

Inherits:
Array
  • Object
show all
Defined in:
lib/mindee/v2/parsing/search/search_rag_documents.rb

Overview

List of RAG documents.

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ SearchRAGDocuments

Returns a new instance of SearchRAGDocuments.

Parameters:

  • raw_response (Array<Hash>) —

    The parsed JSON payload mapping to the RAG documents.



12
13
14
# File 'lib/mindee/v2/parsing/search/search_rag_documents.rb', line 12

def initialize(raw_response)
  super(raw_response.map { |entry| SearchRAGDocument.new(entry) })
end

Instance Method Details

#to_s ⇒ String

Default string representation.

Returns:

  • (String)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/mindee/v2/parsing/search/search_rag_documents.rb', line 18

def to_s
  return "\n" if empty?

  lines = flat_map do |rag_document|
    [
      "* :ID: #{rag_document.id}",
      "  :Model ID: #{rag_document.model_id}",
      "  :Filename: #{rag_document.filename}",
      "  :Created At: #{rag_document.created_at}",
      "  :Total Matches: #{rag_document.total_matches}",
      "  :Last Match At: #{rag_document.last_match_at}",
      "  :Status: #{rag_document.status}",
    ]
  end

  "#{lines.join("\n")}\n"
end