Skip to content

Commit

Permalink
Update workspace nodes/edges; misc fixes (#394) (#396)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
(cherry picked from commit c8bdacc)

Co-authored-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and ohltyler authored Sep 20, 2024
1 parent 2bed20b commit 3447d9a
Show file tree
Hide file tree
Showing 29 changed files with 323 additions and 266 deletions.
28 changes: 13 additions & 15 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ export const OPENAI_DIMENSIONS = {
[`text-embedding-ada-002`]: 1536,
};

// Amazon BedRock
export const BEDROCK_DIMENSIONS = {
[`amazon.titan-embed-text-v1`]: 1536,
[`amazon.titan-embed-text-v2`]: 1024,
[`amazon.titan-embed-image-v1`]: 1024,
[`cohere.embed-english-v3`]: 1024, // same as Cohere directly
[`cohere.embed-multilingual-v3`]: 1024, // same as Cohere directly
};

/**
* Various constants pertaining to Workflow configs
*/
Expand Down Expand Up @@ -135,24 +144,13 @@ export enum NODE_CATEGORY {
* A base set of component classes / types.
*/
export enum COMPONENT_CLASS {
// Indexer-related classes
INDEXER = 'indexer',
KNN_INDEXER = 'knn_indexer',
// Retriever-related classes
RETRIEVER = 'retriever',
// Transformer-related classes
INDEX = 'index',
KNN_INDEX = 'knn_index',
TRANSFORMER = 'transformer',
JSON_TO_JSON_TRANSFORMER = 'json_to_json_transformer',
ML_TRANSFORMER = 'ml_transformer',
RESULTS_TRANSFORMER = 'results_transformer',
// Query-related classes
QUERY = 'query',
MATCH_QUERY = 'match_query',
NEURAL_QUERY = 'neural_query',
// Document-related classes
SEARCH_REQUEST = 'search_request',
DOCUMENT = 'document',
// Results-related classes
RESULTS = 'results',
SEARCH_RESPONSE = 'search_response',
}

/**
Expand Down
2 changes: 1 addition & 1 deletion public/component_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
*/

export * from './transformer';
export * from './indexer';
export * from './indices';
export * from './other';
32 changes: 0 additions & 32 deletions public/component_types/indexer/base_indexer.ts

This file was deleted.

19 changes: 0 additions & 19 deletions public/component_types/indexer/knn_indexer.ts

This file was deleted.

42 changes: 42 additions & 0 deletions public/component_types/indices/base_index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { COMPONENT_CATEGORY, COMPONENT_CLASS } from '../../../common';
import { BaseComponent } from '../base_component';

/**
* A basic index placeholder UI component. Input/output depends on ingest or search context.
* Does not have any functionality.
*/
export class BaseIndex extends BaseComponent {
constructor(category: COMPONENT_CATEGORY) {
super();
this.type = COMPONENT_CLASS.INDEX;
this.label = 'Index';
this.description = 'An OpenSearch index';
this.inputs = [
{
id:
category === COMPONENT_CATEGORY.INGEST
? 'document'
: 'search_request',
label:
category === COMPONENT_CATEGORY.INGEST
? 'Document'
: 'Search Request',
acceptMultiple: false,
},
];
this.outputs =
category === COMPONENT_CATEGORY.INGEST
? []
: [
{
id: 'search_response',
label: 'Search Response',
},
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from './base_indexer';
export * from './knn_indexer';
export * from './base_index';
export * from './knn_index';
20 changes: 20 additions & 0 deletions public/component_types/indices/knn_index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { COMPONENT_CATEGORY, COMPONENT_CLASS } from '../../../common';
import { BaseIndex } from './base_index';

/**
* A basic knn index placeholder UI component. Input/output depends on ingest or search context.
* Does not have any functionality.
*/
export class KnnIndex extends BaseIndex {
constructor(category: COMPONENT_CATEGORY) {
super(category);
this.type = COMPONENT_CLASS.KNN_INDEX;
this.label = 'k-NN Index';
this.description = 'A specialized k-NN index';
}
}
6 changes: 3 additions & 3 deletions public/component_types/other/document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { COMPONENT_CLASS } from '../../../common';
import { BaseComponent } from '../base_component';

/**
* A basic Document placeholder UI component.
* A basic document placeholder UI component.
* Does not have any functionality.
*/
export class Document extends BaseComponent {
Expand All @@ -18,8 +18,8 @@ export class Document extends BaseComponent {
this.description = 'A document to be ingested';
this.outputs = [
{
id: 'output',
label: 'Output',
id: 'document',
label: 'Document',
},
];
}
Expand Down
4 changes: 2 additions & 2 deletions public/component_types/other/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
*/

export * from './document';
export * from './results';
export * from './query';
export * from './search_response';
export * from './search_request';
8 changes: 0 additions & 8 deletions public/component_types/other/query/index.ts

This file was deleted.

20 changes: 0 additions & 20 deletions public/component_types/other/query/match_query.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions public/component_types/other/query/neural_query.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions public/component_types/other/query/query.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions public/component_types/other/results.tsx

This file was deleted.

26 changes: 26 additions & 0 deletions public/component_types/other/search_request.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { COMPONENT_CLASS } from '../../../common';
import { BaseComponent } from '../base_component';

/**
* A basic search request placeholder UI component.
* Does not have any functionality.
*/
export class SearchRequest extends BaseComponent {
constructor() {
super();
this.type = COMPONENT_CLASS.SEARCH_REQUEST;
this.label = 'Search Request';
this.description = 'An OpenSearch search request';
this.outputs = [
{
id: 'search_request',
label: this.label,
},
];
}
}
23 changes: 23 additions & 0 deletions public/component_types/other/search_response.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { COMPONENT_CLASS } from '../../../common';
import { BaseComponent } from '../base_component';

/**
* A basic search response placeholder UI component.
* Does not have any functionality.
*/
export class SearchResponse extends BaseComponent {
constructor() {
super();
this.type = COMPONENT_CLASS.SEARCH_RESPONSE;
this.label = 'Search Response';
this.description = 'OpenSearch search response';
this.inputs = [
{ id: 'search_response', label: this.label, acceptMultiple: false },
];
}
}
Loading

0 comments on commit 3447d9a

Please sign in to comment.