Open andreibondarev opened 3 weeks ago
possible api:
Prompt is an ActiveRecord model.
Creates instance of a prompt:
p = Prompt.new(template: "Tell me a {adjective} joke about {subject}.")
p.save # persist to db
Renders prompt template:
p.render({adjective: "funny", subject: "birds"})
# => "Tell me a funny joke about birds"
Return the template variables:
p.template_variables
# => ['adjective', 'subject']
@sergiobayona Makes sense to me!
langchainrb
offers a way to manage prompt templates: https://github.com/patterns-ai-core/langchainrb?tab=readme-ov-file#prompt-templates. It offers a way to save templates to json or yaml files but to a database. Keeping prompts in a database table allows you to modify prompts on the fly and version them if needed.prompts
table and an ActiveRecord model with a simple field to store the prompt template text. Example: https://github.com/patterns-ai-core/langchainrb/blob/main/lib/langchain/vectorsearch/prompts/rag.yaml#L6-L11