Home Applications irisChatGPT

irisChatGPT

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
4
1 reviews
2
Awards
1.4k
Views
11
IPM installs
5
4
Details
Releases  (3)
Reviews  (1)
Awards  (2)
Issues
Videos  (1)
Articles  (7)
Application uses LangChain framework which is built around LLMs

What's new in this version

INTERSYSTEMS FHIR SQL BUILDER functionality added

irisChatGPT application leverages the functionality of one of the hottest python framework LangChain built around Large Language Models (LLMs).
LangChain is a framework that enables quick and easy development of applications that make use of Large Language Models.
Application is built by using objectscript with the help of intersystems Embedded Python functionality. It also contains Streamlit web application which is an open-source Python app framework to create beautiful web apps for data science and machine learning.

image

Streamlit Web Application Layout

image

Features

  • Built-in Intersystems ObjectScript Reference ChatGPT
  • Built-in InterSystems Grand Prix Contest 2023 ChatGPT
  • INTERSYSTEMS FHIR SQL BUILDER ChatGPT
  • ChatGPT with FHIR server
  • Answer questions over a Cache database by using SQLDatabaseChain
  • Create your own chatGPT model by using PDF, word and text documents
  • OpenAI ChatGPT
  • Wikipedia Search
  • Search on the internet by using DuckDuckGo (DDG) general search engine
  • Generate Python code by using Python REPL LangChain functionality
  • Streamlit Web application
    • Intersystems objectscript reference ChatGPT (Web interface)
    • Intersystems grand prix contest ChatGPT (Web interface)
    • Select and upload your own document for ChatGPT (Web Interface)
    • OpenAI ChatGPT (Web interface)

How to Run

To start coding with this repo, you do the following:

  1. Clone/git pull the repo into any local directory
git clone https://github.com/mwaseem75/irisChatGPT.git
  1. Open the terminal in this directory and run:
docker-compose build
  1. Run the IRIS container with your project:
docker-compose up -d

Installation with ZPM

zpm "install irisChatGPT.ZPM"

Getting Started

Get OpenAI Key

Application requires OpenAI API Key, sign up for OpenAI API on this page. Once you signed up and logged in, click on Personal, and select View API keys in drop-down menu. Create and copy the API Key

image

Connect to IRIS Terminal by using below command

docker-compose exec iris iris session iris

Create a new instance of dc.irisChatGPT class and use SetApiKey method to set OpenAI API Key

set chat = ##class(dc.irisChatGPT).%New()
do chat.SetAPIKey("Enter your Open API Key here")

image

Chat with Intersystems objectscript reference

write chat.irisDocs("Give me details of %$PIECE function with syntax")

image

Chat with InterSystems Grand Prix Contest 2023

write chat.irisContest("Give me Prizes and nominations")

image

INTERSYSTEMS FHIR SQL BUILDER BUILDER ChatGPT

Repository will load FHIR Resources, All you need is to configure FHIR SQL BUILDER.
For configuration, Navigate to http://localhost:55037/csp/fhirsql/index.html
image

For more details about configuration, please watch this Tutorial Video and check
iris-fhirsqlbuilder application by @Guillaume Rongier

Please note that I am using FHIR as package name

To view the specification, Navigate to http://localhost:55037/csp/fhirsql/index.html/spec#/1
image

After the configuration, we can do ChatGPT with FHIR SQL

write chat.irisFHIRSQL("Give me total patients")

image

write chat.irisFHIRSQL("List down all the Male Patients")

image

write chat.irisFHIRSQL("Give me patients where birthdate < 2000")

image

write chat.irisFHIRSQL("Give me observation details of patient 175")

image

write chat.irisFHIRSQL("Give me total encounter of 175")  

image

write chat.irisFHIRSQL("Give me goal of Patient 175")  

image

write chat.irisFHIRSQL("Give me details of Organization 80")  

image

ChatGPT with FHIR server

We need to first set FHIR Endpoint by using SetFHIRUrl method.
Currently, I am setting the FHIR server End point running in docker

do chat.SetFHIRUrl("http://localhost:52773/csp/healthshare/fhirserver/fhir/r4/")

Once URL is set, Now we can ask questions about Patient and Observation resources

write chat.irisFHIR("Give me total patients")

image

write chat.irisFHIR("List down all the Male Patients")

image

write chat.irisFHIR("Give me observation details of patient 175")

image

write chat.irisFHIR("Give me procedure of patients id 1") 

image

write chat.irisFHIR("Give me Immunizations  of patients id 175") 

image

write chat.irisFHIR("Give me all the encounters of year 2012") 

image

write chat.irisFHIR("Give me condition of patient id 175")  

image

write chat.irisFHIR("Give me all female practioners")  

image

Answer questions over a Cache database by using SQLDatabaseChain

write chat.irisDB("Give me total tables")

image

Create your own chatGPT model by using PDF, word and text documents

Use ingest function to upload the document

Copy your document to ManagerDirectory()+‘pdfdata/’ folder and then use the below command to ingest the data.
(The repository already contains Defining and Using Classes PDF which we will upload by using the below command)

set doc = ##class(dc.irisChatGPT).ingest("GOBJ.pdf")

Now we will use personalGPT function to chat with our document

w chat.personalGPT("Give me details of objects and properties") 

image

OpenAI ChatGPT

w chat.openAI("Give me details of Intersystems")

image

Wikipedia Search

w chat.wikiPedia("LangChain")   

image

Search on the internet by using DuckDuckGo (DDG) general search engine

w chat.duckDuckGo("What is the Capital of USA")

image

Generate Python code by using Python REPL LangChain functionality

w chat.pythonREPL("Write a function to check if 11 a prime number and test it")

image

Streamlit Web application

Navigate to Streamlit Web Application or CSP Web application

image

image

image

image

Thanks

Made with
Install
zpm install irisChatGPT download archive
Version
1.0.212 Nov, 2024
ObjectScript quality test
Category
Technology Example
Works with
InterSystems IRISInterSystems IRIS for HealthCaché
First published
01 Jul, 2023
Last checked by moderator
15 Oct, 2024Doesn't work