@theia/ai-vercel-ai 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 +6 -6
- package/lib/browser/vercel-ai-frontend-application-contribution.d.ts +0 -25
- package/lib/browser/vercel-ai-frontend-application-contribution.d.ts.map +0 -1
- package/lib/browser/vercel-ai-frontend-application-contribution.js +0 -191
- package/lib/browser/vercel-ai-frontend-application-contribution.js.map +0 -1
- package/lib/browser/vercel-ai-frontend-module.d.ts +0 -4
- package/lib/browser/vercel-ai-frontend-module.d.ts.map +0 -1
- package/lib/browser/vercel-ai-frontend-module.js +0 -33
- package/lib/browser/vercel-ai-frontend-module.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/common/vercel-ai-language-models-manager.d.ts +0 -49
- package/lib/common/vercel-ai-language-models-manager.d.ts.map +0 -1
- package/lib/common/vercel-ai-language-models-manager.js +0 -21
- package/lib/common/vercel-ai-language-models-manager.js.map +0 -1
- package/lib/common/vercel-ai-preferences.d.ts +0 -8
- package/lib/common/vercel-ai-preferences.d.ts.map +0 -1
- package/lib/common/vercel-ai-preferences.js +0 -131
- package/lib/common/vercel-ai-preferences.js.map +0 -1
- package/lib/node/vercel-ai-backend-module.d.ts +0 -4
- package/lib/node/vercel-ai-backend-module.d.ts.map +0 -1
- package/lib/node/vercel-ai-backend-module.js +0 -35
- package/lib/node/vercel-ai-backend-module.js.map +0 -1
- package/lib/node/vercel-ai-language-model-factory.d.ts +0 -14
- package/lib/node/vercel-ai-language-model-factory.d.ts.map +0 -1
- package/lib/node/vercel-ai-language-model-factory.js +0 -73
- package/lib/node/vercel-ai-language-model-factory.js.map +0 -1
- package/lib/node/vercel-ai-language-model.d.ts +0 -53
- package/lib/node/vercel-ai-language-model.d.ts.map +0 -1
- package/lib/node/vercel-ai-language-model.js +0 -309
- package/lib/node/vercel-ai-language-model.js.map +0 -1
- package/lib/node/vercel-ai-language-models-manager-impl.d.ts +0 -19
- package/lib/node/vercel-ai-language-models-manager-impl.d.ts.map +0 -1
- package/lib/node/vercel-ai-language-models-manager-impl.js +0 -107
- package/lib/node/vercel-ai-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
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2025 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.VercelAiLanguageModelsManagerImpl = 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 vercel_ai_language_model_1 = require("./vercel-ai-language-model");
|
|
23
|
-
const core_1 = require("@theia/core");
|
|
24
|
-
const vercel_ai_language_model_factory_1 = require("./vercel-ai-language-model-factory");
|
|
25
|
-
let VercelAiLanguageModelsManagerImpl = class VercelAiLanguageModelsManagerImpl {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.providerConfigs = new Map();
|
|
28
|
-
}
|
|
29
|
-
// Triggered from frontend. In case you want to use the models on the backend
|
|
30
|
-
// without a frontend then call this yourself
|
|
31
|
-
calculateStatus(effectiveApiKey) {
|
|
32
|
-
return effectiveApiKey
|
|
33
|
-
? { status: 'ready' }
|
|
34
|
-
: { status: 'unavailable', message: 'No Vercel AI API key set' };
|
|
35
|
-
}
|
|
36
|
-
async createOrUpdateLanguageModels(...modelDescriptions) {
|
|
37
|
-
for (const modelDescription of modelDescriptions) {
|
|
38
|
-
this.logger.info(`Vercel AI: Creating or updating model ${modelDescription.id}`);
|
|
39
|
-
const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id);
|
|
40
|
-
const provider = this.determineProvider(modelDescription);
|
|
41
|
-
const providerConfig = this.getProviderConfig(provider);
|
|
42
|
-
const effectiveApiKey = providerConfig.apiKey || this.apiKey;
|
|
43
|
-
const status = this.calculateStatus(effectiveApiKey);
|
|
44
|
-
if (model) {
|
|
45
|
-
if (!(model instanceof vercel_ai_language_model_1.VercelAiModel)) {
|
|
46
|
-
this.logger.warn(`Vercel AI: model ${modelDescription.id} is not a Vercel AI model`);
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
await this.languageModelRegistry.patchLanguageModel(modelDescription.id, {
|
|
50
|
-
model: modelDescription.model,
|
|
51
|
-
enableStreaming: modelDescription.enableStreaming,
|
|
52
|
-
url: modelDescription.url,
|
|
53
|
-
supportsStructuredOutput: modelDescription.supportsStructuredOutput,
|
|
54
|
-
status,
|
|
55
|
-
maxRetries: modelDescription.maxRetries
|
|
56
|
-
});
|
|
57
|
-
this.providerConfigs.set(provider, providerConfig);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
this.languageModelRegistry.addLanguageModels([
|
|
61
|
-
new vercel_ai_language_model_1.VercelAiModel(modelDescription.id, modelDescription.model, status, modelDescription.enableStreaming, modelDescription.supportsStructuredOutput, modelDescription.url, this.logger, this.languageModelFactory, () => this.getProviderConfig(provider), modelDescription.maxRetries, this.tokenUsageService)
|
|
62
|
-
]);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
removeLanguageModels(...modelIds) {
|
|
67
|
-
this.languageModelRegistry.removeLanguageModels(modelIds);
|
|
68
|
-
}
|
|
69
|
-
setProviderConfig(provider, config) {
|
|
70
|
-
const existingConfig = this.providerConfigs.get(provider) || { provider };
|
|
71
|
-
this.providerConfigs.set(provider, { ...existingConfig, ...config });
|
|
72
|
-
}
|
|
73
|
-
determineProvider(modelDescription) {
|
|
74
|
-
// Use the provider from the model description or default to OpenAI
|
|
75
|
-
return modelDescription.provider || 'openai';
|
|
76
|
-
}
|
|
77
|
-
getProviderConfig(provider) {
|
|
78
|
-
let config = this.providerConfigs.get(provider);
|
|
79
|
-
if (!config) {
|
|
80
|
-
config = { provider, apiKey: this.apiKey };
|
|
81
|
-
this.providerConfigs.set(provider, config);
|
|
82
|
-
}
|
|
83
|
-
return config;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
exports.VercelAiLanguageModelsManagerImpl = VercelAiLanguageModelsManagerImpl;
|
|
87
|
-
tslib_1.__decorate([
|
|
88
|
-
(0, inversify_1.inject)(ai_core_1.LanguageModelRegistry),
|
|
89
|
-
tslib_1.__metadata("design:type", Object)
|
|
90
|
-
], VercelAiLanguageModelsManagerImpl.prototype, "languageModelRegistry", void 0);
|
|
91
|
-
tslib_1.__decorate([
|
|
92
|
-
(0, inversify_1.inject)(ai_core_1.TokenUsageService),
|
|
93
|
-
tslib_1.__metadata("design:type", Object)
|
|
94
|
-
], VercelAiLanguageModelsManagerImpl.prototype, "tokenUsageService", void 0);
|
|
95
|
-
tslib_1.__decorate([
|
|
96
|
-
(0, inversify_1.inject)(core_1.ILogger),
|
|
97
|
-
(0, inversify_1.named)('vercel-ai'),
|
|
98
|
-
tslib_1.__metadata("design:type", Object)
|
|
99
|
-
], VercelAiLanguageModelsManagerImpl.prototype, "logger", void 0);
|
|
100
|
-
tslib_1.__decorate([
|
|
101
|
-
(0, inversify_1.inject)(vercel_ai_language_model_factory_1.VercelAiLanguageModelFactory),
|
|
102
|
-
tslib_1.__metadata("design:type", vercel_ai_language_model_factory_1.VercelAiLanguageModelFactory)
|
|
103
|
-
], VercelAiLanguageModelsManagerImpl.prototype, "languageModelFactory", void 0);
|
|
104
|
-
exports.VercelAiLanguageModelsManagerImpl = VercelAiLanguageModelsManagerImpl = tslib_1.__decorate([
|
|
105
|
-
(0, inversify_1.injectable)()
|
|
106
|
-
], VercelAiLanguageModelsManagerImpl);
|
|
107
|
-
//# sourceMappingURL=vercel-ai-language-models-manager-impl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai-language-models-manager-impl.js","sourceRoot":"","sources":["../../src/node/vercel-ai-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,4CAA+F;AAC/F,4DAAyE;AACzE,yEAA2D;AAE3D,sCAAsC;AACtC,yFAA4H;AAGrH,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAAvC;QAGO,oBAAe,GAAkD,IAAI,GAAG,EAAE,CAAC;IAuFzF,CAAC;IAzEG,6EAA6E;IAC7E,6CAA6C;IACnC,eAAe,CAAC,eAAmC;QACzD,OAAO,eAAe;YAClB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;YACrB,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACzE,CAAC;IAED,KAAK,C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,CAAA;AA1FY,8EAAiC;AAMvB;IADlB,IAAA,kBAAM,EAAC,+BAAqB,CAAC;;gFACkC;AAG7C;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;4EAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,WAAW,CAAC;;iEACD;AAGhB;IADlB,IAAA,kBAAM,EAAC,+DAA4B,CAAC;sCACI,+DAA4B;+EAAC;4CAf7D,iCAAiC;IAD7C,IAAA,sBAAU,GAAE;GACA,iCAAiC,CA0F7C"}
|
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) 2025 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-vercel-ai 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,sBAAsB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|