Skip to content

MongoDB Responses API spec #771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

MongoDB Responses API spec #771

wants to merge 3 commits into from

Conversation

mongodben
Copy link
Collaborator

Jira: n/a

Changes

  • Lite specification of new MongoDB Responses API
  • This spec supports both the stateful use case, a la docs chatbot and newer stateless ones like what we're proposing for compass

Notes

  • Conformant to the OpenAI Responses API
  • Note that this is instead of doing a chat completions API, which wouldn't work well for our desire for custom server-side tools or persisting conversations.

// Store in database using the same data model as our normal conversations.
// Update the model to have a few additional fields:
type ResponseConversation = Conversation & {
store?: boolean; // true by default
Copy link
Collaborator

@nlarew nlarew Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. "store the content of messages in the database"?

EDIT: I see later on that this is clarified

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, precisely. always store metadata. only store content if this true

// messages array.
// For MongoDB, can do this by indexing messages.id and then doing an update like
// db.collection.updateOne({ "messages.id": "SOME_VALUE"}, {$push: {messages: {role: "assistant", content: "new!"}}})
previous_response_id: "SOME_VALUE",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I send two requests with the same previous_response_id? ChatGPT supports threads for this but our conversations are single threaded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. didn't think abt the edge case. in this case, lets return 400 to client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants