Construct the following prompt for LLM to make it work much better: using following user…
- User
Construct the following prompt for LLM to make it work much better: using following user sequential request texts construct request to the RAG system. user text: периодический расчет технически закрытых, роль, техническое имя, техническое имя роли, код роли?
Assistant
Okay, here's a prompt designed to leverage LLM for RAG effectively, based on the user's sequential request text:
Prompt:
You are an expert in processing user queries related to SAP authorization roles and technical names. You will analyze the user's request, identify the core information need, and formulate a precise query suitable for retrieval from a knowledge base containing information on SAP roles, transactions, authorization objects, and technical names. Your goal is to generate a RAG-compliant query. **User Request Sequence:** * "периодический расчет технически закрытых, роль, техническое имя, техническое имя роли, код роли?" **Analysis & Task:** The user is inquiring about information related to: * **Authorization roles**: They are asking about roles with technical names and role codes. * **Periodically closed (технически закрытых)**: This suggests they want to find information on roles that are closed. This is a crucial filter. * **Technical Names**: The user is specifically interested in both the role's technical name itself, as well as the technical name *of the role*. The distinction is important. * **Role Code**: The user wants the role code (likely the SAP role ID). **Instructions:** 1. **Translate and Refine:** Translate the user's incomplete phrase into a complete, unambiguous query. 2. **Identify Key Entities:** Clearly identify the key entities (e.g., "authorization role", "technical name", "periodically closed"). 3. **Formulate RAG Query:** Generate a single, concise query string optimized for a retrieval-augmented generation (RAG) system. This query should: * Prioritize entities which are most important. * Include keywords like technical names, codes, and properties related to SAP roles. * Specifically include the condition of being "periodically closed" or "technically closed". **RAG Query Output:** Generate ONLY the query string. Do not include any introductory text, explanations, or conversational elements. Ensure the query is in English.Explanation of the prompt's structure and reasoning:
- Role Definition: The LLM is given a specific role ("expert in SAP authorization roles"). This helps focus its responses.
- User Request Sequence: Directly includes the user's input, allowing the LLM to directly address it.
- Analysis & Task: Provides a structured analysis of what the user is trying to achieve. This helps the LLM understand the underlying intent. It also calls out the distinction between "technical name" and "technical name of the role".
- Instructions: Provides clear, step-by-step instructions on how to formulate the RAG query. This breaks down the complex task into manageable parts.
- RAG Query Output: This section is critical.
- It emphasizes generating ONLY the query string, no extra text. This is essential for RAG systems to work correctly.
- It explicitly requests an English query.
- It enforces query optimization by focusing on entities with the most importance.
Expected output based on the prompt:
"Find SAP authorization roles that are periodically/technically closed AND include the role's technical name, technical name of the role itself, and role code."How this prompt makes the LLM work better:
- Specificity: The prompt is highly specific to the domain of SAP authorization roles.
- Contextual Awareness: It acknowledges the sequential nature of user requests.
- Intent Understanding: It guides the LLM to understand the user's underlying intent, even with incomplete phrases.
- Structured Output: It ensures that the LLM generates a clean, usable query string, ready for a RAG system.
- Translation: Explicitly asks for an English query, removing language barriers.
- Prioritization: Forces the LLM to consider the relative importance of different elements in the request, leading to a more effective query.
- User
make this prompt better for information retrieval from RAG system Prompt: Construct the prompt for LLM from the following user sequential request using the most important keyword/phrase/abbreviations of this questions. Instructions: Take Main text as main part for user request and then take only those from User requests that can relate in meaning to Main text and valuable for information request of the Main text. If request information not valuable do not include that request. Create prompt suitable for RAG system. Exclude duplicates. Output only constructed prompt on the language of user input.
Main text: а роли какие
User requests: Специалист по расчету себестоимости используемые транзакции
Result should be: А какие роли у специалиста по расчету себестоимости
Assistant
Okay, here's an improved prompt, focusing on better information retrieval performance within a RAG system, and incorporating your requirements:
Prompt:
You are an expert at constructing search queries for a Retrieval-Augmented Generation (RAG) system, optimized for retrieving relevant information about SAP roles. Your goal is to transform a user's fragmented input into a coherent and effective query. **Task:** Given a "Main Text" representing the core user question and a list of "User Requests" offering additional context, create a single, concise search query that accurately reflects the user's information need. **Instructions:** 1. **Contextual Understanding:** Thoroughly analyze the "Main Text" to identify the central question. 2. **Relevance Filtering:** Evaluate each "User Request" for its relevance to the "Main Text." Include only those requests that directly enhance or clarify the meaning of the "Main Text," providing more precise or valuable search context. Discard irrelevant requests. Prioritize requests that provide specific attributes or constraints related to the main topic. 3. **Keyword Extraction & Prioritization:** Identify the most important keywords, phrases, and abbreviations from both the "Main Text" and the selected "User Requests." Prioritize keywords that refine the scope of the search. 4. **De-duplication:** Eliminate any redundant or duplicate information. 5. **Query Construction:** Formulate a single, grammatically correct query in the language of the "Main Text" (Russian in this case). The query should be optimized for information retrieval efficiency, meaning it should be concise, unambiguous, and effective at retrieving relevant documents. Favor natural language over SQL or other database-specific syntax. 6. **RAG Suitability:** Ensure the resulting query is well-suited for a RAG system. This means focusing on clarity and comprehensiveness, allowing the retrieval component to identify the most relevant documents. **Input:** * **Main Text:** "а роли какие" * **User Requests:** * "Специалист по расчету себестоимости" * "используемые транзакции" **Reasoning Process (Do NOT output this):** * The "Main Text" asks "what roles?". * "Специалист по расчету себестоимости" (Cost Accounting Specialist) provides valuable context: it specifies *whose* roles the user is interested in. * "используемые транзакции" (used transactions) *could* be relevant, but on its own it doesn't directly relate to "what roles?". It's a separate question and less critical for answering the main question *about roles*. Therefore, it should be excluded for this iteration. **Output:** А какие роли у специалиста по расчету себестоимости?Key Improvements and Explanation:
- Expert Role Definition: The prompt clearly defines the LLM's role as a "search query construction expert" for RAG systems.
- RAG Optimization Focus: Explicitly mentions "RAG Suitability" and emphasizes creating a query that helps the retrieval component find the best documents.
- Relevance Filtering Logic: The instructions provide more detailed guidance on how to determine whether a "User Request" is valuable and should be included. This is crucial for avoiding noise in the query. It specifically mentions prioritizing requests that offer specific attributes or constraints.
- Keyword Prioritization: Explicitly instructs to prioritize keywords that refine the search scope.
- De-duplication: Retains the de-duplication instruction.
- Natural Language Emphasis: Encourages the creation of natural language queries, which are generally better suited for RAG systems than complex, database-specific queries. This is because retrieval systems often use techniques like semantic search, which work best with natural language.
- Reasoning Process (Non-Output): I've included a "Reasoning Process" section (marked as DO NOT OUTPUT). This helps to illustrate the decision-making the LLM should be undertaking, but it's not actually part of the prompt itself. This is purely for explanation.
- Conciseness: The entire prompt is structured to encourage the generation of concise and focused queries.
This revised prompt should yield significantly better results for RAG-based information retrieval, leading to more relevant and accurate search results. The emphasis on relevance filtering and natural language query construction is particularly important for RAG systems.
- User
still got какие роли для специалиста по расчету себестоимости и используемые транзакции result
Assistant
Okay, I understand. The LLM is still including "используемые транзакции" even though it's not directly relevant. This indicates that the relevance filtering instructions need to be strengthened even further. Let's revise the prompt again:
Prompt:
You are an expert at constructing highly targeted search queries for a Retrieval-Augmented Generation (RAG) system focused on SAP roles and authorizations. Your objective is to create the most effective query possible to retrieve relevant information, *avoiding any extraneous or loosely related concepts.* **Task:** Given a "Main Text" representing the core user question and a list of "User Requests" providing potential context, create a single, concise search query that *precisely* reflects the user's *primary* information need. **Instructions:** 1. **Core Intent Identification:** First and foremost, determine the *single, most important question* being asked in the "Main Text." Focus solely on directly answering that question. 2. **Strict Relevance Assessment:** Each "User Request" *must* be evaluated against the following strict criteria: * **Directly Addresses the Core Question:** Does the "User Request" *directly* provide specific details, attributes, or constraints that are *essential* to answering the "Main Text" question? If not, it's irrelevant. * **Increases Search Precision:** Does including the "User Request" *significantly* narrow the search results to a more targeted and relevant set of documents? Avoid including requests that would broaden the search or introduce unrelated concepts. * **Avoids Tangential Information:** Reject any "User Request" that introduces a *separate* question or topic, even if it's loosely related. The goal is extreme focus. *If a "User Request" does NOT meet ALL of these criteria, it MUST be excluded.* 3. **Keyword Extraction & Prioritization:** Extract the most important keywords, phrases, and abbreviations from the "Main Text" and *only the selected "User Requests." Prioritize keywords that represent the key entities and relationships. 4. **De-duplication:** Eliminate any redundant or duplicate information. 5. **Query Construction:** Formulate a single, grammatically correct query in the language of the "Main Text" (Russian in this case). The query should be concise, unambiguous, and optimized for retrieving relevant documents. 6. **RAG Suitability:** The resulting query should be ideally suited for a RAG system, focusing on clarity, precision, and the core information need. **Input:** * **Main Text:** "а роли какие" * **User Requests:** * "Специалист по расчету себестоимости" * "используемые транзакции" **Output:** А какие роли у специалиста по расчету себестоимости?Key Changes and Explanations:
- Stronger Focus on Core Intent: The prompt now emphasizes identifying the single, most important question.
- Stricter Relevance Criteria: The relevance assessment instructions are significantly more demanding. Each User Request must meet all criteria to be included. The addition of "Increases Search Precision" and "Avoids Tangential Information" is critical. The use of "essential" and "significantly" provides measurable thresholds.
- Emphasis on Precision: The prompt stresses the importance of precision and avoiding extraneous information.
- Actionable Instructions: The instructions are designed to be very actionable, leaving less room for misinterpretation by the LLM.
- Emphasis on primary information need: The prompt underlines that the query should reflect the user's primary information need.
By making the relevance criteria much stricter, this prompt should now be much more effective at filtering out irrelevant "User Requests" and generating a highly focused RAG query. The LLM will be forced to critically evaluate each "User Request" and justify its inclusion based on its direct contribution to answering the core question.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.