masci / banks

LLM prompt language based on Jinja. Banks provides tools and functions to build prompts text and chat messages from generic blueprints. It allows attaching metadata to prompts to ease their management, and versioning is first-class citizen. Banks provides ways to store prompts on disk along with their metadata.
MIT License
63 stars 5 forks source link

feat: Add support for chat messages via custom tag `{% chat %}` #15

Closed masci closed 1 month ago

masci commented 1 month ago

Usage:

{% chat role="system" %}
You are a helpful assistant.
{% endchat %}

{% chat role="user" %}
Hello, how are you?
{% endchat %}

Output of prompt.chat_messages():

[
    ChatMessage(role="system", content="You are a helpful assistant.\n"),
    ChatMessage(role="user", content="Hello, how are you?\n"),
]