Skip to content

Commit 0275ff3

Browse files
committed
docs(rag): add Chain of Thought documentation - Document CoT feature and usage instructions - Add examples for API, CLI, and programmatic use - Include explanation of CoT benefits and use cases
1 parent c4c43eb commit 0275ff3

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

agentic_rag/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The system has the following features:
1010
- Smart context retrieval and response generation
1111
- FastAPI-based REST API for document upload and querying
1212
- Support for both OpenAI-based agents or local, transformer-based agents (`Mistral-7B` by default)
13+
- Optional Chain of Thought (CoT) reasoning for more detailed and structured responses
1314

1415
## Setup
1516

@@ -189,6 +190,53 @@ The RAG Agent flow is the following:
189190

190191
TODO: integrate with Trafilatura to crawl web content apart from PDF
191192

193+
194+
## Chain of Thought (CoT) Support
195+
196+
The system implements Chain of Thought prompting, allowing the LLMs to break down complex queries into steps and show their reasoning process. This feature can be activated in several ways:
197+
198+
### 1. Using the API
199+
200+
```http
201+
POST /query
202+
Content-Type: application/json
203+
204+
{
205+
"query": "your question here",
206+
"use_cot": true
207+
}
208+
```
209+
210+
### 2. Using Command Line
211+
212+
```bash
213+
# Using local Mistral model with CoT
214+
python local_rag_agent.py --query "your question" --use-cot
215+
216+
# Using OpenAI with CoT
217+
python rag_agent.py --query "your question" --use-cot
218+
```
219+
220+
### 3. Programmatically
221+
222+
```python
223+
# Initialize agents with CoT enabled
224+
local_agent = LocalRAGAgent(vector_store, use_cot=True)
225+
openai_agent = RAGAgent(vector_store, openai_api_key, use_cot=True)
226+
```
227+
228+
When CoT is enabled, the system will:
229+
1. Break down complex queries into logical steps
230+
2. Show the reasoning process for each step
231+
3. Use available context more effectively by explaining how it relates to each step
232+
4. Arrive at more reliable answers through structured thinking
233+
234+
This is particularly useful for:
235+
- Complex analytical questions
236+
- Multi-step reasoning problems
237+
- Questions requiring detailed explanations
238+
- Queries that need careful consideration of multiple pieces of context
239+
192240
## Contributing
193241

194242
This project is open source. Please submit your contributions by forking this repository and submitting a pull request! Oracle appreciates any contributions that are made by the open source community.

0 commit comments

Comments
 (0)