# Incorrect Citation Format

## The Problem

AI provides sources in inconsistent formats, with wrong URLs, missing page numbers, or citations that don't match retrieved content.

### Symptoms

* ❌ Citations point to wrong documents
* ❌ "Source: Unknown" despite using context
* ❌ Inconsistent citation style
* ❌ Made-up source references
* ❌ Cannot verify claims

### Real-World Example

```
AI response: "The rate limit is 1000/hour [Source: API Documentation, page 15]"

Problems:
→ Document has no page numbers (web page)
→ Claim is from chunk_id: api_v2_limits_003
→ Citation format doesn't match actual source structure

User cannot verify the claim
```

***

## Deep Technical Analysis

### Citation Generation Methods

**Inline Metadata:**

```
Pass source info in context:
"[doc_id:api_guide_v2, title:'API Limits', url:'/docs/api#limits']
The rate limit is 1000 requests per hour."

LLM must extract and format:
→ Often loses metadata
→ Or formats inconsistently
```

**Post-Processing:**

```
Extract citations after generation:
1. Identify factual claims in response
2. Match to source chunks
3. Append citations

More reliable but complex
```

***

## How to Solve

**Implement structured citation format in system prompt + pass chunk IDs inline with content + use post-processing to verify citations + provide citation template ("According to \[doc]...") + include direct URLs in metadata.** See [Citation Management](/rag-scenarios-and-solutions/llm/citation-format.md).


---

# 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://help.twig.so/rag-scenarios-and-solutions/llm/citation-format.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.
