Class: Firecrawl::Models::QueryFormat

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

Overview

Deprecated 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.



52
53
54
55
56
57
58
59
# File 'lib/firecrawl/models/query_format.rb', line 52

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.



50
51
52
# File 'lib/firecrawl/models/query_format.rb', line 50

def mode
  @mode
end

#promptObject (readonly)

Returns the value of attribute prompt.



50
51
52
# File 'lib/firecrawl/models/query_format.rb', line 50

def prompt
  @prompt
end

Instance Method Details

#to_hObject



61
62
63
64
65
66
67
# File 'lib/firecrawl/models/query_format.rb', line 61

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

#typeObject



69
70
71
# File 'lib/firecrawl/models/query_format.rb', line 69

def type
  "query"
end