Skip to content

Commit

Permalink
Add metadata (no quick config fields)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Sep 11, 2024
1 parent 2195ea9 commit fc03ff2
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export enum WORKFLOW_TYPE {
MULTIMODAL_SEARCH = 'Multimodal search',
HYBRID_SEARCH = 'Hybrid search',
SENTIMENT_ANALYSIS = 'Sentiment analysis',
RAG = 'Retrieval-augmented generation',
CUSTOM = 'Custom',
UNKNOWN = 'Unknown',
}
Expand Down
2 changes: 1 addition & 1 deletion public/general_components/general-component-styles.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.multi-select-filter {
&--width {
width: 200px;
width: 300px;
}
}
21 changes: 21 additions & 0 deletions public/pages/workflows/new_workflow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import { snakeCase } from 'lodash';
import {
CollapseProcessor,
MLIngestProcessor,
MLSearchRequestProcessor,
MLSearchResponseProcessor,
NormalizationProcessor,
} from '../../../configs';
import {
Expand Down Expand Up @@ -50,6 +52,10 @@ export function enrichPresetWorkflowWithUiMetadata(
uiMetadata = fetchSentimentAnalysisMetadata();
break;
}
case WORKFLOW_TYPE.RAG: {
uiMetadata = fetchRAGMetadata();
break;
}
default: {
uiMetadata = fetchEmptyMetadata();
break;
Expand Down Expand Up @@ -206,6 +212,21 @@ export function fetchSentimentAnalysisMetadata(): UIState {
return baseState;
}

export function fetchRAGMetadata(): UIState {
let baseState = fetchEmptyMetadata();
baseState.type = WORKFLOW_TYPE.RAG;
baseState.config.ingest.index.name.value = generateId('my_index', 6);
baseState.config.search.request.value = customStringify(FETCH_ALL_QUERY);
baseState.config.search.enrichRequest.processors = [
new MLSearchRequestProcessor().toObj(),
];
baseState.config.search.enrichResponse.processors = [
new MLSearchResponseProcessor().toObj(),
new CollapseProcessor().toObj(),
];
return baseState;
}

// Utility fn to process workflow names from their presentable/readable titles
// on the UI, to a valid name format.
// This leads to less friction if users decide to save the name later on.
Expand Down
14 changes: 14 additions & 0 deletions server/resources/templates/rag.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Retrieval-Augmented Generation",
"description": "A basic workflow containing the index and search pipeline configurations for performing basic retrieval-augmented generation",
"version": {
"template": "1.0.0",
"compatibility": [
"2.17.0",
"3.0.0"
]
},
"ui_metadata": {
"type": "Retrieval-augmented generation"
}
}

0 comments on commit fc03ff2

Please sign in to comment.