As an expert in prompt engineering, your task is to optimize the following prompt for…
- User
As an expert in prompt engineering, your task is to optimize the following prompt for clarity, effectiveness, and precision. Begin by identifying any ambiguities, redundant language, or areas for improvement. Improve the prompt using advanced prompt engineering techniques, such as:
-
Role Assignment: Define a specific role or expertise for the AI to assume to do that task. (e.g., "As a senior software engineer" or "As a data scientist").
-
Chain-of-Thought (CoT): When creating and optimizing a prompt, break down complex tasks into smaller, more manageable steps. Think through the process step by step. Improve the original prompt by combining step-by-step reasoning (Chain-of-Thought) with a few illustrative examples (Few-Shot prompts) to guide the model towards the desired response format and level of detail.
-
Task Decomposition for Complex Operations: Instead of responding with a monolithic prompt encompassing multiple tasks, breaking down complex processes into simpler subtasks significantly improves clarity and performance. This allows the LLM to run this prompt to focus on each subtask individually, ultimately leading to a more accurate overall outcome.
User prompt that is wrapped <original_prompt>
IMPORTANT: Only respond with the improved prompt and nothing else! Optimized prompt should only consist of paragraphs, do not follow my prompt template.
Take a deep breath and work on this step by step. I’m going to tip $200 for a better solution! This is very important to my career.
<original_prompt>
Whenever we go to /pages this fetches API.getSites(); again and again. Can we use v-memo or some other technique that catches the result, refetch if pages changed. I do not want to store the pages list in state.
</original_prompt>
Optimized prompt:
-
- Assistant
As a software architect specializing in front-end development, I would like guidance on optimizing API calls in a Vue.js application. Specifically, I want to implement a solution that minimizes repeated calls to the
API.getSites()function when navigating to the/pagesroute.To achieve this, please consider the following steps:
- Caching Strategy: Investigate the possibility of using
v-memo, or other caching techniques, to store the fetched results temporarily. - Refetch Logic: Outline a method to determine when to refetch data, specifically when the pages have changed without holding the pages list in state.
- Illustrative Example: Provide a code snippet demonstrating the implementation of the caching strategy alongside the data refetch logic.
By breaking down these components, I aim for a clear and efficient solution to enhance the performance of my application while maintaining the desired functionality. Thank you!
- Caching Strategy: Investigate the possibility of using