PromptTemplateManager
Purpose
Context in Monorepo
The PromptTemplateManager will be the second available module in the set and sequence of Data Augmentation Workflow with Microfrontends.
The goal of the Augment-It Monorepo is to transform and augment a set of records by using various AI services. For instance, AI-Powered Search models, AI Powered Data Capture techniques, such as AI Web Crawlers and Web Scrapers through their respective APIs.
By properly integrating the PromptTemplateManager with the RecordCollector, we better ensure prompts well leverage AI capabilities and augment specific customer data effectively.
graph TD
subgraph "PromptTemplateManager"
A[UI Layer] -->|Manages| B[Template Editor]
A -->|Manages| C[Variable Mapper]
A -->|Manages| D[Template Library]
B -->|Uses| E[MDX Editor]
C -->|Pulls from| F[RecordCollector API]
D -->|Stores| G[Template Storage]
end
subgraph "External Systems"
F -->|Provides| H[Customer Data]
I[AI Services] -->|Receives| J[Populated Templates]
end
C -->|Maps variables to| B
B -->|Saves to| D
D -->|Loads to| B
D -->|Sends populated templates to| I
F -->|Syncs with| H
Functionality of PromptTemplateManager
The PromptTemplateManager will provide functionalities to allow users to upload prompts, author new ones, and insert managed variables called from the records made available from the RecordCollector.
The initial use case is using the RecordCollector to pull records from the CRM system about customers.
The PromptTemplateManager shall be the tool that empowers users to select, generate, and iterate on meaningful prompts likely to have the best results. These prompts will specifically make easy the addition of fields as variables to allow the generation of customer specific prompts from a template.
The PromptTemplateManager will enable the users to select the most appropriate prompt to send to the RequestReviewer, which may or may not be the one they were just creating, working on, or saved to disk.
APIs:
- AI Search Model: An API endpoint (REST or WebSocket) to send prompts and receive search results.
- Web Crawler Service: An API endpoint for triggering web crawls based on provided parameters (e.g., target URLs, variables).
- Create prompts templates with variables from the current set of records loaded in the RecordCollector through Variable Mapping: mapping variables from current systems into the prompt templates before execution.
- Enter a WYSIWYG editor for crafting custom prompts with syntax highlighting and auto-completion for supported languages (like Python, JavaScript). a MDX editor to write prompts.
- Variable Management: Interface to map variables from records available from the RecordCollector into the prompt template, possibly using a drag-and-drop or input field-based system.
- Upload markdown or mdx files.
- Save prompt templates that have valid variable syntax.
- Search, filter, and select saved prompts.
- Prompt Validation: Ensure prompts are syntactically correct and adhere to security guidelines.
3. Goals & Non-Goals
Goals
- PromptTemplateManager uses a standard templating syntax to apply data from the RecordCollector to a PromptTemplate, resulting in a filled out template on a per-record basis.
- Users can create, delete, and update PromptTemplates
Non-Goals
- Does not send to AI Model APIs, nor evaluate responses.
Technical Design
sequenceDiagram
participant User
participant UI as PromptTemplateManager UI
participant BE as Backend Service
participant RC as RecordCollector
participant DB as Template Database
User->>UI: Create/Edit Template
UI->>RC: Request Available Variables
RC-->>UI: Return Variable List
UI->>User: Show Variable Palette
User->>UI: Design Template with Variables
UI->>BE: Save Template
BE->>DB: Store Template
DB-->>BE: Confirm Save
BE-->>UI: Save Confirmation
User->>UI: Select Template & Record
UI->>RC: Request Record Data
RC-->>UI: Return Record Data
UI->>BE: Request Template Population
BE->>BE: Merge Variables
BE-->>UI: Return Populated Template
UI->>User: Show Preview
Components
Shared Components
Shared_Search Container
Shared_Filter Container
Shared_Filter Dropdown
Shared_Prompt Template Editor
Shared_MDX Editor
SharedJsonEditor
Shared_List-Column_Layout
Shared_List-Row
Open Questions
How will we handle saving?
Comprehensive Wish List
Attribution of prompts to User Accounts. Filter prompts by team. Limit prompts to being visible and usable by team, lists of other users, and the organization (verified by email).
Error Collection: Collects errors associated with a specific prompt.