-
Notifications
You must be signed in to change notification settings - Fork 51
Thread injection in trace scorers (js) #168
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
base: main
Are you sure you want to change the base?
Conversation
Braintrust eval reportAutoevals (threads-1768759658)
|
| // Pattern to match thread variables in template syntax: {{thread, {{ thread, {%...thread, etc. | ||
| export const THREAD_VARIABLE_PATTERN = new RegExp( | ||
| `\\{[\\{%]\\s*(${THREAD_VARIABLE_NAMES.join("|")})`, | ||
| ); | ||
|
|
||
| /** | ||
| * Check if a template string might use thread-related template variables. | ||
| * This is a heuristic - looks for variable names after {{ or {% syntax. | ||
| */ | ||
| export function templateUsesThreadVariables(template: string): boolean { | ||
| return THREAD_VARIABLE_PATTERN.test(template); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edge case but if users set custom delimiters for whatever reason, this will fail:
https://github.com/mustache/spec/blob/master/specs/delimiters.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function shouldn't live in this repo long-term but it's fine for now.
No description provided.