Artificial Intelligence (AI) is getting a lot of attention lately because it can change many areas of our lives. Better computer power and more data have helped AI do amazing things, like improving medical tests and making self-driving cars. AI can also help businesses make better decisions and work more efficiently, which is why it's becoming more popular and widely used. How can one integrate the OpenAI API calls into an existing IRIS Interoperability application?
To learn how to get OpenAI credentials, follow this tutorial
Original Application
and check out it's source code here available here
Navigate to the Interoperability->[Namespace]->Configure->Production and make sure that our original production is running.
Add a new Operation based on class Banksia.OpenAi.Operation and name it OpenAiOut. Make it enabled. This operation will communicate with OpenAI API servers.
- Operation Class: Banksia.OpenAi.Operation
- Operation Name: OpenAiOut
Fill in the form data and add apiKey in the password field. Save the data by clicking on Save. ID and User Name fields you can fill as you like.
Setup SSL Configuration: create a new Client SSL Configuration OpenAiSSL and select it in the dropdown.
Сheck the repository URL is provided and that we need to query ChatGPT to create a description if no description has been entered.
(request.Summary="") & (request.GitHubUrl '="")
Customize the type of request and the received response, as well as distribute variables for actions.
- Request Message Class: Banksia.OpenAi.Msg.SimplePrompt.Request
set callrequest.Prompt = "Visit the website you will be provided on the next step. Describe the main idea of the project, its objectives and key features in one paragraph."
set callrequest.UserInput = request.GitHubUrl
set callrequest.Model = "gpt-4"
- Response Message Class: Banksia.OpenAi.Msg.SimplePrompt.Response
set request.Summary = callresponse.Content
Step 4 - Add Logo Generation to Business Process
Сonfigure the next <call> element, make a target our OpenAiOut operation as well.
- Name: Generate Logo
Step 5: Test our new Business Process in Production
Go to the Interoperability->Configure->Production section
Verify that the response from the OpenAI API is received and processed correctly by the application. Go to Visual Trace to see the full application cycle and make sure that the correct data is transmitted in each process element.
Conclusion
By following these steps, you can integrate the OpenAI API into the interoperability production using the Business Process in InterSystems IRIS. The bg-openai module is a great resource for developers looking to incorporate AI into their applications. By simplifying the integration process, it opens up new possibilities for enhancing applications with the power of artificial intelligence.
About Author
is an international boutique consultancy headquartered in Sydney, Australia, specializing in providing professional services for InterSystems technologies. With a team of dedicated and experienced professionals, we pride ourselves on being an official InterSystems Premier Partner, authorized to provide services worldwide. Our passion for excellence and innovation drives us to deliver high-quality solutions that meet the unique needs of our clients.
SOCIAL SHARE CARD GENERATOR