Commit 02d619a
[Feat][Memory] Add OpenAI Response API support (#802)
* feat(router): add OpenAI Response API support
Implement OpenAI Response API endpoints for the semantic-router extproc:
- POST /v1/responses - Create response with translation to Chat Completions
- GET /v1/responses/{id} - Retrieve stored response
- DELETE /v1/responses/{id} - Delete stored response
- GET /v1/responses/{id}/input_items - List input items for a response
Key features:
- Request translation: Response API format -> Chat Completions format
- Response translation: Chat Completions format -> Response API format
- Path rewriting: /v1/responses -> /v1/chat/completions for backend
- Conversation chaining via previous_response_id
- Pluggable storage backend (memory store implemented)
- Session-based response storage with TTL support
New packages:
- pkg/responseapi: Types, translator, and ID generation
- pkg/responsestore: Storage interface and memory implementation
- pkg/extproc/req_filter_response_api.go: Response API filter
Config example: config/testing/config.response-api.yaml
Signed-off-by: bitliu <[email protected]>
* docs: add Router Memory guide for Response API
Add documentation for the Router Memory feature under intelligent routing:
- Overview of Response API implementation
- Architecture diagram showing request flow
- Supported endpoints (POST, GET, DELETE, input_items)
- Configuration examples for memory, Milvus, and Redis backends
- Usage examples with curl commands
- Conversation chaining explanation
- API translation table
- Storage backends comparison
- Roadmap with links to related issues
Signed-off-by: bitliu <[email protected]>
* docs: simplify Router Memory guide with real examples
- Replace ASCII architecture with Mermaid diagram
- Use real request/response examples
- Remove unimplemented Milvus/Redis config sections
- Simplify content for better readability
Signed-off-by: bitliu <[email protected]>
* docs: add detailed request flow diagram to Router Memory guide
Signed-off-by: bitliu <[email protected]>
* docs: add cross-model stateful conversation overview
Highlight Semantic Router as unified brain for multiple LLM backends
that only support Chat Completions API, enabling cross-model
stateful conversations.
Signed-off-by: bitliu <[email protected]>
* update
Signed-off-by: bitliu <[email protected]>
---------
Signed-off-by: bitliu <[email protected]>
Co-authored-by: Huamin Chen <[email protected]>1 parent 5b412a8 commit 02d619a
File tree
18 files changed
+2361
-7
lines changed- config/testing
- src/semantic-router/pkg
- config
- extproc
- responseapi
- responsestore
- website
- docs/tutorials/intelligent-route
18 files changed
+2361
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
227 | 266 | | |
228 | 267 | | |
229 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
28 | 49 | | |
29 | | - | |
| 50 | + | |
30 | 51 | | |
31 | 52 | | |
32 | 53 | | |
33 | 54 | | |
34 | 55 | | |
35 | 56 | | |
36 | | - | |
| 57 | + | |
37 | 58 | | |
38 | 59 | | |
39 | 60 | | |
| |||
186 | 207 | | |
187 | 208 | | |
188 | 209 | | |
189 | | - | |
| 210 | + | |
190 | 211 | | |
191 | 212 | | |
192 | 213 | | |
| |||
300 | 321 | | |
301 | 322 | | |
302 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
303 | 335 | | |
304 | 336 | | |
305 | 337 | | |
| |||
332 | 364 | | |
333 | 365 | | |
334 | 366 | | |
335 | | - | |
| 367 | + | |
336 | 368 | | |
| 369 | + | |
| 370 | + | |
337 | 371 | | |
338 | 372 | | |
339 | 373 | | |
| |||
350 | 384 | | |
351 | 385 | | |
352 | 386 | | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
353 | 409 | | |
354 | 410 | | |
355 | 411 | | |
356 | 412 | | |
357 | 413 | | |
358 | 414 | | |
359 | | - | |
| 415 | + | |
| 416 | + | |
360 | 417 | | |
| 418 | + | |
361 | 419 | | |
362 | 420 | | |
363 | 421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
120 | 159 | | |
121 | 160 | | |
122 | 161 | | |
| |||
135 | 174 | | |
136 | 175 | | |
137 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
0 commit comments