This repository was archived by the owner on Sep 29, 2025. It is now read-only.
Commit 5ea37b2
* Add schema for new responses API (#785)
* update contributing
* openai v5.6.0
* create schema for responses API
* add skeleton route to conversations router
* add some basic tests
* put package back
* put package lock back
* add case for message array input
* feat: complete create response test suite
* add minimum to max_output_tokens
* add more test cases
* add test case
* set zod version to 3.25 for v4 support
* start of pr feedback
* adjust schema and tests to not allow empty message strings/arrays
* move create responses
* create new (very basic) router for responses API
* basic test for responses router, will be expanded once middleware is added
* update test
* update func name
* create route for responses API -- ensure certain options are set via config
* clean up tests by moving MONGO_CHAT_MODEL string to test config
* use GenerateResponse type
* update comments in router
* update reqId stuff
* update comment
* Improve responses api errors (#789)
* create errors helper
* update errors to include http code
* add sendErrorResponse helper
* add enum for error codes
* update createResponse to use new error helpers
* handle input validation in createResponse vs middleware
* mostly update tests
* improve error messages from zod
* update tests
* adjust variable names/exports
* add test case for unknown errors
* remove openai dep from mongodb-chat-server in favor of importing from rag-core
* update errors to use openai types and classes
* update tests with new validation errors
* improve router test
* Add rate limiting to responses api (#792)
* add rate limit and global slowdown to responses router
* basic working rate limit with test for responses router
* add more test assertions for openai error
* configure rateLimit middleware properly with makeRateLimitError helper
* update test case
* update test case
* use sendErrorResponse helper within rateLimit middleware to ensure we get logging there too
* remove extra comment
* update error message
* abstract error strings for tests
* Handle messages for responses (#795)
* cleaanup err msg constants
* add failing tests to rag-core for message_id helper
* add findByMessageId to conversation service
* remove extra types from conversation service
* add indexes to conversationsDb
* add test for new getByMessageId service
* remove duplicate export
* add logic for getting conversation to createResponse
* update configs for createResponse -- includes some cleanup
* fix test for successful previous_message_id input
* cleanup test variables
* even cleaner tests
* add logic to catch bad object ids
* add more tests
* more tests
* last test
* fix broken mock
* cleanup tests
* share logic for reaching maxUserMessages in a Conversation
* bump
* Add storage logic to responses (#800)
* skeleton for addMessagesToConversation helper
* more skeleton
* better name
* increment
* add check for previousResponse and input array
* store metadata on conversation and create array of final messages
* add call to save messages
* add logic for checking userId changed
* add test for conversation user id logic
* update logic for adding messages to conversation
* remove unneeded error case
* remove test case
* dont filter, just map
* create helper for convertInputToDBMessages
* update store logic
* save store data on conversation, check for previous message id and no store
* add case to handle mismatched conversation storage settings
* cleanup logic for checking if conversation is stored
* basic spy
* implement tests
* update
* add final spys
* safeParse > safeParseAsync bc we don't need to await any refines, etc.
* add comment
* add userId and storeMessageContent fields to Conversation
* adjust logic for response api to use new convo fields
* fix bug in conversation service logic
* update userId check
* update tests
* test name tweak
* test naming
* add jset mock cleanup
* abstract testMessageContent helper
* update test helper
* test for function call and outputs message storage
* update tests
* cleanup test
* handle data streaming for new responses API (#807)
* ensure stream is configurable in chatbot-server-public layer
* setup data streamer helper
* add skeleton data streaming to createResponse service
* move StreamFunction type to chat-server, share with public
* fix test
* start streaming in createResponse
* add stream disconnect
* move in progress stream message
* stream event from verifiedAnswer helper
* create helper for addMessageToConversationVerifiedAnswerStream
* apply stream configs to chat-public
* update test to use openAI client
* update input schema for openai client call to responses
* add test helper for making local server
* almost finish converting createResposne tests to use openai client
* more tests
* disconnect data streamed on error
* update data stream logic for create response
* update data streamer sendResponsesEvent write type
* i think this still needs to be a string
* mapper for streamError
* export openai shim types
* mostly working tests with reading the response stream from openai client
* create test helper
* fix test helper for reading entire stream
* dont send normal http message at end (maybe need this when we support non-streaming version)
* improved tests
* more test improvement -- proper use of conversation service, additional conversation testing
* fix test for too many messages
* remove skip tests
* mostly working responses tests
* abstract helpers for openai client requests
* use helpers in create response tests
* fix tests by passing responseId
* skip problematic test
* skip problematic test
* create baseResponseData helper
* pass zod validated req body
* add tests for all responses fields
* remove log
* abstract helper for formatOpenaiError
* replace helper
* await server closing properly
* basic working responses tests with openai client
* update rate limit test
* fix testing port
* update test type related to responses streaming
* apply type to data streamer
* cleanup shared type
* fix router tests
* fix router tests
* update errors to be proper openai stream errors
* ensure format message cleans customData as well
* add comment
* update tests per review
* update test utils
* fix test type
* update openai rag-core to 5.9
* fix data streamer for responses events to be SSE compliant
* cleanup responses tests
* cleanup createResponse tests
* cleanup error handling to match openai spec
* fix tests for standard openai exceptions
* cleanup
* add "required" as an option for tool_choice
* cleanup datastreamer test globals
* add test to dataStreamer for streamResponses
* update config to pass the proper stream when setting up public chatbot server
* configure responsesAPIStream handler
* cleanup variable
* fix header type errors for openai 4->5 upgrade
* fix type name for annotation
* start of test fixes
* update tests for streaming mode
* better mock testing
* more specific typing in dataStreamer
* cleanup typing in createResponse
* cleanup type
* cleanup types in generateResponse
* add optional onTextDone stream handler for responses
* forEach to get index instead of for with let
* stream full text on done
* update generate response test util for createResponse
* implement generateResponse call in createResponse
* working
* inject custom system prompt
* PR cleanup
* Delete packages/chatbot-server-mongodb-public/curl.sh
* fix AS nit
---------
Co-authored-by: Andrew Steinheiser <me@iamandrew.io>
Co-authored-by: Ben Perlmutter <mongodben@mongodb.com>
1 parent d289b2f commit 5ea37b2
File tree
19 files changed
+309
-31
lines changed- packages
- chatbot-server-mongodb-public/src
- eval
- experiments
- processors
- tools
- tracing/scrubbedMessages
- mongodb-chatbot-server/src
- processors
- routes/responses
- mongodb-rag-core
- src/eval
19 files changed
+309
-31
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
276 | 277 | | |
277 | 278 | | |
278 | 279 | | |
279 | | - | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
229 | 231 | | |
230 | 232 | | |
231 | 233 | | |
| 234 | + | |
232 | 235 | | |
233 | 236 | | |
234 | 237 | | |
| |||
253 | 256 | | |
254 | 257 | | |
255 | 258 | | |
| 259 | + | |
256 | 260 | | |
257 | 261 | | |
258 | 262 | | |
| |||
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
40 | 39 | | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
Lines changed: 204 additions & 0 deletions
| 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 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 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 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 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 | + | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
307 | | - | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
| 312 | + | |
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| |||
0 commit comments