MongoDB RAG Server API (1.0.0)
Download OpenAPI specification:Download
The MongoDB RAG Server API is a RESTful API that allows you to create and manage conversations. The API is designed to be used by the MongoDB RAG UI frontend, but can also be used by other clients.
NOTE: The default configuration requires capturing user IP address
and a header Origin: some_string
. You can override this.
Refer to the server configuration documentation for more information.
Response samples
- 200
- 400
- 500
{- "_id": "string",
- "messages": [
- {
- "id": "string",
- "role": "user",
- "content": "string",
- "rating": true,
- "userComment": "string",
- "createdAt": 0,
}
], - "createdAt": 0
}
Add message to the conversation
Add a message to the conversation and get a response back from chatbot.
Authorizations:
path Parameters
conversationId required | string The unique identifier for a conversation. |
query Parameters
stream | boolean Default: false If |
Request Body schema: application/json
message required | string <markdown> Markdown-formatted message from the user. |
Responses
Request samples
- Payload
{- "message": "string"
}
Response samples
- 200
- 400
- 404
- 500
{- "id": "string",
- "role": "user",
- "content": "string",
- "rating": true,
- "userComment": "string",
- "createdAt": 0,
}
Get a conversation
Authorizations:
path Parameters
conversationId required | string The unique identifier for a conversation. |
Responses
Response samples
- 200
- 400
- 404
- 500
{- "_id": "string",
- "messages": [
- {
- "id": "string",
- "role": "user",
- "content": "string",
- "rating": true,
- "userComment": "string",
- "createdAt": 0,
}
], - "createdAt": 0
}
Rate message
Authorizations:
path Parameters
conversationId required | string The unique identifier for a conversation. |
messageId required | string The unique identifier for a message. |
Request Body schema: application/json
rating | boolean Set to |
Responses
Request samples
- Payload
{- "rating": true
}
Response samples
- 400
- 404
- 500
{ }
Add comment to assistant message
Add a comment to an assistant message that clarifies a thumbs up/down rating.
You can only rate an an assistant message that has a thumbs up/down rating. You can only rate a message once. The server returns a 400
error response if the message is not from the assistant, is not rated, or has already been rated.
Authorizations:
path Parameters
conversationId required | string The unique identifier for a conversation. |
messageId required | string The unique identifier for a message. |
Request Body schema: application/json
comment | string Comment from the user clarifying why they liked or disliked the message. |
Responses
Request samples
- Payload
{- "comment": "string"
}
Response samples
- 400
- 404
- 500
{ }