Namespace: Conversations
Interfaces
- CommentMessageParams
- Conversation
- ConversationConstants
- ConversationsService
- FindByIdParams
- RateMessageParams
Type Aliases
AddAssistantMessageParams
Ƭ AddAssistantMessageParams: AddMessageParams
<AssistantMessage
>
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:189
AddConversationMessageParams
Ƭ AddConversationMessageParams: Object
Type declaration
Name | Type |
---|---|
conversationId | ObjectId |
message | AddSomeMessageParams |
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:198
AddFunctionMessageParams
Ƭ AddFunctionMessageParams: AddMessageParams
<WithCustomData
<FunctionMessage
>>
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:185
AddManyConversationMessagesParams
Ƭ AddManyConversationMessagesParams: Object
Type declaration
Name | Type |
---|---|
conversationId | ObjectId |
messages | AddSomeMessageParams [] |
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:203
AddMessageParams
Ƭ AddMessageParams<T
>: Omit
<T
, "createdAt"
> & { id?
: ObjectId
}
Type parameters
Name | Type |
---|---|
T | extends SomeMessage |
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:171
AddSomeMessageParams
Ƭ AddSomeMessageParams: AddSystemMessageParams
| AddUserMessageParams
| AddAssistantMessageParams
| AddFunctionMessageParams
& { id?
: ObjectId
}
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:191
AddSystemMessageParams
Ƭ AddSystemMessageParams: AddMessageParams
<SystemMessage
>
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:179
AddUserMessageParams
Ƭ AddUserMessageParams: AddMessageParams
<WithCustomData
<UserMessage
>>
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:181
AssistantMessage
Ƭ AssistantMessage: MessageBase
& { functionCall?
: OpenAI.ChatCompletionMessage.FunctionCall
; metadata?
: AssistantMessageMetadata
; rating?
: boolean
; references?
: any
[] ; role
: "assistant"
; userComment?
: string
}
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:35
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-rag-core/src/conversations/ConversationsService.ts:62
ConversationCustomData
Ƭ ConversationCustomData: Record
<string
, unknown
> | undefined
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:144
CreateConversationParams
Ƭ CreateConversationParams: Object
Type declaration
Name | Type |
---|---|
customData? | ConversationCustomData |
initialMessages? | SomeMessage [] |
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:166
DbMessage
Ƭ DbMessage<SomeMessage
>: SomeMessage
& { createdAt
: Date
; id
: ObjectId
}
Type parameters
Name |
---|
SomeMessage |
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:127
FunctionMessage
Ƭ FunctionMessage: MessageBase
& { name
: string
; role
: "function"
}
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:77
Message
Ƭ Message: DbMessage
<SomeMessage
>
Message stored in the database.
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:142
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-rag-core/src/conversations/ConversationsService.ts:8
SomeMessage
Ƭ SomeMessage: UserMessage
| AssistantMessage
| SystemMessage
| FunctionMessage
Message in the Conversation.
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:121
SystemMessage
Ƭ SystemMessage: MessageBase
& { role
: "system"
}
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:31
UserMessage
Ƭ UserMessage: MessageBase
& { contentForLlm?
: string
; contextContent?
: Partial
<WithScore
<EmbeddedContent
>>[] ; embedding?
: number
[] ; preprocessedContent?
: string
; rejectQuery?
: boolean
; role
: "user"
}
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:82
VerifiedAnswerEventData
Ƭ VerifiedAnswerEventData: Pick
<VerifiedAnswer
, "_id"
| "created"
| "updated"
>
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:72
Variables
defaultConversationConstants
• Const
defaultConversationConstants: ConversationConstants
Defined in
packages/mongodb-rag-core/src/conversations/ConversationsService.ts:280
Functions
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?
: { metadata?
: objectOutputType
<{ sourceName
: ZodOptional
<ZodString
> ; sourceType
: ZodOptional
<ZodString
> ; tags
: ZodOptional
<ZodArray
<ZodString
, "many"
>> }, ZodTypeAny
, "passthrough"
> ; 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?
: { metadata?
: objectOutputType
<{ sourceName
: ZodOptional
<ZodString
> ; sourceType
: ZodOptional
<ZodString
> ; tags
: ZodOptional
<ZodArray
<ZodString
, "many"
>> }, ZodTypeAny
, "passthrough"
> ; title
: string
; url
: string
}[] ; role
: "assistant"
; userComment?
: string
}
Defined in
packages/mongodb-rag-core/src/conversations/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-rag-core/src/conversations/MongoDbConversations.ts:183
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-rag-core/src/conversations/MongoDbConversations.ts:24