@theia/ai-openai 1.55.1 → 1.57.0-next.112
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 +56 -1
- package/lib/browser/openai-frontend-application-contribution.d.ts +8 -0
- package/lib/browser/openai-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/openai-frontend-application-contribution.js +93 -39
- package/lib/browser/openai-frontend-application-contribution.js.map +1 -1
- package/lib/browser/openai-preferences.d.ts.map +1 -1
- package/lib/browser/openai-preferences.js +25 -1
- package/lib/browser/openai-preferences.js.map +1 -1
- package/lib/common/openai-language-models-manager.d.ts +23 -0
- package/lib/common/openai-language-models-manager.d.ts.map +1 -1
- package/lib/node/openai-backend-module.d.ts.map +1 -1
- package/lib/node/openai-backend-module.js +6 -1
- package/lib/node/openai-backend-module.js.map +1 -1
- package/lib/node/openai-language-model.d.ts +23 -6
- package/lib/node/openai-language-model.d.ts.map +1 -1
- package/lib/node/openai-language-model.js +83 -46
- package/lib/node/openai-language-model.js.map +1 -1
- package/lib/node/openai-language-models-manager-impl.d.ts +3 -0
- package/lib/node/openai-language-models-manager-impl.d.ts.map +1 -1
- package/lib/node/openai-language-models-manager-impl.js +31 -8
- package/lib/node/openai-language-models-manager-impl.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/openai-frontend-application-contribution.ts +116 -43
- package/src/browser/openai-preferences.ts +25 -1
- package/src/common/openai-language-models-manager.ts +21 -0
- package/src/node/openai-backend-module.ts +7 -1
- package/src/node/openai-language-model.ts +93 -50
- package/src/node/openai-language-models-manager-impl.ts +43 -8
package/README.md
CHANGED
|
@@ -27,12 +27,66 @@ You can configure the end points via the `ai-features.openAiCustom.customOpenAiM
|
|
|
27
27
|
url: string
|
|
28
28
|
id?: string
|
|
29
29
|
apiKey?: string | true
|
|
30
|
+
apiVersion?: string | true
|
|
31
|
+
supportsDeveloperMessage?: boolean
|
|
32
|
+
enableStreaming?: boolean
|
|
30
33
|
}
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
- `model` and `url` are mandatory attributes, indicating the end point and model to use
|
|
34
37
|
- `id` is an optional attribute which is used in the UI to refer to this configuration
|
|
35
38
|
- `apiKey` is either the key to access the API served at the given URL or `true` to use the global OpenAI API key. If not given 'no-key' will be used.
|
|
39
|
+
- `apiVersion` is either the api version to access the API served at the given URL in Azure or `true` to use the global OpenAI API version.
|
|
40
|
+
- `supportsDeveloperMessage` is a flag that indicates whether the model supports the `developer` role or not. `true` by default.
|
|
41
|
+
- `enableStreaming` is a flag that indicates whether the streaming API shall be used or not. `true` by default.
|
|
42
|
+
|
|
43
|
+
### Azure OpenAI
|
|
44
|
+
|
|
45
|
+
To use a custom OpenAI model hosted on Azure, the `AzureOpenAI` class needs to be used, as described in the
|
|
46
|
+
[openai-node docs](https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai).
|
|
47
|
+
|
|
48
|
+
Requests to an OpenAI model hosted on Azure need an `apiVersion`. To configure a custom OpenAI model in Theia you therefore need to configure the `apiVersion` with the end point.
|
|
49
|
+
Note that if you don't configure an `apiVersion`, the default `OpenAI` object is used for initialization and a connection to an Azure hosted OpenAI model will fail.
|
|
50
|
+
|
|
51
|
+
An OpenAI model version deployed on Azure might not support the `developer` role. In that case it is possible to configure whether the `developer` role is supported or not via the
|
|
52
|
+
`supportsDeveloperMessage` option, which defaults to `true`.
|
|
53
|
+
|
|
54
|
+
The following snippet shows a possible configuration to access an OpenAI model hosted on Azure. The `AZURE_OPENAI_API_BASE_URL` needs to be given without the `/chat/completions`
|
|
55
|
+
path and without the `api-version` parameter, e.g. _`https://<my_prefix>.openai.azure.com/openai/deployments/<my_deployment>`_
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"ai-features.AiEnable.enableAI": true,
|
|
60
|
+
"ai-features.openAiCustom.customOpenAiModels": [
|
|
61
|
+
{
|
|
62
|
+
"model": "gpt4o",
|
|
63
|
+
"url": "<AZURE_OPENAI_API_BASE_URL>",
|
|
64
|
+
"id": "azure-deployment",
|
|
65
|
+
"apiKey": "<AZURE_OPENAI_API_KEY>",
|
|
66
|
+
"apiVersion": "<AZURE_OPENAI_API_VERSION>",
|
|
67
|
+
"supportsDeveloperMessage": false
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"ai-features.agentSettings": {
|
|
71
|
+
"Universal": {
|
|
72
|
+
"languageModelRequirements": [
|
|
73
|
+
{
|
|
74
|
+
"purpose": "chat",
|
|
75
|
+
"identifier": "azure-deployment"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"Orchestrator": {
|
|
80
|
+
"languageModelRequirements": [
|
|
81
|
+
{
|
|
82
|
+
"purpose": "agent-selection",
|
|
83
|
+
"identifier": "azure-deployment"
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
36
90
|
|
|
37
91
|
## Additional Information
|
|
38
92
|
|
|
@@ -45,5 +99,6 @@ You can configure the end points via the `ai-features.openAiCustom.customOpenAiM
|
|
|
45
99
|
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
46
100
|
|
|
47
101
|
## Trademark
|
|
102
|
+
|
|
48
103
|
"Theia" is a trademark of the Eclipse Foundation
|
|
49
|
-
https://www.eclipse.org/theia
|
|
104
|
+
<https://www.eclipse.org/theia>
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { FrontendApplicationContribution, PreferenceService } from '@theia/core/lib/browser';
|
|
2
2
|
import { OpenAiLanguageModelsManager, OpenAiModelDescription } from '../common';
|
|
3
|
+
import { RequestSetting } from '@theia/ai-core/lib/browser/ai-core-preferences';
|
|
3
4
|
export declare class OpenAiFrontendApplicationContribution implements FrontendApplicationContribution {
|
|
4
5
|
protected preferenceService: PreferenceService;
|
|
5
6
|
protected manager: OpenAiLanguageModelsManager;
|
|
6
7
|
protected prevModels: string[];
|
|
7
8
|
protected prevCustomModels: Partial<OpenAiModelDescription>[];
|
|
8
9
|
onStart(): void;
|
|
10
|
+
protected handleModelChanges(newModels: string[]): void;
|
|
11
|
+
private getRequestSettingsPref;
|
|
12
|
+
protected handleCustomModelChanges(newCustomModels: Partial<OpenAiModelDescription>[]): void;
|
|
13
|
+
protected handleRequestSettingsChanges(newSettings: RequestSetting[]): void;
|
|
14
|
+
protected createOpenAIModelDescription(modelId: string, requestSettings: RequestSetting[]): OpenAiModelDescription;
|
|
15
|
+
protected createCustomModelDescriptionsFromPreferences(preferences: Partial<OpenAiModelDescription>[], requestSettings: RequestSetting[]): OpenAiModelDescription[];
|
|
16
|
+
protected getMatchingRequestSetting(modelId: string, providerId: string, requestSettings: RequestSetting[]): RequestSetting | undefined;
|
|
9
17
|
}
|
|
10
18
|
//# sourceMappingURL=openai-frontend-application-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/openai-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"openai-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/openai-frontend-application-contribution.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEhF,OAAO,EAAoC,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAIlH,qBACa,qCAAsC,YAAW,+BAA+B;IAGzF,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAG/C,SAAS,CAAC,OAAO,EAAE,2BAA2B,CAAC;IAE/C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IACpC,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAAE,CAAM;IAEnE,OAAO,IAAI,IAAI;IA4Bf,SAAS,CAAC,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAavD,OAAO,CAAC,sBAAsB;IAI9B,SAAS,CAAC,wBAAwB,CAAC,eAAe,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAAE,GAAG,IAAI;IAsB5F,SAAS,CAAC,4BAA4B,CAAC,WAAW,EAAE,cAAc,EAAE,GAAG,IAAI;IAQ3E,SAAS,CAAC,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,sBAAsB;IAelH,SAAS,CAAC,4CAA4C,CAClD,WAAW,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAAE,EAC9C,eAAe,EAAE,cAAc,EAAE,GAClC,sBAAsB,EAAE;IAwB3B,SAAS,CAAC,yBAAyB,CAC/B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,cAAc,EAAE,GAClC,cAAc,GAAG,SAAS;CAWhC"}
|
|
@@ -21,9 +21,10 @@ const browser_1 = require("@theia/core/lib/browser");
|
|
|
21
21
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
22
|
const common_1 = require("../common");
|
|
23
23
|
const openai_preferences_1 = require("./openai-preferences");
|
|
24
|
+
const ai_core_preferences_1 = require("@theia/ai-core/lib/browser/ai-core-preferences");
|
|
25
|
+
const OPENAI_PROVIDER_ID = 'openai';
|
|
24
26
|
let OpenAiFrontendApplicationContribution = class OpenAiFrontendApplicationContribution {
|
|
25
27
|
constructor() {
|
|
26
|
-
// The preferenceChange.oldValue is always undefined for some reason
|
|
27
28
|
this.prevModels = [];
|
|
28
29
|
this.prevCustomModels = [];
|
|
29
30
|
}
|
|
@@ -32,35 +33,108 @@ let OpenAiFrontendApplicationContribution = class OpenAiFrontendApplicationContr
|
|
|
32
33
|
const apiKey = this.preferenceService.get(openai_preferences_1.API_KEY_PREF, undefined);
|
|
33
34
|
this.manager.setApiKey(apiKey);
|
|
34
35
|
const models = this.preferenceService.get(openai_preferences_1.MODELS_PREF, []);
|
|
35
|
-
this.
|
|
36
|
+
const requestSettings = this.getRequestSettingsPref();
|
|
37
|
+
this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createOpenAIModelDescription(modelId, requestSettings)));
|
|
36
38
|
this.prevModels = [...models];
|
|
37
39
|
const customModels = this.preferenceService.get(openai_preferences_1.CUSTOM_ENDPOINTS_PREF, []);
|
|
38
|
-
this.manager.createOrUpdateLanguageModels(...createCustomModelDescriptionsFromPreferences(customModels));
|
|
40
|
+
this.manager.createOrUpdateLanguageModels(...this.createCustomModelDescriptionsFromPreferences(customModels, this.getRequestSettingsPref()));
|
|
39
41
|
this.prevCustomModels = [...customModels];
|
|
40
42
|
this.preferenceService.onPreferenceChanged(event => {
|
|
41
43
|
if (event.preferenceName === openai_preferences_1.API_KEY_PREF) {
|
|
42
44
|
this.manager.setApiKey(event.newValue);
|
|
43
45
|
}
|
|
44
46
|
else if (event.preferenceName === openai_preferences_1.MODELS_PREF) {
|
|
45
|
-
|
|
46
|
-
const newModels = new Set(event.newValue);
|
|
47
|
-
const modelsToRemove = [...oldModels].filter(model => !newModels.has(model));
|
|
48
|
-
const modelsToAdd = [...newModels].filter(model => !oldModels.has(model));
|
|
49
|
-
this.manager.removeLanguageModels(...modelsToRemove.map(model => `openai/${model}`));
|
|
50
|
-
this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(createOpenAIModelDescription));
|
|
51
|
-
this.prevModels = [...event.newValue];
|
|
47
|
+
this.handleModelChanges(event.newValue);
|
|
52
48
|
}
|
|
53
49
|
else if (event.preferenceName === openai_preferences_1.CUSTOM_ENDPOINTS_PREF) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.manager.removeLanguageModels(...modelsToRemove.map(model => model.id));
|
|
59
|
-
this.manager.createOrUpdateLanguageModels(...modelsToAddOrUpdate);
|
|
50
|
+
this.handleCustomModelChanges(event.newValue);
|
|
51
|
+
}
|
|
52
|
+
else if (event.preferenceName === ai_core_preferences_1.PREFERENCE_NAME_REQUEST_SETTINGS) {
|
|
53
|
+
this.handleRequestSettingsChanges(event.newValue);
|
|
60
54
|
}
|
|
61
55
|
});
|
|
62
56
|
});
|
|
63
57
|
}
|
|
58
|
+
handleModelChanges(newModels) {
|
|
59
|
+
const oldModels = new Set(this.prevModels);
|
|
60
|
+
const updatedModels = new Set(newModels);
|
|
61
|
+
const modelsToRemove = [...oldModels].filter(model => !updatedModels.has(model));
|
|
62
|
+
const modelsToAdd = [...updatedModels].filter(model => !oldModels.has(model));
|
|
63
|
+
this.manager.removeLanguageModels(...modelsToRemove.map(model => `openai/${model}`));
|
|
64
|
+
const requestSettings = this.getRequestSettingsPref();
|
|
65
|
+
this.manager.createOrUpdateLanguageModels(...modelsToAdd.map(modelId => this.createOpenAIModelDescription(modelId, requestSettings)));
|
|
66
|
+
this.prevModels = newModels;
|
|
67
|
+
}
|
|
68
|
+
getRequestSettingsPref() {
|
|
69
|
+
return this.preferenceService.get(ai_core_preferences_1.PREFERENCE_NAME_REQUEST_SETTINGS, []);
|
|
70
|
+
}
|
|
71
|
+
handleCustomModelChanges(newCustomModels) {
|
|
72
|
+
const requestSettings = this.getRequestSettingsPref();
|
|
73
|
+
const oldModels = this.createCustomModelDescriptionsFromPreferences(this.prevCustomModels, requestSettings);
|
|
74
|
+
const newModels = this.createCustomModelDescriptionsFromPreferences(newCustomModels, requestSettings);
|
|
75
|
+
const modelsToRemove = oldModels.filter(model => !newModels.some(newModel => newModel.id === model.id));
|
|
76
|
+
const modelsToAddOrUpdate = newModels.filter(newModel => !oldModels.some(model => model.id === newModel.id &&
|
|
77
|
+
model.model === newModel.model &&
|
|
78
|
+
model.url === newModel.url &&
|
|
79
|
+
model.apiKey === newModel.apiKey &&
|
|
80
|
+
model.apiVersion === newModel.apiVersion &&
|
|
81
|
+
model.supportsDeveloperMessage === newModel.supportsDeveloperMessage &&
|
|
82
|
+
model.supportsStructuredOutput === newModel.supportsStructuredOutput &&
|
|
83
|
+
model.enableStreaming === newModel.enableStreaming));
|
|
84
|
+
this.manager.removeLanguageModels(...modelsToRemove.map(model => model.id));
|
|
85
|
+
this.manager.createOrUpdateLanguageModels(...modelsToAddOrUpdate);
|
|
86
|
+
this.prevCustomModels = [...newCustomModels];
|
|
87
|
+
}
|
|
88
|
+
handleRequestSettingsChanges(newSettings) {
|
|
89
|
+
const models = this.preferenceService.get(openai_preferences_1.MODELS_PREF, []);
|
|
90
|
+
this.manager.createOrUpdateLanguageModels(...models.map(modelId => this.createOpenAIModelDescription(modelId, newSettings)));
|
|
91
|
+
const customModels = this.preferenceService.get(openai_preferences_1.CUSTOM_ENDPOINTS_PREF, []);
|
|
92
|
+
this.manager.createOrUpdateLanguageModels(...this.createCustomModelDescriptionsFromPreferences(customModels, newSettings));
|
|
93
|
+
}
|
|
94
|
+
createOpenAIModelDescription(modelId, requestSettings) {
|
|
95
|
+
const id = `${OPENAI_PROVIDER_ID}/${modelId}`;
|
|
96
|
+
const modelRequestSetting = this.getMatchingRequestSetting(modelId, OPENAI_PROVIDER_ID, requestSettings);
|
|
97
|
+
return {
|
|
98
|
+
id: id,
|
|
99
|
+
model: modelId,
|
|
100
|
+
apiKey: true,
|
|
101
|
+
apiVersion: true,
|
|
102
|
+
supportsDeveloperMessage: !openAIModelsNotSupportingDeveloperMessages.includes(modelId),
|
|
103
|
+
enableStreaming: !openAIModelsWithDisabledStreaming.includes(modelId),
|
|
104
|
+
supportsStructuredOutput: !openAIModelsWithoutStructuredOutput.includes(modelId),
|
|
105
|
+
defaultRequestSettings: modelRequestSetting === null || modelRequestSetting === void 0 ? void 0 : modelRequestSetting.requestSettings
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
createCustomModelDescriptionsFromPreferences(preferences, requestSettings) {
|
|
109
|
+
return preferences.reduce((acc, pref) => {
|
|
110
|
+
var _a, _b, _c;
|
|
111
|
+
if (!pref.model || !pref.url || typeof pref.model !== 'string' || typeof pref.url !== 'string') {
|
|
112
|
+
return acc;
|
|
113
|
+
}
|
|
114
|
+
const modelRequestSetting = this.getMatchingRequestSetting(pref.model, OPENAI_PROVIDER_ID, requestSettings);
|
|
115
|
+
return [
|
|
116
|
+
...acc,
|
|
117
|
+
{
|
|
118
|
+
id: pref.id && typeof pref.id === 'string' ? pref.id : pref.model,
|
|
119
|
+
model: pref.model,
|
|
120
|
+
url: pref.url,
|
|
121
|
+
apiKey: typeof pref.apiKey === 'string' || pref.apiKey === true ? pref.apiKey : undefined,
|
|
122
|
+
apiVersion: typeof pref.apiVersion === 'string' || pref.apiVersion === true ? pref.apiVersion : undefined,
|
|
123
|
+
supportsDeveloperMessage: (_a = pref.supportsDeveloperMessage) !== null && _a !== void 0 ? _a : true,
|
|
124
|
+
supportsStructuredOutput: (_b = pref.supportsStructuredOutput) !== null && _b !== void 0 ? _b : true,
|
|
125
|
+
enableStreaming: (_c = pref.enableStreaming) !== null && _c !== void 0 ? _c : true,
|
|
126
|
+
defaultRequestSettings: modelRequestSetting === null || modelRequestSetting === void 0 ? void 0 : modelRequestSetting.requestSettings
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
}, []);
|
|
130
|
+
}
|
|
131
|
+
getMatchingRequestSetting(modelId, providerId, requestSettings) {
|
|
132
|
+
const matchingSettings = requestSettings.filter(setting => (!setting.providerId || setting.providerId === providerId) && setting.modelId === modelId);
|
|
133
|
+
if (matchingSettings.length > 1) {
|
|
134
|
+
console.warn(`Multiple entries found for provider "${providerId}" and model "${modelId}". Using the first match.`);
|
|
135
|
+
}
|
|
136
|
+
return matchingSettings[0];
|
|
137
|
+
}
|
|
64
138
|
};
|
|
65
139
|
exports.OpenAiFrontendApplicationContribution = OpenAiFrontendApplicationContribution;
|
|
66
140
|
tslib_1.__decorate([
|
|
@@ -74,27 +148,7 @@ tslib_1.__decorate([
|
|
|
74
148
|
exports.OpenAiFrontendApplicationContribution = OpenAiFrontendApplicationContribution = tslib_1.__decorate([
|
|
75
149
|
(0, inversify_1.injectable)()
|
|
76
150
|
], OpenAiFrontendApplicationContribution);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
model: modelId,
|
|
81
|
-
apiKey: true
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
function createCustomModelDescriptionsFromPreferences(preferences) {
|
|
85
|
-
return preferences.reduce((acc, pref) => {
|
|
86
|
-
if (!pref.model || !pref.url || typeof pref.model !== 'string' || typeof pref.url !== 'string') {
|
|
87
|
-
return acc;
|
|
88
|
-
}
|
|
89
|
-
return [
|
|
90
|
-
...acc,
|
|
91
|
-
{
|
|
92
|
-
id: pref.id && typeof pref.id === 'string' ? pref.id : pref.model,
|
|
93
|
-
model: pref.model,
|
|
94
|
-
url: pref.url,
|
|
95
|
-
apiKey: typeof pref.apiKey === 'string' || pref.apiKey === true ? pref.apiKey : undefined
|
|
96
|
-
}
|
|
97
|
-
];
|
|
98
|
-
}, []);
|
|
99
|
-
}
|
|
151
|
+
const openAIModelsWithDisabledStreaming = ['o1'];
|
|
152
|
+
const openAIModelsNotSupportingDeveloperMessages = ['o1-preview', 'o1-mini'];
|
|
153
|
+
const openAIModelsWithoutStructuredOutput = ['o1-preview', 'gpt-4-turbo', 'gpt-4', 'gpt-3.5-turbo', 'o1-mini', 'gpt-4o-2024-05-13'];
|
|
100
154
|
//# sourceMappingURL=openai-frontend-application-contribution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/openai-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;;;;AAEhF,qDAA6F;AAC7F,4DAAkE;AAClE,sCAAgF;AAChF,6DAAwF;
|
|
1
|
+
{"version":3,"file":"openai-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/openai-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;;;;AAEhF,qDAA6F;AAC7F,4DAAkE;AAClE,sCAAgF;AAChF,6DAAwF;AACxF,wFAAkH;AAElH,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAG7B,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QAQO,eAAU,GAAa,EAAE,CAAC;QAC1B,qBAAgB,GAAsC,EAAE,CAAC;IAsIvE,CAAC;IApIG,OAAO;QACH,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAS,iCAAY,EAAE,SAAS,CAAC,CAAC;YAC3E,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAE/B,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAW,gCAAW,EAAE,EAAE,CAAC,CAAC;YACrE,MAAM,eAAe,GAAG,IAAI,CAAC,sBAAsB,EAAE,CAAC;YACtD,IAAI,CAAC,OAAO,CAAC,4BAA4B,CAAC,GAAG,MAAM,CAAC,GAA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AAwC,UAAU,gBAAgB,OAAO,2BAA2B,CACvG,CAAC;QACN,CAAC;QACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AA/IY,sFAAqC;AAGpC;IADT,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;gFACqB;AAGrC;IADT,IAAA,kBAAM,EAAC,oCAA2B,CAAC;;sEACW;gDANtC,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CA+IjD;AAED,MAAM,iCAAiC,GAAG,CAAC,IAAI,CAAC,CAAC;AACjD,MAAM,0CAA0C,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAC7E,MAAM,mCAAmC,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/openai-preferences.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAG/F,eAAO,MAAM,YAAY,4CAA4C,CAAC;AACtE,eAAO,MAAM,WAAW,oDAAoD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AAEnF,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"openai-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/openai-preferences.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAG/F,eAAO,MAAM,YAAY,4CAA4C,CAAC;AACtE,eAAO,MAAM,WAAW,oDAAoD,CAAC;AAC7E,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AAEnF,eAAO,MAAM,uBAAuB,EAAE,gBA8ErC,CAAC"}
|
|
@@ -33,7 +33,7 @@ exports.OpenAiPreferencesSchema = {
|
|
|
33
33
|
type: 'array',
|
|
34
34
|
description: 'Official OpenAI models to use',
|
|
35
35
|
title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
|
|
36
|
-
default: ['gpt-4o', 'gpt-4o-2024-
|
|
36
|
+
default: ['gpt-4o', 'gpt-4o-2024-11-20', 'gpt-4o-2024-08-06', 'gpt-4o-mini', 'o1', 'o1-mini', 'o3-mini'],
|
|
37
37
|
items: {
|
|
38
38
|
type: 'string'
|
|
39
39
|
}
|
|
@@ -49,6 +49,14 @@ exports.OpenAiPreferencesSchema = {
|
|
|
49
49
|
\n\
|
|
50
50
|
- provide an `apiKey` to access the API served at the given url. Use `true` to indicate the use of the global OpenAI API key.\
|
|
51
51
|
\n\
|
|
52
|
+
- provide an `apiVersion` to access the API served at the given url in Azure. Use `true` to indicate the use of the global OpenAI API version.\
|
|
53
|
+
\n\
|
|
54
|
+
- specify `supportsDeveloperMessage: false` to indicate that the developer role shall not be used.\
|
|
55
|
+
\n\
|
|
56
|
+
- specify `supportsStructuredOutput: false` to indicate that structured output shall not be used.\
|
|
57
|
+
\n\
|
|
58
|
+
- specify `enableStreaming: false` to indicate that streaming shall not be used.\
|
|
59
|
+
\n\
|
|
52
60
|
Refer to [our documentation](https://theia-ide.org/docs/user_ai/#openai-compatible-models-eg-via-vllm) for more information.',
|
|
53
61
|
default: [],
|
|
54
62
|
items: {
|
|
@@ -70,6 +78,22 @@ exports.OpenAiPreferencesSchema = {
|
|
|
70
78
|
type: ['string', 'boolean'],
|
|
71
79
|
title: 'Either the key to access the API served at the given url or `true` to use the global OpenAI API key',
|
|
72
80
|
},
|
|
81
|
+
apiVersion: {
|
|
82
|
+
type: ['string', 'boolean'],
|
|
83
|
+
title: 'Either the version to access the API served at the given url in Azure or `true` to use the global OpenAI API version',
|
|
84
|
+
},
|
|
85
|
+
supportsDeveloperMessage: {
|
|
86
|
+
type: 'boolean',
|
|
87
|
+
title: 'Indicates whether the model supports the `developer` role. `true` by default.',
|
|
88
|
+
},
|
|
89
|
+
supportsStructuredOutput: {
|
|
90
|
+
type: 'boolean',
|
|
91
|
+
title: 'Indicates whether the model supports structured output. `true` by default.',
|
|
92
|
+
},
|
|
93
|
+
enableStreaming: {
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
title: 'Indicates whether the streaming API shall be used. `true` by default.',
|
|
96
|
+
}
|
|
73
97
|
}
|
|
74
98
|
}
|
|
75
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-preferences.js","sourceRoot":"","sources":["../../src/browser/openai-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;;;AAGhF,wFAA2F;AAE9E,QAAA,YAAY,GAAG,yCAAyC,CAAC;AACzD,QAAA,WAAW,GAAG,iDAAiD,CAAC;AAChE,QAAA,qBAAqB,GAAG,6CAA6C,CAAC;AAEtE,QAAA,uBAAuB,GAAqB;IACrD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACR,CAAC,oBAAY,CAAC,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,mBAAmB,EAAE;iHACgF;YACrG,KAAK,EAAE,+CAAyB;SACnC;QACD,CAAC,mBAAW,CAAC,EAAE;YACX,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,+BAA+B;YAC5C,KAAK,EAAE,+CAAyB;YAChC,OAAO,EAAE,CAAC,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"openai-preferences.js","sourceRoot":"","sources":["../../src/browser/openai-preferences.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE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,EAAE,SAAS,CAAC;wBAC3B,KAAK,EAAE,qGAAqG;qBAC/G;oBACD,UAAU,EAAE;wBACR,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;wBAC3B,KAAK,EAAE,sHAAsH;qBAChI;oBACD,wBAAwB,EAAE;wBACtB,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,+EAA+E;qBACzF;oBACD,wBAAwB,EAAE;wBACtB,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,4EAA4E;qBACtF;oBACD,eAAe,EAAE;wBACb,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,uEAAuE;qBACjF;iBACJ;aACJ;SACJ;KACJ;CACJ,CAAC"}
|
|
@@ -17,10 +17,33 @@ export interface OpenAiModelDescription {
|
|
|
17
17
|
* The key for the model. If 'true' is provided the global OpenAI API key will be used.
|
|
18
18
|
*/
|
|
19
19
|
apiKey: string | true | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The version for the api. If 'true' is provided the global OpenAI version will be used.
|
|
22
|
+
*/
|
|
23
|
+
apiVersion: string | true | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Indicate whether the streaming API shall be used.
|
|
26
|
+
*/
|
|
27
|
+
enableStreaming: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Flag to configure whether the OpenAPI model supports the `developer` role. Default is `true`.
|
|
30
|
+
*/
|
|
31
|
+
supportsDeveloperMessage: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Flag to configure whether the OpenAPI model supports structured output. Default is `true`.
|
|
34
|
+
*/
|
|
35
|
+
supportsStructuredOutput: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Default request settings for the OpenAI model.
|
|
38
|
+
*/
|
|
39
|
+
defaultRequestSettings?: {
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
20
42
|
}
|
|
21
43
|
export interface OpenAiLanguageModelsManager {
|
|
22
44
|
apiKey: string | undefined;
|
|
23
45
|
setApiKey(key: string | undefined): void;
|
|
46
|
+
setApiVersion(version: string | undefined): void;
|
|
24
47
|
createOrUpdateLanguageModels(...models: OpenAiModelDescription[]): Promise<void>;
|
|
25
48
|
removeLanguageModels(...modelIds: string[]): void;
|
|
26
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-language-models-manager.d.ts","sourceRoot":"","sources":["../../src/common/openai-language-models-manager.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,mCAAmC,6CAA6C,CAAC;AAC9F,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AACjF,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"openai-language-models-manager.d.ts","sourceRoot":"","sources":["../../src/common/openai-language-models-manager.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,mCAAmC,6CAA6C,CAAC;AAC9F,eAAO,MAAM,2BAA2B,eAAwC,CAAC;AACjF,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,sBAAsB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CACvD;AACD,MAAM,WAAW,2BAA2B;IACxC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACzC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjD,4BAA4B,CAAC,GAAG,MAAM,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjF,oBAAoB,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CACpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/openai-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"openai-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/openai-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAM/D,eAAO,MAAM,kBAAkB,eAA+B,CAAC;;AAW/D,wBAEG"}
|
|
@@ -20,10 +20,15 @@ const inversify_1 = require("@theia/core/shared/inversify");
|
|
|
20
20
|
const openai_language_models_manager_1 = require("../common/openai-language-models-manager");
|
|
21
21
|
const core_1 = require("@theia/core");
|
|
22
22
|
const openai_language_models_manager_impl_1 = require("./openai-language-models-manager-impl");
|
|
23
|
+
const connection_container_module_1 = require("@theia/core/lib/node/messaging/connection-container-module");
|
|
23
24
|
exports.OpenAiModelFactory = Symbol('OpenAiModelFactory');
|
|
24
|
-
|
|
25
|
+
// We use a connection module to handle AI services separately for each frontend.
|
|
26
|
+
const openAiConnectionModule = connection_container_module_1.ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => {
|
|
25
27
|
bind(openai_language_models_manager_impl_1.OpenAiLanguageModelsManagerImpl).toSelf().inSingletonScope();
|
|
26
28
|
bind(openai_language_models_manager_1.OpenAiLanguageModelsManager).toService(openai_language_models_manager_impl_1.OpenAiLanguageModelsManagerImpl);
|
|
27
29
|
bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(openai_language_models_manager_1.OPENAI_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(openai_language_models_manager_1.OpenAiLanguageModelsManager))).inSingletonScope();
|
|
28
30
|
});
|
|
31
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
32
|
+
bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(openAiConnectionModule);
|
|
33
|
+
});
|
|
29
34
|
//# sourceMappingURL=openai-backend-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-backend-module.js","sourceRoot":"","sources":["../../src/node/openai-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,6FAA4H;AAC5H,sCAAsE;AACtE,+FAAwF;
|
|
1
|
+
{"version":3,"file":"openai-backend-module.js","sourceRoot":"","sources":["../../src/node/openai-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,6FAA4H;AAC5H,sCAAsE;AACtE,+FAAwF;AACxF,4GAAuG;AAE1F,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAE/D,iFAAiF;AACjF,MAAM,sBAAsB,GAAG,uDAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,EAAE,EAAE;IAClH,IAAI,CAAC,qEAA+B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAClE,IAAI,CAAC,4DAA2B,CAAC,CAAC,SAAS,CAAC,qEAA+B,CAAC,CAAC;IAC7E,IAAI,CAAC,wBAAiB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CACzC,IAAI,2BAAoB,CAAC,oEAAmC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,4DAA2B,CAAC,CAAC,CACtH,CAAC,gBAAgB,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,uDAAyB,CAAC,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;AAC5E,CAAC,CAAC,CAAC"}
|
|
@@ -1,23 +1,40 @@
|
|
|
1
|
-
import { LanguageModel, LanguageModelParsedResponse, LanguageModelRequest, LanguageModelResponse, LanguageModelTextResponse } from '@theia/ai-core';
|
|
1
|
+
import { LanguageModel, LanguageModelParsedResponse, LanguageModelRequest, LanguageModelRequestMessage, LanguageModelResponse, LanguageModelTextResponse } from '@theia/ai-core';
|
|
2
2
|
import { CancellationToken } from '@theia/core';
|
|
3
|
-
import OpenAI from 'openai';
|
|
3
|
+
import { OpenAI } from 'openai';
|
|
4
4
|
import { RunnableToolFunctionWithoutParse } from 'openai/lib/RunnableFunction';
|
|
5
|
+
import { ChatCompletionMessageParam } from 'openai/resources';
|
|
5
6
|
export declare const OpenAiModelIdentifier: unique symbol;
|
|
6
7
|
export declare class OpenAiModel implements LanguageModel {
|
|
7
8
|
readonly id: string;
|
|
8
9
|
model: string;
|
|
10
|
+
enableStreaming: boolean;
|
|
9
11
|
apiKey: () => string | undefined;
|
|
12
|
+
apiVersion: () => string | undefined;
|
|
13
|
+
supportsDeveloperMessage: boolean;
|
|
14
|
+
supportsStructuredOutput: boolean;
|
|
10
15
|
url: string | undefined;
|
|
16
|
+
defaultRequestSettings?: {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
} | undefined;
|
|
11
19
|
/**
|
|
12
20
|
* @param id the unique id for this language model. It will be used to identify the model in the UI.
|
|
13
21
|
* @param model the model id as it is used by the OpenAI API
|
|
14
|
-
* @param
|
|
22
|
+
* @param enableStreaming whether the streaming API shall be used
|
|
23
|
+
* @param apiKey a function that returns the API key to use for this model, called on each request
|
|
24
|
+
* @param apiVersion a function that returns the OpenAPI version to use for this model, called on each request
|
|
25
|
+
* @param supportsDeveloperMessage whether the model supports the `developer` role
|
|
26
|
+
* @param url the OpenAI API compatible endpoint where the model is hosted. If not provided the default OpenAI endpoint will be used.
|
|
27
|
+
* @param defaultRequestSettings optional default settings for requests made using this model.
|
|
15
28
|
*/
|
|
16
|
-
constructor(id: string, model: string, apiKey: () => string | undefined, url: string | undefined
|
|
29
|
+
constructor(id: string, model: string, enableStreaming: boolean, apiKey: () => string | undefined, apiVersion: () => string | undefined, supportsDeveloperMessage: boolean, supportsStructuredOutput: boolean, url: string | undefined, defaultRequestSettings?: {
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
} | undefined);
|
|
32
|
+
protected getSettings(request: LanguageModelRequest): Record<string, unknown>;
|
|
17
33
|
request(request: LanguageModelRequest, cancellationToken?: CancellationToken): Promise<LanguageModelResponse>;
|
|
18
34
|
protected handleNonStreamingRequest(openai: OpenAI, request: LanguageModelRequest): Promise<LanguageModelTextResponse>;
|
|
19
|
-
protected
|
|
20
|
-
protected
|
|
35
|
+
protected toOpenAIMessage(message: LanguageModelRequestMessage): ChatCompletionMessageParam;
|
|
36
|
+
protected toOpenAiRole(message: LanguageModelRequestMessage): 'developer' | 'user' | 'assistant';
|
|
37
|
+
protected isNonStreamingModel(_model: string): boolean;
|
|
21
38
|
protected handleStructuredOutputRequest(openai: OpenAI, request: LanguageModelRequest): Promise<LanguageModelParsedResponse>;
|
|
22
39
|
private getCompletionContent;
|
|
23
40
|
protected createTools(request: LanguageModelRequest): RunnableToolFunctionWithoutParse[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-language-model.d.ts","sourceRoot":"","sources":["../../src/node/openai-language-model.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,aAAa,EACb,2BAA2B,EAC3B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"openai-language-model.d.ts","sourceRoot":"","sources":["../../src/node/openai-language-model.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,aAAa,EACb,2BAA2B,EAC3B,oBAAoB,EACpB,2BAA2B,EAC3B,qBAAqB,EAErB,yBAAyB,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAe,MAAM,QAAQ,CAAC;AAE7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D,eAAO,MAAM,qBAAqB,eAAkC,CAAC;AAErE,qBAAa,WAAY,YAAW,aAAa;aAazB,EAAE,EAAE,MAAM;IACnB,KAAK,EAAE,MAAM;IACb,eAAe,EAAE,OAAO;IACxB,MAAM,EAAE,MAAM,MAAM,GAAG,SAAS;IAChC,UAAU,EAAE,MAAM,MAAM,GAAG,SAAS;IACpC,wBAAwB,EAAE,OAAO;IACjC,wBAAwB,EAAE,OAAO;IACjC,GAAG,EAAE,MAAM,GAAG,SAAS;IACvB,sBAAsB,CAAC;;;IAnBlC;;;;;;;;;OASG;gBAEiB,EAAE,EAAE,MAAM,EACnB,KAAK,EA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