Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kladaFOX committed Oct 10, 2024
1 parent 28d44b5 commit 5272e8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ This version enhances the flexibility and robustness of the Completions class, e
* 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:
```ruby
Spectre::Prompt.render(template: 'nested/folder/nested', locals: { query: 'What is AI?' })
Spectre::Prompt.render(template: 'classification/intent/user', locals: { query: 'What is AI?' })
```
* This feature allows for better organization and scalability when dealing with multiple prompt categories and complex scenarios.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,16 +390,20 @@ app/
rag/
system.yml.erb
user.yml.erb
nested/
folder/
nested.yml.erb
classification/
intent/
system.yml.erb
user.yml.erb
entity/
system.yml.erb
user.yml.erb
```

To render a prompt from a nested folder, simply pass the full path to the `template` argument:

```ruby
# Rendering from a nested folder
Spectre::Prompt.render(template: 'nested/folder/nested', locals: { query: 'What is AI?' })
Spectre::Prompt.render(template: 'classification/intent/user', locals: { query: 'What is AI?' })
```

This allows for more flexibility when organizing your prompt files, particularly when dealing with complex scenarios or multiple prompt categories.
Expand Down

0 comments on commit 5272e8a

Please sign in to comment.