mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Inference AI Connector] Added elastic provider for EIS and enhancements (#205672)](https://github.com/elastic/kibana/pull/205672) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Yuliia Naumenko","email":"jo.naumenko@gmail.com"},"sourceCommit":{"committedDate":"2025-01-23T02:32:57Z","message":"[Inference AI Connector] Added elastic provider for EIS and enhancements (#205672)\n\n## Summary\r\n\r\nCurrent PR creates a new platform shared plugin named\r\n`inference_endpoint` to expose in Kibana the new internal API\r\n`_inference/_services`, which returns the list of inference providers\r\nwith the configuration settings.\r\n\r\nChanged `@kbn/inference_endpoint_ui_common` package to fetch dynamically\r\nthe list of providers by using the route introduced in\r\n`inference_endpoint` plugin.\r\nAdded fields settings filter based on the selected task in the\r\n`supported_task_types`.\r\n\r\nCleaned up the types consolidating all in the package\r\n`@kbn/inference_endpoint_ui_common`.\r\nChanged .inference connector to use `unified_completion` subAction for\r\nselected `chat_completion` task type.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: pgayvallet <pierre.gayvallet@elastic.co>","sha":"7f98b6bf5dc161b513abf4a85a893029e8ba5fee","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","ci:project-deploy-elasticsearch","backport:version","8.18 candidate","v8.18.0"],"title":"[Inference AI Connector] Added elastic provider for EIS and enhancements","number":205672,"url":"https://github.com/elastic/kibana/pull/205672","mergeCommit":{"message":"[Inference AI Connector] Added elastic provider for EIS and enhancements (#205672)\n\n## Summary\r\n\r\nCurrent PR creates a new platform shared plugin named\r\n`inference_endpoint` to expose in Kibana the new internal API\r\n`_inference/_services`, which returns the list of inference providers\r\nwith the configuration settings.\r\n\r\nChanged `@kbn/inference_endpoint_ui_common` package to fetch dynamically\r\nthe list of providers by using the route introduced in\r\n`inference_endpoint` plugin.\r\nAdded fields settings filter based on the selected task in the\r\n`supported_task_types`.\r\n\r\nCleaned up the types consolidating all in the package\r\n`@kbn/inference_endpoint_ui_common`.\r\nChanged .inference connector to use `unified_completion` subAction for\r\nselected `chat_completion` task type.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: pgayvallet <pierre.gayvallet@elastic.co>","sha":"7f98b6bf5dc161b513abf4a85a893029e8ba5fee"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/205672","number":205672,"mergeCommit":{"message":"[Inference AI Connector] Added elastic provider for EIS and enhancements (#205672)\n\n## Summary\r\n\r\nCurrent PR creates a new platform shared plugin named\r\n`inference_endpoint` to expose in Kibana the new internal API\r\n`_inference/_services`, which returns the list of inference providers\r\nwith the configuration settings.\r\n\r\nChanged `@kbn/inference_endpoint_ui_common` package to fetch dynamically\r\nthe list of providers by using the route introduced in\r\n`inference_endpoint` plugin.\r\nAdded fields settings filter based on the selected task in the\r\n`supported_task_types`.\r\n\r\nCleaned up the types consolidating all in the package\r\n`@kbn/inference_endpoint_ui_common`.\r\nChanged .inference connector to use `unified_completion` subAction for\r\nselected `chat_completion` task type.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: pgayvallet <pierre.gayvallet@elastic.co>","sha":"7f98b6bf5dc161b513abf4a85a893029e8ba5fee"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: Yuliia Naumenko <jo.naumenko@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
edbf659486
commit
9b431dc5b1
41 changed files with 527 additions and 717 deletions
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -535,6 +535,7 @@ x-pack/platform/packages/shared/index-management/index_management_shared_types @
|
|||
test/plugin_functional/plugins/index_patterns @elastic/kibana-data-discovery
|
||||
x-pack/platform/packages/private/ml/inference_integration_flyout @elastic/ml-ui
|
||||
x-pack/platform/packages/shared/ai-infra/inference-common @elastic/appex-ai-infra
|
||||
x-pack/platform/plugins/shared/inference_endpoint @elastic/ml-ui
|
||||
x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common @elastic/response-ops @elastic/appex-ai-infra @elastic/obs-ai-assistant @elastic/security-generative-ai
|
||||
x-pack/platform/plugins/shared/inference @elastic/appex-ai-infra
|
||||
x-pack/platform/packages/private/kbn-infra-forge @elastic/obs-ux-management-team
|
||||
|
|
|
@ -645,6 +645,10 @@ Index Management by running this series of requests in Console:
|
|||
external LLM APIs. Its goals are:
|
||||
|
||||
|
||||
|{kib-repo}blob/{branch}/x-pack/platform/plugins/shared/inference_endpoint/README.md[inferenceEndpoint]
|
||||
|A Kibana plugin
|
||||
|
||||
|
||||
|{kib-repo}blob/{branch}/x-pack/solutions/observability/plugins/infra/README.md[infra]
|
||||
|This is the home of the infra plugin, which aims to provide a solution for
|
||||
the infrastructure monitoring use-case within Kibana.
|
||||
|
|
|
@ -573,6 +573,7 @@
|
|||
"@kbn/index-management-shared-types": "link:x-pack/platform/packages/shared/index-management/index_management_shared_types",
|
||||
"@kbn/index-patterns-test-plugin": "link:test/plugin_functional/plugins/index_patterns",
|
||||
"@kbn/inference-common": "link:x-pack/platform/packages/shared/ai-infra/inference-common",
|
||||
"@kbn/inference-endpoint-plugin": "link:x-pack/platform/plugins/shared/inference_endpoint",
|
||||
"@kbn/inference-endpoint-ui-common": "link:x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common",
|
||||
"@kbn/inference-plugin": "link:x-pack/platform/plugins/shared/inference",
|
||||
"@kbn/inference_integration_flyout": "link:x-pack/platform/packages/private/ml/inference_integration_flyout",
|
||||
|
|
|
@ -1064,6 +1064,8 @@
|
|||
"@kbn/inference_integration_flyout/*": ["x-pack/platform/packages/private/ml/inference_integration_flyout/*"],
|
||||
"@kbn/inference-common": ["x-pack/platform/packages/shared/ai-infra/inference-common"],
|
||||
"@kbn/inference-common/*": ["x-pack/platform/packages/shared/ai-infra/inference-common/*"],
|
||||
"@kbn/inference-endpoint-plugin": ["x-pack/platform/plugins/shared/inference_endpoint"],
|
||||
"@kbn/inference-endpoint-plugin/*": ["x-pack/platform/plugins/shared/inference_endpoint/*"],
|
||||
"@kbn/inference-endpoint-ui-common": ["x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common"],
|
||||
"@kbn/inference-endpoint-ui-common/*": ["x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common/*"],
|
||||
"@kbn/inference-plugin": ["x-pack/platform/plugins/shared/inference"],
|
||||
|
|
|
@ -15,7 +15,7 @@ export enum InferenceConnectorType {
|
|||
Inference = '.inference',
|
||||
}
|
||||
|
||||
export const COMPLETION_TASK_TYPE = 'completion';
|
||||
export const COMPLETION_TASK_TYPE = 'chat_completion';
|
||||
|
||||
const allSupportedConnectorTypes = Object.values(InferenceConnectorType);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FieldType } from '@kbn/search-connectors/types';
|
||||
import { FieldType } from '../../types/types';
|
||||
import { ensureBooleanType, ensureCorrectTyping, ensureStringType } from './configuration_utils';
|
||||
|
||||
describe('configuration utils', () => {
|
||||
|
|
|
@ -29,6 +29,7 @@ const mockProviders = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -38,6 +39,7 @@ const mockProviders = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/embeddings',
|
||||
|
@ -47,6 +49,7 @@ const mockProviders = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -63,6 +66,7 @@ const mockProviders = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -72,6 +76,7 @@ const mockProviders = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -88,6 +93,7 @@ const mockProviders = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -98,6 +104,7 @@ const mockProviders = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -107,6 +114,7 @@ const mockProviders = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -28,11 +28,16 @@ import { ConnectorFormSchema } from '@kbn/triggers-actions-ui-plugin/public';
|
|||
|
||||
import { HttpSetup, IToasts } from '@kbn/core/public';
|
||||
import * as LABELS from '../translations';
|
||||
import { Config, ConfigEntryView, FieldType, Secrets } from '../types/types';
|
||||
import { Config, ConfigEntryView, Secrets } from '../types/types';
|
||||
import { SERVICE_PROVIDERS } from './providers/render_service_provider/service_provider';
|
||||
import { DEFAULT_TASK_TYPE, ServiceProviderKeys } from '../constants';
|
||||
import { SelectableProvider } from './providers/selectable';
|
||||
import { TaskTypeOption, generateInferenceEndpointId, getTaskTypeOptions } from '../utils/helpers';
|
||||
import {
|
||||
TaskTypeOption,
|
||||
generateInferenceEndpointId,
|
||||
getTaskTypeOptions,
|
||||
mapProviderFields,
|
||||
} from '../utils/helpers';
|
||||
import { ConfigurationFormItems } from './configuration/configuration_form_items';
|
||||
import { AdditionalOptionsFields } from './additional_options_fields';
|
||||
import { ProviderSecretHiddenField } from './hidden_fields/provider_secret_hidden_field';
|
||||
|
@ -104,7 +109,7 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
|
|||
);
|
||||
|
||||
const onTaskTypeOptionsSelect = useCallback(
|
||||
(taskType: string) => {
|
||||
(taskType: string, providerSelected?: string) => {
|
||||
setSelectedTaskType(taskType);
|
||||
|
||||
const inferenceId = generateInferenceEndpointId({
|
||||
|
@ -112,14 +117,42 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
|
|||
taskType,
|
||||
});
|
||||
|
||||
const newProvider = providers?.find(
|
||||
(p) => p.service === (config.provider === '' ? providerSelected : config.provider)
|
||||
);
|
||||
if (newProvider) {
|
||||
const newProviderSchema: ConfigEntryView[] = mapProviderFields(taskType, newProvider);
|
||||
setProviderSchema(newProviderSchema);
|
||||
}
|
||||
|
||||
// Update config and secrets with the new set of fields + keeps the entered data for a common
|
||||
const newConfig = { ...(config.providerConfig ?? {}) };
|
||||
const newSecrets = { ...(secrets?.providerSecrets ?? {}) };
|
||||
Object.keys(config.providerConfig ?? {}).forEach((k) => {
|
||||
if (!newProvider?.configurations[k].supported_task_types.includes(taskType)) {
|
||||
delete newConfig[k];
|
||||
}
|
||||
});
|
||||
if (secrets && secrets?.providerSecrets) {
|
||||
Object.keys(secrets.providerSecrets).forEach((k) => {
|
||||
if (!newProvider?.configurations[k].supported_task_types.includes(taskType)) {
|
||||
delete newSecrets[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
updateFieldValues({
|
||||
config: {
|
||||
taskType,
|
||||
inferenceId,
|
||||
providerConfig: newConfig,
|
||||
},
|
||||
secrets: {
|
||||
providerSecrets: newSecrets,
|
||||
},
|
||||
});
|
||||
},
|
||||
[config, updateFieldValues]
|
||||
[config, providers, secrets, updateFieldValues]
|
||||
);
|
||||
|
||||
const onProviderChange = useCallback(
|
||||
|
@ -128,41 +161,28 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
|
|||
|
||||
setTaskTypeOptions(getTaskTypeOptions(newProvider?.task_types ?? []));
|
||||
if (newProvider?.task_types && newProvider?.task_types.length > 0) {
|
||||
onTaskTypeOptionsSelect(newProvider?.task_types[0]);
|
||||
onTaskTypeOptionsSelect(newProvider?.task_types[0], provider);
|
||||
}
|
||||
|
||||
const newProviderSchema: ConfigEntryView[] = Object.keys(
|
||||
newProvider?.configurations ?? {}
|
||||
).map(
|
||||
(k): ConfigEntryView => ({
|
||||
key: k,
|
||||
isValid: true,
|
||||
validationErrors: [],
|
||||
value: newProvider?.configurations[k].default_value ?? null,
|
||||
default_value: newProvider?.configurations[k].default_value ?? null,
|
||||
description: newProvider?.configurations[k].description ?? null,
|
||||
label: newProvider?.configurations[k].label ?? '',
|
||||
required: newProvider?.configurations[k].required ?? false,
|
||||
sensitive: newProvider?.configurations[k].sensitive ?? false,
|
||||
updatable: newProvider?.configurations[k].updatable ?? false,
|
||||
type: newProvider?.configurations[k].type ?? FieldType.STRING,
|
||||
})
|
||||
);
|
||||
|
||||
setProviderSchema(newProviderSchema);
|
||||
|
||||
const defaultProviderConfig: Record<string, unknown> = {};
|
||||
const defaultProviderSecrets: Record<string, unknown> = {};
|
||||
|
||||
Object.keys(newProvider?.configurations ?? {}).forEach((k) => {
|
||||
if (!newProvider?.configurations[k].sensitive) {
|
||||
if (newProvider?.configurations[k] && !!newProvider?.configurations[k].default_value) {
|
||||
defaultProviderConfig[k] = newProvider.configurations[k].default_value;
|
||||
const newProviderSchema: ConfigEntryView[] = newProvider
|
||||
? mapProviderFields(newProvider.task_types[0], newProvider)
|
||||
: [];
|
||||
if (newProvider) {
|
||||
setProviderSchema(newProviderSchema);
|
||||
}
|
||||
|
||||
newProviderSchema.forEach((fieldConfig) => {
|
||||
if (!fieldConfig.sensitive) {
|
||||
if (fieldConfig && !!fieldConfig.default_value) {
|
||||
defaultProviderConfig[fieldConfig.key] = fieldConfig.default_value;
|
||||
} else {
|
||||
defaultProviderConfig[k] = null;
|
||||
defaultProviderConfig[fieldConfig.key] = null;
|
||||
}
|
||||
} else {
|
||||
defaultProviderSecrets[k] = null;
|
||||
defaultProviderSecrets[fieldConfig.key] = null;
|
||||
}
|
||||
});
|
||||
const inferenceId = generateInferenceEndpointId({
|
||||
|
@ -262,18 +282,19 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
|
|||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (config?.provider && isEdit) {
|
||||
if (config?.provider && config?.taskType && isEdit) {
|
||||
const newProvider = providers?.find((p) => p.service === config.provider);
|
||||
// Update connector providerSchema
|
||||
const newProviderSchema = Object.keys(newProvider?.configurations ?? {}).map((k) => ({
|
||||
key: k,
|
||||
isValid: true,
|
||||
...newProvider?.configurations[k],
|
||||
})) as ConfigEntryView[];
|
||||
|
||||
setProviderSchema(newProviderSchema);
|
||||
const newProviderSchema: ConfigEntryView[] = newProvider
|
||||
? mapProviderFields(config.taskType, newProvider)
|
||||
: [];
|
||||
if (newProvider) {
|
||||
setProviderSchema(newProviderSchema);
|
||||
}
|
||||
setSelectedTaskType(config.taskType);
|
||||
}
|
||||
}, [config?.provider, config?.taskType, isEdit, providers]);
|
||||
}, [config, config?.provider, config?.taskType, isEdit, providers, selectedTaskType]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isSubmitting) {
|
||||
|
@ -304,9 +325,10 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
|
|||
typeof configValue === 'string' ||
|
||||
typeof configValue === 'number' ||
|
||||
typeof configValue === 'boolean' ||
|
||||
configValue === null
|
||||
configValue === null ||
|
||||
configValue === undefined
|
||||
) {
|
||||
itemValue.value = configValue;
|
||||
itemValue.value = configValue ?? null;
|
||||
}
|
||||
}
|
||||
return itemValue;
|
||||
|
@ -315,7 +337,7 @@ export const InferenceServiceFormFields: React.FC<InferenceServicesProps> = ({
|
|||
|
||||
setOptionalProviderFormFields(existingConfiguration.filter((p) => !p.required && !p.sensitive));
|
||||
setRequiredProviderFormFields(existingConfiguration.filter((p) => p.required || p.sensitive));
|
||||
}, [config?.providerConfig, providerSchema, secrets]);
|
||||
}, [config?.providerConfig, providerSchema, secrets, selectedTaskType]);
|
||||
|
||||
return !isLoading ? (
|
||||
<>
|
||||
|
|
|
@ -66,6 +66,11 @@ export const SERVICE_PROVIDERS: Record<ServiceProviderKeys, ServiceProviderRecor
|
|||
name: 'Elasticsearch',
|
||||
solutions: ['Search'],
|
||||
},
|
||||
[ServiceProviderKeys.elastic]: {
|
||||
icon: elasticIcon,
|
||||
name: 'Elastic',
|
||||
solutions: ['Observability', 'Security', 'Search'],
|
||||
},
|
||||
[ServiceProviderKeys.googleaistudio]: {
|
||||
icon: googleAIStudioIcon,
|
||||
name: 'Google AI Studio',
|
||||
|
|
|
@ -24,6 +24,7 @@ const providers = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -33,6 +34,7 @@ const providers = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/embeddings',
|
||||
|
@ -42,6 +44,7 @@ const providers = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -11,6 +11,7 @@ export enum ServiceProviderKeys {
|
|||
azureaistudio = 'azureaistudio',
|
||||
cohere = 'cohere',
|
||||
elasticsearch = 'elasticsearch',
|
||||
elastic = 'elastic',
|
||||
googleaistudio = 'googleaistudio',
|
||||
googlevertexai = 'googlevertexai',
|
||||
hugging_face = 'hugging_face',
|
||||
|
|
|
@ -9,619 +9,13 @@ import type { HttpSetup } from '@kbn/core-http-browser';
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
import { KibanaServerError } from '@kbn/kibana-utils-plugin/common';
|
||||
import { IToasts } from '@kbn/core/public';
|
||||
import { FieldType, InferenceProvider } from '../..';
|
||||
import { INFERENCE_ENDPOINT_INTERNAL_API_VERSION, InferenceProvider } from '../..';
|
||||
import * as i18n from '../translations';
|
||||
|
||||
const getProviders = (http: HttpSetup): InferenceProvider[] => {
|
||||
return [
|
||||
{
|
||||
service: 'alibabacloud-ai-search',
|
||||
name: 'AlibabaCloud AI Search',
|
||||
task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
configurations: {
|
||||
workspace: {
|
||||
default_value: null,
|
||||
description: 'The name of the workspace used for the {infer} task.',
|
||||
label: 'Workspace',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `A valid API key for the AlibabaCloud AI Search API.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
service_id: {
|
||||
default_value: null,
|
||||
description: 'The name of the model service to use for the {infer} task.',
|
||||
label: 'Project ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
host: {
|
||||
default_value: null,
|
||||
description:
|
||||
'The name of the host address used for the {infer} task. You can find the host address at https://opensearch.console.aliyun.com/cn-shanghai/rag/api-key[ the API keys section] of the documentation.',
|
||||
label: 'Host',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
http_schema: {
|
||||
default_value: null,
|
||||
description: '',
|
||||
label: 'HTTP Schema',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'amazonbedrock',
|
||||
name: 'Amazon Bedrock',
|
||||
task_types: ['text_embedding', 'completion'],
|
||||
configurations: {
|
||||
secret_key: {
|
||||
default_value: null,
|
||||
description: 'A valid AWS secret key that is paired with the access_key.',
|
||||
label: 'Secret Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
provider: {
|
||||
default_value: null,
|
||||
description: 'The model provider for your deployment.',
|
||||
label: 'Provider',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
access_key: {
|
||||
default_value: null,
|
||||
description: 'A valid AWS access key that has permissions to use Amazon Bedrock.',
|
||||
label: 'Access Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
model: {
|
||||
default_value: null,
|
||||
description:
|
||||
'The base model ID or an ARN to a custom model based on a foundational model.',
|
||||
label: 'Model',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description:
|
||||
'By default, the amazonbedrock service sets the number of requests allowed per minute to 240.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
region: {
|
||||
default_value: null,
|
||||
description: 'The region that your model or ARN is deployed in.',
|
||||
label: 'Region',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'anthropic',
|
||||
name: 'Anthropic',
|
||||
task_types: ['completion'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description:
|
||||
'By default, the anthropic service sets the number of requests allowed per minute to 50.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
description: 'The name of the model to use for the inference task.',
|
||||
label: 'Model ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'azureaistudio',
|
||||
name: 'Azure AI Studio',
|
||||
task_types: ['text_embedding', 'completion'],
|
||||
configurations: {
|
||||
endpoint_type: {
|
||||
default_value: null,
|
||||
description: 'Specifies the type of endpoint that is used in your model deployment.',
|
||||
label: 'Endpoint Type',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
provider: {
|
||||
default_value: null,
|
||||
description: 'The model provider for your deployment.',
|
||||
label: 'Provider',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
target: {
|
||||
default_value: null,
|
||||
description: 'The target URL of your Azure AI Studio model deployment.',
|
||||
label: 'Target',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'azureopenai',
|
||||
name: 'Azure OpenAI',
|
||||
task_types: ['text_embedding', 'completion'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
entra_id: {
|
||||
default_value: null,
|
||||
description: 'You must provide either an API key or an Entra ID.',
|
||||
label: 'Entra ID',
|
||||
required: false,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description:
|
||||
'The azureopenai service sets a default number of requests allowed per minute depending on the task type.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
deployment_id: {
|
||||
default_value: null,
|
||||
description: 'The deployment name of your deployed models.',
|
||||
label: 'Deployment ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
resource_name: {
|
||||
default_value: null,
|
||||
description: 'The name of your Azure OpenAI resource.',
|
||||
label: 'Resource Name',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
api_version: {
|
||||
default_value: null,
|
||||
description: 'The Azure API version ID to use.',
|
||||
label: 'API Version',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'cohere',
|
||||
name: 'Cohere',
|
||||
task_types: ['text_embedding', 'rerank', 'completion'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'elasticsearch',
|
||||
name: 'Elasticsearch',
|
||||
task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
configurations: {
|
||||
num_allocations: {
|
||||
default_value: 1,
|
||||
description:
|
||||
'The total number of allocations this model is assigned across machine learning nodes.',
|
||||
label: 'Number Allocations',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
num_threads: {
|
||||
default_value: 2,
|
||||
description: 'Sets the number of threads used by each model allocation during inference.',
|
||||
label: 'Number Threads',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
model_id: {
|
||||
default_value: '.multilingual-e5-small',
|
||||
description: 'The name of the model to use for the inference task.',
|
||||
label: 'Model ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'googleaistudio',
|
||||
name: 'Google AI Studio',
|
||||
task_types: ['text_embedding', 'completion'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
description: "ID of the LLM you're using.",
|
||||
label: 'Model ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'googlevertexai',
|
||||
name: 'Google Vertex AI',
|
||||
task_types: ['text_embedding', 'rerank'],
|
||||
configurations: {
|
||||
service_account_json: {
|
||||
default_value: null,
|
||||
description: "API Key for the provider you're connecting to.",
|
||||
label: 'Credentials JSON',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
project_id: {
|
||||
default_value: null,
|
||||
description:
|
||||
'The GCP Project ID which has Vertex AI API(s) enabled. For more information on the URL, refer to the {geminiVertexAIDocs}.',
|
||||
label: 'GCP Project',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
location: {
|
||||
default_value: null,
|
||||
description:
|
||||
'Please provide the GCP region where the Vertex AI API(s) is enabled. For more information, refer to the {geminiVertexAIDocs}.',
|
||||
label: 'GCP Region',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
description: `ID of the LLM you're using.`,
|
||||
label: 'Model ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'hugging_face',
|
||||
name: 'Hugging Face',
|
||||
task_types: ['text_embedding', 'sparse_embedding'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/embeddings',
|
||||
description: 'The URL endpoint to use for the requests.',
|
||||
label: 'URL',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'mistral',
|
||||
name: 'Mistral',
|
||||
task_types: ['text_embedding'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description: `API Key for the provider you're connecting to.`,
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
model: {
|
||||
default_value: null,
|
||||
description:
|
||||
'Refer to the Mistral models documentation for the list of available text embedding models.',
|
||||
label: 'Model',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description: 'Minimize the number of rate limit errors.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
description: 'Allows you to specify the maximum number of tokens per input.',
|
||||
label: 'Maximum Input Tokens',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'openai',
|
||||
name: 'OpenAI',
|
||||
task_types: ['text_embedding', 'completion'],
|
||||
configurations: {
|
||||
api_key: {
|
||||
default_value: null,
|
||||
description:
|
||||
'The OpenAI API authentication key. For more details about generating OpenAI API keys, refer to the https://platform.openai.com/account/api-keys.',
|
||||
label: 'API Key',
|
||||
required: true,
|
||||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
organization_id: {
|
||||
default_value: null,
|
||||
description: 'The unique identifier of your organization.',
|
||||
label: 'Organization ID',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
description:
|
||||
'Default number of requests allowed per minute. For text_embedding is 3000. For completion is 500.',
|
||||
label: 'Rate Limit',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
description: 'The name of the model to use for the inference task.',
|
||||
label: 'Model ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/chat/completions',
|
||||
description:
|
||||
'The OpenAI API endpoint URL. For more information on the URL, refer to the https://platform.openai.com/docs/api-reference.',
|
||||
label: 'URL',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
service: 'watsonxai',
|
||||
name: 'IBM Watsonx',
|
||||
task_types: ['text_embedding'],
|
||||
configurations: {
|
||||
project_id: {
|
||||
default_value: null,
|
||||
description: '',
|
||||
label: 'Project ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
description: 'The name of the model to use for the inference task.',
|
||||
label: 'Model ID',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
api_version: {
|
||||
default_value: null,
|
||||
description: 'The IBM Watsonx API version ID to use.',
|
||||
label: 'API Version',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
description: 'Allows you to specify the maximum number of tokens per input.',
|
||||
label: 'Maximum Input Tokens',
|
||||
required: false,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
},
|
||||
url: {
|
||||
default_value: null,
|
||||
description: '',
|
||||
label: 'URL',
|
||||
required: true,
|
||||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
export const getProviders = async (http: HttpSetup): Promise<InferenceProvider[]> => {
|
||||
return await http.get(`/internal/_inference/_services`, {
|
||||
version: INFERENCE_ENDPOINT_INTERNAL_API_VERSION,
|
||||
});
|
||||
};
|
||||
|
||||
export const useProviders = (http: HttpSetup, toasts: IToasts) => {
|
||||
|
|
|
@ -41,6 +41,7 @@ export interface ConfigProperties {
|
|||
sensitive: boolean;
|
||||
updatable: boolean;
|
||||
type: FieldType;
|
||||
supported_task_types: string[];
|
||||
}
|
||||
|
||||
interface ConfigEntry extends ConfigProperties {
|
|
@ -4,24 +4,15 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { FieldType } from '@kbn/search-connectors';
|
||||
|
||||
export { FieldType } from '@kbn/search-connectors';
|
||||
|
||||
export interface ConfigProperties {
|
||||
default_value: string | number | boolean | null;
|
||||
description: string | null;
|
||||
label: string;
|
||||
required: boolean;
|
||||
sensitive: boolean;
|
||||
updatable: boolean;
|
||||
type: FieldType;
|
||||
}
|
||||
import { ConfigProperties } from './dynamic_config/types';
|
||||
|
||||
interface ConfigEntry extends ConfigProperties {
|
||||
key: string;
|
||||
}
|
||||
|
||||
export * from './dynamic_config/types';
|
||||
|
||||
export interface ConfigEntryView extends ConfigEntry {
|
||||
isValid: boolean;
|
||||
validationErrors: string[];
|
||||
|
@ -30,14 +21,6 @@ export interface ConfigEntryView extends ConfigEntry {
|
|||
|
||||
export type FieldsConfiguration = Record<string, ConfigProperties>;
|
||||
|
||||
export interface InferenceProvider {
|
||||
service: string;
|
||||
name: string;
|
||||
task_types: string[];
|
||||
logo?: string;
|
||||
configurations: FieldsConfiguration;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
taskType: string;
|
||||
taskTypeConfig?: Record<string, unknown>;
|
||||
|
@ -49,3 +32,24 @@ export interface Config {
|
|||
export interface Secrets {
|
||||
providerSecrets?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface InferenceProvider {
|
||||
service: string;
|
||||
name: string;
|
||||
task_types: string[];
|
||||
logo?: string;
|
||||
configurations: FieldsConfiguration;
|
||||
}
|
||||
export interface Config {
|
||||
taskType: string;
|
||||
taskTypeConfig?: Record<string, unknown>;
|
||||
inferenceId: string;
|
||||
provider: string;
|
||||
providerConfig?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface Secrets {
|
||||
providerSecrets?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export const INFERENCE_ENDPOINT_INTERNAL_API_VERSION = '1';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { ValidationFunc } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { isEmpty } from 'lodash/fp';
|
||||
import { Config, ConfigEntryView } from '../types/types';
|
||||
import { Config, ConfigEntryView, FieldType, InferenceProvider } from '../types/types';
|
||||
import * as LABELS from '../translations';
|
||||
|
||||
export interface TaskTypeOption {
|
||||
|
@ -78,3 +78,29 @@ export const getNonEmptyValidator = (
|
|||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const mapProviderFields = (
|
||||
taskType: string,
|
||||
newProvider: InferenceProvider
|
||||
): ConfigEntryView[] => {
|
||||
return Object.keys(newProvider.configurations ?? {})
|
||||
.filter((pk) =>
|
||||
(newProvider.configurations[pk].supported_task_types ?? [taskType]).includes(taskType)
|
||||
)
|
||||
.map(
|
||||
(k): ConfigEntryView => ({
|
||||
key: k,
|
||||
isValid: true,
|
||||
validationErrors: [],
|
||||
value: newProvider.configurations[k].default_value ?? null,
|
||||
default_value: newProvider.configurations[k].default_value ?? null,
|
||||
description: newProvider.configurations[k].description ?? null,
|
||||
label: newProvider.configurations[k].label ?? '',
|
||||
required: newProvider.configurations[k].required ?? false,
|
||||
sensitive: newProvider.configurations[k].sensitive ?? false,
|
||||
updatable: newProvider.configurations[k].updatable ?? false,
|
||||
type: newProvider.configurations[k].type ?? FieldType.STRING,
|
||||
supported_task_types: newProvider.configurations[k].supported_task_types ?? [],
|
||||
})
|
||||
);
|
||||
};
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
"kbn_references": [
|
||||
"@kbn/i18n",
|
||||
"@kbn/i18n-react",
|
||||
"@kbn/search-connectors",
|
||||
"@kbn/es-ui-shared-plugin",
|
||||
"@kbn/triggers-actions-ui-plugin",
|
||||
"@kbn/core-http-browser",
|
||||
|
|
22
x-pack/platform/plugins/shared/inference_endpoint/README.md
Executable file
22
x-pack/platform/plugins/shared/inference_endpoint/README.md
Executable file
|
@ -0,0 +1,22 @@
|
|||
# inference-endpoint
|
||||
|
||||
A Kibana plugin
|
||||
|
||||
---
|
||||
|
||||
## Development
|
||||
|
||||
See the [kibana contributing guide](https://github.com/elastic/kibana/blob/main/CONTRIBUTING.md) for instructions setting up your development environment.
|
||||
|
||||
## Scripts
|
||||
|
||||
<dl>
|
||||
<dt><code>yarn kbn bootstrap</code></dt>
|
||||
<dd>Execute this to install node_modules and setup the dependencies in your plugin and in Kibana</dd>
|
||||
|
||||
<dt><code>yarn plugin-helpers build</code></dt>
|
||||
<dd>Execute this to create a distributable version of this plugin that can be installed in Kibana</dd>
|
||||
|
||||
<dt><code>yarn plugin-helpers dev --watch</code></dt>
|
||||
<dd>Execute this to build your plugin ui browser side so Kibana could pick up when started in development</dd>
|
||||
</dl>
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const PLUGIN_ID = 'inferenceEndpoint';
|
||||
export const PLUGIN_NAME = 'inference-endpoint';
|
||||
|
||||
export const INFERENCE_ENDPOINT_INTERNAL_API_VERSION = '1';
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
preset: '@kbn/test',
|
||||
rootDir: '../../../../..',
|
||||
roots: [
|
||||
'<rootDir>/x-pack/platform/plugins/shared/inference_endpoint/server',
|
||||
'<rootDir>/x-pack/platform/plugins/shared/inference_endpoint/common',
|
||||
],
|
||||
setupFiles: [],
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: [
|
||||
'<rootDir>/x-pack/platform/plugins/shared/inference_endpoint/{server,common}/**/*.{js,ts,tsx}',
|
||||
],
|
||||
|
||||
coverageReporters: ['html'],
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"type": "plugin",
|
||||
"id": "@kbn/inference-endpoint-plugin",
|
||||
"owner": "@elastic/ml-ui",
|
||||
"group": "platform",
|
||||
"visibility": "shared",
|
||||
"plugin": {
|
||||
"id": "inferenceEndpoint",
|
||||
"server": true,
|
||||
"browser": false,
|
||||
"configPath": ["xpack", "inference_endpoint"],
|
||||
"requiredPlugins": [
|
||||
"navigation"
|
||||
],
|
||||
"requiredBundles": [
|
||||
],
|
||||
"optionalPlugins": [],
|
||||
"extraPublicDirs": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { PluginInitializerContext } from '@kbn/core/server';
|
||||
|
||||
// This exports static code and TypeScript types,
|
||||
// as well as, Kibana Platform `plugin()` initializer.
|
||||
|
||||
export async function plugin(initializerContext: PluginInitializerContext) {
|
||||
const { InferenceEndpointPlugin } = await import('./plugin');
|
||||
return new InferenceEndpointPlugin(initializerContext);
|
||||
}
|
||||
|
||||
export type { InferenceEndpointPluginSetup, InferenceEndpointPluginStart } from './types';
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type {
|
||||
PluginInitializerContext,
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
Plugin,
|
||||
Logger,
|
||||
} from '@kbn/core/server';
|
||||
|
||||
import type { InferenceEndpointPluginSetup, InferenceEndpointPluginStart } from './types';
|
||||
import { getInferenceServicesRoute } from './routes';
|
||||
|
||||
export class InferenceEndpointPlugin
|
||||
implements Plugin<InferenceEndpointPluginSetup, InferenceEndpointPluginStart>
|
||||
{
|
||||
private readonly logger: Logger;
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext) {
|
||||
this.logger = initializerContext.logger.get();
|
||||
}
|
||||
|
||||
public setup(core: CoreSetup) {
|
||||
this.logger.debug('inference-endpoint: Setup');
|
||||
const router = core.http.createRouter();
|
||||
|
||||
// Register server side APIs
|
||||
getInferenceServicesRoute(router, this.logger);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart) {
|
||||
this.logger.debug('inference-endpoint: Started');
|
||||
return {};
|
||||
}
|
||||
|
||||
public stop() {}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import type { IKibanaResponse, IRouter, RequestHandlerContext } from '@kbn/core/server';
|
||||
import { Logger } from '@kbn/logging';
|
||||
import { InferenceServicesGetResponse } from '../types';
|
||||
import { INFERENCE_ENDPOINT_INTERNAL_API_VERSION } from '../../common';
|
||||
|
||||
export const getInferenceServicesRoute = (
|
||||
router: IRouter<RequestHandlerContext>,
|
||||
logger: Logger
|
||||
) => {
|
||||
router.versioned
|
||||
.get({
|
||||
access: 'internal',
|
||||
path: '/internal/_inference/_services',
|
||||
})
|
||||
.addVersion(
|
||||
{
|
||||
version: INFERENCE_ENDPOINT_INTERNAL_API_VERSION,
|
||||
validate: {},
|
||||
},
|
||||
async (
|
||||
context,
|
||||
request,
|
||||
response
|
||||
): Promise<IKibanaResponse<InferenceServicesGetResponse>> => {
|
||||
try {
|
||||
const esClient = (await context.core).elasticsearch.client.asInternalUser;
|
||||
|
||||
const result = await esClient.transport.request<InferenceServicesGetResponse>({
|
||||
method: 'GET',
|
||||
path: `/_inference/_services`,
|
||||
});
|
||||
|
||||
return response.ok({
|
||||
body: result,
|
||||
});
|
||||
} catch (err) {
|
||||
logger.error(err);
|
||||
return response.customError({
|
||||
body: { message: err.message },
|
||||
statusCode: err.statusCode,
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import type { InferenceProvider } from '@kbn/inference-endpoint-ui-common';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface InferenceEndpointPluginSetup {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface InferenceEndpointPluginStart {}
|
||||
|
||||
export interface InferenceServicesGetResponse {
|
||||
endpoints: InferenceProvider[];
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"extends": "../../../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "target/types",
|
||||
},
|
||||
"include": [
|
||||
"__mocks__/**/*",
|
||||
"common/**/*",
|
||||
"public/**/*",
|
||||
"server/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"target/**/*",
|
||||
".storybook/**/*.js"
|
||||
],
|
||||
"kbn_references": [
|
||||
"@kbn/core",
|
||||
"@kbn/logging",
|
||||
"@kbn/inference-endpoint-ui-common",
|
||||
]
|
||||
}
|
|
@ -28,6 +28,7 @@ export enum ServiceProviderKeys {
|
|||
anthropic = 'anthropic',
|
||||
watsonxai = 'watsonxai',
|
||||
'alibabacloud-ai-search' = 'alibabacloud-ai-search',
|
||||
elastic = 'elastic',
|
||||
}
|
||||
|
||||
export const INFERENCE_CONNECTOR_ID = '.inference';
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { ConfigProperties } from '@kbn/inference-endpoint-ui-common';
|
||||
import {
|
||||
ConfigSchema,
|
||||
SecretsSchema,
|
||||
|
@ -23,7 +24,6 @@ import {
|
|||
DashboardActionParamsSchema,
|
||||
DashboardActionResponseSchema,
|
||||
} from './schema';
|
||||
import { ConfigProperties } from '../dynamic_config/types';
|
||||
|
||||
export type Config = TypeOf<typeof ConfigSchema>;
|
||||
export type Secrets = TypeOf<typeof SecretsSchema>;
|
||||
|
@ -49,11 +49,3 @@ export type DashboardActionParams = TypeOf<typeof DashboardActionParamsSchema>;
|
|||
export type DashboardActionResponse = TypeOf<typeof DashboardActionResponseSchema>;
|
||||
|
||||
export type FieldsConfiguration = Record<string, ConfigProperties>;
|
||||
|
||||
export interface InferenceProvider {
|
||||
service: string;
|
||||
name: string;
|
||||
task_types: string[];
|
||||
logo?: string;
|
||||
configurations: FieldsConfiguration;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -36,6 +37,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -52,6 +54,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['sparse_embedding'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -61,6 +64,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['sparse_embedding'],
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
|
@ -70,6 +74,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['sparse_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -86,6 +91,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -95,6 +101,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
api_version: {
|
||||
default_value: null,
|
||||
|
@ -104,6 +111,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
|
@ -113,6 +121,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
url: {
|
||||
default_value: null,
|
||||
|
@ -122,6 +131,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -138,6 +148,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
provider: {
|
||||
default_value: null,
|
||||
|
@ -147,6 +158,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
api_key: {
|
||||
default_value: null,
|
||||
|
@ -156,6 +168,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -165,6 +178,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
target: {
|
||||
default_value: null,
|
||||
|
@ -174,6 +188,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -190,6 +205,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -199,6 +215,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/embeddings',
|
||||
|
@ -208,6 +225,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -224,6 +242,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
provider: {
|
||||
default_value: null,
|
||||
|
@ -233,6 +252,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
access_key: {
|
||||
default_value: null,
|
||||
|
@ -242,6 +262,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
model: {
|
||||
default_value: null,
|
||||
|
@ -251,6 +272,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -261,6 +283,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
region: {
|
||||
default_value: null,
|
||||
|
@ -270,6 +293,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -286,6 +310,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -296,6 +321,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -305,6 +331,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -321,6 +348,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -330,6 +358,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -339,6 +368,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -356,6 +386,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
},
|
||||
num_threads: {
|
||||
default_value: 2,
|
||||
|
@ -365,6 +396,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: '.multilingual-e5-small',
|
||||
|
@ -374,6 +406,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -391,6 +424,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
organization_id: {
|
||||
default_value: null,
|
||||
|
@ -400,6 +434,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -410,6 +445,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -419,6 +455,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/chat/completions',
|
||||
|
@ -429,6 +466,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -445,6 +483,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
entra_id: {
|
||||
default_value: null,
|
||||
|
@ -454,6 +493,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -464,6 +504,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
deployment_id: {
|
||||
default_value: null,
|
||||
|
@ -473,6 +514,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
resource_name: {
|
||||
default_value: null,
|
||||
|
@ -482,6 +524,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
api_version: {
|
||||
default_value: null,
|
||||
|
@ -491,6 +534,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -507,6 +551,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
model: {
|
||||
default_value: null,
|
||||
|
@ -517,6 +562,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -526,6 +572,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
|
@ -535,6 +582,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -551,6 +599,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
project_id: {
|
||||
default_value: null,
|
||||
|
@ -561,6 +610,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
location: {
|
||||
default_value: null,
|
||||
|
@ -571,6 +621,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -580,6 +631,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -589,6 +641,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -605,6 +658,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
api_key: {
|
||||
default_value: null,
|
||||
|
@ -614,6 +668,7 @@ const providersSchemas = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
service_id: {
|
||||
default_value: null,
|
||||
|
@ -623,6 +678,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
host: {
|
||||
default_value: null,
|
||||
|
@ -633,6 +689,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -642,6 +699,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'int',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
http_schema: {
|
||||
default_value: null,
|
||||
|
@ -651,6 +709,7 @@ const providersSchemas = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: 'string',
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { isEmpty } from 'lodash/fp';
|
||||
import { ValidationFunc } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { ConfigEntryView } from '../../../common/dynamic_config/types';
|
||||
import { ConfigEntryView } from '@kbn/inference-endpoint-ui-common';
|
||||
import { Config } from './types';
|
||||
import * as i18n from './translations';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import React from 'react';
|
||||
import { HiddenField } from '@kbn/es-ui-shared-plugin/static/forms/components';
|
||||
import { UseField } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib';
|
||||
import { ConfigEntryView } from '../../../common/dynamic_config/types';
|
||||
import { ConfigEntryView } from '@kbn/inference-endpoint-ui-common';
|
||||
import { getNonEmptyValidator } from './helpers';
|
||||
|
||||
export const getProviderSecretsHiddenField = (
|
||||
|
|
|
@ -21,7 +21,7 @@ describe('Inference Params Fields renders', () => {
|
|||
actionConnector={{
|
||||
actionTypeId: '.inference',
|
||||
config: {
|
||||
taskType: 'completion',
|
||||
taskType: 'chat_completion',
|
||||
},
|
||||
id: 'test',
|
||||
isPreconfigured: false,
|
||||
|
@ -80,19 +80,10 @@ describe('Inference Params Fields renders', () => {
|
|||
);
|
||||
expect(editAction).toHaveBeenCalledTimes(2);
|
||||
if (provider === 'openai') {
|
||||
expect(editAction).toHaveBeenCalledWith('subAction', SUB_ACTION.UNIFIED_COMPLETION, 0);
|
||||
expect(editAction).toHaveBeenCalledWith('subAction', SUB_ACTION.COMPLETION, 0);
|
||||
expect(editAction).toHaveBeenCalledWith(
|
||||
'subActionParams',
|
||||
{
|
||||
body: {
|
||||
messages: [
|
||||
{
|
||||
content: 'Hello world',
|
||||
role: 'user',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{ input: 'What is Elastic?' },
|
||||
0
|
||||
);
|
||||
}
|
||||
|
|
|
@ -36,9 +36,7 @@ const InferenceServiceParamsFields: React.FunctionComponent<
|
|||
if (!subAction) {
|
||||
editAction(
|
||||
'subAction',
|
||||
provider === 'openai' && taskType === 'completion'
|
||||
? SUB_ACTION.UNIFIED_COMPLETION
|
||||
: taskType,
|
||||
taskType === 'chat_completion' ? SUB_ACTION.UNIFIED_COMPLETION : taskType,
|
||||
index
|
||||
);
|
||||
}
|
||||
|
@ -50,9 +48,7 @@ const InferenceServiceParamsFields: React.FunctionComponent<
|
|||
'subActionParams',
|
||||
{
|
||||
...(DEFAULTS_BY_TASK_TYPE[
|
||||
provider === 'openai' && taskType === 'completion'
|
||||
? SUB_ACTION.UNIFIED_COMPLETION
|
||||
: taskType
|
||||
taskType === 'chat_completion' ? SUB_ACTION.UNIFIED_COMPLETION : taskType
|
||||
] ?? {}),
|
||||
},
|
||||
index
|
||||
|
|
|
@ -161,8 +161,16 @@ export const configValidator = (configObject: Config, validatorServices: Validat
|
|||
);
|
||||
}
|
||||
|
||||
if (taskType === 'chat_completion' && !Object.keys(SUB_ACTION).includes('UNIFIED_COMPLETION')) {
|
||||
throw new Error(
|
||||
`Task type is not supported${
|
||||
taskType && taskType.length ? `: ${taskType}` : ``
|
||||
} by Inference Endpoint.`
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!taskType.includes('completion') &&
|
||||
taskType !== 'chat_completion' &&
|
||||
!Object.keys(SUB_ACTION).includes(taskType.toUpperCase())
|
||||
) {
|
||||
throw new Error(
|
||||
|
|
|
@ -59,7 +59,7 @@ describe('InferenceConnector', () => {
|
|||
services,
|
||||
});
|
||||
|
||||
it('uses the completion task_type is supplied', async () => {
|
||||
it('uses the chat_completion task_type is supplied', async () => {
|
||||
mockEsClient.transport.request.mockResolvedValue({
|
||||
body: Readable.from([
|
||||
`data: {"id":"chatcmpl-AbLKRuRMZCAcMMQdl96KMTUgAfZNg","choices":[{"delta":{"content":" you"},"index":0}],"model":"gpt-4o-2024-08-06","object":"chat.completion.chunk"}\n\n`,
|
||||
|
@ -84,7 +84,7 @@ describe('InferenceConnector', () => {
|
|||
n: undefined,
|
||||
},
|
||||
method: 'POST',
|
||||
path: '_inference/completion/test/_unified',
|
||||
path: '_inference/chat_completion/test/_unified',
|
||||
},
|
||||
{ asStream: true, meta: true }
|
||||
);
|
||||
|
@ -287,7 +287,7 @@ describe('InferenceConnector', () => {
|
|||
n: undefined,
|
||||
},
|
||||
method: 'POST',
|
||||
path: '_inference/completion/test/_unified',
|
||||
path: '_inference/chat_completion/test/_unified',
|
||||
},
|
||||
{ asStream: true, meta: true }
|
||||
);
|
||||
|
@ -309,7 +309,7 @@ describe('InferenceConnector', () => {
|
|||
{
|
||||
body: { messages: [{ content: 'Hello world', role: 'user' }], n: undefined },
|
||||
method: 'POST',
|
||||
path: '_inference/completion/test/_unified',
|
||||
path: '_inference/chat_completion/test/_unified',
|
||||
},
|
||||
{ asStream: true, meta: true, signal }
|
||||
);
|
||||
|
|
|
@ -187,7 +187,7 @@ export class InferenceConnector extends SubActionConnector<Config, Secrets> {
|
|||
const response = await this.esClient.transport.request<UnifiedChatCompleteResponse>(
|
||||
{
|
||||
method: 'POST',
|
||||
path: `_inference/completion/${this.inferenceId}/_unified`,
|
||||
path: `_inference/chat_completion/${this.inferenceId}/_unified`,
|
||||
body: { ...params.body, n: undefined }, // exclude n param for now, constant is used on the inference API side
|
||||
},
|
||||
{
|
||||
|
@ -196,7 +196,6 @@ export class InferenceConnector extends SubActionConnector<Config, Secrets> {
|
|||
signal: params.signal,
|
||||
}
|
||||
);
|
||||
|
||||
// errors should be thrown as it will not be a stream response
|
||||
if (response.statusCode >= 400) {
|
||||
const error = await streamToString(response.body as unknown as Readable);
|
||||
|
|
|
@ -59,6 +59,10 @@ export const SERVICE_PROVIDERS: Record<ServiceProviderKeys, ServiceProviderRecor
|
|||
icon: elasticIcon,
|
||||
name: 'Elasticsearch',
|
||||
},
|
||||
[ServiceProviderKeys.elastic]: {
|
||||
icon: elasticIcon,
|
||||
name: 'Elastic',
|
||||
},
|
||||
[ServiceProviderKeys.elser]: {
|
||||
icon: elasticIcon,
|
||||
name: 'Elasticsearch',
|
||||
|
|
|
@ -16,6 +16,7 @@ export enum ServiceProviderKeys {
|
|||
azureaistudio = 'azureaistudio',
|
||||
cohere = 'cohere',
|
||||
elasticsearch = 'elasticsearch',
|
||||
elastic = 'elastic',
|
||||
elser = 'elser',
|
||||
googleaistudio = 'googleaistudio',
|
||||
hugging_face = 'hugging_face',
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FieldType } from '@kbn/search-connectors/types';
|
||||
import { FieldType } from '@kbn/inference-endpoint-ui-common';
|
||||
import { InferenceProvider } from '../../types';
|
||||
|
||||
export const mockProviders: InferenceProvider[] = [
|
||||
|
@ -22,6 +22,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -31,6 +32,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -47,6 +49,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['sparse_embedding'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -56,6 +59,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['sparse_embedding'],
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
|
@ -65,6 +69,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['sparse_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -81,6 +86,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -90,6 +96,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
api_version: {
|
||||
default_value: null,
|
||||
|
@ -99,6 +106,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
|
@ -108,6 +116,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
url: {
|
||||
default_value: null,
|
||||
|
@ -117,6 +126,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -133,6 +143,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
provider: {
|
||||
default_value: null,
|
||||
|
@ -142,6 +153,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
api_key: {
|
||||
default_value: null,
|
||||
|
@ -151,6 +163,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -160,6 +173,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
target: {
|
||||
default_value: null,
|
||||
|
@ -169,6 +183,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -185,6 +200,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -194,6 +210,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/embeddings',
|
||||
|
@ -203,6 +220,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -219,6 +237,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
provider: {
|
||||
default_value: null,
|
||||
|
@ -228,6 +247,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
access_key: {
|
||||
default_value: null,
|
||||
|
@ -237,6 +257,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
model: {
|
||||
default_value: null,
|
||||
|
@ -246,6 +267,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -256,6 +278,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
region: {
|
||||
default_value: null,
|
||||
|
@ -265,6 +288,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -281,6 +305,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -291,6 +316,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -300,6 +326,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -316,6 +343,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -325,6 +353,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -334,6 +363,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -351,6 +381,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
},
|
||||
num_threads: {
|
||||
default_value: 2,
|
||||
|
@ -360,6 +391,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: '.multilingual-e5-small',
|
||||
|
@ -369,6 +401,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -386,6 +419,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
organization_id: {
|
||||
default_value: null,
|
||||
|
@ -395,6 +429,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -405,6 +440,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -414,6 +450,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
url: {
|
||||
default_value: 'https://api.openai.com/v1/chat/completions',
|
||||
|
@ -424,6 +461,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -440,6 +478,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
entra_id: {
|
||||
default_value: null,
|
||||
|
@ -449,6 +488,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -459,6 +499,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
deployment_id: {
|
||||
default_value: null,
|
||||
|
@ -468,6 +509,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
resource_name: {
|
||||
default_value: null,
|
||||
|
@ -477,6 +519,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
api_version: {
|
||||
default_value: null,
|
||||
|
@ -486,6 +529,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -502,6 +546,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
model: {
|
||||
default_value: null,
|
||||
|
@ -512,6 +557,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -521,6 +567,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
max_input_tokens: {
|
||||
default_value: null,
|
||||
|
@ -530,6 +577,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -546,6 +594,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
project_id: {
|
||||
default_value: null,
|
||||
|
@ -556,6 +605,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
location: {
|
||||
default_value: null,
|
||||
|
@ -566,6 +616,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -575,6 +626,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
model_id: {
|
||||
default_value: null,
|
||||
|
@ -584,6 +636,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'rerank'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -600,6 +653,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
api_key: {
|
||||
default_value: null,
|
||||
|
@ -609,6 +663,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: true,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
service_id: {
|
||||
default_value: null,
|
||||
|
@ -618,6 +673,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
host: {
|
||||
default_value: null,
|
||||
|
@ -628,6 +684,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
'rate_limit.requests_per_minute': {
|
||||
default_value: null,
|
||||
|
@ -637,6 +694,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.INTEGER,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
http_schema: {
|
||||
default_value: null,
|
||||
|
@ -646,6 +704,7 @@ export const mockProviders: InferenceProvider[] = [
|
|||
sensitive: false,
|
||||
updatable: true,
|
||||
type: FieldType.STRING,
|
||||
supported_task_types: ['text_embedding', 'sparse_embedding', 'rerank', 'completion'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
"@kbn/licensing-plugin",
|
||||
"@kbn/inference-endpoint-ui-common",
|
||||
"@kbn/es-ui-shared-plugin",
|
||||
"@kbn/search-connectors",
|
||||
"@kbn/safer-lodash-set"
|
||||
],
|
||||
"exclude": [
|
||||
|
|
|
@ -81,7 +81,7 @@ describe('useLoadConnectors', () => {
|
|||
id: '6',
|
||||
actionTypeId: '.inference',
|
||||
isMissingSecrets: false,
|
||||
config: { provider: 'openai', taskType: 'completion' },
|
||||
config: { provider: 'openai', taskType: 'chat_completion' },
|
||||
},
|
||||
];
|
||||
mockedLoadConnectors.mockResolvedValue(connectors);
|
||||
|
@ -130,7 +130,7 @@ describe('useLoadConnectors', () => {
|
|||
actionTypeId: '.inference',
|
||||
config: {
|
||||
provider: 'openai',
|
||||
taskType: 'completion',
|
||||
taskType: 'chat_completion',
|
||||
},
|
||||
id: '6',
|
||||
isMissingSecrets: false,
|
||||
|
|
|
@ -5976,6 +5976,10 @@
|
|||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/inference-endpoint-plugin@link:x-pack/platform/plugins/shared/inference_endpoint":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
||||
"@kbn/inference-endpoint-ui-common@link:x-pack/platform/packages/shared/kbn-inference-endpoint-ui-common":
|
||||
version "0.0.0"
|
||||
uid ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue