Home Applications iris-VectorLab

iris-VectorLab

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
1 reviews
0
Awards
203
Views
19
IPM installs
0
0
Details
Releases
Reviews  (1)
Issues
Articles  (2)
The application demonstrates the functionality of Vector Search.

What's new in this version

Added Text generation functionality with the help of GPT2 LLM (Large Language Model) model and Hugging Face pipeline

Summary

IRIS-VectorLab is a web application that demonstrates the functionality of Vector Search with the help of embedded python. It leverages the functionality of the Python framework SentenceTransformers for state-of-the-art sentence embeddings and uses HuggingFace pipeline along with GPT2 LLM (Large Language Model) model for text generation.

one one one one one one OEX license

Features

  • Text to Embeddings Translation.
  • VECTOR-typed Data Insertion.
  • View Vector Data
  • Perform Vector Search by using VECTOR_DOT_PRODUCT and VECTOR_COSINE functions.
  • Demonstrate the difference between normal and vector search
  • HuggingFace Text generation with the help of GPT2 LLM (Large Language Model) model and Hugging Face pipeline

Application Interface

image

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Docker (e.g. for dev purposes)

Clone/git pull the repo into any local directory

$ git clone https://github.com/mwaseem75/iris-VectorLab.git

Open the terminal in this directory and run:

$ docker-compose up -d

IPM

Open IRIS for Health installation with IPM client installed. Call in any namespace:

USER>zpm "install iris-VectorLab"

Application already loaded some dummy data for testing purposes.

Test functionality through IRIS terminal

Run the below command to start IRIS terminal from VS CODE terminal

$ docker-compose exec iris iris session iris
image

View existing data

Run the below command in IRIS terminal to view the existing data

do ##class(dc.VectorLab.Base).ListData()
image

Inserting vector data

Run the below command to insert vector data, Pass the desired description as an argument

do ##class(dc.VectorLab.Base).SaveData("InterSystems IRIS Data Platform 2024.1 introduces Vector Search")

Run the ListData command again to view the data
image

View vector data

Run the below command to view vector data in IRIS terminal and pass the ID which is 17 in our case.

set vector =  ##class(dc.VectorLab.Base).ViewData(17,2) 
write vector
image

Performing Vector Search

Run the below command to search vector data

set vector =  ##class(dc.VectorLab.Base).VectorSearch("The fox and the chicken")

Application will get the top 5 similar records
image

HuggingFace Text generation with the help of GPT2 LLM

Run the below command by passing some text, application will generate the text accordingly to search vector data

set rc=##class(dc.VectorLab.Base).Generate("Generative AI is")
write rc
image

Test the functionality by Running Web Application

Navigate to http://localhost:52773/csp/vectorlab/index.csp to run the application. (by using demo|demo)
image

Add data with vector embeddings

Click on the Resources List to view Resource records of the connected FHIR Server and further clink on the record itself to view JSON and Human readable details of selected Resource
image
image

View Vector Data

From application

image image

From Management portal
Screenshot 2024-05-13 133805

Load data

If needed, Load data button will remove all the data and load the fresh data.
image

Performing Vector Search

Type “The fox and the chicken” in search and click Vector search button
image

Application will get the top 5 similar vector data.

Now we will do a traditional search by clicking the Normal search button, as expected system will not retrieve any record.
image

HuggingFace Text generation with the help of GPT2 LLM and Hugging Face pipeline

Navigate to http://localhost:52773/csp/vectorlab/generate.csp to run the application.

Type some text and press generate button, application will generate the text accordingly with the help of GPT2 LLM (Large Language Model) model and Hugging Face pipeline
image

Thanks

Made with
Install
zpm install iris-VectorLab
Version
1.0.115 May, 2024
ObjectScript quality test
Category
Technology Example
Works with
InterSystems IRISCachéInterSystems Vector Search
First published
12 May, 2024
Last checked by moderator
02 Jul, 2024Doesn't work