Spaces:
Sleeping
Sleeping
Download apps/ruby-sdk/lib/firecrawl/models/query_format.rb from s-eto-hub/firecrawl-api: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/ruby-sdk/lib/firecrawl/models/query_format.rb
- Command line
-
hf download hf://spaces/s-eto-hub/firecrawl-api/apps/ruby-sdk/lib/firecrawl/models/query_format.rb
-
curl -L -o query_format.rb https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/ruby-sdk/lib/firecrawl/models/query_format.rb
1.44 kB
| # frozen_string_literal: true | |
| module Firecrawl | |
| module Models | |
| # Question format for asking a question about page content. | |
| class QuestionFormat | |
| attr_reader :question | |
| def initialize(question:) | |
| @question = question | |
| end | |
| def to_h | |
| { | |
| "type" => "question", | |
| "question" => question, | |
| } | |
| end | |
| def type | |
| "question" | |
| end | |
| end | |
| # Highlights format for extracting direct highlights from page content. | |
| class HighlightsFormat | |
| attr_reader :query | |
| def initialize(query:) | |
| @query = query | |
| end | |
| def to_h | |
| { | |
| "type" => "highlights", | |
| "query" => query, | |
| } | |
| end | |
| def type | |
| "highlights" | |
| end | |
| end | |
| # Deprecated query format for asking a question about page content. | |
| class QueryFormat | |
| MODE_FREEFORM = "freeform" | |
| MODE_DIRECT_QUOTE = "directQuote" | |
| attr_reader :prompt, :mode | |
| 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 | |
| def to_h | |
| { | |
| "type" => "query", | |
| "prompt" => prompt, | |
| "mode" => mode, | |
| }.compact | |
| end | |
| def type | |
| "query" | |
| end | |
| end | |
| end | |
| end | |