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

Introduced Nested Template Support in Prompts. #7

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

kladaFOX
Copy link
Contributor

@kladaFOX kladaFOX commented Oct 9, 2024

Changelog for Version 1.1.1

Release Date: [11th Oct 2024]

New Features:

  • Nested Template Support in Prompts
    • You can now organize your prompt files in nested directories and render them using the Spectre::Prompt.render method.
    • Example: To render a template from a nested folder:
      Spectre::Prompt.render(template: 'nested/folder/nested', locals: { query: 'What is AI?' })
    • This feature allows for better organization and scalability when dealing with multiple prompt categories and complex scenarios.

@kladaFOX kladaFOX requested a review from matthewblack October 9, 2024 14:37
@kladaFOX kladaFOX self-assigned this Oct 9, 2024
lib/spectre/prompt.rb Outdated Show resolved Hide resolved
Copy link
Member

@matthewblack matthewblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. One comment / question related to Spectre.root

@matthewblack matthewblack self-requested a review October 10, 2024 13:45
Copy link
Member

@matthewblack matthewblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kladaFOX kladaFOX requested a review from matthewblack October 10, 2024 13:53
@kladaFOX
Copy link
Contributor Author

kladaFOX commented Oct 10, 2024

@matthewblack take a look at new prompts feature Nested Template Support in Prompts
Now you can pass nested folders for templates as so:

Spectre::Prompt.render(template: 'nested/folder/user', locals: { query: 'What is AI?' })

@kladaFOX kladaFOX changed the title Introduced a root attribute to the Spectre configuration. Introduced Nested Template Support in Prompts. Oct 10, 2024
Copy link
Member

@matthewblack matthewblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

For the example, let's update it to be this:

app/
  spectre/
    prompts/
      rag/
        system.yml.erb
        user.yml.erb
      classificiation/
        intent/
          system.yml.erb
          user.yml.erb
        entity/
          system.yml.erb
          user.yml.erb

@kladaFOX kladaFOX merged commit 680d3d2 into main Oct 10, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants