# ICLPrompt

> `ICLPrompt` is the class for in-context learning prompts. You can desgin a few task-specific examples as prompt for instructing LLM, and then LLM can quickly figures out how to perform well on that task.

#### **build\_prompt**

```python
build_prompt(
    self, 
    prompt: str, 
    in_context_examples: List[Dict] = None, 
    n_shots: int = 2
)
```

**Description**

Build a prompt from a given string input and a list of in-context examples.

**Parameters**

* `prompt` (str): The prompt string.
* `in_context_examples` (List\[Dict]): A list of in-context examples. Defaults to None.
* `n_shots` (int): The number of in-context examples to use. Defaults to 2.

**Example**

```python
from easyinstruct import ICLPrompt
prompts = ICLPrompt()
prompts.build_prompt(
     "Identify the animals mentioned in the sentences.", 
     in_context_examples = [{"text": "The cat is on the mat.", "label": "cat"}, {"text": "The dog is on the rug.", "label": "dog"}], 
     n_shots = 2
)
```


---

# 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://zjunlp.gitbook.io/easyinstruct/documentations/prompts/iclprompt.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.
