Added Text generation functionality with the help of GPT2 LLM (Large Language Model) model and Hugging Face pipeline
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.
Make sure you have git and Docker desktop installed.
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
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.
Run the below command to start IRIS terminal from VS CODE terminal
$ docker-compose exec iris iris session iris
Run the below command in IRIS terminal to view the existing data
do ##class(dc.VectorLab.Base).ListData()
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
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
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
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
Navigate to http://localhost:52773/csp/vectorlab/index.csp to run the application. (by using demo|demo)
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
From application
From Management portal
If needed, Load data button will remove all the data and load the fresh data.
Type “The fox and the chicken” in search and click Vector search button
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.
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
Thanks