Prompt Retriever Node
The Prompt Retriever node is designed to store prompt templates with associated names and descriptions. These stored prompts can later be queried and used by a MultiPromptChain. This node is particularly useful for organizing and managing multiple prompts that can be dynamically selected based on the context or requirements of a conversation or task.
Node Details
-
Name: promptRetriever
-
Type: PromptRetriever
-
Category: Retrievers
-
Version: 1.0
Input Parameters
-
Prompt Name
-
Type: string
-
Description: A unique identifier for the prompt template
-
Example: “physics-qa”
-
-
Prompt Description
-
Type: string
-
Description: A brief explanation of what the prompt does and when it should be used
-
Example: “Good for answering questions about physics”
-
-
Prompt System Message
-
Type: string
-
Description: The actual prompt template or system message that guides the AI’s behavior
-
Example: “You are a very smart physics professor. You are great at answering questions about physics in a concise and easy to understand manner. When you don’t know the answer to a question you admit that you don’t know.”
-
Output
The node initializes and returns a PromptRetriever object, which encapsulates the provided prompt information (name, description, and system message).
Usage
This node is typically used as part of a larger system where multiple specialized prompts are needed. By storing prompts with metadata, it allows for:
-
Organized Prompt Management: Keeping track of multiple prompts for different purposes.
-
Dynamic Prompt Selection: Enabling systems to choose the most appropriate prompt based on the current context or user query.
-
Improved Maintainability: Centralizing prompt storage and making it easier to update or modify prompts without changing the underlying code.
Integration
The Prompt Retriever is often used in conjunction with a MultiPromptChain, which can dynamically select and use the most appropriate prompt based on the input or context. This allows for creating more flexible and adaptive AI systems that can handle a wide range of queries or tasks by selecting the most suitable prompt template.
Example Use Case
In a multi-purpose AI assistant, you might have several Prompt Retriever nodes set up:
-
One for physics questions
-
One for literature analysis
-
One for coding help
-
One for general conversation
The system could then use a MultiPromptChain to analyze the user’s input and select the most appropriate prompt, allowing the AI to seamlessly switch between different areas of expertise or conversation styles.
Was this page helpful?