-
Notifications
You must be signed in to change notification settings - Fork 338
Add firstLines handlebars helper #140
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
Open
kym6464
wants to merge
14
commits into
mufeedvh:main
Choose a base branch
from
kym6464:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ODAncona for review |
Bumps [astro](https://github.com/withastro/astro/tree/HEAD/packages/astro) from 5.7.3 to 5.10.1. - [Release notes](https://github.com/withastro/astro/releases) - [Changelog](https://github.com/withastro/astro/blob/main/packages/astro/CHANGELOG.md) - [Commits](https://github.com/withastro/astro/commits/astro@5.10.1/packages/astro) --- updated-dependencies: - dependency-name: astro dependency-version: 5.10.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [starlight-blog](https://github.com/HiDeoo/starlight-blog/tree/HEAD/packages/starlight-blog) from 0.20.0 to 0.24.0. - [Release notes](https://github.com/HiDeoo/starlight-blog/releases) - [Changelog](https://github.com/HiDeoo/starlight-blog/blob/main/packages/starlight-blog/CHANGELOG.md) - [Commits](https://github.com/HiDeoo/starlight-blog/commits/starlight-blog@0.24.0/packages/starlight-blog) --- updated-dependencies: - dependency-name: starlight-blog dependency-version: 0.24.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a custom Handlebars helper called
firstLines
which works like the unixhead
command. This is for directories that contain.csv
or.jsonl
files since you only need to pass the first few lines to the LLM to have it understand the shape of the data, and the rest fills up the context for no reason.This is best explained by example:
Example 1: Base Case
This shows the folder structure that I'm using for testing with a basic handlebars template.
template.hbs
{{ source_tree }}
output
Project Path: test_dir
Source Tree:
test_dir/code.js:
test_dir/data.csv:
Example 2: using firstLines
This example uses the
firstLines
helper by modifying the template in the following way:template_custom.hbs
{{ source_tree }}
output
test_dir
├── code.js
└── data.csv
test_dir/data.csv:
Next Steps / Questions
I would like to figure out a way to selectively apply the
firstLines
helper to data files such as.csv
and.jsonl
. And ideally you could selectively exclude certain files where you do in fact want the entire thing in the context. Any thoughts on how to approach this?I think it would make sense to update website/src/content/docs/docs/tutorials/learn_templates.mdx as part of this PR, does that sound ok? I was thinking of adding a "data analysis" geared template example to demonstrate how this is useful.
Disclaimer: this is my first experience with "writing" Rust (I had Claude write the code and verified functionality) so please let me know if there are any issues.