eli02 commited on
Commit
a11c2af
·
1 Parent(s): 6fcf210

Remove detailed endpoint documentation from README for brevity

Browse files
Files changed (1) hide show
  1. README.md +1 -183
README.md CHANGED
@@ -9,186 +9,4 @@ pinned: false
9
  license: unknown
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
-
14
- # Al Ghazali Rag Retrieval Api
15
-
16
- ## Endpoints
17
-
18
- ### 1. `/login` Endpoint
19
- This endpoint is used to authenticate the user and issue an access token and a refresh token.
20
-
21
- #### Request:
22
- ```bash
23
- curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/login \
24
- -H "Content-Type: application/x-www-form-urlencoded" \
25
- -d 'username=user1332&password=RmzmurS7aE!t'
26
- ```
27
-
28
- #### Response:
29
- If the credentials are valid, the server responds with:
30
- ```json
31
- {
32
- "access_token": "your-access-token",
33
- "refresh_token": "your-refresh-token",
34
- "token_type": "bearer",
35
- "expires_in": 1800 // Access token expires in 30 minutes (1800 seconds)
36
- }
37
- ```
38
-
39
- If the credentials are invalid, the server responds with:
40
- ```json
41
- {
42
- "detail": "Invalid username or password"
43
- }
44
- ```
45
-
46
- ### 2. `/refresh` Endpoint
47
- This endpoint is used to refresh the access token using a valid refresh token.
48
-
49
- #### Request:
50
- ```bash
51
- curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/refresh \
52
- -H "Content-Type: application/json" \
53
- -d '{"refresh_token": "your-refresh-token"}'
54
- ```
55
-
56
- #### Response:
57
- If the refresh token is valid, the server responds with:
58
- ```json
59
- {
60
- "access_token": "new-access-token",
61
- "refresh_token": "your-refresh-token", // Optionally issue a new refresh token
62
- "token_type": "bearer",
63
- "expires_in": 1800
64
- }
65
- ```
66
-
67
- If the refresh token is invalid or expired, the server responds with:
68
- ```json
69
- {
70
- "detail": "Could not validate credentials"
71
- }
72
- ```
73
-
74
- ### 3. `/search` Endpoint
75
- This endpoint is used to send a search query and retrieve results. It requires a valid access token.
76
-
77
- #### Request:
78
- ```bash
79
- curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/search \
80
- -H "Content-Type: application/json" \
81
- -H "Authorization: Bearer your-access-token" \
82
- -d '{"query": "test query"}'
83
- ```
84
-
85
- #### Response:
86
- If the access token is valid, the server responds with:
87
- ```json
88
- [
89
- {
90
- "text": "Result 1 text",
91
- "similarity": 0.95
92
- },
93
- {
94
- "text": "Result 2 text",
95
- "similarity": 0.92
96
- },
97
- {
98
- "text": "Result 3 text",
99
- "similarity": 0.89
100
- }
101
- ]
102
- ```
103
-
104
- If the access token is invalid or expired, the server responds with:
105
- ```json
106
- {
107
- "detail": "Could not validate credentials"
108
- }
109
- ```
110
-
111
- ### 4. Root Endpoint (`/`)
112
- This endpoint is used to check if the API is running.
113
-
114
- #### Request:
115
- ```bash
116
- curl -X GET https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/
117
- ```
118
-
119
- #### Response:
120
- ```json
121
- {
122
- "message": "Welcome to the Alchemy of Happiness API!"
123
- }
124
- ```
125
-
126
- ## Workflow Example
127
-
128
- ### Step 1: Login
129
- 1. **Request**:
130
- ```bash
131
- curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/login \
132
- -H "Content-Type: application/x-www-form-urlencoded" \
133
- -d 'username=user1332&password=RmzmurS7aE!t'
134
- ```
135
- 2. **Response**:
136
- ```json
137
- {
138
- "access_token": "your-access-token",
139
- "refresh_token": "your-refresh-token",
140
- "token_type": "bearer",
141
- "expires_in": 1800
142
- }
143
- ```
144
-
145
- ### Step 2: Search
146
- 1. **Request**:
147
- ```bash
148
- curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/search \
149
- -H "Content-Type: application/json" \
150
- -H "Authorization: Bearer your-access-token" \
151
- -d '{"query": "test query"}'
152
- ```
153
- 2. **Response**:
154
- ```json
155
- [
156
- {
157
- "text": "Result 1 text",
158
- "similarity": 0.95
159
- },
160
- {
161
- "text": "Result 2 text",
162
- "similarity": 0.92
163
- },
164
- {
165
- "text": "Result 3 text",
166
- "similarity": 0.89
167
- }
168
- ]
169
- ```
170
-
171
- ### Step 3: Refresh Token
172
- 1. **Request**:
173
- ```bash
174
- curl -X POST https://humblebeeai-al-ghazali-rag-retrieval-api.hf.space/refresh \
175
- -H "Content-Type: application/json" \
176
- -d '{"refresh_token": "your-refresh-token"}'
177
- ```
178
- 2. **Response**:
179
- ```json
180
- {
181
- "access_token": "new-access-token",
182
- "refresh_token": "your-refresh-token",
183
- "token_type": "bearer",
184
- "expires_in": 1800
185
- }
186
- ```
187
-
188
- ## Summary
189
- - **`/login`**: Authenticate and get tokens.
190
- - **`/refresh`**: Refresh the access token.
191
- - **`/search`**: Send a search query (requires a valid access token).
192
- - **`/`**: Check if the API is running.
193
-
194
- Let me know if you need further clarification or assistance!
 
9
  license: unknown
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference