@mate-academy/llm-gateway 7.0.0 → 7.0.1

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.
@@ -376,6 +376,22 @@ export type LLMAssistanceOptions<Provider extends LLMProviders, Reporter extends
376
376
  export type LLMAssistanceResult = LLMRequestResult<{
377
377
  text: string;
378
378
  }>;
379
+ /**
380
+ * Options for a one-shot prompt in a newly created chat.
381
+ * Combines chat creation options with message sending options.
382
+ * @template Provider - The LLM provider type
383
+ * @template Reporter - Reporter interface type
384
+ */
385
+ export type LLMPromptInNewChatOptions<Provider extends LLMProviders, Reporter extends LLMReporterInterface<any> | undefined> = LLMMethodBaseOptions<Reporter> & {
386
+ model: LLMModel<Provider>;
387
+ message: LLMAssistanceMessage;
388
+ instructions?: string;
389
+ history?: LLMAssistanceMessage[];
390
+ storageId?: string;
391
+ files?: LLMUploadedFile[];
392
+ tools?: LLMToolDefinition[];
393
+ maxToolIterations?: number;
394
+ };
379
395
  export interface LLMToolDefinition<Schema extends LLMSchemaInterface = LLMSchemaInterface> {
380
396
  name: string;
381
397
  description: string;
@@ -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 LLMProviders, LLMPurposes, type LLMUploadFileOptions, type LLMUploadFileResult, type LLMStructuredResult, type LLMUploadedFile } from '../LLMService.typedefs';
1
+ import { type LLMAssistanceOptions, type LLMAssistanceResult, type LLMAssistanceMessage, type LLMToolDefinition, type LLMCreateChatOptions, type LLMCreateChatResult, type LLMCreateFileStorageOptions, type LLMCreateFileStorageResult, type LLMInstanceOptions, type LLMModel, type LLMPromptInNewChatOptions, 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,5 +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
+ promptInNewChat<Schema extends LLMSchemaInterface>(options: LLMPromptInNewChatOptions<Provider, Reporter> & {
25
+ schema: Schema;
26
+ }): Promise<LLMStructuredResult<InferSchema<Schema>>>;
27
+ promptInNewChat(options: LLMPromptInNewChatOptions<Provider, Reporter>): Promise<LLMAssistanceResult>;
24
28
  abstract countTokens(messages: LLMAssistanceMessage[], model: LLMModel<Provider>): Promise<number>;
25
29
  }
@@ -27,6 +27,14 @@ class LLMAssistanceService extends services_1.LLMBaseService {
27
27
  }
28
28
  return this.assistInChatText(options);
29
29
  }
30
+ async promptInNewChat(options) {
31
+ const chatResult = await this.createChat(options);
32
+ if ('error' in chatResult) {
33
+ return chatResult;
34
+ }
35
+ const assistOptions = Object.assign(options, { chatId: chatResult.chatId });
36
+ return this.assistInChat(assistOptions);
37
+ }
30
38
  }
31
39
  exports.LLMAssistanceService = LLMAssistanceService;
32
40
  //# sourceMappingURL=LLMAssistanceService.abstract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LLMAssistanceService.abstract.js","sourceRoot":"","sources":["../../src/services/LLMAssistanceService.abstract.ts"],"names":[],"mappings":";;;AAAA,+DAiB+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;CAeF;AAhHD,oDAgHC"}
1
+ {"version":3,"file":"LLMAssistanceService.abstract.js","sourceRoot":"","sources":["../../src/services/LLMAssistanceService.abstract.ts"],"names":[],"mappings":";;;AAAA,+DAkB+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,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAElD,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CACjC,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAEL,CAAC;QAEpC,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;CAMF;AA3ID,oDA2IC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mate-academy/llm-gateway",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "A gateway package for LLM services.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",