Class: Firecrawl::Models::QueryFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/firecrawl/models/query_format.rb

Overview

Query format for asking a question about page content.

Constant Summary collapse

MODE_FREEFORM =
"freeform"
MODE_DIRECT_QUOTE =
"directQuote"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prompt:, mode: nil) ⇒ QueryFormat

Returns a new instance of QueryFormat.



12
13
14
15
16
17
18
19
# File 'lib/firecrawl/models/query_format.rb', line 12

def initialize(prompt:, mode: nil)
  unless mode.nil? || [MODE_FREEFORM, MODE_DIRECT_QUOTE].include?(mode)
    raise ArgumentError, "query mode must be 'freeform' or 'directQuote'"
  end

  @prompt = prompt
  @mode = mode
end

Instance Attribute Details

#modeObject (readonly)

Returns the value of attribute mode.



10
11
12
# File 'lib/firecrawl/models/query_format.rb', line 10

def mode
  @mode
end

#promptObject (readonly)

Returns the value of attribute prompt.



10
11
12
# File 'lib/firecrawl/models/query_format.rb', line 10

def prompt
  @prompt
end

Instance Method Details

#to_hObject



21
22
23
24
25
26
27
# File 'lib/firecrawl/models/query_format.rb', line 21

def to_h
  {
    "type" => "query",
    "prompt" => prompt,
    "mode" => mode,
  }.compact
end

#typeObject



29
30
31
# File 'lib/firecrawl/models/query_format.rb', line 29

def type
  "query"
end