@theia/ai-huggingface 1.67.0-next.13 → 1.67.0-next.56
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/README.md +1 -0
- package/package.json +4 -4
- package/lib/browser/huggingface-frontend-application-contribution.d.ts +0 -16
- package/lib/browser/huggingface-frontend-application-contribution.d.ts.map +0 -1
- package/lib/browser/huggingface-frontend-application-contribution.js +0 -84
- package/lib/browser/huggingface-frontend-application-contribution.js.map +0 -1
- package/lib/browser/huggingface-frontend-module.d.ts +0 -4
- package/lib/browser/huggingface-frontend-module.d.ts.map +0 -1
- package/lib/browser/huggingface-frontend-module.js +0 -33
- package/lib/browser/huggingface-frontend-module.js.map +0 -1
- package/lib/common/huggingface-language-models-manager.d.ts +0 -19
- package/lib/common/huggingface-language-models-manager.d.ts.map +0 -1
- package/lib/common/huggingface-language-models-manager.js +0 -21
- package/lib/common/huggingface-language-models-manager.js.map +0 -1
- package/lib/common/huggingface-preferences.d.ts +0 -5
- package/lib/common/huggingface-preferences.d.ts.map +0 -1
- package/lib/common/huggingface-preferences.js +0 -42
- package/lib/common/huggingface-preferences.js.map +0 -1
- package/lib/common/index.d.ts +0 -2
- package/lib/common/index.d.ts.map +0 -1
- package/lib/common/index.js +0 -20
- package/lib/common/index.js.map +0 -1
- package/lib/node/huggingface-backend-module.d.ts +0 -5
- package/lib/node/huggingface-backend-module.d.ts.map +0 -1
- package/lib/node/huggingface-backend-module.js +0 -36
- package/lib/node/huggingface-backend-module.js.map +0 -1
- package/lib/node/huggingface-language-model.d.ts +0 -29
- package/lib/node/huggingface-language-model.d.ts.map +0 -1
- package/lib/node/huggingface-language-model.js +0 -145
- package/lib/node/huggingface-language-model.js.map +0 -1
- package/lib/node/huggingface-language-models-manager-impl.d.ts +0 -12
- package/lib/node/huggingface-language-models-manager-impl.d.ts.map +0 -1
- package/lib/node/huggingface-language-models-manager-impl.js +0 -67
- package/lib/node/huggingface-language-models-manager-impl.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Alternatively, the Hugging Face API key can also be provided via the `HUGGINGFAC
|
|
|
18
18
|
|
|
19
19
|
## Additional Information
|
|
20
20
|
|
|
21
|
+
- [API documentation for `@theia/ai-huggingface`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_ai-huggingface.html)
|
|
21
22
|
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
22
23
|
- [Theia - Website](https://theia-ide.org/)
|
|
23
24
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-huggingface",
|
|
3
|
-
"version": "1.67.0-next.
|
|
3
|
+
"version": "1.67.0-next.56+d8f18cc386c",
|
|
4
4
|
"description": "Theia - Hugging Face Integration",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@huggingface/inference": "^2.0.0",
|
|
7
|
-
"@theia/ai-core": "1.67.0-next.
|
|
8
|
-
"@theia/core": "1.67.0-next.
|
|
7
|
+
"@theia/ai-core": "1.67.0-next.56+d8f18cc386c",
|
|
8
|
+
"@theia/core": "1.67.0-next.56+d8f18cc386c"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"nyc": {
|
|
47
47
|
"extends": "../../configs/nyc.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
|
|
50
50
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
2
|
-
import { HuggingFaceLanguageModelsManager, HuggingFaceModelDescription } from '../common';
|
|
3
|
-
import { PreferenceService } from '@theia/core';
|
|
4
|
-
export declare class HuggingFaceFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
5
|
-
protected preferenceService: PreferenceService;
|
|
6
|
-
protected manager: HuggingFaceLanguageModelsManager;
|
|
7
|
-
protected prevModels: string[];
|
|
8
|
-
onStart(): void;
|
|
9
|
-
protected handleModelChanges(newModels: string[]): void;
|
|
10
|
-
/**
|
|
11
|
-
* Called when the API key changes. Updates all HuggingFace models on the manager to ensure the new key is used.
|
|
12
|
-
*/
|
|
13
|
-
protected handleKeyChange(newApiKey: string | undefined): void;
|
|
14
|
-
protected createHuggingFaceModelDescription(modelId: string): HuggingFaceModelDescription;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=huggingface-frontend-application-contribution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/huggingface-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,gCAAgC,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,qBACa,0CAA2C,YAAW,+BAA+B;IAG9F,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAG/C,SAAS,CAAC,OAAO,EAAE,gCAAgC,CAAC;IAEpD,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IAEpC,OAAO,IAAI,IAAI;IAoBf,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAYvD;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAM9D,SAAS,CAAC,iCAAiC,CACvC,OAAO,EAAE,MAAM,GAChB,2BAA2B;CAOjC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HuggingFaceFrontendApplicationContribution = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const common_1 = require("../common");
|
|
22
|
-
const huggingface_preferences_1 = require("../common/huggingface-preferences");
|
|
23
|
-
const core_1 = require("@theia/core");
|
|
24
|
-
const HUGGINGFACE_PROVIDER_ID = 'huggingface';
|
|
25
|
-
let HuggingFaceFrontendApplicationContribution = class HuggingFaceFrontendApplicationContribution {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.prevModels = [];
|
|
28
|
-
}
|
|
29
|
-
onStart() {
|
|
30
|
-
this.preferenceService.ready.then(() => {
|
|
31
|
-
const apiKey = this.preferenceService.get(huggingface_preferences_1.API_KEY_PREF, undefined);
|
|
32
|
-
this.manager.setApiKey(apiKey);
|
|
33
|
-
const models = this.preferenceService.get(huggingface_preferences_1.MODELS_PREF, []);
|
|
34
|
-
this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createHuggingFaceModelDescription(modelId)));
|
|
35
|
-
this.prevModels = [...models];
|
|
36
|
-
this.preferenceService.onPreferenceChanged(event => {
|
|
37
|
-
if (event.preferenceName === huggingface_preferences_1.API_KEY_PREF) {
|
|
38
|
-
this.manager.setApiKey(event.newValue);
|
|
39
|
-
this.handleKeyChange(event.newValue);
|
|
40
|
-
}
|
|
41
|
-
else if (event.preferenceName === huggingface_preferences_1.MODELS_PREF) {
|
|
42
|
-
this.handleModelChanges(event.newValue);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
handleModelChanges(newModels) {
|
|
48
|
-
const oldModels = new Set(this.prevModels);
|
|
49
|
-
const updatedModels = new Set(newModels);
|
|
50
|
-
const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model));
|
|
51
|
-
const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model));
|
|
52
|
-
this.manager.removeLanguageModels(...modelsToRemove.map(model => `${HUGGINGFACE_PROVIDER_ID}/${model}`));
|
|
53
|
-
this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createHuggingFaceModelDescription(modelId)));
|
|
54
|
-
this.prevModels = newModels;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Called when the API key changes. Updates all HuggingFace models on the manager to ensure the new key is used.
|
|
58
|
-
*/
|
|
59
|
-
handleKeyChange(newApiKey) {
|
|
60
|
-
if (this.prevModels && this.prevModels.length > 0) {
|
|
61
|
-
this.manager.createOrUpdateLanguageModels(...this.prevModels.map(modelId => this.createHuggingFaceModelDescription(modelId)));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
createHuggingFaceModelDescription(modelId) {
|
|
65
|
-
const id = `${HUGGINGFACE_PROVIDER_ID}/${modelId}`;
|
|
66
|
-
return {
|
|
67
|
-
id: id,
|
|
68
|
-
model: modelId
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
exports.HuggingFaceFrontendApplicationContribution = HuggingFaceFrontendApplicationContribution;
|
|
73
|
-
tslib_1.__decorate([
|
|
74
|
-
(0, inversify_1.inject)(core_1.PreferenceService),
|
|
75
|
-
tslib_1.__metadata("design:type", Object)
|
|
76
|
-
], HuggingFaceFrontendApplicationContribution.prototype, "preferenceService", void 0);
|
|
77
|
-
tslib_1.__decorate([
|
|
78
|
-
(0, inversify_1.inject)(common_1.HuggingFaceLanguageModelsManager),
|
|
79
|
-
tslib_1.__metadata("design:type", Object)
|
|
80
|
-
], HuggingFaceFrontendApplicationContribution.prototype, "manager", void 0);
|
|
81
|
-
exports.HuggingFaceFrontendApplicationContribution = HuggingFaceFrontendApplicationContribution = tslib_1.__decorate([
|
|
82
|
-
(0, inversify_1.injectable)()
|
|
83
|
-
], HuggingFaceFrontendApplicationContribution);
|
|
84
|
-
//# sourceMappingURL=huggingface-frontend-application-contribution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/huggingface-frontend-application-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAGhF,4DAAkE;AAClE,sCAA0F;AAC1F,+EAA8E;AAC9E,sCAAgD;AAEhD,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAEvC,IAAM,0CAA0C,GAAhD,MAAM,0CAA0C;IAAhD;QAQO,eAAU,GAAa,EAAE,CAAC;IAoDxC,CAAC;IAlDG,OAAO;QACH,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAS,sCAAY,EAAE,SAAS,CAAC,CA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,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAE9E,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,uBAAuB,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC;QACzG,IAAI,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1H,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAED;;OAEG;IACO,eAAe,CAAC,SAA6B;QACnD,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChD,IAAI,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClI,CAAC;IACL,CAAC;IAES,iCAAiC,CACvC,OAAe;QAEf,MAAM,EAAE,GAAG,GAAG,uBAAuB,IAAI,OAAO,EAAE,CAAC;QACnD,OAAO;YACH,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,OAAO;SACjB,CAAC;IACN,CAAC;CACJ,CAAA;AA5DY,gGAA0C;AAGzC;IADT,IAAA,kBAAM,EAAC,wBAAiB,CAAC;;qFACqB;AAGrC;IADT,IAAA,kBAAM,EAAC,yCAAgC,CAAC;;2EACW;qDAN3C,0CAA0C;IADtD,IAAA,sBAAU,GAAE;GACA,0CAA0C,CA4DtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/huggingface-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAO/D,wBAQG"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
-
const huggingface_preferences_1 = require("../common/huggingface-preferences");
|
|
20
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
-
const huggingface_frontend_application_contribution_1 = require("./huggingface-frontend-application-contribution");
|
|
22
|
-
const common_1 = require("../common");
|
|
23
|
-
const core_1 = require("@theia/core");
|
|
24
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
25
|
-
bind(core_1.PreferenceContribution).toConstantValue({ schema: huggingface_preferences_1.HuggingFacePreferencesSchema });
|
|
26
|
-
bind(huggingface_frontend_application_contribution_1.HuggingFaceFrontendApplicationContribution).toSelf().inSingletonScope();
|
|
27
|
-
bind(browser_1.FrontendApplicationContribution).toService(huggingface_frontend_application_contribution_1.HuggingFaceFrontendApplicationContribution);
|
|
28
|
-
bind(common_1.HuggingFaceLanguageModelsManager).toDynamicValue(ctx => {
|
|
29
|
-
const provider = ctx.container.get(browser_1.RemoteConnectionProvider);
|
|
30
|
-
return provider.createProxy(common_1.HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH);
|
|
31
|
-
}).inSingletonScope();
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=huggingface-frontend-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-frontend-module.js","sourceRoot":"","sources":["../../src/browser/huggingface-frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,4DAA+D;AAC/D,+EAAiF;AACjF,qDAA+H;AAC/H,mHAA6G;AAC7G,sCAAuG;AACvG,sCAAqD;AAErD,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,sDAA4B,EAAE,CAAC,CAAC;IACvF,IAAI,CAAC,0FAA0C,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC7E,IAAI,CAAC,yCAA+B,CAAC,CAAC,SAAS,CAAC,0FAA0C,CAAC,CAAC;IAC5F,IAAI,CAAC,yCAAgC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QACxD,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAA4B,kCAAwB,CAAC,CAAC;QACxF,OAAO,QAAQ,CAAC,WAAW,CAAmC,iDAAwC,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH = "/services/huggingface/language-model-manager";
|
|
2
|
-
export declare const HuggingFaceLanguageModelsManager: unique symbol;
|
|
3
|
-
export interface HuggingFaceModelDescription {
|
|
4
|
-
/**
|
|
5
|
-
* The identifier of the model which will be shown in the UI.
|
|
6
|
-
*/
|
|
7
|
-
id: string;
|
|
8
|
-
/**
|
|
9
|
-
* The model ID as used by the Hugging Face API.
|
|
10
|
-
*/
|
|
11
|
-
model: string;
|
|
12
|
-
}
|
|
13
|
-
export interface HuggingFaceLanguageModelsManager {
|
|
14
|
-
apiKey: string | undefined;
|
|
15
|
-
setApiKey(key: string | undefined): void;
|
|
16
|
-
createOrUpdateLanguageModels(...models: HuggingFaceModelDescription[]): Promise<void>;
|
|
17
|
-
removeLanguageModels(...modelIds: string[]): void;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=huggingface-language-models-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-language-models-manager.d.ts","sourceRoot":"","sources":["../../src/common/huggingface-language-models-manager.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,wCAAwC,iDAAiD,CAAC;AACvG,eAAO,MAAM,gCAAgC,eAA6C,CAAC;AAE3F,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC7C,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACzC,4BAA4B,CAAC,GAAG,MAAM,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtF,oBAAoB,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACrD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HuggingFaceLanguageModelsManager = exports.HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH = void 0;
|
|
19
|
-
exports.HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH = '/services/huggingface/language-model-manager';
|
|
20
|
-
exports.HuggingFaceLanguageModelsManager = Symbol('HuggingFaceLanguageModelsManager');
|
|
21
|
-
//# sourceMappingURL=huggingface-language-models-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-language-models-manager.js","sourceRoot":"","sources":["../../src/common/huggingface-language-models-manager.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEnE,QAAA,wCAAwC,GAAG,8CAA8C,CAAC;AAC1F,QAAA,gCAAgC,GAAG,MAAM,CAAC,kCAAkC,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { PreferenceSchema } from '@theia/core';
|
|
2
|
-
export declare const API_KEY_PREF = "ai-features.huggingFace.apiKey";
|
|
3
|
-
export declare const MODELS_PREF = "ai-features.huggingFace.models";
|
|
4
|
-
export declare const HuggingFacePreferencesSchema: PreferenceSchema;
|
|
5
|
-
//# sourceMappingURL=huggingface-preferences.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-preferences.d.ts","sourceRoot":"","sources":["../../src/common/huggingface-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAO,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,YAAY,mCAAmC,CAAC;AAC7D,eAAO,MAAM,WAAW,mCAAmC,CAAC;AAE5D,eAAO,MAAM,4BAA4B,EAAE,gBAmB1C,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HuggingFacePreferencesSchema = exports.MODELS_PREF = exports.API_KEY_PREF = void 0;
|
|
19
|
-
const ai_core_preferences_1 = require("@theia/ai-core/lib/common/ai-core-preferences");
|
|
20
|
-
const core_1 = require("@theia/core");
|
|
21
|
-
exports.API_KEY_PREF = 'ai-features.huggingFace.apiKey';
|
|
22
|
-
exports.MODELS_PREF = 'ai-features.huggingFace.models';
|
|
23
|
-
exports.HuggingFacePreferencesSchema = {
|
|
24
|
-
properties: {
|
|
25
|
-
[exports.API_KEY_PREF]: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
markdownDescription: core_1.nls.localize('theia/ai/huggingFace/apiKey/mdDescription', 'Enter an API Key for your Hugging Face Account. **Please note:** By using this preference the Hugging Face API key will be stored in clear text\
|
|
28
|
-
on the machine running Theia. Use the environment variable `HUGGINGFACE_API_KEY` to set the key securely.'),
|
|
29
|
-
title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
|
|
30
|
-
},
|
|
31
|
-
[exports.MODELS_PREF]: {
|
|
32
|
-
type: 'array',
|
|
33
|
-
description: core_1.nls.localize('theia/ai/huggingFace/models/description', 'Hugging Face models to use'),
|
|
34
|
-
title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
|
|
35
|
-
default: ['bigcode/starcoder'],
|
|
36
|
-
items: {
|
|
37
|
-
type: 'string'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
//# sourceMappingURL=huggingface-preferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-preferences.js","sourceRoot":"","sources":["../../src/common/huggingface-preferences.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,uFAA0F;AAC1F,sCAAoD;AAEvC,QAAA,YAAY,GAAG,gCAAgC,CAAC;AAChD,QAAA,WAAW,GAAG,gCAAgC,CAAC;AAE/C,QAAA,4BAA4B,GAAqB;IAC1D,UAAU,EAAE;QACR,CAAC,oBAAY,CAAC,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,2CAA2C,EACzE;sHACsG,CAAC;YAC3G,KAAK,EAAE,+CAAyB;SACnC;QACD,CAAC,mBAAW,CAAC,EAAE;YACX,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,UAAG,CAAC,QAAQ,CAAC,yCAAyC,EAAE,4BAA4B,CAAC;YAClG,KAAK,EAAE,+CAAyB;YAChC,OAAO,EAAE,CAAC,mBAAmB,CAAC;YAC9B,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;SACJ;KACJ;CACJ,CAAC"}
|
package/lib/common/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAeA,cAAc,uCAAuC,CAAC"}
|
package/lib/common/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
// *****************************************************************************
|
|
5
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
6
|
-
//
|
|
7
|
-
// This program and the accompanying materials are made available under the
|
|
8
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
-
//
|
|
11
|
-
// This Source Code may also be made available under the following Secondary
|
|
12
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
-
// with the GNU Classpath Exception which is available at
|
|
15
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
-
//
|
|
17
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
-
// *****************************************************************************
|
|
19
|
-
tslib_1.__exportStar(require("./huggingface-language-models-manager"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/lib/common/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,gFAAsD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/huggingface-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAO/D,eAAO,MAAM,uBAAuB,eAAoC,CAAC;;AAWzE,wBAGG"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HuggingFaceModelFactory = void 0;
|
|
19
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
20
|
-
const huggingface_language_models_manager_1 = require("../common/huggingface-language-models-manager");
|
|
21
|
-
const core_1 = require("@theia/core");
|
|
22
|
-
const connection_container_module_1 = require("@theia/core/lib/node/messaging/connection-container-module");
|
|
23
|
-
const huggingface_language_models_manager_impl_1 = require("./huggingface-language-models-manager-impl");
|
|
24
|
-
const huggingface_preferences_1 = require("../common/huggingface-preferences");
|
|
25
|
-
exports.HuggingFaceModelFactory = Symbol('HuggingFaceModelFactory');
|
|
26
|
-
// We use a connection module to handle AI services separately for each frontend.
|
|
27
|
-
const huggingfaceConnectionModule = connection_container_module_1.ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => {
|
|
28
|
-
bind(huggingface_language_models_manager_impl_1.HuggingFaceLanguageModelsManagerImpl).toSelf().inSingletonScope();
|
|
29
|
-
bind(huggingface_language_models_manager_1.HuggingFaceLanguageModelsManager).toService(huggingface_language_models_manager_impl_1.HuggingFaceLanguageModelsManagerImpl);
|
|
30
|
-
bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(huggingface_language_models_manager_1.HUGGINGFACE_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(huggingface_language_models_manager_1.HuggingFaceLanguageModelsManager))).inSingletonScope();
|
|
31
|
-
});
|
|
32
|
-
exports.default = new inversify_1.ContainerModule(bind => {
|
|
33
|
-
bind(core_1.PreferenceContribution).toConstantValue({ schema: huggingface_preferences_1.HuggingFacePreferencesSchema });
|
|
34
|
-
bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(huggingfaceConnectionModule);
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=huggingface-backend-module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-backend-module.js","sourceRoot":"","sources":["../../src/node/huggingface-backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,4DAA+D;AAC/D,uGAA2I;AAC3I,sCAA8F;AAC9F,4GAAuG;AACvG,yGAAkG;AAClG,+EAAiF;AAEpE,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAEzE,iFAAiF;AACjF,MAAM,2BAA2B,GAAG,uDAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,EAAE,EAAE;IACvH,IAAI,CAAC,+EAAoC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACvE,IAAI,CAAC,sEAAgC,CAAC,CAAC,SAAS,CAAC,+EAAoC,CAAC,CAAC;IACvF,IAAI,CAAC,wBAAiB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CACzC,IAAI,2BAAoB,CAAC,8EAAwC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,sEAAgC,CAAC,CAAC,CAChI,CAAC,gBAAgB,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,sDAA4B,EAAE,CAAC,CAAC;IACvF,IAAI,CAAC,uDAAyB,CAAC,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { LanguageModel, LanguageModelRequest, LanguageModelResponse, LanguageModelTextResponse, LanguageModelStatus } from '@theia/ai-core';
|
|
2
|
-
import { CancellationToken } from '@theia/core';
|
|
3
|
-
import { HfInference } from '@huggingface/inference';
|
|
4
|
-
export declare const HuggingFaceModelIdentifier: unique symbol;
|
|
5
|
-
export declare class HuggingFaceModel implements LanguageModel {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
model: string;
|
|
8
|
-
status: LanguageModelStatus;
|
|
9
|
-
apiKey: () => string | undefined;
|
|
10
|
-
readonly name?: string | undefined;
|
|
11
|
-
readonly vendor?: string | undefined;
|
|
12
|
-
readonly version?: string | undefined;
|
|
13
|
-
readonly family?: string | undefined;
|
|
14
|
-
readonly maxInputTokens?: number | undefined;
|
|
15
|
-
readonly maxOutputTokens?: number | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* @param id the unique id for this language model. It will be used to identify the model in the UI.
|
|
18
|
-
* @param model the model id as it is used by the Hugging Face API
|
|
19
|
-
* @param apiKey function to retrieve the API key for Hugging Face
|
|
20
|
-
*/
|
|
21
|
-
constructor(id: string, model: string, status: LanguageModelStatus, apiKey: () => string | undefined, name?: string | undefined, vendor?: string | undefined, version?: string | undefined, family?: string | undefined, maxInputTokens?: number | undefined, maxOutputTokens?: number | undefined);
|
|
22
|
-
request(request: LanguageModelRequest, cancellationToken?: CancellationToken): Promise<LanguageModelResponse>;
|
|
23
|
-
protected getSettings(request: LanguageModelRequest): Record<string, unknown>;
|
|
24
|
-
protected handleNonStreamingRequest(hfInference: HfInference, request: LanguageModelRequest): Promise<LanguageModelTextResponse>;
|
|
25
|
-
protected handleStreamingRequest(hfInference: HfInference, request: LanguageModelRequest, cancellationToken?: CancellationToken): Promise<LanguageModelResponse>;
|
|
26
|
-
protected isStreamingSupported(model: string): boolean;
|
|
27
|
-
private initializeHfInference;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=huggingface-language-model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-language-model.d.ts","sourceRoot":"","sources":["../../src/node/huggingface-language-model.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,aAAa,EACb,oBAAoB,EAEpB,qBAAqB,EAErB,yBAAyB,EAEzB,mBAAmB,EACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,eAAO,MAAM,0BAA0B,eAAuC,CAAC;AAkC/E,qBAAa,gBAAiB,YAAW,aAAa;aAQ9B,EAAE,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,mBAAmB;IAC3B,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS;aACvB,IAAI,CAAC;aACL,MAAM,CAAC;aACP,OAAO,CAAC;aACR,MAAM,CAAC;aACP,cAAc,CAAC;aACf,eAAe,CAAC;IAfpC;;;;OAIG;gBAEiB,EAAE,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,mBAAmB,EAC3B,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS,EACvB,IAAI,CAAC,oBAAQ,EACb,MAAM,CAAC,oBAAQ,EACf,OAAO,CAAC,oBAAQ,EAChB,MAAM,CAAC,oBAAQ,EACf,cAAc,CAAC,oBAAQ,EACvB,eAAe,CAAC,oBAAQ;IAGtC,OAAO,CAAC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IASnH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAI7D,yBAAyB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,yBAAyB,CAAC;cAyBtH,sBAAsB,CAClC,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,oBAAoB,EAC7B,iBAAiB,CAAC,EAAE,iBAAiB,GACtC,OAAO,CAAC,qBAAqB,CAAC;IAqCjC,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAKtD,OAAO,CAAC,qBAAqB;CAOhC"}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HuggingFaceModel = exports.HuggingFaceModelIdentifier = void 0;
|
|
19
|
-
const ai_core_1 = require("@theia/ai-core");
|
|
20
|
-
const inference_1 = require("@huggingface/inference");
|
|
21
|
-
exports.HuggingFaceModelIdentifier = Symbol('HuggingFaceModelIdentifier');
|
|
22
|
-
const createMessageContent = (message) => {
|
|
23
|
-
if (ai_core_1.LanguageModelMessage.isTextMessage(message)) {
|
|
24
|
-
return message.text;
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
};
|
|
28
|
-
function toHuggingFacePrompt(messages) {
|
|
29
|
-
if (messages.length === 1) {
|
|
30
|
-
const message = messages[0];
|
|
31
|
-
return (ai_core_1.LanguageModelMessage.isTextMessage(message) && message.text) || '';
|
|
32
|
-
}
|
|
33
|
-
return messages.map(message => {
|
|
34
|
-
const messageContent = createMessageContent(message);
|
|
35
|
-
if (messageContent === undefined) {
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
return `${toRoleLabel(message.actor)}: ${messageContent}`;
|
|
39
|
-
}).filter(m => m !== undefined).join('\n');
|
|
40
|
-
}
|
|
41
|
-
function toRoleLabel(actor) {
|
|
42
|
-
switch (actor) {
|
|
43
|
-
case 'user':
|
|
44
|
-
return 'User';
|
|
45
|
-
case 'ai':
|
|
46
|
-
return 'Assistant';
|
|
47
|
-
case 'system':
|
|
48
|
-
return 'System';
|
|
49
|
-
default:
|
|
50
|
-
return '';
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
class HuggingFaceModel {
|
|
54
|
-
/**
|
|
55
|
-
* @param id the unique id for this language model. It will be used to identify the model in the UI.
|
|
56
|
-
* @param model the model id as it is used by the Hugging Face API
|
|
57
|
-
* @param apiKey function to retrieve the API key for Hugging Face
|
|
58
|
-
*/
|
|
59
|
-
constructor(id, model, status, apiKey, name, vendor, version, family, maxInputTokens, maxOutputTokens) {
|
|
60
|
-
this.id = id;
|
|
61
|
-
this.model = model;
|
|
62
|
-
this.status = status;
|
|
63
|
-
this.apiKey = apiKey;
|
|
64
|
-
this.name = name;
|
|
65
|
-
this.vendor = vendor;
|
|
66
|
-
this.version = version;
|
|
67
|
-
this.family = family;
|
|
68
|
-
this.maxInputTokens = maxInputTokens;
|
|
69
|
-
this.maxOutputTokens = maxOutputTokens;
|
|
70
|
-
}
|
|
71
|
-
async request(request, cancellationToken) {
|
|
72
|
-
const hfInference = this.initializeHfInference();
|
|
73
|
-
if (this.isStreamingSupported(this.model)) {
|
|
74
|
-
return this.handleStreamingRequest(hfInference, request, cancellationToken);
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
return this.handleNonStreamingRequest(hfInference, request);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
getSettings(request) {
|
|
81
|
-
var _a;
|
|
82
|
-
return (_a = request.settings) !== null && _a !== void 0 ? _a : {};
|
|
83
|
-
}
|
|
84
|
-
async handleNonStreamingRequest(hfInference, request) {
|
|
85
|
-
const settings = this.getSettings(request);
|
|
86
|
-
const response = await hfInference.textGeneration({
|
|
87
|
-
model: this.model,
|
|
88
|
-
inputs: toHuggingFacePrompt(request.messages),
|
|
89
|
-
parameters: {
|
|
90
|
-
...settings
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
const stopWords = Array.isArray(settings.stop) ? settings.stop : [];
|
|
94
|
-
let cleanText = response.generated_text;
|
|
95
|
-
stopWords.forEach(stopWord => {
|
|
96
|
-
if (cleanText.endsWith(stopWord)) {
|
|
97
|
-
cleanText = cleanText.slice(0, -stopWord.length).trim();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return {
|
|
101
|
-
text: cleanText
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
async handleStreamingRequest(hfInference, request, cancellationToken) {
|
|
105
|
-
const settings = this.getSettings(request);
|
|
106
|
-
const stream = hfInference.textGenerationStream({
|
|
107
|
-
model: this.model,
|
|
108
|
-
inputs: toHuggingFacePrompt(request.messages),
|
|
109
|
-
parameters: {
|
|
110
|
-
...settings
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
const stopWords = Array.isArray(settings.stop) ? settings.stop : [];
|
|
114
|
-
const asyncIterator = {
|
|
115
|
-
async *[Symbol.asyncIterator]() {
|
|
116
|
-
for await (const chunk of stream) {
|
|
117
|
-
let content = chunk.token.text;
|
|
118
|
-
stopWords.forEach(stopWord => {
|
|
119
|
-
if (content.endsWith(stopWord)) {
|
|
120
|
-
content = content.slice(0, -stopWord.length).trim();
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
yield { content };
|
|
124
|
-
if (cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.isCancellationRequested) {
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
return { stream: asyncIterator };
|
|
131
|
-
}
|
|
132
|
-
isStreamingSupported(model) {
|
|
133
|
-
// Assuming all models support streaming for now; can be refined if needed
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
initializeHfInference() {
|
|
137
|
-
const token = this.apiKey();
|
|
138
|
-
if (!token) {
|
|
139
|
-
throw new Error('Please provide a Hugging Face API token.');
|
|
140
|
-
}
|
|
141
|
-
return new inference_1.HfInference(token);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.HuggingFaceModel = HuggingFaceModel;
|
|
145
|
-
//# sourceMappingURL=huggingface-language-model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-language-model.js","sourceRoot":"","sources":["../../src/node/huggingface-language-model.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,4CASwB;AAExB,sDAAqD;AAExC,QAAA,0BAA0B,GAAG,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAC/E,MAAM,oBAAoB,GAAG,CAAC,OAA6B,EAAsB,EAAE;IAC/E,IAAI,8BAAoB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9C,OAAO,OAAO,CAAC,IAAI,CAAC;IACxB,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;A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ElB,IAAI,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,uBAAuB,EAAE,CAAC;wBAC7C,MAAM;oBACV,CAAC;gBACL,CAAC;YACL,CAAC;SACJ,CAAC;QAEF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IACrC,CAAC;IAES,oBAAoB,CAAC,KAAa;QACxC,0EAA0E;QAC1E,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,qBAAqB;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,IAAI,uBAAW,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;CACJ;AA/GD,4CA+GC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LanguageModelRegistry, LanguageModelStatus } from '@theia/ai-core';
|
|
2
|
-
import { HuggingFaceLanguageModelsManager, HuggingFaceModelDescription } from '../common';
|
|
3
|
-
export declare class HuggingFaceLanguageModelsManagerImpl implements HuggingFaceLanguageModelsManager {
|
|
4
|
-
protected _apiKey: string | undefined;
|
|
5
|
-
protected readonly languageModelRegistry: LanguageModelRegistry;
|
|
6
|
-
get apiKey(): string | undefined;
|
|
7
|
-
protected calculateStatus(apiKey: string | undefined): LanguageModelStatus;
|
|
8
|
-
createOrUpdateLanguageModels(...modelDescriptions: HuggingFaceModelDescription[]): Promise<void>;
|
|
9
|
-
removeLanguageModels(...modelIds: string[]): void;
|
|
10
|
-
setApiKey(apiKey: string | undefined): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=huggingface-language-models-manager-impl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-language-models-manager-impl.d.ts","sourceRoot":"","sources":["../../src/node/huggingface-language-models-manager-impl.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG5E,OAAO,EAAE,gCAAgC,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAE1F,qBACa,oCAAqC,YAAW,gCAAgC;IAEzF,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAGtC,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAEhE,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB;IAIpE,4BAA4B,CAAC,GAAG,iBAAiB,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCtG,oBAAoB,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI;IAIjD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;CAG9C"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.HuggingFaceLanguageModelsManagerImpl = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const ai_core_1 = require("@theia/ai-core");
|
|
21
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
-
const huggingface_language_model_1 = require("./huggingface-language-model");
|
|
23
|
-
let HuggingFaceLanguageModelsManagerImpl = class HuggingFaceLanguageModelsManagerImpl {
|
|
24
|
-
get apiKey() {
|
|
25
|
-
var _a;
|
|
26
|
-
return (_a = this._apiKey) !== null && _a !== void 0 ? _a : process.env.HUGGINGFACE_API_KEY;
|
|
27
|
-
}
|
|
28
|
-
calculateStatus(apiKey) {
|
|
29
|
-
return apiKey ? { status: 'ready' } : { status: 'unavailable', message: 'No Hugging Face API key set' };
|
|
30
|
-
}
|
|
31
|
-
async createOrUpdateLanguageModels(...modelDescriptions) {
|
|
32
|
-
for (const modelDescription of modelDescriptions) {
|
|
33
|
-
const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id);
|
|
34
|
-
const apiKeyProvider = () => this.apiKey;
|
|
35
|
-
const status = this.calculateStatus(this.apiKey);
|
|
36
|
-
if (model) {
|
|
37
|
-
if (!(model instanceof huggingface_language_model_1.HuggingFaceModel)) {
|
|
38
|
-
console.warn(`Hugging Face: model ${modelDescription.id} is not a Hugging Face model`);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
model.model = modelDescription.model;
|
|
42
|
-
model.apiKey = apiKeyProvider;
|
|
43
|
-
model.status = status;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.languageModelRegistry.addLanguageModels([
|
|
47
|
-
new huggingface_language_model_1.HuggingFaceModel(modelDescription.id, modelDescription.model, status, apiKeyProvider, undefined, undefined, undefined, undefined, undefined, undefined)
|
|
48
|
-
]);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
removeLanguageModels(...modelIds) {
|
|
53
|
-
this.languageModelRegistry.removeLanguageModels(modelIds);
|
|
54
|
-
}
|
|
55
|
-
setApiKey(apiKey) {
|
|
56
|
-
this._apiKey = apiKey || undefined;
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
exports.HuggingFaceLanguageModelsManagerImpl = HuggingFaceLanguageModelsManagerImpl;
|
|
60
|
-
tslib_1.__decorate([
|
|
61
|
-
(0, inversify_1.inject)(ai_core_1.LanguageModelRegistry),
|
|
62
|
-
tslib_1.__metadata("design:type", Object)
|
|
63
|
-
], HuggingFaceLanguageModelsManagerImpl.prototype, "languageModelRegistry", void 0);
|
|
64
|
-
exports.HuggingFaceLanguageModelsManagerImpl = HuggingFaceLanguageModelsManagerImpl = tslib_1.__decorate([
|
|
65
|
-
(0, inversify_1.injectable)()
|
|
66
|
-
], HuggingFaceLanguageModelsManagerImpl);
|
|
67
|
-
//# sourceMappingURL=huggingface-language-models-manager-impl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"huggingface-language-models-manager-impl.js","sourceRoot":"","sources":["../../src/node/huggingface-language-models-manager-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4CAA4E;AAC5E,4DAAkE;AAClE,6EAAgE;AAIzD,IAAM,oCAAoC,GAA1C,MAAM,oCAAoC;IAO7C,IAAI,MAAM;;QACN,OAAO,MAAA,IAAI,CAAC,OAAO,mCAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAC3D,CAAC;IAES,eAAe,CAAC,MAA0B;QAChD,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,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,CAAA;AAvDY,oFAAoC;AAK1B;IADlB,IAAA,kBAAM,EAAC,+BAAqB,CAAC;;mFACkC;+CALvD,oCAAoC;IADhD,IAAA,sBAAU,GAAE;GACA,oCAAoC,CAuDhD"}
|
package/lib/package.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
package/lib/package.spec.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2024 EclipseSource GmbH and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('ai-huggingface package', () => {
|
|
24
|
-
it('support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=package.spec.js.map
|
package/lib/package.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF;;;;;;qBAMqB;AAErB,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAEpC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|