Interface: ConversationsRouterParams
Configuration for the /conversations/* routes.
Properties
addMessageToConversationCustomData
• Optional
addMessageToConversationCustomData: AddCustomDataFunc
Function that takes the request + response and returns any custom data you want to include
in the Message persisted to the database.
For example, you might want to store details about what LLM was used to generate the response.
The custom data is persisted to the database with the Message
in the
Message.customData field inside of the Conversation.messages array.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:185
conversations
• conversations: ConversationsService
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:118
createConversationCustomData
• Optional
createConversationCustomData: AddCustomDataFunc
Function that takes the request + response and returns any custom data you want to include in the Conversation persisted to the database. For example, you might want to store the user's email address with the conversation. The custom data is persisted to the database with the Conversation in the Conversation.customData field.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:176
filterPreviousMessages
• Optional
filterPreviousMessages: FilterPreviousMessages
Function to filter which previous messages are sent to the ChatLlm. For example, you may only want to send the system prompt to the LLM with the user message or the system prompt and X prior messages. Defaults to sending only the system prompt.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:140
generateUserPrompt
• Optional
generateUserPrompt: GenerateUserPromptFunc
Function to generate the user prompt sent to the ChatLlm. You can perform any preprocessing of the user's message including retrieval augmented generation here.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:126
llm
• llm: ChatLlm
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:117
maxInputLengthCharacters
• Optional
maxInputLengthCharacters: number
Maximum number of characters in user input. Server returns 400 error if user input is longer than this.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:132
maxUserCommentLength
• Optional
maxUserCommentLength: number
Maximum number of characters allowed in a user's comment on an assistant Message. If not specified, user comments may be of any length.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:191
maxUserMessagesInConversation
• Optional
maxUserMessagesInConversation: number
Maximum number of user-sent messages in a conversation. Server returns 400 error if user tries to add a message to a conversation that has this many messages.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:147
middleware
• Optional
middleware: ConversationsMiddleware
[]
Middleware to put in front of all the routes in the conversationsRouter. You can use this to do things like authentication, data validation, etc.
If you want the middleware to run only on certain routes, you can add conditional logic inside the middleware. For example:
const someMiddleware: ConversationsMiddleware = (req, res, next) => {
if (req.path === "/conversations") {
// Do something
}
next();
}
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:167
rateLimitConfig
• Optional
rateLimitConfig: ConversationsRateLimitConfig
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:148
systemPrompt
• systemPrompt: Object
Type declaration
Name | Type | Description |
---|---|---|
embedding? | number [] | The vector representation of the content. |
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:119