Understanding Prompts
Introduction to Prompts
In the world of Large Language Models (LLMs), a prompt is typically a string of text that provides instructions or context to the AI. However, at Mirai, we've expanded this concept to make prompts more powerful and flexible.
The Evolution of Prompts
Basic Prompts
At its simplest, a prompt might look like this:
Structured Prompts
In more advanced applications, prompts often include different roles:
Dynamic Prompts
Real-world applications often need to incorporate variable data:
Challenges with Traditional Prompts
Code Integration: Prompts become part of the application code, making them difficult to modify.
Template Limitations: Simple templates can help, but they struggle with complex scenarios involving conditions or loops.
Data Pipeline Complexity: Prompts may depend on complex computations or other prompts, requiring additional processing.
Existing Solutions and Their Limitations
Tools like Langchain attempt to address these issues:
However, these solutions often limit flexibility and still require significant application-side logic.
The Mirai Approach: Redefining Prompts
At Mirai, we've redefined prompts to achieve greater flexibility and completeness. In our system, a prompt is essentially a program that interacts with LLMs.
Components of a Mirai Prompt
Input Data Format Description: A JSON schema that defines the structure of input data.
Processing Logic: A Python script that processes the input data and interacts with the LLM.
Example of a Mirai Prompt
Input Data Format:
Processing Logic:
Benefits of the Mirai Approach
Flexibility: You can include complex logic and custom operations within the prompt itself.
Completeness: All prompt-related logic is contained in one place, separate from the main application code.
Ease of Editing: Prompts can be modified without changing the underlying application.
Powerful Processing: You can perform complex data manipulations and multiple LLM calls within a single prompt.
By redefining prompts as mini-programs, Mirai offers a powerful and flexible solution for creating sophisticated AI-powered applications.
Last updated