Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ export type InferenceServiceSettings =
api_key: string;
url: string;
};
}
| {
service: 'amazonbedrock';
service_settings: {
access_key: string;
secret_key: string;
region: string;
provider: string;
model: string;
};
};

export type InferenceAPIConfigResponse = {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@ describe('RenderEndpoint component tests', () => {
});
});

describe('with amazonbedrock service', () => {
const mockEndpoint = {
model_id: 'amazon-bedrock-1',
service: 'amazonbedrock',
service_settings: {
region: 'us-west-1',
provider: 'AMAZONTITAN',
model: 'model-bedrock-xyz',
},
} as any;

it('renders the component with endpoint details', () => {
render(<EndpointInfo endpoint={mockEndpoint} />);

expect(screen.getByText('amazon-bedrock-1')).toBeInTheDocument();
expect(screen.getByText('model-bedrock-xyz')).toBeInTheDocument();
expect(screen.getByText('region: us-west-1, provider: amazontitan')).toBeInTheDocument();
});
});

describe('for MIT licensed models', () => {
const mockEndpointWithMitLicensedModel = {
model_id: 'model-123',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ function endpointModelAtrributes(endpoint: InferenceAPIConfigResponse) {
return mistralAttributes(endpoint);
case ServiceProviderKeys.googleaistudio:
return googleAIStudioAttributes(endpoint);
case ServiceProviderKeys.amazonbedrock:
return amazonBedrockAttributes(endpoint);
default:
return null;
}
Expand Down Expand Up @@ -175,6 +177,18 @@ function mistralAttributes(endpoint: InferenceAPIConfigResponse) {
.join(', ');
}

function amazonBedrockAttributes(endpoint: InferenceAPIConfigResponse) {
const serviceSettings = endpoint.service_settings;

const region = 'region' in serviceSettings ? serviceSettings.region : undefined;
const provider =
'provider' in serviceSettings ? serviceSettings.provider.toLocaleLowerCase() : undefined;

return [region && `region: ${region}`, provider && `provider: ${provider}`]
.filter(Boolean)
.join(', ');
}

function googleAIStudioAttributes(endpoint: InferenceAPIConfigResponse) {
const serviceSettings = endpoint.service_settings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import azureAIStudioIcon from '../../../../assets/images/providers/azure_ai_stud
import azureOpenAIIcon from '../../../../assets/images/providers/azure_open_ai.svg';
import googleAIStudioIcon from '../../../../assets/images/providers/google_ai_studio.svg';
import mistralIcon from '../../../../assets/images/providers/mistral.svg';
import amazonBedrockIcon from '../../../../assets/images/providers/amazon_bedrock.svg';
import { ServiceProviderKeys } from '../../types';

interface ServiceProviderProps {
Expand All @@ -27,6 +28,10 @@ interface ServiceProviderRecord {
}

export const SERVICE_PROVIDERS: Record<ServiceProviderKeys, ServiceProviderRecord> = {
[ServiceProviderKeys.amazonbedrock]: {
icon: amazonBedrockIcon,
name: 'Amazon Bedrock',
},
[ServiceProviderKeys.azureaistudio]: {
icon: azureAIStudioIcon,
name: 'Azure AI Studio',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { InferenceAPIConfigResponse } from '@kbn/ml-trained-models-utils';
export const INFERENCE_ENDPOINTS_TABLE_PER_PAGE_VALUES = [10, 25, 50, 100];

export enum ServiceProviderKeys {
amazonbedrock = 'amazonbedrock',
azureopenai = 'azureopenai',
azureaistudio = 'azureaistudio',
cohere = 'cohere',
Expand Down