Class: LlmScraper::PromptBuilder
- Inherits:
-
Object
- Object
- LlmScraper::PromptBuilder
- Defined in:
- lib/llm_scraper/prompt_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #build(content) ⇒ Object
-
#initialize(schema) ⇒ PromptBuilder
constructor
A new instance of PromptBuilder.
Constructor Details
#initialize(schema) ⇒ PromptBuilder
Returns a new instance of PromptBuilder.
12 13 14 |
# File 'lib/llm_scraper/prompt_builder.rb', line 12 def initialize(schema) @schema = schema end |
Class Method Details
.build(schema, content) ⇒ String
8 9 10 |
# File 'lib/llm_scraper/prompt_builder.rb', line 8 def self.build(schema, content) new(schema).build(content) end |
Instance Method Details
#build(content) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/llm_scraper/prompt_builder.rb', line 16 def build(content) <<~PROMPT Extract the following fields from the content below. Return ONLY a valid JSON object. No markdown fences. No explanation. Fields: #{render_fields} Rules: - Missing field → null (never omit the key) - Return nothing except the JSON object Content: #{content} PROMPT end |