Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSL for prompt #75

Open
swerner opened this issue Aug 18, 2024 · 2 comments
Open

DSL for prompt #75

swerner opened this issue Aug 18, 2024 · 2 comments

Comments

@swerner
Copy link
Contributor

swerner commented Aug 18, 2024

I know its easy to get started with just a string prompt, but I've been thinking an easier to use DSL for prompting might make it possible to do more complicated techniques without writing a long paragraph.

This could also make it easier to do things like RAG, attaching files, audio, video, etc, run different models, insert randomness (Oblique Strategies) into the prompt, or enable essentially a "Prompt Currying" workflow. It also allows us to bake in techniques/deprecate outdated techniques, target techniques to certain models, etc.

In my mind I'm thinking something very similar to what activerecord has with being able to chain methods together that all return the self, but only generate the final result once its needed.

Rough sketch, but something like:

def prompt
  role("Expert programmer in #{@technologies.join(", ")}").
  instructions("write code using #{@technologies.join(", ")}").
  task(@task_description).
  examples(retrieve_task_examples(@task_description)).
  validate_response_with(@task_validator).
  compare_responses_between(:gpt-4o, :claude-3.5, :gemini-1.5-flash).
  use_chain_of_thought
end
@mdeering
Copy link

I'm looking at liquid and its Context for this.
https://www.rubydoc.info/gems/liquid/Liquid/Context

Powers Shopify's theme system for theirs store fronts.

@swerner
Copy link
Contributor Author

swerner commented Aug 19, 2024

Oh interesting! I'm not super familiar with Liquid, I'll look into this, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants