> For the complete documentation index, see [llms.txt](https://yunaeecy.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yunaeecy.gitbook.io/wiki/artificial-intelligence/todays-learning-langchain/prompt.md).

# Prompt

Prompt engineering is a **method** for **communicating** with **large language models** to steer thier behavior for designed outcomes **without updating the model weights**. It is an empirical science, and the effcet of prompt engineering methods can vary a lot among models, thus requiring heavy experimentation and heuristics. When working with prompts, you interact with th LLM via an API or directly, and you can **configure a few parameters** to get different results for your prompts. These parameters include temperature, which affects the randomness of the output, and the version of LLM you use. A poorly crafted prompt only generates a poor response that is half-baked and inaccurate, that's close to hallucination. Using the correct vocabulary to **instruct the model** in the most concise from is critical to exploit the power of LLMs. Since LLMs are limited by the number of tokens for accepting the input and generating the output, prompts must adhere to the size restrictions imposed by the model.

The more descriptive and detailed the prompt is, the better the results. This is particularly important when you have a desired outcome or style of generation you are seeking. There aren't specific tokens or keywords that lead to better results. It's more important to have a good format and descriptive prompt. In fact, providing examples is very effective to get desired output in specific formats.

When designing prompts, you should also keep in mind the length of the prompt as there are limitations regarding how long the prompt can be.

An example:

Prompt:

```
Extract the same of places in the following text.
Desired format:
Place: <comma_separated_list_of_company_names>
Input: "Although these developments are encouraging to researchers, much is still a mystery.
 “We often have a black box between the brain and the effect we see in the periphery,” 
 says Henrique Veiga-Fernandes, a neuroimmunologist at the Champalimaud Centre for 
 the Unknown in Lisbon. “If we want to use it in the therapeutic context, we actually
  need to understand the mechanism.""
```

Output:

Place: Champalimaud Centre for the Unknown, Lisbon


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://yunaeecy.gitbook.io/wiki/artificial-intelligence/todays-learning-langchain/prompt.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
