Skip to content

Commit 5925d1b

Browse files
committed
Finish UI Piece
Signed-off-by: David Weik <[email protected]>
1 parent 85922c0 commit 5925d1b

File tree

3 files changed

+129
-4
lines changed

3 files changed

+129
-4
lines changed

js/objects/add-rag-builder-object.js

Lines changed: 109 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,26 +366,126 @@ async function addRAGBuilderObject(ragBuilderObject, paneID, ragBuilderInterface
366366
ragBuilderVectorDBHeader.innerText = ragBuilderInterfaceText?.ragBuilderVectorDBHeader;
367367
let ragBuilderVectorDBDescription = document.createElement('p');
368368
ragBuilderVectorDBDescription.innerHTML = ragBuilderInterfaceText?.ragBuilderVectorDBDescription;
369+
let ragBuilderVectorDBContainer = document.createElement('div');
369370
let ragBuilderVectorDBSelectorDropdown = document.createElement('select');
370371
ragBuilderVectorDBSelectorDropdown.setAttribute('class', 'form-select');
371372
ragBuilderVectorDBSelectorDropdown.setAttribute('id', `${ragBuilderObject?.id}-vectorDB-dropdown`);
373+
ragBuilderVectorDBSelectorDropdown.onchange = async function () {
374+
ragBuilderVectorDBContainer.innerHTML = '';
375+
let ragBuilderVectorDBDescriptor = document.createElement('p');
376+
const selectedVectorDB = this.options[this.selectedIndex].value;
377+
// Implement VectorDB specific notes
378+
if (selectedVectorDB === 'Chroma') {
379+
ragBuilderVectorDBDescriptor.innerHTML = ragBuilderInterfaceText?.chromaDescriptor;
380+
let ragBuilderVectorDBCollectionInputLabel = document.createElement('span');
381+
ragBuilderVectorDBCollectionInputLabel.innerText = `${ragBuilderInterfaceText?.ragBuilderVectorDBCollectionInputLabel}:`;
382+
let ragBuilderVectorDBCollectionInput = document.createElement('input');
383+
ragBuilderVectorDBCollectionInput.type = 'text';
384+
ragBuilderVectorDBCollectionInput.placholder = "my_collection";
385+
ragBuilderVectorDBCollectionInput.setAttribute('id', `${ragBuilderObject?.id}-collection-name`);
386+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDescriptor);
387+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBCollectionInputLabel);
388+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBCollectionInput);
389+
} else if (selectedVectorDB === 'SingleStore') {
390+
ragBuilderVectorDBDescriptor.innerHTML = ragBuilderInterfaceText?.singleStoreDescriptor;
391+
let ragBuilderVectorDBDatabaseInputLabel = document.createElement('span');
392+
ragBuilderVectorDBDatabaseInputLabel.innerText = `${ragBuilderInterfaceText?.ragBuilderVectorDBDatabaseInputLabel}:`;
393+
let ragBuilderVectorDBDatabaseInput = document.createElement('input');
394+
ragBuilderVectorDBDatabaseInput.type = 'text';
395+
ragBuilderVectorDBDatabaseInput.placholder = "database_name";
396+
ragBuilderVectorDBDatabaseInput.setAttribute('id', `${ragBuilderObject?.id}-database-name`);
397+
let ragBuilderVectorDBTableInputLabel = document.createElement('span');
398+
ragBuilderVectorDBTableInputLabel.innerText = `${ragBuilderInterfaceText?.ragBuilderVectorDBTableInputLabel}:`;
399+
let ragBuilderVectorDBTableInput = document.createElement('input');
400+
ragBuilderVectorDBTableInput.type = 'text';
401+
ragBuilderVectorDBTableInput.placholder = "table_name";
402+
ragBuilderVectorDBTableInput.setAttribute('id', `${ragBuilderObject?.id}-table-name`);
403+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDescriptor);
404+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDatabaseInputLabel);
405+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDatabaseInput);
406+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBTableInputLabel);
407+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBTableInput);
408+
} else if (selectedVectorDB === 'pgVector') {
409+
ragBuilderVectorDBDescriptor.innerHTML = ragBuilderInterfaceText?.pgVectorDescriptor;
410+
let ragBuilderVectorDBDatabaseInputLabel = document.createElement('span');
411+
ragBuilderVectorDBDatabaseInputLabel.innerText = `${ragBuilderInterfaceText?.ragBuilderVectorDBDatabaseInputLabel}:`;
412+
let ragBuilderVectorDBDatabaseInput = document.createElement('input');
413+
ragBuilderVectorDBDatabaseInput.type = 'text';
414+
ragBuilderVectorDBDatabaseInput.placholder = "database_name";
415+
ragBuilderVectorDBDatabaseInput.setAttribute('id', `${ragBuilderObject?.id}-database-name`);
416+
let ragBuilderVectorDBTableInputLabel = document.createElement('span');
417+
ragBuilderVectorDBTableInputLabel.innerText = `${ragBuilderInterfaceText?.ragBuilderVectorDBTableInputLabel}:`;
418+
let ragBuilderVectorDBTableInput = document.createElement('input');
419+
ragBuilderVectorDBTableInput.type = 'text';
420+
ragBuilderVectorDBTableInput.placholder = "table_name";
421+
ragBuilderVectorDBTableInput.setAttribute('id', `${ragBuilderObject?.id}-table-name`);
422+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDescriptor);
423+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDatabaseInputLabel);
424+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBDatabaseInput);
425+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBTableInputLabel);
426+
ragBuilderVectorDBContainer.appendChild(ragBuilderVectorDBTableInput);
427+
}
428+
}
372429
let ragBuilderVectorDBSelectorItem = document.createElement('option');
373430
ragBuilderVectorDBSelectorItem.value = `${ragBuilderInterfaceText?.ragBuilderVectorDBHeader}`;
374431
ragBuilderVectorDBSelectorItem.innerHTML = `${ragBuilderInterfaceText?.ragBuilderVectorDBHeader}`;
375432
ragBuilderVectorDBSelectorDropdown.append(ragBuilderVectorDBSelectorItem);
376433
// Add the projects to the dropdown
377434
for (const vectorDB in ragBuilderObject?.vectorDBList) {
378-
if (ragBuilderObject?.vectorDBList[vectorDB] in SUPPORTEDVECTORDBS) {
435+
if (SUPPORTEDVECTORDBS.includes(ragBuilderObject?.vectorDBList[vectorDB])) {
379436
let vectorDBOption = document.createElement('option');
380437
vectorDBOption.value = ragBuilderObject?.vectorDBList[vectorDB];
381438
vectorDBOption.innerHTML = ragBuilderObject?.vectorDBList[vectorDB];
382439
ragBuilderVectorDBSelectorDropdown.append(vectorDBOption);
383440
} else {
384-
console.log(`The configured Vector DB: ${vectorDBList[vectorDB]} is not supported, please open an issue.`)
441+
console.log(`The configured Vector DB: ${ragBuilderObject?.vectorDBList[vectorDB]} is not supported, please open an issue.`);
385442
}
386443
}
387444

388445
// Add a selector for the embedding model
446+
let ragBuilderEmbeddingModelHeader = document.createElement('h2');
447+
ragBuilderEmbeddingModelHeader.innerText = ragBuilderInterfaceText?.ragBuilderEmbeddingModelHeader;
448+
let ragBuilderEmbeddingModelDescription = document.createElement('p');
449+
ragBuilderEmbeddingModelDescription.innerText = ragBuilderInterfaceText?.ragBuilderEmbeddingModelDescription;
450+
// Retrieve the Embedding Models
451+
let ragBuilderAvailableEmbeddingModels = await getModelProjectModels(VIYA, ragBuilderObject?.embeddingProjectID);
452+
let promptBuilderDeprecatedLLMs = await getModelProjectModels(VIYA, ragBuilderObject?.embeddingProjectID, "eq(tags,'deprecated')");
453+
ragBuilderAvailableEmbeddingModels = ragBuilderAvailableEmbeddingModels.filter(obj1 => !promptBuilderDeprecatedLLMs.some(obj2 => obj1.id === obj2.id))
454+
for(const ragBuilderAvailableEmbeddingModel in ragBuilderAvailableEmbeddingModels) {
455+
let ragBuilderAvailableEmbeddingContents = await getModelContents(VIYA, ragBuilderAvailableEmbeddingModels[ragBuilderAvailableEmbeddingModel]?.id);
456+
for(const ragBuilderAvailableEmbeddingContent in ragBuilderAvailableEmbeddingContents) {
457+
if(ragBuilderAvailableEmbeddingContents[ragBuilderAvailableEmbeddingContent]?.name == 'options.json') {
458+
ragBuilderAvailableEmbeddingModels[ragBuilderAvailableEmbeddingModel].fileURI = ragBuilderAvailableEmbeddingContents[ragBuilderAvailableEmbeddingContent]?.fileURI
459+
let promptBuilderCurrentOptions = await getFileContent(VIYA, ragBuilderAvailableEmbeddingModels[ragBuilderAvailableEmbeddingModel].fileURI);
460+
let ragBuilderCurrentOptionsContent = await promptBuilderCurrentOptions.json();
461+
ragBuilderAvailableEmbeddingModels[ragBuilderAvailableEmbeddingModel].options = ragBuilderCurrentOptionsContent;
462+
}
463+
}
464+
}
465+
let ragBuilderEmbeddingModelSelectorDropdown = document.createElement('select');
466+
ragBuilderEmbeddingModelSelectorDropdown.setAttribute('class', 'form-select');
467+
ragBuilderEmbeddingModelSelectorDropdown.setAttribute('id', `${ragBuilderObject?.id}-embedding-model-dropdown`);
468+
let ragBuilderEmbeddingModelSelectorItem = document.createElement('option');
469+
ragBuilderEmbeddingModelSelectorItem.value = `${ragBuilderInterfaceText?.ragBuilderEmbeddingModelHeader}`;
470+
ragBuilderEmbeddingModelSelectorItem.innerHTML = `${ragBuilderInterfaceText?.ragBuilderEmbeddingModelHeader}`;
471+
ragBuilderEmbeddingModelSelectorDropdown.append(ragBuilderEmbeddingModelSelectorItem);
472+
// Add the Embedding Models to the dropdown
473+
for (const embeddingModel in ragBuilderAvailableEmbeddingModels) {
474+
let embeddingModelOption = document.createElement('option');
475+
embeddingModelOption.value = ragBuilderAvailableEmbeddingModels[embeddingModel].id;
476+
embeddingModelOption.innerHTML = ragBuilderAvailableEmbeddingModels[embeddingModel].name;
477+
ragBuilderEmbeddingModelSelectorDropdown.append(embeddingModelOption);
478+
}
479+
480+
// Save RAG Setup
481+
let ragSetupSaveButton = document.createElement('div');
482+
ragSetupSaveButton.id = `${paneID}-obj-${ragBuilderObject?.id}-rag-setup-save-button`;
483+
ragSetupSaveButton.innerText = `${ragBuilderInterfaceText?.ragSetupSaveButton}`;
484+
ragSetupSaveButton.setAttribute('type', 'button');
485+
ragSetupSaveButton.setAttribute('class', 'btn btn-primary');
486+
ragSetupSaveButton.onclick = async function () {
487+
console.log('SAVED');
488+
}
389489

390490
ragBuilderContainer.appendChild(ragBuilderHeader);
391491
ragBuilderContainer.appendChild(ragBuilderDescription);
@@ -411,6 +511,13 @@ async function addRAGBuilderObject(ragBuilderObject, paneID, ragBuilderInterface
411511
ragBuilderContainer.appendChild(ragBuilderVectorDBDescription);
412512
ragBuilderContainer.appendChild(ragBuilderVectorDBSelectorDropdown);
413513
ragBuilderContainer.appendChild(document.createElement('br'));
514+
ragBuilderContainer.appendChild(ragBuilderVectorDBContainer);
515+
ragBuilderContainer.appendChild(document.createElement('br'));
516+
ragBuilderContainer.appendChild(ragBuilderEmbeddingModelHeader);
517+
ragBuilderContainer.appendChild(ragBuilderEmbeddingModelDescription);
518+
ragBuilderContainer.appendChild(ragBuilderEmbeddingModelSelectorDropdown);
519+
ragBuilderContainer.appendChild(document.createElement('br'));
520+
ragBuilderContainer.appendChild(ragSetupSaveButton);
414521

415522
return ragBuilderContainer;
416523
}

language/de.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,15 @@
245245
"chunkSizeOverlapText": "Geben Sie die Größe der Überlappung zwischen Chunks an",
246246
"chunkSeparatorText": "Geben Sie die Seperators ein. Stellen Sie dabei sicher das jeder Seperator in einfachen Anführungszeichen ist und durch Kommata getrennt sind",
247247
"ragBuilderVectorDBHeader": "Wählen Sie eine Vector Datenbank für Ihr Projekt",
248-
"ragBuilderVectorDBDescription": "Eine Vektor Datenbank (Vektor-DB) ist eine Art von Datenbank, die Daten als hochdimensionale Vektoren speichert. Diese Vektoren sind numerische Darstellungen von Daten. Sie werden von Embedding-Modellen erstellt und erfassen die semantische Bedeutung und die wichtigsten Merkmale der ursprünglichen Daten."
248+
"ragBuilderVectorDBDescription": "Eine Vektor Datenbank (Vektor-DB) ist eine Art von Datenbank, die Daten als hochdimensionale Vektoren speichert. Diese Vektoren sind numerische Darstellungen von Daten. Sie werden von Embedding-Modellen erstellt und erfassen die semantische Bedeutung und die wichtigsten Merkmale der ursprünglichen Daten. Für die Verbindung zu den Vektor-Datenbanken muss beim deployment des RAG Setups dann Umgebungsvariablen gesetzt werden. Diese Informationen finden sich als Deployment-Notes.md zusammen mit dem RAG Setup im SAS Model Manager.",
249+
"chromaDescriptor": "Chroma ist eine open-source, embedding database, mit der man auch auf einem lokalen Rechner einfach starten kann. Sie wurde speziell für die Entwicklung von KI-Anwendungen wie RAG konzipiert und ist bekannt für ihre Benutzerfreundlichkeit und Entwicklerfreundlichkeit. Chroma konzentriert sich darauf, eine reine Vektordatenbank zu sein, die vector embeddings und ihre Metadaten speichert, um eine schnelle semantische Suche zu ermöglichen. <br><ul><li><b>Use Case:</b> Chroma ist eine ausgezeichnete Wahl für einen Machbarkeitsnachweis (Proof-of-Concept) oder für schnelles Prototyping. Ihr schlanker Charakter und die einfache Einrichtung machen sie ideal, um schnell eine Idee zu testen, Bilder, Videos oder andere Inhalte basierend auf Text oder anderen Eingaben abzurufen, ohne die Komplexität eines größeren Datenbanksystems.</li></ul>",
250+
"pgVectorDescriptor": "pgVector ist eine open-source Erweiterung, die die robuste und funktionsreiche relationale PostgreSQL-Datenbank in eine Vektordatenbank verwandelt. Sie ermöglicht es, vector embeddings neben Ihren strukturierten Daten zu speichern und abzufragen, was Ihre Architektur vereinfacht, da keine separate Datenbank für Ihre Vektoren erforderlich ist. pgVector nutzt die vollumfänglichen SQL-Funktionen von PostgreSQL, einschließlich Joins und Filtern, um hybride Suchvorgänge durchzuführen. <br><ul><li><b>Use Case:</b> pgVector ist eine gute Option für eine Anwendung, die komplexe, multimodale Abfragen erfordert. Zum Beispiel eine Suche, die ein Bild basierend auf der Textbeschreibung eines Benutzers findet und gleichzeitig die Ergebnisse basierend auf strukturierten Daten wie dem Preis, der Kategorie und der Verfügbarkeit des Produkts filtert.</li></ul>",
251+
"singleStoreDescriptor": "SingleStore ist eine verteilte SQL-Datenbank, die Transaktionen und Echtzeitanalysen mit integrierten Vektorfunktionen vereint. Im Gegensatz zu einer spezialisierten Vektordatenbank ist SingleStore eine Multi-Modell-Datenbank, die sowohl traditionelle relationale Daten als auch Vektoren verarbeiten kann. Dies ermöglicht leistungsstarke hybride Suchvorgänge, die die Geschwindigkeit einer Vektorsuche mit der tiefen Filterung und der analytischen Leistungsfähigkeit von SQL kombinieren.<br><ul><li><b>Use Case:</b> SingleStore eignet sich am besten für eine Anwendung auf Unternehmensebene, die in einem massiven Umfang und mit geringer Latenz betrieben werden muss. Ihre Architektur ist ideal für Anwendungen wie eine große E-Commerce-Plattform, die Echtzeitsuchen in einem Produktkatalog mit Millionen von Artikeln durchführen und diese Daten gleichzeitig sofort mit Kundenanalysen, Bestandsdaten und der Bestellhistorie verknüpfen muss.</li></ul>",
252+
"ragBuilderVectorDBCollectionInputLabel": "Geben Sie einen Namen für die Collection ein: ",
253+
"ragBuilderVectorDBDatabaseInputLabel": "Geben Sie den Namen der Datenbank ein: ",
254+
"ragBuilderVectorDBTableInputLabel": "Geben Sie einen Namen für die Tabelle ein: ",
255+
"ragBuilderEmbeddingModelHeader": "Wählen Sie das Embedding Modell für Ihr Projekt",
256+
"ragBuilderEmbeddingModelDescription": "Embedding-Modelle sind grundlegend für RAG-Systeme, da sie bestimmen, wie Ihre Textdaten in numerische Vektoren umgewandelt werden. Ziel ist es, embeddings zu erstellen, die die semantische Bedeutung Ihres Textes präzise erfassen, damit das System die relevantesten Informationen finden kann.",
257+
"ragSetupSaveButton": "RAG Setup Speichern"
249258
}
250259
}

