We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'd like to load my prompts from external text files, so they are versioned cleanly.
The Read File doesn't solve my problem: The variables can't be linked to inputs in the resulting text node.
Read File
Example:
Is it possible to do this currently in Rivet ?
If not, what workaround do you use to properly version your prompts ?
The text was updated successfully, but these errors were encountered:
This is my current solution, using a Code Node to replace the inputs in the prompt.
Code Node
My prompt text file (prompt.txt):
This is the beginning of my prompt {{userInstructions}} {{userContext}} Here are additional instructions.
And the parsing code :
const prompt = inputs.prompt.value const variables = Object.fromEntries( Object.entries(inputs).filter(([key, _]) => key !== "prompt") ); function replacePlaceholders(prompt, variables) { var result = prompt for(let placeholder in variables) { let regex = new RegExp(`{{${placeholder}}}`, 'g') result = result.replace(regex, variables[placeholder].value); } return result; } const outputString = replacePlaceholders(prompt, variables); return { output: { type: 'string', value: outputString } };
Does anybody have a more elegant / less complicated solution ?
Sorry, something went wrong.
I think this is a great opportunity for a rivet plugin!
No branches or pull requests
Feature Request
I'd like to load my prompts from external text files, so they are versioned cleanly.
The
Read File
doesn't solve my problem: The variables can't be linked to inputs in the resulting text node.Example:
I would like `{{userInstructions}}` and `{{context}}` to be available as variables / inputs.Is it possible to do this currently in Rivet ?
If not, what workaround do you use to properly version your prompts ?
Code of Conduct
The text was updated successfully, but these errors were encountered: