You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/azure-ai-citations.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,28 +44,34 @@ When Azure AI Search returns citations in a streaming response:
44
44
When Azure AI Search returns citations in a non-streaming response:
45
45
46
46
1. The pipeline extracts citations from the response
47
-
2.**If `AZURE_AI_OPENWEBUI_CITATIONS` is enabled**: Citation events are emitted via `__event_emitter__`
47
+
2.**If `AZURE_AI_OPENWEBUI_CITATIONS` is enabled**: Individual citation events are emitted via `__event_emitter__` for each source
48
48
3.**If `AZURE_AI_ENHANCE_CITATIONS` is enabled**: The response content is enhanced with a formatted citation section
49
49
50
50
## Citation Format
51
51
52
52
### OpenWebUI Citation Event Structure
53
53
54
-
Citation events follow the official OpenWebUI specification (see [OpenWebUI Events Documentation](https://docs.openwebui.com/features/plugin/development/events#source-or-citation-and-code-execution)):
54
+
Each citation is emitted as a separate event to ensure all sources appear in the UI. Citation events follow the official OpenWebUI specification (see [OpenWebUI Events Documentation](https://docs.openwebui.com/features/plugin/development/events#source-or-citation-and-code-execution)):
55
55
56
56
```python
57
57
{
58
58
"type": "citation",
59
59
"data": {
60
-
"document": ["Document content 1", "Document content 2", ...], # Content from each citation
61
-
"metadata": [{"source": "https://..."}, ...], # Metadata with source URLs
62
-
"source": {"name": "Source Name"}, # Display name for the source
63
-
"distances": [0.95, 0.87, ...] # Relevance scores (displayed as percentage)
60
+
"document": ["Document content..."], # Content from this citation
61
+
"metadata": [{"source": "https://..."}], # Metadata with source URL
62
+
"source": {
63
+
"name": "[doc1] Document Title", # Unique name with index
64
+
"url": "https://..."# Source URL if available
65
+
},
66
+
"distances": [0.95] # Relevance score (displayed as percentage)
64
67
}
65
68
}
66
69
```
67
70
68
-
The `distances` array contains relevance scores from Azure AI Search, which OpenWebUI displays as a percentage on the citation cards.
71
+
Key points:
72
+
- Each source document gets its own citation event
73
+
- The `source.name` includes the doc index (`[doc1]`, `[doc2]`, etc.) to prevent grouping
74
+
- The `distances` array contains relevance scores from Azure AI Search, which OpenWebUI displays as a percentage on the citation cards
0 commit comments