# Chain-of-Thought Approach

**Chain-of-Thought Approach:** This is a learning method that uses a series of prompts or questions to direct the model towards generating a specific response. It showcases the AI's cognitive abilities and clarifies how it thinks through problems. The prompt starts with a question and a correct answer to provide the necessary context and detailed reasoning for the model, then it asks another question that should be solved using the same logical process. **Example:**

**First you write a prompt which has a question and and an answer as well:**\
Q: A pet store manager is revising inventory to maximize sales potential within a budget constraint. The store carries four types of aquarium fish priced as follows:

* Guppies: $3.99
* Goldfish: $1.99
* Betta: $5.99
* Angelfish: $8.99

Given a budget of $20 and equal maintenance requirements for each fish type, determine the best strategy to maximize the number of units in stock.

A: To optimize the inventory under a fixed budget with the goal of maximizing potential sales, the manager should focus on the cost-effectiveness of each fish type. The cost per unit for each fish type is:

* Goldfish: $1.99
* Guppies: $3.99
* Betta: $5.99
* Angelfish: $8.99

The Goldfish offer the lowest cost per unit, making them the most budget-efficient choice for maximizing inventory. Calculating the maximum number of Goldfish that can be purchased within the $20 budget involves dividing the total budget by the cost per Goldfish:

<figure><img src="/files/d0qHomzz3oUft4QiLKSx" alt=""><figcaption></figcaption></figure>

Therefore, purchasing 10 Goldfish would utilize the budget most effectively by maximizing the number of units the store can offer for sale, potentially increasing the volume of transactions due to the lower price point.

\
**And then you write a prompt you want to be solved in a similar manner:**\
Q: A wholesale supplier offers four types of office supplies at the following prices:

* Notebooks: $2.50
* Pens: $1.25
* Staplers: $3.75
* Folders: $1.00

You have a $50 budget to prepare for an upcoming conference. How should you allocate your budget to maximize the number of supplies you can provide to attendees?


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knuth-concepts.gitbook.io/generative-ai-prompt-engineering-basics/chain-of-thought-approach.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
