Skip to content

Commit c8bdacc

Browse files
authored
Update workspace nodes/edges; misc fixes (#394)
* cover few edge cases Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * Make quick config fields all fullwidth Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * word consistency; add more known embeddings Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * remove unnecessary spacing Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * Rename UI component from query -> search request Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * rename results -> search response Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * update names; remove unnecessary components; add detailed i/o Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * rename Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> * Fix & improve test Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> --------- Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent 33bb798 commit c8bdacc

29 files changed

+323
-266
lines changed

common/constants.ts

+13-15
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ export const OPENAI_DIMENSIONS = {
8686
[`text-embedding-ada-002`]: 1536,
8787
};
8888

89+
// Amazon BedRock
90+
export const BEDROCK_DIMENSIONS = {
91+
[`amazon.titan-embed-text-v1`]: 1536,
92+
[`amazon.titan-embed-text-v2`]: 1024,
93+
[`amazon.titan-embed-image-v1`]: 1024,
94+
[`cohere.embed-english-v3`]: 1024, // same as Cohere directly
95+
[`cohere.embed-multilingual-v3`]: 1024, // same as Cohere directly
96+
};
97+
8998
/**
9099
* Various constants pertaining to Workflow configs
91100
*/
@@ -135,24 +144,13 @@ export enum NODE_CATEGORY {
135144
* A base set of component classes / types.
136145
*/
137146
export enum COMPONENT_CLASS {
138-
// Indexer-related classes
139-
INDEXER = 'indexer',
140-
KNN_INDEXER = 'knn_indexer',
141-
// Retriever-related classes
142-
RETRIEVER = 'retriever',
143-
// Transformer-related classes
147+
INDEX = 'index',
148+
KNN_INDEX = 'knn_index',
144149
TRANSFORMER = 'transformer',
145-
JSON_TO_JSON_TRANSFORMER = 'json_to_json_transformer',
146150
ML_TRANSFORMER = 'ml_transformer',
147-
RESULTS_TRANSFORMER = 'results_transformer',
148-
// Query-related classes
149-
QUERY = 'query',
150-
MATCH_QUERY = 'match_query',
151-
NEURAL_QUERY = 'neural_query',
152-
// Document-related classes
151+
SEARCH_REQUEST = 'search_request',
153152
DOCUMENT = 'document',
154-
// Results-related classes
155-
RESULTS = 'results',
153+
SEARCH_RESPONSE = 'search_response',
156154
}
157155

158156
/**

public/component_types/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
*/
55

66
export * from './transformer';
7-
export * from './indexer';
7+
export * from './indices';
88
export * from './other';

public/component_types/indexer/base_indexer.ts

-32
This file was deleted.

public/component_types/indexer/knn_indexer.ts

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { COMPONENT_CATEGORY, COMPONENT_CLASS } from '../../../common';
7+
import { BaseComponent } from '../base_component';
8+
9+
/**
10+
* A basic index placeholder UI component. Input/output depends on ingest or search context.
11+
* Does not have any functionality.
12+
*/
13+
export class BaseIndex extends BaseComponent {
14+
constructor(category: COMPONENT_CATEGORY) {
15+
super();
16+
this.type = COMPONENT_CLASS.INDEX;
17+
this.label = 'Index';
18+
this.description = 'An OpenSearch index';
19+
this.inputs = [
20+
{
21+
id:
22+
category === COMPONENT_CATEGORY.INGEST
23+
? 'document'
24+
: 'search_request',
25+
label:
26+
category === COMPONENT_CATEGORY.INGEST
27+
? 'Document'
28+
: 'Search Request',
29+
acceptMultiple: false,
30+
},
31+
];
32+
this.outputs =
33+
category === COMPONENT_CATEGORY.INGEST
34+
? []
35+
: [
36+
{
37+
id: 'search_response',
38+
label: 'Search Response',
39+
},
40+
];
41+
}
42+
}

public/component_types/indexer/index.ts public/component_types/indices/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
export * from './base_indexer';
7-
export * from './knn_indexer';
6+
export * from './base_index';
7+
export * from './knn_index';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { COMPONENT_CATEGORY, COMPONENT_CLASS } from '../../../common';
7+
import { BaseIndex } from './base_index';
8+
9+
/**
10+
* A basic knn index placeholder UI component. Input/output depends on ingest or search context.
11+
* Does not have any functionality.
12+
*/
13+
export class KnnIndex extends BaseIndex {
14+
constructor(category: COMPONENT_CATEGORY) {
15+
super(category);
16+
this.type = COMPONENT_CLASS.KNN_INDEX;
17+
this.label = 'k-NN Index';
18+
this.description = 'A specialized k-NN index';
19+
}
20+
}

public/component_types/other/document.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { COMPONENT_CLASS } from '../../../common';
77
import { BaseComponent } from '../base_component';
88

99
/**
10-
* A basic Document placeholder UI component.
10+
* A basic document placeholder UI component.
1111
* Does not have any functionality.
1212
*/
1313
export class Document extends BaseComponent {
@@ -18,8 +18,8 @@ export class Document extends BaseComponent {
1818
this.description = 'A document to be ingested';
1919
this.outputs = [
2020
{
21-
id: 'output',
22-
label: 'Output',
21+
id: 'document',
22+
label: 'Document',
2323
},
2424
];
2525
}

public/component_types/other/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
*/
55

66
export * from './document';
7-
export * from './results';
8-
export * from './query';
7+
export * from './search_response';
8+
export * from './search_request';

public/component_types/other/query/index.ts

-8
This file was deleted.

public/component_types/other/query/match_query.tsx

-20
This file was deleted.

public/component_types/other/query/neural_query.tsx

-20
This file was deleted.

public/component_types/other/query/query.tsx

-26
This file was deleted.

public/component_types/other/results.tsx

-21
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { COMPONENT_CLASS } from '../../../common';
7+
import { BaseComponent } from '../base_component';
8+
9+
/**
10+
* A basic search request placeholder UI component.
11+
* Does not have any functionality.
12+
*/
13+
export class SearchRequest extends BaseComponent {
14+
constructor() {
15+
super();
16+
this.type = COMPONENT_CLASS.SEARCH_REQUEST;
17+
this.label = 'Search Request';
18+
this.description = 'An OpenSearch search request';
19+
this.outputs = [
20+
{
21+
id: 'search_request',
22+
label: this.label,
23+
},
24+
];
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { COMPONENT_CLASS } from '../../../common';
7+
import { BaseComponent } from '../base_component';
8+
9+
/**
10+
* A basic search response placeholder UI component.
11+
* Does not have any functionality.
12+
*/
13+
export class SearchResponse extends BaseComponent {
14+
constructor() {
15+
super();
16+
this.type = COMPONENT_CLASS.SEARCH_RESPONSE;
17+
this.label = 'Search Response';
18+
this.description = 'OpenSearch search response';
19+
this.inputs = [
20+
{ id: 'search_response', label: this.label, acceptMultiple: false },
21+
];
22+
}
23+
}

0 commit comments

Comments
 (0)