@mate-academy/llm-gateway 7.0.1 → 7.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.
|
@@ -382,13 +382,8 @@ export type LLMAssistanceResult = LLMRequestResult<{
|
|
|
382
382
|
* @template Provider - The LLM provider type
|
|
383
383
|
* @template Reporter - Reporter interface type
|
|
384
384
|
*/
|
|
385
|
-
export type
|
|
386
|
-
|
|
387
|
-
message: LLMAssistanceMessage;
|
|
388
|
-
instructions?: string;
|
|
389
|
-
history?: LLMAssistanceMessage[];
|
|
390
|
-
storageId?: string;
|
|
391
|
-
files?: LLMUploadedFile[];
|
|
385
|
+
export type LLMAssistInNewChatOptions<Provider extends LLMProviders, Reporter extends LLMReporterInterface<any> | undefined> = LLMCreateChatOptions<Provider, Reporter> & {
|
|
386
|
+
prompt: string;
|
|
392
387
|
tools?: LLMToolDefinition[];
|
|
393
388
|
maxToolIterations?: number;
|
|
394
389
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LLMAssistanceOptions, type LLMAssistanceResult, type LLMAssistanceMessage, type LLMToolDefinition, type LLMCreateChatOptions, type LLMCreateChatResult, type LLMCreateFileStorageOptions, type LLMCreateFileStorageResult, type LLMInstanceOptions, type LLMModel, type
|
|
1
|
+
import { type LLMAssistInNewChatOptions, type LLMAssistanceOptions, type LLMAssistanceResult, type LLMAssistanceMessage, type LLMToolDefinition, type LLMCreateChatOptions, type LLMCreateChatResult, type LLMCreateFileStorageOptions, type LLMCreateFileStorageResult, type LLMInstanceOptions, type LLMModel, type LLMProviders, LLMPurposes, type LLMUploadFileOptions, type LLMUploadFileResult, type LLMStructuredResult, type LLMUploadedFile } from '../LLMService.typedefs';
|
|
2
2
|
import { type LLMLoggerInterface } from '../utilities/logger';
|
|
3
3
|
import { type LLMReporterInterface } from '../utilities/reporter';
|
|
4
4
|
import { LLMBaseService } from '../services';
|
|
@@ -21,9 +21,9 @@ export declare abstract class LLMAssistanceService<Provider extends LLMProviders
|
|
|
21
21
|
protected abstract assistInChatStructured(options: LLMAssistanceOptions<Provider, Reporter> & {
|
|
22
22
|
schema: LLMSchemaInterface;
|
|
23
23
|
}): Promise<LLMStructuredResult>;
|
|
24
|
-
|
|
24
|
+
assistInNewChat<Schema extends LLMSchemaInterface>(options: LLMAssistInNewChatOptions<Provider, Reporter> & {
|
|
25
25
|
schema: Schema;
|
|
26
26
|
}): Promise<LLMStructuredResult<InferSchema<Schema>>>;
|
|
27
|
-
|
|
27
|
+
assistInNewChat(options: LLMAssistInNewChatOptions<Provider, Reporter>): Promise<LLMAssistanceResult>;
|
|
28
28
|
abstract countTokens(messages: LLMAssistanceMessage[], model: LLMModel<Provider>): Promise<number>;
|
|
29
29
|
}
|
|
@@ -27,13 +27,24 @@ class LLMAssistanceService extends services_1.LLMBaseService {
|
|
|
27
27
|
}
|
|
28
28
|
return this.assistInChatText(options);
|
|
29
29
|
}
|
|
30
|
-
async
|
|
30
|
+
async assistInNewChat(options) {
|
|
31
31
|
const chatResult = await this.createChat(options);
|
|
32
32
|
if ('error' in chatResult) {
|
|
33
33
|
return chatResult;
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
|
|
35
|
+
const message = {
|
|
36
|
+
role: LLMService_typedefs_1.LLMRoles.User,
|
|
37
|
+
content: [{
|
|
38
|
+
type: LLMService_typedefs_1.LLMMessageContentType.TEXT,
|
|
39
|
+
text: options.prompt,
|
|
40
|
+
}],
|
|
41
|
+
};
|
|
42
|
+
// @ts-expect-error conditional Reporter type prevents direct assignment
|
|
43
|
+
return this.assistInChat({
|
|
44
|
+
...options,
|
|
45
|
+
chatId: chatResult.chatId,
|
|
46
|
+
message,
|
|
47
|
+
});
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
exports.LLMAssistanceService = LLMAssistanceService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LLMAssistanceService.abstract.js","sourceRoot":"","sources":["../../src/services/LLMAssistanceService.abstract.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"LLMAssistanceService.abstract.js","sourceRoot":"","sources":["../../src/services/LLMAssistanceService.abstract.ts"],"names":[],"mappings":";;;AAAA,+DAoB+B;AAG/B,yCAA4C;AAG5C,MAAsB,oBAGpB,SAAQ,yBAIP;IACD,YACE,QAAkB,EAClB,MAAsC,EACtC,QAAkB,EAClB,OAAsC;QAEtC,KAAK,CACH,QAAQ,EACR,mBAAmB,EACnB,iCAAW,CAAC,UAAU,EACtB,MAAM,EACN,QAAQ,EACR,OAAO,CACR,CAAC;IACJ,CAAC;IAES,uBAAuB,CAC/B,KAA0B;QAE1B,MAAM,WAAW,GAAG,kBAAkB,CAAC;QACvC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,KAAK,CACb,sBAAsB,IAAI,CAAC,IAAI,IAAI;sBACjC,4BAA4B,CAC/B,CAAC;YACJ,CAAC;YAED,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,KAAK,CACb,wBAAwB,IAAI,CAAC,IAAI,GAAG,CACrC,CAAC;YACJ,CAAC;YAED,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAuCD,YAAY,CACV,OACmC;QAEnC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,sBAAsB,CAChC,OACkC,CACnC,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAoBD,KAAK,CAAC,eAAe,CACnB,OACmC;QAEnC,MAAM,UAA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