priompt

Prompt design using JSX.

open-sourceagent-frameworks
Visit WebsiteView on GitHub
2.8k
Stars
+232
Stars/month
0
Releases (6m)

Overview

Priompt is a JSX-based prompting library that brings structured design principles to prompt engineering. Inspired by React, it allows developers to create prompts using familiar JSX components while intelligently managing token limits through a priority system. The library automatically determines what content to include in the final prompt based on component priorities and available token space. It features building blocks like `<scope>` for setting priorities, `<first>` for fallback content, and `<empty>` for token reservation. Priompt renders prompts by including all components with sufficiently high priority that fit within the token limit, making it particularly valuable for managing long conversations, complex prompt templates, and dynamic content inclusion. The priority-based approach ensures that the most important information is always included while less critical content is gracefully omitted when space is limited.

Pros

  • + JSX-based syntax familiar to React developers, making prompt design more structured and maintainable
  • + Intelligent priority-based token management automatically optimizes content inclusion within limits
  • + Declarative approach with reusable components enables complex prompt templates with fallback strategies

Cons

  • - Requires familiarity with JSX and React concepts, potentially limiting accessibility for non-frontend developers
  • - Additional abstraction layer may be overkill for simple prompting scenarios
  • - Limited ecosystem and community compared to more established prompting frameworks

Use Cases

Getting Started

Install the packages with `npm install @anysphere/priompt @anysphere/priompt-preview`. Create a JSX component that returns PromptElement with components like SystemMessage, UserMessage, and scope elements with priority attributes. Render the prompt using the priompt renderer which will automatically include content based on priorities and token limits.