# Optimizing Retrieval Precision

## Why does the AI agent use the wrong document as its source?

When the AI agent or LLM give answers using the wrong document in your EbbotGPT knowledge, it's an AI hallucination type of issue.

**Problem:** The Language Model (LLM) provides an answer sourced from a document other than the one intended and both relevant documents was retrieved.&#x20;

**Cause:** The LLM struggles to discern, based on the user's question or the content of the retrieved documents, which document contains the definitively "correct" answer. This often occurs when documents contain similar or overlapping information.&#x20;

### Potential solutions on optimizing retrieval precision

**Document improvement:** Enhance the target document's clarity and specificity. Make it easier for the LLM to identify it as the most relevant source for particular queries. This could involve:&#x20;

* Adding unique identifiers or key phrases.&#x20;
* Structuring information more clearly.&#x20;
* Ensuring the document directly answers common questions it's intended for.&#x20;

**Persona refinement:** Modify the persona or instructions to guide its behavior when faced with ambiguous document relevance. For example, instruct the AI agent to:&#x20;

* "If multiple documents contain similar information, always present information from all relevant documents, noting their distinct sources."&#x20;
* "If uncertain about the primary source, state the source of the information provided."


---

# 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://docs.ebbot.ai/ebbot-docs/core-capabilities/ebbotgpt/ebbotgpt-best-practices/optimizing-retrieval-precision.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.
