sublayerapp / sublayer

A model-agnostic Ruby Generative AI DSL and framework. Provides base classes for building Generators, Actions, Tasks, and Agents that can be used to build AI powered applications in Ruby.
https://docs.sublayer.com
MIT License
109 stars 2 forks source link

Add new named_strings output adapter #67

Closed swerner closed 2 months ago

swerner commented 2 months ago

New output adapter to return an object with named string attributes. This is useful for when you want to extract a few different types of strings from a text or want to construct an object based on a prompt.

For example, say you have a product with some attributes and you want to generate a short description, long description, key features, and target audience. Or have a blog post and want to extract the key ideas, major points, summary, and followup questions.

As part of this change we've also introduced some post-processing for results where you can optionally add materialize_result(raw_results) to your output_adapter and return a better formatted object or attribute to your generator.

swerner commented 2 months ago

finishes #13