Files
AI/참고/firecrawl-main/apps/ruby-sdk/lib/firecrawl/models/agent_options.rb
2026-05-12 19:40:31 +09:00

34 lines
888 B
Ruby

# frozen_string_literal: true
module Firecrawl
module Models
# Options for starting an agent task.
class AgentOptions
FIELDS = %i[
urls prompt schema integration max_credits
strict_constrain_to_urls model webhook
].freeze
attr_reader(*FIELDS)
def initialize(**kwargs)
FIELDS.each { |f| instance_variable_set(:"@#{f}", kwargs[f]) }
raise ArgumentError, "Agent prompt is required" if prompt.nil? || prompt.empty?
end
def to_h
{
"urls" => urls,
"prompt" => prompt,
"schema" => schema,
"integration" => integration,
"maxCredits" => max_credits,
"strictConstrainToURLs" => strict_constrain_to_urls,
"model" => model,
"webhook" => webhook.is_a?(Hash) ? webhook : webhook&.to_h,
}.compact
end
end
end
end