language/en.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,15 @@
245245
"chunkSizeOverlapText": "Specify the size of the overlap of chunks",
246246
"chunkSeparatorText": "Specify the list of separators. Make sure they are in single quotes and separated by commas",
247247
"ragBuilderVectorDBHeader": "Select a Vector DB for your project",
248-
"ragBuilderVectorDBDescription": "A vector database (vector DB) is a type of database that stores data as high-dimensional vectors, which are numerical representations of data. These vectors, often called embeddings, are created by embedding models and capture the semantic meaning and key features of the original data."
248+
"ragBuilderVectorDBDescription": "A vector database (vector DB) is a type of database that stores data as high-dimensional vectors, which are numerical representations of data. These vectors, often called embeddings, are created by embedding models and capture the semantic meaning and key features of the original data. For the connection with the vector DB additional information might be required for the deployment of the RAG setup. The required environment will be stored along the RAG Setup in SAS Model Manager in Deployment-Notes.md.",
249+
"chromaDescriptor": "Chroma is an open-source, AI-native embedding database that's simple to get started with, even on a local machine. It's designed specifically for building AI applications like RAG and is known for its ease of use and developer-friendly nature. Chroma is focused on being a pure vector database, storing vector embeddings and their metadata to enable fast semantic search.<br><ul><li><b>Use Case:</b> Chroma is an excellent choice for a proof-of-concept or for rapid prototyping. Its lightweight nature and simple setup make it ideal for quickly testing an idea to retrieve images, videos, or other content based on text or other inputs, without the complexity of a larger database system.</li></ul>",
250+
"pgVectorDescriptor": "pgVector is an open-source extension that turns the robust and feature-rich PostgreSQL relational database into a vector database. It allows you to store and query vector embeddings alongside your structured data, simplifying your architecture by not requiring a separate database for your vectors. pgVector leverages PostgreSQL's full-featured SQL capabilities, including joins and filtering, to perform hybrid searches. <br><ul><li><b>Use Case:</b> pgVector is a strong option for an application that requires the ability to perform complex, multimodal queries. For example, a search that finds an image based on a user's text description, while simultaneously filtering the results based on structured data like the product's price, category, and availability.</li></ul>",
251+
"singleStoreDescriptor": "SingleStore is a distributed SQL database that unifies transactions and real-time analytics with built-in vector capabilities. Unlike a specialized vector database, SingleStore is a multi-model database that can handle traditional relational data as well as vectors. This allows for powerful hybrid searches that combine the speed of a vector search with the deep filtering and analytical power of SQL.<br><ul><li><b>Use Case:</b> SingleStore is best suited for an enterprise-level application that needs to operate at a massive scale with low latency. Its architecture is ideal for applications like a large e-commerce platform that needs to perform real-time searches across a product catalog of millions of items, while also instantly joining that data with customer analytics, inventory data, and order history.</li></ul>",
252+
"ragBuilderVectorDBCollectionInputLabel": "Enter the name of collection: ",
253+
"ragBuilderVectorDBDatabaseInputLabel": "Enter the name of the database: ",
254+
"ragBuilderVectorDBTableInputLabel": "Enter the name of the table: ",
255+
"ragBuilderEmbeddingModelHeader": "Select the Embedding Model for your project",
256+
"ragBuilderEmbeddingModelDescription": "Embedding models are fundamental to RAG systems, as they determine how your text data is converted into numerical vectors. The goal is to create embeddings that accurately capture the semantic meaning of your text, allowing the system to find the most relevant information.",
257+
"ragSetupSaveButton": "Save RAG Setup"
249258
}
250259
}

0 commit comments

Comments
 (0)