deploy: current vibn theia state
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// *****************************************************************************
|
||||
// Copyright (C) 2025 EclipseSource GmbH.
|
||||
//
|
||||
// This program and the accompanying materials are made available under the
|
||||
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||
// http://www.eclipse.org/legal/epl-2.0.
|
||||
//
|
||||
// This Source Code may also be made available under the following Secondary
|
||||
// Licenses when the conditions for such availability set forth in the Eclipse
|
||||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
||||
// with the GNU Classpath Exception which is available at
|
||||
// https://www.gnu.org/software/classpath/license.html.
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
||||
// *****************************************************************************
|
||||
export const GOOGLE_LANGUAGE_MODELS_MANAGER_PATH = '/services/google/language-model-manager';
|
||||
export const GoogleLanguageModelsManager = Symbol('GoogleLanguageModelsManager');
|
||||
export interface GoogleModelDescription {
|
||||
/**
|
||||
* The identifier of the model which will be shown in the UI.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The model ID as used by the Google Gemini API.
|
||||
*/
|
||||
model: string;
|
||||
/**
|
||||
* The key for the model. If 'true' is provided the global Gemini API key will be used.
|
||||
*/
|
||||
apiKey: string | true | undefined;
|
||||
/**
|
||||
* Indicate whether the streaming API shall be used.
|
||||
*/
|
||||
enableStreaming: boolean;
|
||||
/**
|
||||
* Maximum number of tokens to generate. Default is 4096.
|
||||
*/
|
||||
maxTokens?: number;
|
||||
|
||||
}
|
||||
|
||||
export interface GoogleLanguageModelsManager {
|
||||
apiKey: string | undefined;
|
||||
setApiKey(key: string | undefined): void;
|
||||
setMaxRetriesOnErrors(maxRetries: number): void;
|
||||
setRetryDelayOnRateLimitError(retryDelay: number): void;
|
||||
setRetryDelayOnOtherErrors(retryDelay: number): void;
|
||||
createOrUpdateLanguageModels(...models: GoogleModelDescription[]): Promise<void>;
|
||||
removeLanguageModels(...modelIds: string[]): void
|
||||
}
|
||||
71
packages/ai-google/src/common/google-preferences.ts
Normal file
71
packages/ai-google/src/common/google-preferences.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
// *****************************************************************************
|
||||
// Copyright (C) 2025 EclipseSource GmbH.
|
||||
//
|
||||
// This program and the accompanying materials are made available under the
|
||||
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||
// http://www.eclipse.org/legal/epl-2.0.
|
||||
//
|
||||
// This Source Code may also be made available under the following Secondary
|
||||
// Licenses when the conditions for such availability set forth in the Eclipse
|
||||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
||||
// with the GNU Classpath Exception which is available at
|
||||
// https://www.gnu.org/software/classpath/license.html.
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
||||
// *****************************************************************************
|
||||
|
||||
import { AI_CORE_PREFERENCES_TITLE } from '@theia/ai-core/lib/common/ai-core-preferences';
|
||||
import { nls, PreferenceSchema } from '@theia/core';
|
||||
|
||||
export const API_KEY_PREF = 'ai-features.google.apiKey';
|
||||
export const MODELS_PREF = 'ai-features.google.models';
|
||||
export const MAX_RETRIES = 'ai-features.google.maxRetriesOnErrors';
|
||||
export const RETRY_DELAY_RATE_LIMIT = 'ai-features.google.retryDelayOnRateLimitError';
|
||||
export const RETRY_DELAY_OTHER_ERRORS = 'ai-features.google.retryDelayOnOtherErrors';
|
||||
|
||||
export const GooglePreferencesSchema: PreferenceSchema = {
|
||||
properties: {
|
||||
[API_KEY_PREF]: {
|
||||
type: 'string',
|
||||
markdownDescription: nls.localize('theia/ai/google/apiKey/description',
|
||||
'Enter an API Key of your official Google AI (Gemini) Account. **Please note:** By using this preference the GOOGLE AI API key will be stored in clear text\
|
||||
on the machine running Theia. Use the environment variable `GOOGLE_API_KEY` to set the key securely.'),
|
||||
title: AI_CORE_PREFERENCES_TITLE,
|
||||
},
|
||||
[MODELS_PREF]: {
|
||||
type: 'array',
|
||||
description: nls.localize('theia/ai/google/models/description', 'Official Google Gemini models to use'),
|
||||
title: AI_CORE_PREFERENCES_TITLE,
|
||||
default: ['gemini-3-pro-preview', 'gemini-3-flash-preview', 'gemini-2.5-pro', 'gemini-2.5-flash'],
|
||||
items: {
|
||||
type: 'string'
|
||||
}
|
||||
},
|
||||
[MAX_RETRIES]: {
|
||||
type: 'integer',
|
||||
description: nls.localize('theia/ai/google/maxRetriesOnErrors/description',
|
||||
'Maximum number of retries in case of errors. If smaller than 1, then the retry logic is disabled'),
|
||||
title: AI_CORE_PREFERENCES_TITLE,
|
||||
default: 3,
|
||||
minimum: 0
|
||||
},
|
||||
[RETRY_DELAY_RATE_LIMIT]: {
|
||||
type: 'number',
|
||||
description: nls.localize('theia/ai/google/retryDelayOnRateLimitError/description',
|
||||
'Delay in seconds between retries in case of rate limit errors. See https://ai.google.dev/gemini-api/docs/rate-limits'),
|
||||
title: AI_CORE_PREFERENCES_TITLE,
|
||||
default: 60,
|
||||
minimum: 0
|
||||
},
|
||||
[RETRY_DELAY_OTHER_ERRORS]: {
|
||||
type: 'number',
|
||||
description: nls.localize('theia/ai/google/retryDelayOnOtherErrors/description',
|
||||
'Delay in seconds between retries in case of other errors (sometimes the Google GenAI reports errors such as incomplete JSON syntax returned from the model \
|
||||
or 500 Internal Server Error). Setting this to -1 prevents retries in these cases. Otherwise a retry happens either immediately (if set to 0) or after \
|
||||
this delay in seconds (if set to a positive number).'),
|
||||
title: AI_CORE_PREFERENCES_TITLE,
|
||||
default: -1,
|
||||
minimum: -1
|
||||
}
|
||||
}
|
||||
};
|
||||
16
packages/ai-google/src/common/index.ts
Normal file
16
packages/ai-google/src/common/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
// *****************************************************************************
|
||||
// Copyright (C) 2025 EclipseSource GmbH.
|
||||
//
|
||||
// This program and the accompanying materials are made available under the
|
||||
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||
// http://www.eclipse.org/legal/epl-2.0.
|
||||
//
|
||||
// This Source Code may also be made available under the following Secondary
|
||||
// Licenses when the conditions for such availability set forth in the Eclipse
|
||||
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
||||
// with the GNU Classpath Exception which is available at
|
||||
// https://www.gnu.org/software/classpath/license.html.
|
||||
//
|
||||
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
||||
// *****************************************************************************
|
||||
export * from './google-language-models-manager';
|
||||
Reference in New Issue
Block a user