The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Narsing1
Mega Sage

NOTE:  Currently the Codex API's are not working properly.  Please use this as a reference when you are using a subscription based ChatGPT.

 

Introduction

 

As I have been hearing a lot about how powerful ChatGPT is, thought of integrating into Servicenow.  While checking the features of ChatGPT I was really impressed with the Code Search that is offered by ChatGPT.  It's very powerful and gives you the exact code as per your requirement.

 

Examples:

angular js code button click go to gmail.com

Narsing1_0-1676213800857.png

 

Servicenow code for delete a record

Narsing1_1-1676213843377.png

 

Step 1 - ChatGPT

Create an account in https://platform.openai.com/

Once you create account, login using the credentials and get the API Key / Bearer Token from https://platform.openai.com/docs/quickstart/build-your-application

Click on “Create new secret key”, copy the key and save it in a notepad/in some other.

Narsing1_0-1676214031917.png

 

 

Step 2 - Servicenow

Download the Update set from the Share Location 

Once you commit the update set, modify the System Property called “chatgpt.token” and store the ChatGPT API Key like this in your Servicenow Instance.

 

 

 

 

 

Bearer <your api key>

 

 

 

 

 

 

Narsing1_1-1676214218685.png

Now, you are ready to use the Tool.  Go to the Filter Navigator and type "ChatGPT" ==> "Code Search"

On the Search bar, type your requirement and you will get the code based on your requirement like this.

 

Narsing1_0-1676251172027.png

 

screen1.jpg

 

 

 

 

 

 

 

Narsing1_0-1676220507838.png

screen2.jpg

 

 

 

 

 

 

 

 

 

 

screen3.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Note:

  • All the code results that you see here are completely from ChatGPT AI Engine.  Sometimes the results may vary based on the response that it will get from the API.  
  • Also, sometimes you may see few unnecessary html tags because of the format issues. But overall you can easily identify the code that you need to copy from this and use it for your own purpose.
  • At present, only the admins can access this Tool, but you may change it based on your requirement.

 

Thank You

Narsing

 

 

 

 

 

Comments
Venkata1
Tera Expert

@Narsing1  I have imported the updateset but I am getting response as "Sorry! you have no results" any thoughts on why client script is going to exxception?

Narsing1
Mega Sage

Looks like Code Davinci not working at this moment.  Checking the API details.

Thanks,

Narsing

Venkata1
Tera Expert

@Narsing1 I tried with 'text-davinci-003'  but my prepaid balance expired. I am trying to reload but getting page error issue. 

 

i will try and let you know if new model is working. Please also keep me posted with your findings. Thankyou.

Yogesh Shinde
ServiceNow Employee
ServiceNow Employee

Thanks @Narsing1 . Please note that after committing the update set, I can see the ChatGpt option in the menu but it's not working. Please see the screenshot. This may be because I just couldn't find the System Property called “chatgpt.token”. Please advise how to find this property so that I can update my OpenAI API key there.

 

YogeshShinde_0-1680860991358.png

 

Narsing1
Mega Sage

Hi @Yogesh Shinde 

Looks like Codex API's are not working and also I am hearing that OpenAI is discontinuing its support on Codex.

I am still trying to see whether it has provided any other way.  Since Codex is only a Beta, we may not expect much.

 

As far as the API Call and other logic in this update is concerned, it is in the correct way.  Please check the OpenAI community as well for more information.

 

Thanks,

Narsing

Yogesh Shinde
ServiceNow Employee
ServiceNow Employee

Thanks for the response @Narsing1

 

As of March 2023, the Codex models are now deprecated. Please check out our newer Chat models which are able to do many coding tasks with similar capability

Varun Sareen
Tera Contributor

@Narsing1  Have you applied the update provided by @Yogesh Shinde  to your cod yet?

Yogesh Shinde
ServiceNow Employee
ServiceNow Employee

I did update the chatgpt.token system property and provided the bearer token. But still the same error as the codex models are now deprecated.

Community Alums
Not applicable

So just to be clear, this ChatGPT search no longer works and the share project simply hasn't been taken down, correct?

I get the same errors as all the others on this page. 

LonLandry1
Giga Guru

Likewise - SORRY! Not able to find your code at this moment is the response to all queries

Narsing1
Mega Sage

Hey,

Sorry.. I didn't go through with the latest API's and it was done almost 2 years back.  Looks like the Codex api's are not working properly at present.  

Could be some subscription issues.  Not sure whether it needs a paid subscription at present.  But I am sure the concept will be the same to use the API.

 

Thanks,

Narsing

Version history
Last update:
‎11-13-2024 07:55 PM
Updated by:
Contributors