@mate-academy/llm-gateway 1.2.0 → 1.2.1-canary.0
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/LLMService.typedefs.d.ts +5 -5
- package/dist/LLMService.typedefs.js +1 -1
- package/dist/LLMService.typedefs.js.map +1 -1
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js +1 -1
- package/dist/providers/OpenAI/services/OpenAIAssistance.service.js.map +1 -1
- package/package.json +9 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Logger } from '@mate-academy/core';
|
|
2
2
|
import { type ClientOptions, type OpenAI } from 'openai';
|
|
3
|
-
import { type GoogleGenAI } from '@google/genai';
|
|
3
|
+
import { type GoogleGenAIOptions, type GoogleGenAI } from '@google/genai';
|
|
4
4
|
import { type OpenAIModelNames } from './providers/OpenAI/OpenAI.typedefs';
|
|
5
5
|
import { type GoogleGenerativeAIModelNames } from './providers/GoogleGenerativeAI/GoogleGenerativeAI.typedefs';
|
|
6
6
|
import { type LLMCompletionService } from './services/LLMCompletionService.abstract';
|
|
@@ -24,9 +24,7 @@ export type LLMInstances = {
|
|
|
24
24
|
*/
|
|
25
25
|
export type LLMInstanceOptions = {
|
|
26
26
|
[LLMProviders.OpenAI]: ClientOptions;
|
|
27
|
-
[LLMProviders.GoogleGenerativeAI]:
|
|
28
|
-
apiKey: string;
|
|
29
|
-
};
|
|
27
|
+
[LLMProviders.GoogleGenerativeAI]: GoogleGenAIOptions;
|
|
30
28
|
};
|
|
31
29
|
/**
|
|
32
30
|
* Supported service purposes/types that the LLM gateway provides.
|
|
@@ -167,7 +165,9 @@ export interface LLMSendMessageOptions<Provider extends LLMProviders> {
|
|
|
167
165
|
*/
|
|
168
166
|
export declare enum LLMUploadFileMimeTypes {
|
|
169
167
|
PNG = "image/png",
|
|
170
|
-
PLAIN_TEXT = "text/plain"
|
|
168
|
+
PLAIN_TEXT = "text/plain",
|
|
169
|
+
AUDIO_MP3 = "audio/mp3",
|
|
170
|
+
AUDIO_WAV = "audio/wav"
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Represents a file to be uploaded to an LLM service.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var LLMProviders,LLMPurposes,LLMRoles,LLMMessageContentType,LLMUploadFileMimeTypes;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LLMUploadFileMimeTypes=exports.LLMMessageContentType=exports.LLMRoles=exports.LLMPurposes=exports.LLMProviders=void 0,function(e){e.OpenAI="OpenAI",e.GoogleGenerativeAI="GoogleGenerativeAI"}(LLMProviders||(exports.LLMProviders=LLMProviders={})),function(e){e.Completion="completion",e.Assistance="assistance"}(LLMPurposes||(exports.LLMPurposes=LLMPurposes={})),function(e){e.User="user",e.Assistant="assistant"}(LLMRoles||(exports.LLMRoles=LLMRoles={})),function(e){e.TEXT="text",e.IMAGE_URL="image_url"}(LLMMessageContentType||(exports.LLMMessageContentType=LLMMessageContentType={})),function(e){e.PNG="image/png",e.PLAIN_TEXT="text/plain"}(LLMUploadFileMimeTypes||(exports.LLMUploadFileMimeTypes=LLMUploadFileMimeTypes={}));
|
|
1
|
+
"use strict";var LLMProviders,LLMPurposes,LLMRoles,LLMMessageContentType,LLMUploadFileMimeTypes;Object.defineProperty(exports,"__esModule",{value:!0}),exports.LLMUploadFileMimeTypes=exports.LLMMessageContentType=exports.LLMRoles=exports.LLMPurposes=exports.LLMProviders=void 0,function(e){e.OpenAI="OpenAI",e.GoogleGenerativeAI="GoogleGenerativeAI"}(LLMProviders||(exports.LLMProviders=LLMProviders={})),function(e){e.Completion="completion",e.Assistance="assistance"}(LLMPurposes||(exports.LLMPurposes=LLMPurposes={})),function(e){e.User="user",e.Assistant="assistant"}(LLMRoles||(exports.LLMRoles=LLMRoles={})),function(e){e.TEXT="text",e.IMAGE_URL="image_url"}(LLMMessageContentType||(exports.LLMMessageContentType=LLMMessageContentType={})),function(e){e.PNG="image/png",e.PLAIN_TEXT="text/plain",e.AUDIO_MP3="audio/mp3",e.AUDIO_WAV="audio/wav"}(LLMUploadFileMimeTypes||(exports.LLMUploadFileMimeTypes=LLMUploadFileMimeTypes={}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LLMService.typedefs.js","sourceRoot":"","sources":["../src/LLMService.typedefs.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,yDAAyC,CAAA;AAC3C,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAkBD;;GAEG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;AAC3B,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAqFD;;GAEG;AACH,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,mCAAuB,CAAA;AACzB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,gDAAuB,CAAA;AACzB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AA+DD;;GAEG;AACH,IAAY,
|
|
1
|
+
{"version":3,"file":"LLMService.typedefs.js","sourceRoot":"","sources":["../src/LLMService.typedefs.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACH,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,yDAAyC,CAAA;AAC3C,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAkBD;;GAEG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,wCAAyB,CAAA;AAC3B,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAqFD;;GAEG;AACH,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,mCAAuB,CAAA;AACzB,CAAC,EAHW,QAAQ,wBAAR,QAAQ,QAGnB;AAED;;GAEG;AACH,IAAY,qBAGX;AAHD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,gDAAuB,CAAA;AACzB,CAAC,EAHW,qBAAqB,qCAArB,qBAAqB,QAGhC;AA+DD;;GAEG;AACH,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,mDAAyB,CAAA;IACzB,iDAAuB,CAAA;IACvB,iDAAuB,CAAA;AACzB,CAAC,EALW,sBAAsB,sCAAtB,sBAAsB,QAKjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OpenAIAssistanceService=void 0;const fs_1=require("fs"),openai_1=require("openai"),LLMService_typedefs_1=require("../../../LLMService.typedefs"),services_1=require("../../../services"),OpenAI_typedefs_1=require("../../../providers/OpenAI/OpenAI.typedefs");class OpenAIAssistanceService extends services_1.LLMAssistanceService{#e=null;uploadedFiles=new Map;constructor(e,t){super(LLMService_typedefs_1.LLMProviders.OpenAI,e,t)}get instance(){return this.#e||(this.#e=new openai_1.OpenAI(this.options)),this.#e}async uploadFile(e){try{const{path:t}=e,s=this.uploadedFiles.get(t);if(s){if((await this.instance.files.retrieve(s)).id)return{...e,fileId:s}}const r=(0,fs_1.createReadStream)(t),i=await this.instance.files.create({purpose:"assistants",file:r});return await this.instance.files.waitForProcessing(i.id),this.uploadedFiles.set(t,i.id),{...e,fileId:i.id}}catch(t){return this.logger.child("uploadFile").error("Error uploading file",{error:t,file:e}),{error:t}}}async deleteFile(e){await this.instance.files.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.OpenAIAssistanceService=void 0;const fs_1=require("fs"),openai_1=require("openai"),LLMService_typedefs_1=require("../../../LLMService.typedefs"),services_1=require("../../../services"),OpenAI_typedefs_1=require("../../../providers/OpenAI/OpenAI.typedefs");class OpenAIAssistanceService extends services_1.LLMAssistanceService{#e=null;uploadedFiles=new Map;constructor(e,t){super(LLMService_typedefs_1.LLMProviders.OpenAI,e,t)}get instance(){return this.#e||(this.#e=new openai_1.OpenAI(this.options)),this.#e}async uploadFile(e){try{const{path:t}=e,s=this.uploadedFiles.get(t);if(s){if((await this.instance.files.retrieve(s)).id)return{...e,fileId:s}}const r=(0,fs_1.createReadStream)(t),i=await this.instance.files.create({purpose:"assistants",file:r});return await this.instance.files.waitForProcessing(i.id),this.uploadedFiles.set(t,i.id),{...e,fileId:i.id}}catch(t){return this.logger.child("uploadFile").error("Error uploading file",{error:t,file:e}),{error:t}}}async deleteFile(e){await this.instance.files.delete(e),this.uploadedFiles.delete(e)}async createFileStorage(e){const{uploadedFiles:t}=e;try{const e=await this.instance.vectorStores.create({expires_after:{anchor:"last_active_at",days:1}});return await this.instance.vectorStores.fileBatches.createAndPoll(e.id,{file_ids:t.map((({fileId:e})=>e))}),{storageId:e.id}}catch(e){return this.logger.child("createFileStorage").error("Error creating file storage",{error:e,uploadedFiles:t}),{error:e}}}async deleteFileStorage(e){await this.instance.vectorStores.delete(e)}async createChat(e){try{const{storageId:t}=e,s=t?{tool_resources:{file_search:{vector_store_ids:[t]}}}:{};return{chatId:(await this.instance.beta.threads.create({...s})).id}}catch(t){return this.logger.child("createChat").error("Error creating chat",{error:t,options:e}),{error:t}}}async deleteChat(e){await this.instance.beta.threads.delete(e)}async createAssistant(e){try{const{model:t,instructions:s,storageIds:r}=e,i=r?.length?{tools:[{type:"file_search"}],tool_resources:{file_search:{vector_store_ids:r}}}:{};return{assistantId:(await this.instance.beta.assistants.create({model:t.name,instructions:s,temperature:t.config.temperature,top_p:t.config.top_p,...i})).id}}catch(t){return this.logger.child("createAssistant").error("Error creating assistant",{error:t,options:e}),{error:t}}}async deleteAssistant(e){await this.instance.beta.assistants.delete(e)}async assistInChat(e){try{const{message:t,chatId:s,assistantId:r}=e,i={role:t.role===LLMService_typedefs_1.LLMRoles.User?OpenAI_typedefs_1.OpenAIRoles.User:OpenAI_typedefs_1.OpenAIRoles.Assistant,content:[t.content]};await this.instance.beta.threads.messages.create(s,i);const a=await this.instance.beta.threads.runs.createAndPoll(s,{assistant_id:r}),{status:n}=a;if("completed"!==n)throw new Error(`Thread run did not complete for message, status: ${n}`);const o=(await this.instance.beta.threads.messages.list(s,{run_id:a.id})).data.find((e=>e.role===OpenAI_typedefs_1.OpenAIRoles.Assistant)),c=o?.content.find((e=>"text"===e.type&&"text"in e));return{text:c?.text?.value??""}}catch(t){return this.logger.child("assistInChat").error("Error assisting in chat",{error:t,options:e}),{error:t}}}}exports.OpenAIAssistanceService=OpenAIAssistanceService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAIAssistance.service.js","sourceRoot":"","sources":["../../../../src/providers/OpenAI/services/OpenAIAssistance.service.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AAEtC,mCAAgC;AAChC,+DAc+B;AAC/B,yCAAkD;AAClD,wEAAiE;AAEjE,MAAa,uBACX,SAAQ,+BAAyC;IACjD,SAAS,GAAkB,IAAI,CAAC;IAExB,aAAa,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEvD,YACE,MAAc,EACd,OAAgD;QAEhD,KAAK,CAAC,kCAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,IAAc,QAAQ;QACpB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAmB;QAClC,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YAEtB,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAEnD,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;gBAErE,IAAI,UAAU,CAAC,EAAE,EAAE,CAAC;oBAClB,OAAO;wBACL,GAAG,IAAI;wBACP,MAAM,EAAE,aAAa;qBACtB,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,MAAM,cAAc,GAAG,IAAA,qBAAgB,EAAC,IAAI,CAAC,CAAC;YAE9C,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;gBACpD,OAAO,EAAE,YAAY;gBACrB,IAAI,EAAE,cAAc;aACrB,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAE7D,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;YAE9C,OAAO;gBACL,GAAG,IAAI;gBACP,MAAM,EAAE,YAAY,CAAC,EAAE;aACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM;iBACR,KAAK,CAAC,YAAY,CAAC;iBACnB,KAAK,CAAC,sBAAsB,EAAE;gBAC7B,KAAK;gBACL,IAAI;aACL,CAAC,CAAC;YAEL,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CACd,MAAc;QAEd,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"OpenAIAssistance.service.js","sourceRoot":"","sources":["../../../../src/providers/OpenAI/services/OpenAIAssistance.service.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AAEtC,mCAAgC;AAChC,+DAc+B;AAC/B,yCAAk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ACL,OAAO;aACR,CAAC,CAAC;YAEL,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AA1RD,0DA0RC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mate-academy/llm-gateway",
|
|
3
|
-
"version": "1.2.0",
|
|
3
|
+
"version": "1.2.1-canary.0",
|
|
4
4
|
"description": "A gateway package for LLM services.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"minify": "find dist -type f -name \"*.js\" -exec terser {} -c -m -o {} \\;",
|
|
10
10
|
"lint": "eslint .",
|
|
11
11
|
"lint:fix": "eslint . --fix",
|
|
12
|
-
"prepublishOnly": "npm run lint:fix && npm run build",
|
|
12
|
+
"prepublishOnly": "npm run lint:fix && npm run type-check && npm run build",
|
|
13
|
+
"type-check": "tsc --noEmit",
|
|
13
14
|
"postpublish": "npm run clean",
|
|
14
15
|
"clean": "rm -rf ./dist",
|
|
15
16
|
"patch": "npm version patch && npm publish",
|
|
@@ -44,19 +45,19 @@
|
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@mate-academy/ts-config": "^1.0.5",
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
48
|
-
"eslint": "^9.
|
|
49
|
-
"terser": "^5.
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.33.1",
|
|
49
|
+
"eslint": "^9.28.0",
|
|
50
|
+
"terser": "^5.41.0",
|
|
50
51
|
"tsc-alias": "^1.8.16",
|
|
51
52
|
"typescript": "^5.8.3",
|
|
52
|
-
"typescript-eslint": "^8.
|
|
53
|
+
"typescript-eslint": "^8.33.1"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
|
-
"@google/genai": "^
|
|
56
|
+
"@google/genai": "^1.4.0",
|
|
56
57
|
"@mate-academy/core": "^1.10.4",
|
|
57
58
|
"axios": "^1.9.0",
|
|
58
59
|
"js-tiktoken": "^1.0.20",
|
|
59
|
-
"openai": "^
|
|
60
|
+
"openai": "^5.1.1",
|
|
60
61
|
"uuid": "^11.1.0"
|
|
61
62
|
}
|
|
62
63
|
}
|