diff --git a/common/constants.ts b/common/constants.ts index 71389bca..09a81a3d 100644 --- a/common/constants.ts +++ b/common/constants.ts @@ -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', } diff --git a/public/general_components/general-component-styles.scss b/public/general_components/general-component-styles.scss index 68f9cebf..c8c1f9d4 100644 --- a/public/general_components/general-component-styles.scss +++ b/public/general_components/general-component-styles.scss @@ -1,5 +1,5 @@ .multi-select-filter { &--width { - width: 200px; + width: 300px; } } diff --git a/public/pages/workflows/new_workflow/utils.ts b/public/pages/workflows/new_workflow/utils.ts index 841290b8..6f2289e6 100644 --- a/public/pages/workflows/new_workflow/utils.ts +++ b/public/pages/workflows/new_workflow/utils.ts @@ -5,8 +5,10 @@ import { snakeCase } from 'lodash'; import { + CollapseProcessor, MLIngestProcessor, MLSearchRequestProcessor, + MLSearchResponseProcessor, NormalizationProcessor, } from '../../../configs'; import { @@ -50,6 +52,10 @@ export function enrichPresetWorkflowWithUiMetadata( uiMetadata = fetchSentimentAnalysisMetadata(); break; } + case WORKFLOW_TYPE.RAG: { + uiMetadata = fetchRAGMetadata(); + break; + } default: { uiMetadata = fetchEmptyMetadata(); break; @@ -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. diff --git a/server/resources/templates/rag.json b/server/resources/templates/rag.json new file mode 100644 index 00000000..d0ad304c --- /dev/null +++ b/server/resources/templates/rag.json @@ -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" + } +} \ No newline at end of file