Skip to content

Commit d8f9de7

Browse files
authored
feat: change endpoint to support /chat/completion, add Swagger
feat: change endpoint to support /chat/completion, add Swagger fields for /docs endpoint
2 parents 01db213 + 6f1370b commit d8f9de7

16 files changed

Lines changed: 1738 additions & 551 deletions

File tree

agents/base/crewai_websearch_agent/README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,32 +172,31 @@ Get the route URL:
172172
oc get route crewai-websearch-agent -o jsonpath='{.spec.host}'
173173
```
174174

175-
/chat response:
175+
Send a test request:
176+
177+
Non-streaming
176178

177179
```bash
178-
curl -X POST https://<YOUR_ROUTE_URL>/chat \
180+
curl -X POST https://<YOUR_ROUTE_URL>/chat/completions \
179181
-H "Content-Type: application/json" \
180-
-d '{"message": "What is the best cluster hosting service?"}'
182+
-d '{"messages": [{"role": "user", "content": "What is the best cluster hosting service?"}], "stream": false}'
181183
```
182184

183-
/stream response:
185+
Streaming
184186

185187
```bash
186-
curl -sN -X POST https://<YOUR_ROUTE_URL>/stream \
188+
curl -sN -X POST https://<YOUR_ROUTE_URL>/chat/completions \
187189
-H "Content-Type: application/json" \
188-
-d '{"message": "What is the best cluster hosting service?"}'
190+
-d '{"messages": [{"role": "user", "content": "What is the best cluster hosting service?"}], "stream": true}'
189191
```
190192

191-
Pretty /stream response
193+
Pretty Printed Stream
192194

193195
```bash
194-
curl -sN -X POST https://<YOUR_ROUTE_URL>/stream \
196+
curl -sN -X POST https://<YOUR_ROUTE_URL>/chat/completions \
195197
-H "Content-Type: application/json" \
196-
-d '{"message": "What is the best cluster hosting service??"}' |
197-
grep --line-buffered '^data: ' |
198-
sed -u 's/^data: //' |
199-
grep -v '^\[DONE\]$' |
200-
jq -r -j '.choices[0].delta.content // empty'
198+
-d '{"messages": [{"role": "user", "content": "What is the best cluster hosting service?"}], "stream": true}' |
199+
jq -R -r -j --stream 'scan("^data:(.*)")[] | fromjson.choices[0].delta.content // empty'
201200
```
202201

203202
---

0 commit comments

Comments
 (0)