Class: Mindee::V2::Parsing::Search::SearchRAGDocument

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

Overview

Individual RAG document information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_response) ⇒ SearchRAGDocument

Returns a new instance of SearchRAGDocument.

Parameters:

  • server_response (Hash) —

    The parsed JSON payload mapping to the RAG document.



33
34
35
36
37
38
39
40
41
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 33

def initialize(server_response)
  @id = server_response['id']
  @model_id = server_response['model_id']
  @filename = server_response['filename']
  @created_at = Time.iso8601(server_response['created_at'])
  @total_matches = server_response['total_matches']
  @last_match_at = (Time.iso8601(server_response['last_match_at']) if server_response['last_match_at'])
  @status = server_response['status']
end

Instance Attribute Details

#created_at ⇒ Time (readonly)

Returns Date and time of the document creation.

Returns:

  • (Time) —

    Date and time of the document creation.



21
22
23
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 21

def created_at
  @created_at
end

#filename ⇒ String (readonly)

Returns Original filename of the uploaded document.

Returns:

  • (String) —

    Original filename of the uploaded document.



18
19
20
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 18

def filename
  @filename
end

#id ⇒ String (readonly)

Returns Unique identifier of the RAG document.

Returns:

  • (String) —

    Unique identifier of the RAG document.



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

def id
  @id
end

#last_match_at ⇒ Time? (readonly)

Returns Date and time of the latest matching inference, if any.

Returns:

  • (Time, nil) —

    Date and time of the latest matching inference, if any.



27
28
29
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 27

def last_match_at
  @last_match_at
end

#model_id ⇒ String (readonly)

Returns Model identifier linked to the RAG document.

Returns:

  • (String) —

    Model identifier linked to the RAG document.



15
16
17
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 15

def model_id
  @model_id
end

#status ⇒ String (readonly)

Returns Current status of the RAG document.

Returns:

  • (String) —

    Current status of the RAG document.



30
31
32
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 30

def status
  @status
end

#total_matches ⇒ Integer (readonly)

Returns Number of times this document was used in an inference.

Returns:

  • (Integer) —

    Number of times this document was used in an inference.



24
25
26
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 24

def total_matches
  @total_matches
end

Instance Method Details

#to_s ⇒ String

String representation of the RAG document.

Returns:

  • (String)


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mindee/v2/parsing/search/search_rag_document.rb', line 45

def to_s
  [
    ":ID: #{@id}",
    ":Model ID: #{@model_id}",
    ":Filename: #{@filename}",
    ":Created At: #{@created_at}",
    ":Total Matches: #{@total_matches}",
    ":Last Match At: #{@last_match_at}",
    ":Status: #{@status}",
  ].join("\n")
end