Class: Firecrawl::Models::JsonFormat

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

Overview

JSON format for extracting structured data from page content using a schema.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema: nil, prompt: nil, check_prompt_injection: nil) ⇒ JsonFormat

Returns a new instance of JsonFormat.



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

def initialize(schema: nil, prompt: nil, check_prompt_injection: nil)
  @schema = schema
  @prompt = prompt
  @check_prompt_injection = check_prompt_injection
end

Instance Attribute Details

#check_prompt_injectionObject (readonly)

Returns the value of attribute check_prompt_injection.



47
48
49
# File 'lib/firecrawl/models/query_format.rb', line 47

def check_prompt_injection
  @check_prompt_injection
end

#promptObject (readonly)

Returns the value of attribute prompt.



47
48
49
# File 'lib/firecrawl/models/query_format.rb', line 47

def prompt
  @prompt
end

#schemaObject (readonly)

Returns the value of attribute schema.



47
48
49
# File 'lib/firecrawl/models/query_format.rb', line 47

def schema
  @schema
end

Instance Method Details

#to_hObject



55
56
57
58
59
60
61
62
# File 'lib/firecrawl/models/query_format.rb', line 55

def to_h
  {
    "type" => "json",
    "schema" => schema,
    "prompt" => prompt,
    "checkPromptInjection" => check_prompt_injection,
  }.compact
end

#typeObject



64
65
66
# File 'lib/firecrawl/models/query_format.rb', line 64

def type
  "json"
end