Skip to content

Commit 9119d44

Browse files
committed
docs: improve readme and api docs
1 parent 8b817d1 commit 9119d44

File tree

5 files changed

+56
-39
lines changed

5 files changed

+56
-39
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,18 @@ modules: application features
4141
utils: class and constant utilities for this module
4242
```
4343
44-
### Search In Document Flow
44+
### Search In Documents Flow
4545
46-
The search in document endpoint is the most complex of this application, it uses RAG concepts to break down the provided
47-
PDF document into small chunks and use it as context to the follow-up questions. Also, it uses Redis to store
48-
and retrieve chat history during user's session.
46+
To perform a search in documents and ask questions about them, we have two endpoints for that:
4947
50-
> A possible improvement, is to have a separated endpoint for uploading documents and another one for handling questions
51-
> to it. For this initial version the endpoint accepts one document at a time and a question is needed, check this process on the diagram below:
48+
- `POST /resources/docs`
49+
- `POST /genai/search-in-documents`
50+
51+
On `/resources/docs` the documents are uploaded to local system and then broke down into small chunks to be stored on a vector database.
52+
53+
The `/genai/search-in-documents` endpoint uses RAG concept, it's responsible to create an Embedding of the user question, and retrieve the most relevant chunks from vector database using it as context for follow-up questions. Also, it uses Redis to store and retrieve chat history during user's session.
54+
55+
Check this process on the diagram below:
5256

5357
![GenAI Search in Document Flow](docs/genai-flow.png 'GenAI Search in Document Flow')
5458

@@ -128,3 +132,5 @@ Current supported roles are: [`admin`, `user`]:
128132
| GET status/ | [x] | [x] |
129133
| POST /genai/translate | [x] | [x] |
130134
| POST /genai/search-in-document | [x] | [x] |
135+
| GET /genai/chat-history | [x] | [x] |
136+
| POST /resources/docs | [x] | [x] |

docs/genai-flow.png

3.01 KB
Loading

src/modules/genai/application/routes/index.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ const router = express.Router()
5858
* items:
5959
* type: string
6060
* example: ["text field should not be empty"]
61-
* security:
62-
* - bearerAuth: []
61+
* parameters:
62+
* - in: header
63+
* name: Authorization
64+
* required: true
65+
* schema:
66+
* type: string
67+
* example: Bearer <token>
6368
*/
6469
router.post(
6570
'/translate',
@@ -98,8 +103,13 @@ router.post(
98103
* data:
99104
* type: string
100105
* example: The project aims to develop and validate a web platform (software) for automatically correcting assessments created in Microsoft Word.
101-
* security:
102-
* - bearerAuth: []
106+
* parameters:
107+
* - in: header
108+
* name: Authorization
109+
* required: true
110+
* schema:
111+
* type: string
112+
* example: Bearer <token>
103113
*/
104114
router.post(
105115
'/search-in-documents',
@@ -155,12 +165,6 @@ router.post(
155165
* example: {}
156166
* parameters:
157167
* - in: header
158-
* name: Content-Type
159-
* required: true
160-
* schema:
161-
* type: string
162-
* example: application/json
163-
* - in: header
164168
* name: Authorization
165169
* required: true
166170
* schema:

src/modules/resources/application/routes/index.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ const router = express.Router()
7272
* example: Please provide at least one file!
7373
* parameters:
7474
* - in: header
75-
* name: Content-Type
76-
* required: true
77-
* schema:
78-
* type: string
79-
* example: application/json
80-
* - in: header
8175
* name: Authorization
8276
* required: true
8377
* schema:

src/modules/users/application/routes/index.ts

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ const router = express.Router()
4646
* name:
4747
* type: string
4848
* example: User
49-
* security:
50-
* - bearerAuth: []
49+
* parameters:
50+
* - in: header
51+
* name: Authorization
52+
* required: true
53+
* schema:
54+
* type: string
55+
* example: Bearer <token>
5156
*/
5257
router.get('/', isAuthenticated, usersController.getUser)
5358

@@ -63,6 +68,12 @@ router.get('/', isAuthenticated, usersController.getUser)
6368
* required: true
6469
* schema:
6570
* type: string
71+
* - in: header
72+
* name: Authorization
73+
* required: true
74+
* schema:
75+
* type: string
76+
* example: Bearer <token>
6677
* requestBody:
6778
* required: true
6879
* content:
@@ -120,9 +131,7 @@ router.get('/', isAuthenticated, usersController.getUser)
120131
* type: array
121132
* items:
122133
* type: string
123-
* example: ["Invalid email address", "name field is required"]
124-
* security:
125-
* - bearerAuth: []
134+
* example: ["Invalid email address", "name field is
126135
*/
127136
router.patch(
128137
'/',
@@ -143,6 +152,12 @@ router.patch(
143152
* required: true
144153
* schema:
145154
* type: string
155+
* - in: header
156+
* name: Authorization
157+
* required: true
158+
* schema:
159+
* type: string
160+
* example: Bearer <token>
146161
* requestBody:
147162
* required: true
148163
* content:
@@ -203,8 +218,6 @@ router.patch(
203218
* items:
204219
* type: string
205220
* example: Role is required.
206-
* security:
207-
* - bearerAuth: []
208221
*/
209222
router.patch(
210223
'/change-role/:id',
@@ -251,14 +264,10 @@ router.patch(
251264
* type: string
252265
* format: date-time
253266
* example: 2024-09-30T21:04:18.656Z
254-
* headers:
255-
* Content-Type:
256-
* description: The content type of the response
257-
* schema:
258-
* type: string
259-
* example: application/json
260-
* Authorization:
261-
* description: Bearer token for authorization
267+
* parameters:
268+
* - in: header
269+
* name: Authorization
270+
* required: true
262271
* schema:
263272
* type: string
264273
* example: Bearer <token>
@@ -282,6 +291,12 @@ router.get(
282291
* required: true
283292
* schema:
284293
* type: string
294+
* - in: header
295+
* name: Authorization
296+
* required: true
297+
* schema:
298+
* type: string
299+
* example: Bearer <token>
285300
* responses:
286301
* 200:
287302
* description: Successfully deleted the user
@@ -314,8 +329,6 @@ router.get(
314329
* role:
315330
* type: string
316331
* example: user
317-
* security:
318-
* - bearerAuth: []
319332
*/
320333
router.delete(
321334
'/:id',

0 commit comments

Comments
 (0)