Class: Omen::Instructions
- Inherits:
-
Object
- Object
- Omen::Instructions
- Defined in:
- app/models/omen/instructions.rb
Overview
Everything Claude is told before a question: the prose, and the schema it may write against.
Constant Summary collapse
- PROSE =
The prose, kept beside this class so it reads as prose rather than as a string.
File. 'instructions.md', __dir__
- TIME_ZONE =
The database function a stored timestamp is read through, created by the gem's rake task. Every one of these is prefixed, since
todayespecially is a name a host may want itself. 'omen_time_zone'- TODAY =
The database function that answers what day it is where the company works.
'omen_today'- MILES =
The database function a distance in miles is measured with, created by the same task.
'omen_miles_between'
Class Method Summary collapse
-
.block(reading) ⇒ Array<Hash>
Cached for an hour: the schema is thousands of tokens, and refining sends it again.
Instance Method Summary collapse
-
#initialize(reading) ⇒ Instructions
constructor
A new instance of Instructions.
-
#text ⇒ String
Today's date is said out loud because "last month" is Claude's to resolve, and it has no clock.
Constructor Details
#initialize(reading) ⇒ Instructions
Returns a new instance of Instructions.
24 25 26 |
# File 'app/models/omen/instructions.rb', line 24 def initialize(reading) @reading = reading end |
Class Method Details
.block(reading) ⇒ Array<Hash>
Cached for an hour: the schema is thousands of tokens, and refining sends it again.
19 20 21 |
# File 'app/models/omen/instructions.rb', line 19 def self.block(reading) [ { type: 'text', text: new(reading).text, cache_control: { type: 'ephemeral', ttl: '1h' } } ] end |
Instance Method Details
#text ⇒ String
Today's date is said out loud because "last month" is Claude's to resolve, and it has no clock.
30 31 32 33 34 35 |
# File 'app/models/omen/instructions.rb', line 30 def text format File.read(PROSE), today: Date.current.to_fs(:long), zone_fn: TIME_ZONE, today_fn: TODAY, miles_fn: MILES, schema: schema, types: types, readable: readable, refused: refused, notes: @reading.notes end |