Module: Chatpdf::Actionable::InstanceMethods

Defined in:
lib/chatpdf/concerns/actionable.rb

Instance Method Summary collapse

Instance Method Details

#add_pdf(file_path) ⇒ Object



4
5
6
# File 'lib/chatpdf/concerns/actionable.rb', line 4

def add_pdf(file_path)
  Chatpdf::Api::FileUpload.new(self).add_pdf_via_upload(file_path)
end

#add_pdf_via_url(url) ⇒ Object



8
9
10
# File 'lib/chatpdf/concerns/actionable.rb', line 8

def add_pdf_via_url(url)
  Chatpdf::Api::FileUpload.new(self).add_pdf_via_url(url)
end

#chat(source_id, messages) ⇒ Object



12
13
14
15
16
17
# File 'lib/chatpdf/concerns/actionable.rb', line 12

def chat(source_id, messages)
  Chatpdf::Api::Chat.new(self).chat(
    source_id,
    messages
  )
end

#chat_stream(source_id, messages) ⇒ Object



30
31
32
33
34
# File 'lib/chatpdf/concerns/actionable.rb', line 30

def chat_stream(source_id, messages)
  Chatpdf::Api::ChatStream.new(self).chat_stream(source_id, messages) do |chunk|
    yield chunk
  end
end

#chat_with_reference(source_id, messages) ⇒ Object



19
20
21
22
23
24
# File 'lib/chatpdf/concerns/actionable.rb', line 19

def chat_with_reference(source_id, messages)
  Chatpdf::Api::Chat.new(self).chat_with_reference(
    source_id,
    messages
  )
end

#delete_source(source_ids = []) ⇒ Object



26
27
28
# File 'lib/chatpdf/concerns/actionable.rb', line 26

def delete_source(source_ids = [])
  Chatpdf::Api::DeleteSource.new(self).delete_source(source_ids)
end