@fr-data-fabric/chatbot-api-nest 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain/use-cases/chats/GetChatCompletionUC.d.ts +8 -1
- package/dist/domain/use-cases/chats/GetChatCompletionUC.js +2 -1
- package/dist/domain/use-cases/chats/GetChatCompletionUC.js.map +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/domain/use-cases/chats/GetChatCompletionUC.ts +20 -1
- package/src/index.ts +36 -0
|
@@ -23,6 +23,13 @@ export declare abstract class GetChatCompletionUC<AvailableTools extends Availab
|
|
|
23
23
|
abstract getLLM(options: {
|
|
24
24
|
model?: string;
|
|
25
25
|
}): BaseChatModel;
|
|
26
|
-
abstract getPrompt(question: string,
|
|
26
|
+
abstract getPrompt(question: string, contextDocuments: {
|
|
27
|
+
content: string;
|
|
28
|
+
id: string;
|
|
29
|
+
}[], documents: DocumentEntity[]): Promise<BaseMessage[]>;
|
|
30
|
+
abstract getContextDocuments(question: string, conversation: ConversationEntity, currentUser: UserEntity): Promise<{
|
|
31
|
+
content: string;
|
|
32
|
+
id: string;
|
|
33
|
+
}[]>;
|
|
27
34
|
execute(input: GetChatCompletionInput<AvailableTools>): Observable<StreamEvents<AvailableTools>>;
|
|
28
35
|
}
|
|
@@ -24,7 +24,8 @@ class GetChatCompletionUC {
|
|
|
24
24
|
tools: input.tools ? this.getTools(toolOptions, input.tools) : [],
|
|
25
25
|
});
|
|
26
26
|
void (async () => {
|
|
27
|
-
const
|
|
27
|
+
const contextDocuments = await this.getContextDocuments(input.message, input.conversation, input.currentUser);
|
|
28
|
+
const prompt = await this.getPrompt(input.message, contextDocuments, input.documents);
|
|
28
29
|
const eventStream = agent.streamEvents({ messages: prompt }, { streamMode: 'messages', configurable: { runId: input.runId } });
|
|
29
30
|
let lastToolId = undefined;
|
|
30
31
|
for await (const event of eventStream) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetChatCompletionUC.js","sourceRoot":"/","sources":["domain/use-cases/chats/GetChatCompletionUC.ts"],"names":[],"mappings":";;;AAUA,yCAMmB;AACnB,+BAAkC;AAalC,MAAsB,mBAAmB;
|
|
1
|
+
{"version":3,"file":"GetChatCompletionUC.js","sourceRoot":"/","sources":["domain/use-cases/chats/GetChatCompletionUC.ts"],"names":[],"mappings":";;;AAUA,yCAMmB;AACnB,+BAAkC;AAalC,MAAsB,mBAAmB;IAwBvC,OAAO,CAAC,KAA6C;QACnD,OAAO,IAAI,iBAAU,CAA+B,CAAC,QAAQ,EAAE,EAAE;YAC/D,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;gBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB,CAAC,CAAC;YAEH,IAAI,WAAW,GAAG,CAAC,CAAC;YACpB,MAAM,WAAW,GAAgB;gBAC/B,cAAc;oBACZ,OAAO,EAAE,WAAW,CAAC;gBACvB,CAAC;gBACD,UAAU,CAAC,OAAO;oBAChB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;gBACnD,CAAC;gBACD,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC;YAEF,MAAM,KAAK,GAAG,IAAA,uBAAW,EAAC;gBACxB,KAAK;gBACL,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;aAClE,CAAC,CAAC;YAEH,KAAK,CAAC,KAAK,IAAI,EAAE;gBACf,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CACrD,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,WA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,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC;4BACnC,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;4BAChD,IAAI,aAAa,CAAC,IAAI,IAAI,aAAa,CAAC,EAAE,EAAE,CAAC;gCAC3C,UAAU,GAAG,aAAa,CAAC,EAAE,CAAC;gCAC9B,QAAQ,CAAC,IAAI,CAAC;oCACZ,KAAK,EAAE,mBAAmB;oCAC1B,IAAI,EAAE,aAAa,CAAC,IAAiC;oCACrD,EAAE,EAAE,aAAa,CAAC,EAAE;iCACrB,CAAC,CAAC;4BACL,CAAC;iCAAM,IAAI,UAAU,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;gCAC5C,QAAQ,CAAC,IAAI,CAAC;oCACZ,KAAK,EAAE,aAAa;oCACpB,EAAE,EAAE,UAAU;oCACd,KAAK,EAAE,aAAa,CAAC,IAAI;iCAC1B,CAAC,CAAC;4BACL,CAAC;wBACH,CAAC;6BAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;4BACzB,QAAQ,CAAC,IAAI,CAAC;gCACZ,KAAK,EAAE,aAAa;gCACpB,OAAO,EAAE,KAAK,CAAC,OAAiB;6BACjC,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;gBACD,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAlHD,kDAkHC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
1
|
export * from './chatbot-api.module';
|
|
2
|
+
export * from './domain/entities/ChatEntity';
|
|
3
|
+
export * from './domain/entities/ChatSourceEntity';
|
|
4
|
+
export * from './domain/entities/ChatTextContentEntity';
|
|
5
|
+
export * from './domain/entities/ConversationEntity';
|
|
6
|
+
export * from './domain/entities/DocumentEntity';
|
|
7
|
+
export * from './domain/entities/ToolUseEntity';
|
|
8
|
+
export * from './domain/entities/UserEntity';
|
|
9
|
+
export * from './domain/interfaces/ChatRepository';
|
|
10
|
+
export * from './domain/interfaces/ConversationRepository';
|
|
11
|
+
export * from './domain/interfaces/LLMService';
|
|
12
|
+
export * from './domain/interfaces/PromptService';
|
|
13
|
+
export * from './domain/use-cases/_common';
|
|
14
|
+
export * from './domain/use-cases/chats/chat.types';
|
|
15
|
+
export * from './domain/use-cases/chats/GetChatCompletionUC';
|
|
16
|
+
export * from './domain/use-cases/chats/SendChatUC';
|
|
17
|
+
export * from './domain/use-cases/conversations/CreateConversationUC';
|
|
18
|
+
export * from './domain/use-cases/conversations/DeleteConversationUC';
|
|
19
|
+
export * from './domain/use-cases/conversations/GenerateConversationTitleUC';
|
|
20
|
+
export * from './domain/use-cases/conversations/GetConversationUC';
|
|
21
|
+
export * from './domain/use-cases/conversations/GetConversationsUC';
|
|
22
|
+
export * from './domain/use-cases/conversations/UpdateConversationUC';
|
|
23
|
+
export * from './inputs/controllers/_common/CurrentUserRest';
|
|
24
|
+
export * from './inputs/resolvers/_common/CurrentUserGql';
|
|
25
|
+
export * from './inputs/resolvers/_common/GqlPaginatedOutput';
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,34 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./chatbot-api.module"), exports);
|
|
18
|
+
// Entities
|
|
19
|
+
__exportStar(require("./domain/entities/ChatEntity"), exports);
|
|
20
|
+
__exportStar(require("./domain/entities/ChatSourceEntity"), exports);
|
|
21
|
+
__exportStar(require("./domain/entities/ChatTextContentEntity"), exports);
|
|
22
|
+
__exportStar(require("./domain/entities/ConversationEntity"), exports);
|
|
23
|
+
__exportStar(require("./domain/entities/DocumentEntity"), exports);
|
|
24
|
+
__exportStar(require("./domain/entities/ToolUseEntity"), exports);
|
|
25
|
+
__exportStar(require("./domain/entities/UserEntity"), exports);
|
|
26
|
+
// Interfaces & DI tokens
|
|
27
|
+
__exportStar(require("./domain/interfaces/ChatRepository"), exports);
|
|
28
|
+
__exportStar(require("./domain/interfaces/ConversationRepository"), exports);
|
|
29
|
+
__exportStar(require("./domain/interfaces/LLMService"), exports);
|
|
30
|
+
__exportStar(require("./domain/interfaces/PromptService"), exports);
|
|
31
|
+
// Use-case common types
|
|
32
|
+
__exportStar(require("./domain/use-cases/_common"), exports);
|
|
33
|
+
// Chat use cases & types
|
|
34
|
+
__exportStar(require("./domain/use-cases/chats/chat.types"), exports);
|
|
35
|
+
__exportStar(require("./domain/use-cases/chats/GetChatCompletionUC"), exports);
|
|
36
|
+
__exportStar(require("./domain/use-cases/chats/SendChatUC"), exports);
|
|
37
|
+
// Conversation use cases
|
|
38
|
+
__exportStar(require("./domain/use-cases/conversations/CreateConversationUC"), exports);
|
|
39
|
+
__exportStar(require("./domain/use-cases/conversations/DeleteConversationUC"), exports);
|
|
40
|
+
__exportStar(require("./domain/use-cases/conversations/GenerateConversationTitleUC"), exports);
|
|
41
|
+
__exportStar(require("./domain/use-cases/conversations/GetConversationUC"), exports);
|
|
42
|
+
__exportStar(require("./domain/use-cases/conversations/GetConversationsUC"), exports);
|
|
43
|
+
__exportStar(require("./domain/use-cases/conversations/UpdateConversationUC"), exports);
|
|
44
|
+
// Input helpers (decorators & GQL utilities)
|
|
45
|
+
__exportStar(require("./inputs/controllers/_common/CurrentUserRest"), exports);
|
|
46
|
+
__exportStar(require("./inputs/resolvers/_common/CurrentUserGql"), exports);
|
|
47
|
+
__exportStar(require("./inputs/resolvers/_common/GqlPaginatedOutput"), exports);
|
|
18
48
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AAErC,WAAW;AACX,+DAA6C;AAC7C,qEAAmD;AACnD,0EAAwD;AACxD,uEAAqD;AACrD,mEAAiD;AACjD,kEAAgD;AAChD,+DAA6C;AAE7C,yBAAyB;AACzB,qEAAmD;AACnD,6EAA2D;AAC3D,iEAA+C;AAC/C,oEAAkD;AAElD,wBAAwB;AACxB,6DAA2C;AAE3C,yBAAyB;AACzB,sEAAoD;AACpD,+EAA6D;AAC7D,sEAAoD;AAEpD,yBAAyB;AACzB,wFAAsE;AACtE,wFAAsE;AACtE,+FAA6E;AAC7E,qFAAmE;AACnE,sFAAoE;AACpE,wFAAsE;AAEtE,6CAA6C;AAC7C,+EAA6D;AAC7D,4EAA0D;AAC1D,gFAA8D"}
|