John Zhang1
Kilo Patron
Kilo Patron

I have posted How to build ServiceNow user interface (Virtual Agent) on the portal to chat with Chat GPT blog to introduce how to integrating with ChatGPT.  This blog will introduce how to integrating with the Assistants API to let ServiceNow user to chat with the GPT with OpenAI in real time.

 

Objectives

  • Introduction OpenAI APIs ( ChatGPT, Assistants API and Gemini API)
  • Use Case
  • Technical Approach
  • Design
  • Implementation
  • References

Introduction OpenAI APIs

ChatGPT is a specific language model, while the OpenAI Assistants API is an interface for integrating language models into applications. The Gemini API, on the other hand, is part of OpenAI's initiative to enhance AI capabilities by combining multiple models for improved performance.

 

The Assistants API enables developers to easily build powerful AI assistants within their apps. This API removes the need to manage conversation history and adds access to OpenAI-hosted tools like Code Interpreter and Retrieva
OpenAI Assistants API.


• Type: The OpenAI Assistants API is an interface that allows developers to integrate language models into their applications or services. It is designed to make it easier for developers to build custom conversational agents.
• Usage: Developers can use the Assistants API to create applications that involve interactive and dynamic conversations, tailored to specific use cases.
• Access: Available through the OpenAI platform, developers can use the API to leverage OpenAI's language models.

 

Use Case

ServiceNow end user can directly chat with GPT of the OpenAI Assistants APIs to get their answer in real time through the virtual agent on Employee Center Portal.

 

Design 

JohnZhang1_0-1707256957985.png

 

Process Flow

JohnZhang1_1-1707257004398.png

 

Technical Approach

  • Create REST message to configure with the OpenAI Assistants API endpoint access.
  • Create Flow Action in Flow designer to access the REST message created above.
  • Create the Virtual Agent topic to configure the above Flow Action.

Implementation

Create Rest Message (Outbound)

 

JohnZhang1_5-1707065559587.png

 

Create the Flow Action -askAssisstantsAPI

JohnZhang1_1-1707065034241.png

 

JohnZhang1_2-1707065138027.png

JohnZhang1_3-1707065371825.png

JohnZhang1_4-1707065435324.png

 

 

 

 

Create the Virtual Agent Topic -"Chat to OpenAI Assistants API"

JohnZhang1_0-1707063403107.png

 

JohnZhang1_0-1707066045781.png

 

JohnZhang1_1-1707066306506.png

 

References

2 Comments