Class: CoachZed::PromptBuilder
- Inherits:
-
Object
- Object
- CoachZed::PromptBuilder
- Defined in:
- lib/coach_zed/prompt_builder.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(consultation_prompt:, catalog:, start_date:, schedule_key:, generation_days:, existing_feed_context: nil) ⇒ PromptBuilder
constructor
A new instance of PromptBuilder.
Constructor Details
#initialize(consultation_prompt:, catalog:, start_date:, schedule_key:, generation_days:, existing_feed_context: nil) ⇒ PromptBuilder
Returns a new instance of PromptBuilder.
8 9 10 11 12 13 14 15 |
# File 'lib/coach_zed/prompt_builder.rb', line 8 def initialize(consultation_prompt:, catalog:, start_date:, schedule_key:, generation_days:, existing_feed_context: nil) @consultation_prompt = consultation_prompt @catalog = catalog @start_date = start_date @schedule_key = schedule_key @generation_days = generation_days @existing_feed_context = existing_feed_context end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/coach_zed/prompt_builder.rb', line 17 def build <<~PROMPT You are a training coach. Build a daily training schedule for the athlete using only the provided catalog. CoachZed manages the scheduling contract, so follow the rules below without requiring the end user to restate them. Return strict JSON only. Do not wrap it in markdown fences or commentary. Every string value must be valid JSON text on a single line. Do not emit literal newlines, tabs, or other control characters inside string values. Required JSON Schema: #{JSON.pretty_generate(CoachZed::ScheduleSchema.to_h)} Rules: - Produce exactly #{generation_days} entries for the requested time period. - Set `program_length_days` to exactly #{generation_days}. - Keep `program_length_days` equal to the number of entries in `days`. - Treat catalog entries marked `primary` as the main training sessions. - Aim for 5-6 primary workouts per 7-day week. - Use at most one primary workout per day. - A primary day may include one complementary workout. - On non-primary days, pair complementary workouts with other complementary work only. - Keep rest days to 1 or fewer per 7-day week. - Include rest days when appropriate. - Use only workouts that exist in the catalog. - Match the athlete's goals and the requested time period. - If existing feed context is provided, continue from the end of the prior feed and avoid changing earlier weeks. - Keep the JSON valid and complete. Schedule metadata: - Start date: #{@start_date.iso8601} - Schedule key: #{@schedule_key} Athlete consultation prompt: #{@consultation_prompt} Existing feed context (most recent weeks, if available): #{existing_feed_context || "none"} Catalog: #{JSON.pretty_generate(catalog.map(&:to_h))} PROMPT end |