Open jkomoros opened 1 year ago
Perhaps profile should have a cache file that caches embed, prompt, and seed values unless force is true.
Add a notion of deterministic
to seed-types where the output is fully implied by their inputs + environment. Everything but now
, random
, prompt
, recall
, retrieve
, input
are deterministic. (Others?)
Create a SeedCalculation
type. An environment can be cloned and add a calculation (which fails if the environment already has a calculation). seed.growIncremental() returns the Calculation immediately. A Calculation has a .result : Promise<value>
which can be awaited for the final value. A Calculation also has an events
which is a generator function that returns a string of events as things happen.
The events are various types, a discriminated union.
parent? : {ref: SeedReference, property: PropertyName}
, so it's possible to tell which property it is. (You can also recover it from the last bit of the ID in some cases, but not for loops or non-implicitly-nested versions)
Currently seed.grow() returns the final result, and there's no good way (other than turning on verbose and looking at logs) to see what the intermediate results are.
Also, seeds, when grown with the same environment, should reuse the same result unless
force
is passed..grow() should return a Plant, which is a particular instantiated version of a seed with a given environment. seed.plant(env).grow(force). Seeds have a WeakMap memoization of env -> plant.
Garden should gain a
plant(seedId, env)
convenience wrapper andgrow(seedID, env)
convenience wrapper.(Ensure that environments truly are readonly with typescript types)
See also a few comments in #3.