mongodb-chatbot-server
Interfaces
- AppConfig
- AzureOpenAiServiceConfig
- CallToolResponse
- ChatLlm
- CommentMessageParams
- Conversation
- ConversationConstants
- ConversationsRateLimitConfig
- ConversationsRouterLocals
- ConversationsRouterParams
- ConversationsService
- DataStreamer
- EmbeddedContent
- FindByIdParams
- GenerateUserPromptFuncReturnValue
- LlmAnswerQuestionParams
- LlmCallToolParams
- MakeLangchainChatLlmProps
- MakeOpenAiChatLlmParams
- MakeRagGenerateUserPromptParams
- MakeUserMessageFuncParams
- MakeVerifiedAnswerGenerateUserPromptParams
- RateMessageParams
- SearchBooster
- Tool
- ToolCallParams
Type Aliases
AddAssistantMessageParams
Ƭ AddAssistantMessageParams: Omit
<AssistantMessage
, "id"
| "createdAt"
>
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:184
AddConversationMessageParams
Ƭ AddConversationMessageParams: Object
Type declaration
Name | Type |
---|---|
conversationId | ObjectId |
message | AddSomeMessageParams |
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:195
AddCustomDataFunc
Ƭ AddCustomDataFunc: (request
: Request
, response
: ConversationsRouterResponse
) => Promise
<ConversationCustomData
>
Type declaration
▸ (request
, response
): Promise
<ConversationCustomData
>
Function to add custom data to the Conversation persisted to the database. Has access to the Express.js request and response plus the ConversationsRouterLocals from the Response.locals object.
Parameters
Name | Type |
---|---|
request | Request |
response | ConversationsRouterResponse |
Returns
Promise
<ConversationCustomData
>
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:69
AddFunctionMessageParams
Ƭ AddFunctionMessageParams: Omit
<FunctionMessage
, "id"
| "createdAt"
> & { customData?
: Record
<string
, unknown
> }
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:177
AddManyConversationMessagesParams
Ƭ AddManyConversationMessagesParams: Object
Type declaration
Name | Type |
---|---|
conversationId | ObjectId |
messages | AddSomeMessageParams [] |
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:200
AddSomeMessageParams
Ƭ AddSomeMessageParams: AddSystemMessageParams
| AddUserMessageParams
| AddAssistantMessageParams
| AddFunctionMessageParams
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:189
AddSystemMessageParams
Ƭ AddSystemMessageParams: Omit
<SystemMessage
, "id"
| "createdAt"
>
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:171
AddUserMessageParams
Ƭ AddUserMessageParams: Omit
<UserMessage
, "id"
| "createdAt"
> & { customData?
: Record
<string
, unknown
> }
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:173
AssistantMessage
Ƭ AssistantMessage: MessageBase
& { functionCall?
: FunctionCall
; metadata?
: AssistantMessageMetadata
; rating?
: boolean
; references?
: any
[] ; role
: "assistant"
; userComment?
: string
}
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:37
AssistantMessageMetadata
Ƭ AssistantMessageMetadata: Object
Index signature
▪ [k: string
]: unknown
Type declaration
Name | Type | Description |
---|---|---|
verifiedAnswer? | VerifiedAnswerEventData | If the message came from the verified answers collection, contains the metadata about the verified answer. |
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:64
ConversationCustomData
Ƭ ConversationCustomData: Record
<string
, unknown
> | undefined
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:144
ConversationsMiddleware
Ƭ ConversationsMiddleware: RequestHandler
<ParamsDictionary
, any
, any
, any
, ConversationsRouterLocals
>
Middleware to put in front of all the routes in the conversationsRouter.
This middleware is useful for things like authentication, data validation, etc.
It exposes the app's ConversationsService.
It also lets you access ConversationsRouterLocals via Response.locals
(docs).
You can use the locals in other middleware or persist when you create the conversation
with the POST /conversations
endpoint with the AddCustomDataFunc.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:102
ConversationsRouterResponse
Ƭ ConversationsRouterResponse: Response
<any
, ConversationsRouterLocals
>
Express.js Response from the app's ConversationsService.
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:87
CreateConversationParams
Ƭ CreateConversationParams: Object
Type declaration
Name | Type |
---|---|
customData? | ConversationCustomData |
initialMessages? | SomeMessage [] |
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:166
DatabaseConnection
Ƭ DatabaseConnection: Object
Type declaration
Name | Type |
---|---|
close | (force? : boolean ) => Promise <void > |
drop | () => Promise <void > |
Defined in
packages/mongodb-rag-core/build/DatabaseConnection.d.ts:1
DeltaStreamEvent
Ƭ DeltaStreamEvent: StreamEvent
& { data
: string
; type
: "delta"
}
Event when server streams additional message response to the client.
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:54
EmbedArgs
Ƭ EmbedArgs: Object
Type declaration
Name | Type | Description |
---|---|---|
text | string | The text to embed. |
Defined in
packages/mongodb-rag-core/build/Embedder.d.ts:1
EmbedResult
Ƭ EmbedResult: Object
Type declaration
Name | Type | Description |
---|---|---|
embedding | number [] | Vector embedding of the text. |
Defined in
packages/mongodb-rag-core/build/Embedder.d.ts:7
EmbeddedContentStore
Ƭ EmbeddedContentStore: VectorStore
<EmbeddedContent
> & { close?
: () => Promise
<void
> ; deleteEmbeddedContent
: (args
: { page
: Page
}) => Promise
<void
> ; loadEmbeddedContent
: (args
: { page
: Page
}) => Promise
<EmbeddedContent
[]> ; updateEmbeddedContent
: (args
: { embeddedContent
: EmbeddedContent
[] ; page
: Page
}) => Promise
<void
> }
Data store of the embedded content.
Defined in
packages/mongodb-rag-core/build/EmbeddedContent.d.ts:53
Embedder
Ƭ Embedder: Object
Takes a string of text and returns an array of numbers representing the vector embedding of the text.
Type declaration
Name | Type |
---|---|
embed | (args : EmbedArgs ) => Promise <EmbedResult > |
Defined in
packages/mongodb-rag-core/build/Embedder.d.ts:17
FilterPreviousMessages
Ƭ FilterPreviousMessages: (conversation
: Conversation
) => Promise
<Message
[]>
Type declaration
▸ (conversation
): Promise
<Message
[]>
Filters which previous conversation messages are sent to the LLM along with the user prompt. 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.
Parameters
Name | Type |
---|---|
conversation | Conversation |
Returns
Promise
<Message
[]>
Defined in
packages/mongodb-chatbot-server/src/processors/FilterPreviousMessages.ts:9
FindContentFunc
Ƭ FindContentFunc: (args
: FindContentFuncArgs
) => Promise
<FindContentResult
>
Type declaration
▸ (args
): Promise
<FindContentResult
>
Parameters
Name | Type |
---|---|
args | FindContentFuncArgs |
Returns
Promise
<FindContentResult
>
Defined in
packages/mongodb-chatbot-server/src/processors/FindContentFunc.ts:7
FindContentFuncArgs
Ƭ FindContentFuncArgs: Object
Type declaration
Name | Type |
---|---|
query | string |
Defined in
packages/mongodb-chatbot-server/src/processors/FindContentFunc.ts:3
FindContentResult
Ƭ FindContentResult: Object
Type declaration
Name | Type |
---|---|
content | WithScore <EmbeddedContent >[] |
queryEmbedding | number [] |
Defined in
packages/mongodb-chatbot-server/src/processors/FindContentFunc.ts:11
FindNearestNeighborsOptions
Ƭ FindNearestNeighborsOptions: Object
Options for performing a nearest-neighbor search.
Type declaration
Name | Type | Description |
---|---|---|
filter | Record <string , unknown > | Search filter expression. |
indexName | string | The name of the index to use. |
k | number | The number of nearest neighbors to return. |
minScore | number | The minimum nearest-neighbor score threshold between 0-1. |
numCandidates | number | Number of nearest neighbors to use during the search. Value must be less than or equal to 10000. You can't specify a number less than the number of documents to return (k). |
path | string | The keypath to the field with the vector data to use. |
Defined in
packages/mongodb-rag-core/build/VectorStore.d.ts:17
FindVerifiedAnswerFunc
Ƭ FindVerifiedAnswerFunc: (args
: FindVerifiedAnswerFuncArgs
) => Promise
<FindVerifiedAnswerResult
>
Type declaration
▸ (args
): Promise
<FindVerifiedAnswerResult
>
Parameters
Name | Type |
---|---|
args | FindVerifiedAnswerFuncArgs |
Returns
Promise
<FindVerifiedAnswerResult
>
Defined in
packages/mongodb-chatbot-server/src/processors/FindVerifiedAnswerFunc.ts:7
FindVerifiedAnswerFuncArgs
Ƭ FindVerifiedAnswerFuncArgs: Object
Type declaration
Name | Type |
---|---|
query | string |
Defined in
packages/mongodb-chatbot-server/src/processors/FindVerifiedAnswerFunc.ts:3
FindVerifiedAnswerResult
Ƭ FindVerifiedAnswerResult: Object
Type declaration
Name | Type |
---|---|
answer? | WithScore <VerifiedAnswer > |
queryEmbedding | number [] |
Defined in
packages/mongodb-chatbot-server/src/processors/FindVerifiedAnswerFunc.ts:11
FinishedStreamEvent
Ƭ FinishedStreamEvent: StreamEvent
& { data
: string
; type
: "finished"
}
Event denoting the end of streaming.
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:87
FunctionMessage
Ƭ FunctionMessage: MessageBase
& { name
: string
; role
: "function"
}
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:79
GenerateUserPromptFunc
Ƭ GenerateUserPromptFunc: (params
: GenerateUserPromptFuncParams
) => Promise
<GenerateUserPromptFuncReturnValue
>
Type declaration
▸ (params
): Promise
<GenerateUserPromptFuncReturnValue
>
Generate the user prompt sent to the ChatLlm. This function is a flexible construct that you can use to customize the chatbot behavior. For example, you can use this function to perform retrieval augmented generation (RAG) or chain of thought prompting. Include whatever logic in here to construct the user message that the LLM responds to.
If you are doing RAG, this can include the content from vector search.
Parameters
Name | Type |
---|---|
params | GenerateUserPromptFuncParams |
Returns
Promise
<GenerateUserPromptFuncReturnValue
>
Defined in
packages/mongodb-chatbot-server/src/processors/GenerateUserPromptFunc.ts:66
GenerateUserPromptFuncParams
Ƭ GenerateUserPromptFuncParams: Object
Type declaration
Name | Type | Description |
---|---|---|
conversation? | Conversation | Conversation with preceding messages |
customData? | ConversationCustomData | Custom data for the message request. |
reqId | string | String Id for request |
userMessageText | string | Original user message |
Defined in
packages/mongodb-chatbot-server/src/processors/GenerateUserPromptFunc.ts:9
LoadPagesArgs
Ƭ LoadPagesArgs<QueryShape
>: Object
Type parameters
Name | Type |
---|---|
QueryShape | unknown |
Type declaration
Name | Type | Description |
---|---|---|
query? | QueryShape | A custom query to refine the pages to load. |
sources? | string [] | The names of the sources to load pages from. If undefined, loads available pages from all sources. |
updated? | Date | If specified, refines the query to load pages with an updated date later or equal to the given date. |
urls? | string [] | If specified, refines the query to only load pages where the url is included in the list. |
Defined in
packages/mongodb-rag-core/build/Page.d.ts:50
MakeDefaultFindContentFuncArgs
Ƭ MakeDefaultFindContentFuncArgs: Object
Type declaration
Name | Type |
---|---|
embedder | Embedder |
findNearestNeighborsOptions? | Partial <FindNearestNeighborsOptions > |
searchBoosters? | SearchBooster [] |
store | EmbeddedContentStore |
Defined in
packages/mongodb-chatbot-server/src/processors/makeDefaultFindContent.ts:9
MakeDefaultFindVerifiedAnswerFuncArgs
Ƭ MakeDefaultFindVerifiedAnswerFuncArgs: Object
Type declaration
Name | Type |
---|---|
embedder | Embedder |
findNearestNeighborsOptions? | Partial <FindNearestNeighborsOptions > |
store | VerifiedAnswerStore |
Defined in
packages/mongodb-chatbot-server/src/processors/makeDefaultFindVerifiedAnswer.ts:8
MakeLangChainEmbedderParams
Ƭ MakeLangChainEmbedderParams: Object
Type declaration
Name | Type | Description |
---|---|---|
langChainEmbeddings | Embeddings | LangChain.js Embeddings instance. You can configure things like caching and retry behavior in the Embeddings instance. |
Defined in
packages/mongodb-rag-core/build/LangChainEmbedder.d.ts:3
MakeOpenAiEmbedderArgs
Ƭ MakeOpenAiEmbedderArgs: Object
Type declaration
Name | Type | Description |
---|---|---|
backoffOptions? | BackoffOptions | Options used for automatic retry (usually due to rate limiting). |
deployment | string | The deployment key. |
openAiClient | OpenAIClient | The OpenAI client. |
Defined in
packages/mongodb-rag-core/build/OpenAiEmbedder.d.ts:4
MakeReferenceLinksFunc
Ƭ MakeReferenceLinksFunc: (chunks
: EmbeddedContent
[]) => any
[]
Type declaration
▸ (chunks
): any
[]
Function that generates the references in the response to user.
Parameters
Name | Type |
---|---|
chunks | EmbeddedContent [] |
Returns
any
[]
Defined in
packages/mongodb-chatbot-server/src/processors/MakeReferenceLinksFunc.ts:6
MakeTypeChatJsonTranslateFuncArgs
Ƭ MakeTypeChatJsonTranslateFuncArgs: Object
Type declaration
Name | Type | Description |
---|---|---|
azureOpenAiServiceConfig | AzureOpenAiServiceConfig | Settings for using the Azure service. |
numRetries? | number | Number of times to retry the query preprocessor if it fails. |
retryDelayMs? | number | Delay between retries in milliseconds. |
schema | string | The text of a .d.ts that would inform the schema. |
schemaName | string | The name of the TypeChat schema or interface. |
Defined in
packages/mongodb-rag-core/build/TypeChatJsonTranslateFunc.d.ts:7
MakeUserMessageFunc
Ƭ MakeUserMessageFunc: (params
: MakeUserMessageFuncParams
) => Promise
<UserMessage
>
Type declaration
▸ (params
): Promise
<UserMessage
>
Parameters
Name | Type |
---|---|
params | MakeUserMessageFuncParams |
Returns
Promise
<UserMessage
>
Defined in
packages/mongodb-chatbot-server/src/processors/makeRagGenerateUserPrompt.ts:48
Message
Ƭ Message: SomeMessage
& { createdAt
: Date
; id
: ObjectId
}
Message stored in the database.
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:132
MessageBase
Ƭ MessageBase: Object
Type declaration
Name | Type | Description |
---|---|---|
content | string | Message that occurs in the conversation. |
customData? | Record <string , unknown > | Custom data received from the client to include in the Message persisted to the database. |
metadata? | Record <string , unknown > | Arbitrary data about the message that should be sent to the client. |
role | string | The role of the message in the conversation. |
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:10
MetadataStreamEvent
Ƭ MetadataStreamEvent: StreamEvent
& { data
: Record
<string
, unknown
> ; type
: "metadata"
}
Event when server streams a metadata object to the client.
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:79
MongoDbPageStore
Ƭ MongoDbPageStore: DatabaseConnection
& Omit
<PageStore
, "loadPages"
> & { queryType
: "mongodb"
; loadPages
: (args?
: LoadPagesArgs
<Filter
<PersistedPage
>>) => Promise
<PersistedPage
[]> }
Defined in
packages/mongodb-rag-core/build/MongoDbPageStore.d.ts:5
OpenAIChatCompletionWithoutUsage
Ƭ OpenAIChatCompletionWithoutUsage: Omit
<ChatCompletions
, "usage"
>
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:85
OpenAiAwaitedResponse
Ƭ OpenAiAwaitedResponse: ChatRequestAssistantMessage
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:89
OpenAiChatMessage
Ƭ OpenAiChatMessage: ChatRequestMessage
& { content
: string
| null
; embedding?
: number
[] ; role
: OpenAiMessageRole
}
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:21
OpenAiMessageRole
Ƭ OpenAiMessageRole: "system"
| "assistant"
| "user"
| "function"
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:19
OpenAiStreamingResponse
Ƭ OpenAiStreamingResponse: AsyncIterable
<OpenAIChatCompletionWithoutUsage
>
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:87
Page
Ƭ Page: Object
Represents a page from a data source.
Type declaration
Name | Type | Description |
---|---|---|
body | string | The text of the page. |
format | PageFormat | The file format of the page. This format determines how the page should be chunked and vector-embedded. |
metadata? | PageMetadata | Arbitrary metadata for page. |
sourceName | string | Data source name. |
title? | string | A human-readable title. |
url | string | - |
Defined in
packages/mongodb-rag-core/build/Page.d.ts:5
PageAction
Ƭ PageAction: "created"
| "updated"
| "deleted"
Defined in
packages/mongodb-rag-core/build/Page.d.ts:36
PageFormat
Ƭ PageFormat: typeof pageFormats
[number
]
A canonical page format.
Defined in
packages/mongodb-rag-core/build/PageFormat.d.ts:15
PageMetadata
Ƭ PageMetadata: Object
Index signature
▪ [k: string
]: unknown
Type declaration
Name | Type | Description |
---|---|---|
tags? | string [] | Arbitrary tags. |
Defined in
packages/mongodb-rag-core/build/Page.d.ts:29
PageStore
Ƭ PageStore: Object
Data store for Page objects.
Type declaration
Name | Type | Description |
---|---|---|
close? | () => Promise <void > | Close connection to data store. |
queryType? | "mongodb" | string | The format that the store uses for custom queries. If not specified, the store does not allow custom queries. |
loadPages | (args? : LoadPagesArgs <unknown >) => Promise <PersistedPage []> | Loads pages from the Page store. |
updatePages | (pages : PersistedPage []) => Promise <void > | Updates or adds the given pages in the store. |
Defined in
packages/mongodb-rag-core/build/Page.d.ts:74
PersistedPage
Ƭ PersistedPage: Page
& { action
: PageAction
; updated
: Date
}
Represents a Page stored in the database.
Defined in
packages/mongodb-rag-core/build/Page.d.ts:40
ProcessingStreamEvent
Ƭ ProcessingStreamEvent: StreamEvent
& { data
: string
; type
: "processing"
}
Event for when the server is processing a request.
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:59
QueryPreprocessorFunc
Ƭ QueryPreprocessorFunc<ReturnType
>: (params
: QueryProcessorFuncParams
) => Promise
<ReturnType
>
Type parameters
Name | Type |
---|---|
ReturnType | extends QueryPreprocessorResult = QueryPreprocessorResult |
Type declaration
▸ (params
): Promise
<ReturnType
>
Query preprocessors transform an input query to a new query based on your business logic.
If the preprocessor can't transform the query, it may return undefined. The preprocessor may also suggest not answering with the rejectQuery field in the return value (for example, if the query disparages your company, you might want to send a canned response).
Parameters
Name | Type |
---|---|
params | QueryProcessorFuncParams |
Returns
Promise
<ReturnType
>
Defined in
packages/mongodb-chatbot-server/src/processors/QueryPreprocessorFunc.ts:17
QueryPreprocessorResult
Ƭ QueryPreprocessorResult: Object
Type declaration
Name | Type |
---|---|
query? | string |
rejectQuery? | boolean |
Defined in
packages/mongodb-chatbot-server/src/processors/QueryPreprocessorFunc.ts:21
QueryProcessorFuncParams
Ƭ QueryProcessorFuncParams: Object
Type declaration
Name | Type |
---|---|
messages? | Message [] |
query | string |
Defined in
packages/mongodb-chatbot-server/src/processors/QueryPreprocessorFunc.ts:3
Question
Ƭ Question: z.infer
<typeof Question
>
Defined in
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:3
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:19
Reference
Ƭ Reference: z.infer
<typeof Reference
>
A formatted reference for an assistant message.
For example, a Reference might be a docs page, dev center article, or a MongoDB University module.
Defined in
packages/mongodb-rag-core/build/services/conversations.d.ts:8
packages/mongodb-rag-core/build/services/conversations.d.ts:9
References
Ƭ References: z.infer
<typeof References
>
Defined in
packages/mongodb-rag-core/build/services/conversations.d.ts:19
packages/mongodb-rag-core/build/services/conversations.d.ts:20
ReferencesStreamEvent
Ƭ ReferencesStreamEvent: StreamEvent
& { data
: any
[] ; type
: "references"
}
Event when server streams single References object to the client.
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:71
SomeMessage
Ƭ SomeMessage: UserMessage
| AssistantMessage
| SystemMessage
| FunctionMessage
Message in the Conversation.
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:123
SomeStreamEvent
Ƭ SomeStreamEvent: DeltaStreamEvent
| MetadataStreamEvent
| ProcessingStreamEvent
| ReferencesStreamEvent
| FinishedStreamEvent
The event types streamed from the chat server to the client.
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:95
SystemMessage
Ƭ SystemMessage: MessageBase
& { role
: "system"
}
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:33
SystemPrompt
Ƭ SystemPrompt: OpenAiChatMessage
& { content
: string
; role
: "system"
}
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:34
ToolCallDirective
Ƭ ToolCallDirective: FunctionCallPreset
| FunctionName
Defined in
packages/mongodb-chatbot-server/src/services/ChatLlm.ts:110
UserMessage
Ƭ UserMessage: MessageBase
& { contentForLlm?
: string
; contextContent?
: Partial
<WithScore
<EmbeddedContent
>>[] ; embedding?
: number
[] ; preprocessedContent?
: string
; rejectQuery?
: boolean
; role
: "user"
}
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:84
VectorStore
Ƭ VectorStore<T
>: Object
Generic vector store for vector-searchable data.
Type parameters
Name |
---|
T |
Type declaration
Name | Type |
---|---|
close? | () => Promise <void > |
findNearestNeighbors | (vector : number [], options? : Partial <FindNearestNeighborsOptions >) => Promise <WithScore <T >[]> |
Defined in
packages/mongodb-rag-core/build/VectorStore.d.ts:4
VerifiedAnswer
Ƭ VerifiedAnswer: z.infer
<typeof VerifiedAnswer
>
Defined in
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:20
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:88
VerifiedAnswerEventData
Ƭ VerifiedAnswerEventData: Pick
<VerifiedAnswer
, "_id"
| "created"
| "updated"
>
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:74
VerifiedAnswerStore
Ƭ VerifiedAnswerStore: VectorStore
<VerifiedAnswer
>
Defined in
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:89
WithFilterAndK
Ƭ WithFilterAndK<T
>: T
& { filter
: Record
<string
, unknown
> ; k
: number
}
Type parameters
Name |
---|
T |
Defined in
packages/mongodb-chatbot-server/src/processors/makeBoostOnAtlasSearchFilter.ts:9
WithScore
Ƭ WithScore<T
>: T
& { score
: number
}
Type parameters
Name |
---|
T |
Defined in
packages/mongodb-rag-core/build/VectorStore.d.ts:11
Variables
CORE_ENV_VARS
• Const
CORE_ENV_VARS: Object
Type declaration
Name | Type |
---|---|
MONGODB_CONNECTION_URI | string |
MONGODB_DATABASE_NAME | string |
NODE_ENV | string |
OPENAI_API_KEY | string |
OPENAI_CHAT_COMPLETION_DEPLOYMENT | string |
OPENAI_CHAT_COMPLETION_MODEL_VERSION | string |
OPENAI_EMBEDDING_DEPLOYMENT | string |
OPENAI_EMBEDDING_MODEL | string |
OPENAI_EMBEDDING_MODEL_VERSION | string |
OPENAI_ENDPOINT | string |
VECTOR_SEARCH_INDEX_NAME | string |
Defined in
packages/mongodb-rag-core/build/CoreEnvVars.d.ts:1
CUSTOM_REQUEST_ORIGIN_HEADER
• Const
CUSTOM_REQUEST_ORIGIN_HEADER: "X-Request-Origin"
Defined in
packages/mongodb-chatbot-server/src/middleware/requireRequestOrigin.ts:4
DEFAULT_API_PREFIX
• Const
DEFAULT_API_PREFIX: "/api/v1"
Defined in
packages/mongodb-chatbot-server/src/app.ts:108
DEFAULT_MAX_REQUEST_TIMEOUT_MS
• Const
DEFAULT_MAX_REQUEST_TIMEOUT_MS: 60000
Defined in
packages/mongodb-chatbot-server/src/app.ts:110
Question
• Const
Question: z.ZodObject
<{ embedding
: z.ZodArray
<z.ZodNumber
, "many"
> ; embedding_model
: z.ZodString
; embedding_model_version
: z.ZodString
; text
: z.ZodString
}, "strip"
, z.ZodTypeAny
, { embedding
: number
[] ; embedding_model
: string
; embedding_model_version
: string
; text
: string
}, { embedding
: number
[] ; embedding_model
: string
; embedding_model_version
: string
; text
: string
}>
Defined in
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:3
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:19
Reference
• Reference: ZodObject
<{ title
: ZodString
; url
: ZodString
}, "strip"
, ZodTypeAny
, { title
: string
; url
: string
}, { title
: string
; url
: string
}>
Defined in
packages/mongodb-rag-core/build/services/conversations.d.ts:8
packages/mongodb-rag-core/build/services/conversations.d.ts:9
References
• References: ZodArray
<ZodObject
<{ title
: ZodString
; url
: ZodString
}, "strip"
, ZodTypeAny
, { title
: string
; url
: string
}, { title
: string
; url
: string
}>, "many"
>
Defined in
packages/mongodb-rag-core/build/services/conversations.d.ts:19
packages/mongodb-rag-core/build/services/conversations.d.ts:20
SomeExpressRequest
• Const
SomeExpressRequest: ZodObject
<{ body
: ZodOptional
<ZodObject
<, "strip"
, ZodTypeAny
, , >> ; headers
: ZodOptional
<ZodObject
<, "strip"
, ZodTypeAny
, , >> ; params
: ZodOptional
<ZodObject
<, "strip"
, ZodTypeAny
, , >> ; query
: ZodOptional
<ZodObject
<, "strip"
, ZodTypeAny
, , >> }, "strip"
, ZodTypeAny
, { body?
: {} ; headers?
: {} ; params?
: {} ; query?
: {} }, { body?
: {} ; headers?
: {} ; params?
: {} ; query?
: {} }>
Defined in
packages/mongodb-chatbot-server/src/middleware/validateRequestSchema.ts:6
VerifiedAnswer
• Const
VerifiedAnswer: z.ZodObject
<{ _id
: z.ZodString
; answer
: z.ZodString
; author_email
: z.ZodString
; created
: z.ZodDate
; hidden
: z.ZodOptional
<z.ZodBoolean
> ; question
: z.ZodObject
<{ embedding
: z.ZodArray
<z.ZodNumber
, "many"
> ; embedding_model
: z.ZodString
; embedding_model_version
: z.ZodString
; text
: z.ZodString
}, "strip"
, z.ZodTypeAny
, { embedding
: number
[] ; embedding_model
: string
; embedding_model_version
: string
; text
: string
}, { embedding
: number
[] ; embedding_model
: string
; embedding_model_version
: string
; text
: string
}> ; references
: z.ZodArray
<z.ZodObject
<{ title
: z.ZodString
; url
: z.ZodString
}, "strip"
, z.ZodTypeAny
, { title
: string
; url
: string
}, { title
: string
; url
: string
}>, "many"
> ; updated
: z.ZodOptional
<z.ZodDate
> }, "strip"
, z.ZodTypeAny
, { _id
: string
; answer
: string
; author_email
: string
; created
: Date
; hidden?
: boolean
; question
: { embedding
: number
[] ; embedding_model
: string
; embedding_model_version
: string
; text
: string
} ; references
: { title
: string
; url
: string
}[] ; updated?
: Date
}, { _id
: string
; answer
: string
; author_email
: string
; created
: Date
; hidden?
: boolean
; question
: { embedding
: number
[] ; embedding_model
: string
; embedding_model_version
: string
; text
: string
} ; references
: { title
: string
; url
: string
}[] ; updated?
: Date
}>
Defined in
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:20
packages/mongodb-rag-core/build/VerifiedAnswer.d.ts:88
defaultConversationConstants
• Const
defaultConversationConstants: ConversationConstants
Defined in
packages/mongodb-chatbot-server/src/services/ConversationsService.ts:277
logger
• Const
logger: Logger
Defined in
packages/mongodb-rag-core/build/services/logger.d.ts:13
pageFormats
• Const
pageFormats: ("txt"
| "md"
| "mdx"
| "restructuredtext"
| "csv"
| "json"
| "yaml"
| "toml"
| "xml"
| "openapi-yaml"
| "openapi-json"
| "graphql"
| "c"
| "cpp"
| "csharp"
| "go"
| "html"
| "java"
| "javascript"
| "kotlin"
| "latex"
| "objective-c"
| "php"
| "python"
| "ruby"
| "rust"
| "scala"
| "shell"
| "swift"
| "typescript"
)[]
The list of canonical file formats that we support for pages.
Defined in
packages/mongodb-rag-core/build/PageFormat.d.ts:4
rateLimitResponse
• Const
rateLimitResponse: Object
Type declaration
Name | Type |
---|---|
error | string |
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:194
Functions
asPageFormat
▸ asPageFormat(str
): undefined
| "txt"
| "md"
| "mdx"
| "restructuredtext"
| "csv"
| "json"
| "yaml"
| "toml"
| "xml"
| "openapi-yaml"
| "openapi-json"
| "graphql"
| "c"
| "cpp"
| "csharp"
| "go"
| "html"
| "java"
| "javascript"
| "kotlin"
| "latex"
| "objective-c"
| "php"
| "python"
| "ruby"
| "rust"
| "scala"
| "shell"
| "swift"
| "typescript"
Maps a string to the canonical page format it represents.
Parameters
Name | Type |
---|---|
str | string |
Returns
undefined
| "txt"
| "md"
| "mdx"
| "restructuredtext"
| "csv"
| "json"
| "yaml"
| "toml"
| "xml"
| "openapi-yaml"
| "openapi-json"
| "graphql"
| "c"
| "cpp"
| "csharp"
| "go"
| "html"
| "java"
| "javascript"
| "kotlin"
| "latex"
| "objective-c"
| "php"
| "python"
| "ruby"
| "rust"
| "scala"
| "shell"
| "swift"
| "typescript"
The canonical page format, or undefined if the string is not a recognized page format.
Defined in
packages/mongodb-rag-core/build/PageFormat.d.ts:11
assertEnvVars
▸ assertEnvVars<T
>(ENV_VARS
): T
Type parameters
Name | Type |
---|---|
T | extends Record <string , string > |
Parameters
Name | Type |
---|---|
ENV_VARS | T |
Returns
T
Defined in
packages/mongodb-rag-core/build/assertEnvVars.d.ts:1
createLoggerMessage
▸ createLoggerMessage(«destructured»
): Object
Parameters
Name | Type |
---|---|
«destructured» | CreateMessageParams |
Returns
Object
Name | Type |
---|---|
ipAddress | undefined | string |
message | string |
requestBody | unknown |
requestId | undefined | string |
Defined in
packages/mongodb-rag-core/build/services/logger.d.ts:7
createMessage
▸ createMessage(messageParams
): { content
: string
; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; id
: ObjectId
; metadata?
: Record
<string
, unknown
> ; role
: "system"
} | { content
: string
; contentForLlm?
: string
; contextContent?
: Partial
<WithScore
<EmbeddedContent
>>[] ; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; embedding?
: number
[] ; id
: ObjectId
; metadata?
: Record
<string
, unknown
> ; preprocessedContent?
: string
; rejectQuery?
: boolean
; role
: "user"
} | { content
: string
; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; id
: ObjectId
; metadata?
: Record
<string
, unknown
> ; name
: string
; role
: "function"
} | { content
: string
; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; functionCall?
: FunctionCall
; id
: ObjectId
; metadata?
: Record
<string
, unknown
> & AssistantMessageMetadata
; rating?
: boolean
; references?
: { title
: string
; url
: string
}[] ; role
: "assistant"
; userComment?
: string
}
Parameters
Name | Type |
---|---|
messageParams | AddSomeMessageParams |
Returns
{ content
: string
; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; id
: ObjectId
; metadata?
: Record
<string
, unknown
> ; role
: "system"
} | { content
: string
; contentForLlm?
: string
; contextContent?
: Partial
<WithScore
<EmbeddedContent
>>[] ; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; embedding?
: number
[] ; id
: ObjectId
; metadata?
: Record
<string
, unknown
> ; preprocessedContent?
: string
; rejectQuery?
: boolean
; role
: "user"
} | { content
: string
; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; id
: ObjectId
; metadata?
: Record
<string
, unknown
> ; name
: string
; role
: "function"
} | { content
: string
; createdAt
: Date
; customData?
: Record
<string
, unknown
> ; functionCall?
: FunctionCall
; id
: ObjectId
; metadata?
: Record
<string
, unknown
> & AssistantMessageMetadata
; rating?
: boolean
; references?
: { title
: string
; url
: string
}[] ; role
: "assistant"
; userComment?
: string
}
Defined in
packages/mongodb-chatbot-server/src/services/mongodbConversations.ts:165
createMessageFromOpenAIChatMessage
▸ createMessageFromOpenAIChatMessage(chatMessage
): Message
Create a Message object from the OpenAiChatMessage object.
Parameters
Name | Type |
---|---|
chatMessage | AddSomeMessageParams |
Returns
Defined in
packages/mongodb-chatbot-server/src/services/mongodbConversations.ts:183
errorHandler
▸ errorHandler(err
, req
, res
, next
): void
General error handler. Called at usage of next()
in routes.
Parameters
Name | Type |
---|---|
err | any |
req | Request <ParamsDictionary , any , any , ParsedQs , Record <string , any >> |
res | Response <any , Record <string , any >, number > |
next | NextFunction |
Returns
void
Defined in
node_modules/@types/express-serve-static-core/index.d.ts:73
escapeNewlines
▸ escapeNewlines(str
): string
Parameters
Name | Type |
---|---|
str | string |
Returns
string
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:5
extractFrontMatter
▸ extractFrontMatter<T
>(text
, language?
, delimiter?
): Object
This function extracts frontmatter from a string. The generic type does not validate that the frontmatter conforms to the type. It just provides the type for developer convenience.
Type parameters
Name | Type |
---|---|
T | extends Record <string , unknown > |
Parameters
Name | Type |
---|---|
text | string |
language? | string |
delimiter? | string |
Returns
Object
Name | Type |
---|---|
body | string |
metadata? | T |
Defined in
packages/mongodb-rag-core/build/extractFrontMatter.d.ts:7
filterDefined
▸ filterDefined<T
>(array
): Exclude
<T
, undefined
>[]
Given an array of possibly undefined T, return those that are defined.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
array | T [] |
Returns
Exclude
<T
, undefined
>[]
Defined in
packages/mongodb-rag-core/build/arrayFilters.d.ts:8
filterFulfilled
▸ filterFulfilled<T
>(array
): PromiseFulfilledResult
<T
>[]
Given an array of PromiseSettledResults, return those that are fulfilled as PromiseFulfilledResults.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
array | PromiseSettledResult <T >[] |
Returns
PromiseFulfilledResult
<T
>[]
Defined in
packages/mongodb-rag-core/build/arrayFilters.d.ts:4
filterOnlySystemPrompt
▸ filterOnlySystemPrompt(conversation
): Promise
<Message
[]>
Only include the initial system prompt.
Parameters
Name | Type |
---|---|
conversation | Conversation <ConversationCustomData > |
Returns
Promise
<Message
[]>
Defined in
packages/mongodb-chatbot-server/src/processors/FilterPreviousMessages.ts:9
includeChunksForMaxTokensPossible
▸ includeChunksForMaxTokensPossible(«destructured»
): EmbeddedContent
[]
This function returns the chunks that can fit in the maxTokens. It limits the number of tokens that are sent to the LLM.
Parameters
Name | Type |
---|---|
«destructured» | Object |
› content | EmbeddedContent [] |
› maxTokens | number |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeRagGenerateUserPrompt.ts:202
isPageFormat
▸ isPageFormat(str
): str is "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"
Type guard to check if a string is a canonical page format.
Parameters
Name | Type |
---|---|
str | string |
Returns
str is "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript"
Defined in
packages/mongodb-rag-core/build/PageFormat.d.ts:19
makeApp
▸ makeApp(config
): Promise
<Express
>
Constructor function to make the Express.js app.
Parameters
Name | Type |
---|---|
config | AppConfig |
Returns
Promise
<Express
>
Defined in
packages/mongodb-chatbot-server/src/app.ts:115
makeBoostOnAtlasSearchFilter
▸ makeBoostOnAtlasSearchFilter(«destructured»
): SearchBooster
Boost certain results in search results from Atlas Search.
Parameters
Name | Type |
---|---|
«destructured» | MakeBoostOnAtlasSearchFilterArgs |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeBoostOnAtlasSearchFilter.ts:37
makeConversationsRouter
▸ makeConversationsRouter(«destructured»
): Router
Constructor function to make the /conversations/* Express.js router.
Parameters
Name | Type |
---|---|
«destructured» | ConversationsRouterParams |
Returns
Router
Defined in
packages/mongodb-chatbot-server/src/routes/conversations/conversationsRouter.ts:217
makeDataStreamer
▸ makeDataStreamer(): DataStreamer
Create a DataStreamer that streams data to the client.
Returns
Defined in
packages/mongodb-chatbot-server/src/services/dataStreamer.ts:116
makeDefaultFindContent
▸ makeDefaultFindContent(«destructured»
): FindContentFunc
Basic implementation of FindContentFunc with search boosters.
Parameters
Name | Type |
---|---|
«destructured» | MakeDefaultFindContentFuncArgs |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeDefaultFindContent.ts:19
makeDefaultFindVerifiedAnswer
▸ makeDefaultFindVerifiedAnswer(«destructured»
): FindVerifiedAnswerFunc
Basic implementation of FindVerifiedAnswerFunc.
Parameters
Name | Type |
---|---|
«destructured» | MakeDefaultFindVerifiedAnswerFuncArgs |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeDefaultFindVerifiedAnswer.ts:17
makeDefaultReferenceLinks
▸ makeDefaultReferenceLinks(chunks
): { title
: string
; url
: string
}[]
The default reference format returns the following for chunks from unique pages:
{
title: chunk.metadata.pageTitle ?? chunk.url, // if title doesn't exist, just put url
url: chunk.url // this always exists
}
Parameters
Name | Type |
---|---|
chunks | EmbeddedContent [] |
Returns
{ title
: string
; url
: string
}[]
Defined in
packages/mongodb-chatbot-server/src/processors/MakeReferenceLinksFunc.ts:6
makeFilterNPreviousMessages
▸ makeFilterNPreviousMessages(n
): FilterPreviousMessages
Creates a filter that only includes the previous n messages in the conversations. The first message in the conversation must be the system prompt.
Parameters
Name | Type | Description |
---|---|---|
n | number | Number of previous messages to include. |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeFilterNPreviousMessages.ts:8
makeHandleTimeoutMiddleware
▸ makeHandleTimeoutMiddleware(apiTimeout
): (req
: Request
<ParamsDictionary
, any
, any
, ParsedQs
, Record
<string
, any
>>, res
: Response
<any
, Record
<string
, any
>>, next
: NextFunction
) => void
Parameters
Name | Type |
---|---|
apiTimeout | number |
Returns
fn
▸ (req
, res
, next
): void
Parameters
Name | Type |
---|---|
req | Request <ParamsDictionary , any , any , ParsedQs , Record <string , any >> |
res | Response <any , Record <string , any >> |
next | NextFunction |
Returns
void
Defined in
packages/mongodb-chatbot-server/src/app.ts:93
makeLangChainEmbedder
▸ makeLangChainEmbedder(«destructured»
): Embedder
Constructor for implementation of the Embedder using a LangChain.js Embeddings
class.
Parameters
Name | Type |
---|---|
«destructured» | MakeLangChainEmbedderParams |
Returns
Defined in
packages/mongodb-rag-core/build/LangChainEmbedder.d.ts:13
makeLangchainChatLlm
▸ makeLangchainChatLlm(«destructured»
): ChatLlm
Use any Langchain JS ChatModel
to talk to an LLM.
Note: This ChatLLM does not currently support tool calling.
Parameters
Name | Type |
---|---|
«destructured» | MakeLangchainChatLlmProps |
Returns
Defined in
packages/mongodb-chatbot-server/src/services/LangchainChatLlm.ts:23
makeMongoDbConversationsService
▸ makeMongoDbConversationsService(database
, conversationConstants?
): ConversationsService
Create ConversationsService that uses MongoDB as a data store.
Parameters
Name | Type | Default value |
---|---|---|
database | Db | undefined |
conversationConstants | ConversationConstants | defaultConversationConstants |
Returns
Defined in
packages/mongodb-chatbot-server/src/services/mongodbConversations.ts:24
makeMongoDbEmbeddedContentStore
▸ makeMongoDbEmbeddedContentStore(«destructured»
): EmbeddedContentStore
& DatabaseConnection
Parameters
Name | Type |
---|---|
«destructured» | MakeMongoDbDatabaseConnectionParams |
Returns
EmbeddedContentStore
& DatabaseConnection
Defined in
packages/mongodb-rag-core/build/MongoDbEmbeddedContentStore.d.ts:4
makeMongoDbPageStore
▸ makeMongoDbPageStore(«destructured»
): MongoDbPageStore
Data store for Page objects using MongoDB.
Parameters
Name | Type |
---|---|
«destructured» | MakeMongoDbDatabaseConnectionParams |
Returns
Defined in
packages/mongodb-rag-core/build/MongoDbPageStore.d.ts:12
makeMongoDbVerifiedAnswerStore
▸ makeMongoDbVerifiedAnswerStore(«destructured»
): VerifiedAnswerStore
& DatabaseConnection
Parameters
Name | Type |
---|---|
«destructured» | MakeMongoDbDatabaseConnectionParams & { collectionName : string } |
Returns
VerifiedAnswerStore
& DatabaseConnection
Defined in
packages/mongodb-rag-core/build/MongoDbVerifiedAnswerStore.d.ts:4
makeOpenAiChatLlm
▸ makeOpenAiChatLlm(«destructured»
): Required
<ChatLlm
>
Construct the ChatLlm service using the OpenAI ChatGPT API.
The ChatLlm
wraps the @azure/openai package.
Parameters
Name | Type |
---|---|
«destructured» | MakeOpenAiChatLlmParams |
Returns
Required
<ChatLlm
>
Defined in
packages/mongodb-chatbot-server/src/services/openAiChatLlm.ts:24
makeOpenAiEmbedder
▸ makeOpenAiEmbedder(«destructured»
): Embedder
Constructor for implementation of the Embedder using OpenAI Embeddings API.
Parameters
Name | Type |
---|---|
«destructured» | MakeOpenAiEmbedderArgs |
Returns
Defined in
packages/mongodb-rag-core/build/OpenAiEmbedder.d.ts:22
makeRagGenerateUserPrompt
▸ makeRagGenerateUserPrompt(«destructured»
): GenerateUserPromptFunc
Construct a GenerateUserPromptFunc function that uses retrieval augmented generation (RAG) to generate the user prompt and return references to use in the answer. The returned RAG user prompt generator performs the following steps:
- Preprocess the user's message using the query preprocessor.
- Find content using vector search.
- Removes any chunks that would exceed the max context tokens.
- Generate the user message using the make user message function.
- Return the user message and references.
Parameters
Name | Type |
---|---|
«destructured» | MakeRagGenerateUserPromptParams |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeRagGenerateUserPrompt.ts:64
makeStaticSite
▸ makeStaticSite(app
): Express
Middleware that serves the static site from the root path
(GET https://my-site.com/
).
Parameters
Name | Type |
---|---|
app | Express |
Returns
Express
Defined in
packages/mongodb-chatbot-server/src/routes/staticSite.ts:8
makeTypeChatJsonTranslateFunc
▸ makeTypeChatJsonTranslateFunc<SchemaType
>(«destructured»
): (prompt
: string
) => Promise
<SchemaType
>
Type parameters
Name | Type |
---|---|
SchemaType | extends object |
Parameters
Name | Type |
---|---|
«destructured» | MakeTypeChatJsonTranslateFuncArgs |
Returns
fn
▸ (prompt
): Promise
<SchemaType
>
Parameters
Name | Type |
---|---|
prompt | string |
Returns
Promise
<SchemaType
>
Defined in
packages/mongodb-rag-core/build/TypeChatJsonTranslateFunc.d.ts:29
makeVerifiedAnswerGenerateUserPrompt
▸ makeVerifiedAnswerGenerateUserPrompt(«destructured»
): GenerateUserPromptFunc
Constructs a GenerateUserPromptFunc that searches for verified answers for the user query. If no verified answer can be found for the given query, the onNoVerifiedAnswerFound GenerateUserPromptFunc is called instead.
Parameters
Name | Type |
---|---|
«destructured» | MakeVerifiedAnswerGenerateUserPromptParams |
Returns
Defined in
packages/mongodb-chatbot-server/src/processors/makeVerifiedAnswerGenerateUserPrompt.ts:21
pageFormat
▸ pageFormat(str
, defaultPageFormat?
): PageFormat
Converts a string to a canonical page format. If the string is not a recognized page format or a synonym for one, this returns a default page format.
Parameters
Name | Type |
---|---|
str | string |
defaultPageFormat? | "txt" | "md" | "mdx" | "restructuredtext" | "csv" | "json" | "yaml" | "toml" | "xml" | "openapi-yaml" | "openapi-json" | "graphql" | "c" | "cpp" | "csharp" | "go" | "html" | "java" | "javascript" | "kotlin" | "latex" | "objective-c" | "php" | "python" | "ruby" | "rust" | "scala" | "shell" | "swift" | "typescript" |
Returns
Defined in
packages/mongodb-rag-core/build/PageFormat.d.ts:25
removeFrontMatter
▸ removeFrontMatter(content
, options?
): string
Parameters
Name | Type |
---|---|
content | string |
options? | FrontMatterOptions |
Returns
string
Defined in
packages/mongodb-rag-core/build/removeFrontMatter.d.ts:2
reqHandler
▸ reqHandler(req
, res
, next
): void
Parameters
Name | Type |
---|---|
req | Request <ParamsDictionary , any , any , ParsedQs , Record <string , any >> |
res | Response <any , Record <string , any >, number > |
next | NextFunction |
Returns
void
Defined in
node_modules/@types/express-serve-static-core/index.d.ts:60
requireRequestOrigin
▸ requireRequestOrigin(): ConversationsMiddleware
Returns
Defined in
packages/mongodb-chatbot-server/src/middleware/requireRequestOrigin.ts:6
requireValidIpAddress
▸ requireValidIpAddress(): ConversationsMiddleware
Returns
Defined in
packages/mongodb-chatbot-server/src/middleware/requireValidIpAddress.ts:5
updateFrontMatter
▸ updateFrontMatter(text
, metadataIn
): string
Parameters
Name | Type |
---|---|
text | string |
metadataIn | Record <string , unknown > |
Returns
string
Defined in
packages/mongodb-rag-core/build/updateFrontMatter.d.ts:1