Need help for ChatGPT prompt for writing code

We have developed a library of methods (around 50 functions/methods) on top of node.js
We use this library to write short snippets of code to perform a certain task. One example of such a task is this:

Read the user's name, mobile number and email id from the session data and write this information in a google sheet as a new entry.

For getting this task done using ChatGPT, we give the user guide of our library which contains description of functions, syntax of functions, usage example of functions and expected output from those methods/functions. Now as a prompt, we ask chatGPT to read this documentation and write a code to “Read the user's name, mobile number and email id from the session data and write this information in a google sheet as a new entry.

Now instead of using our custom library of functions to write this code, chatGPT writes a generic node.js code to perform this task. ChatGPT assumes that there is a variable called session and it writes a function to read data from session and the it calls google library functions and writes a new method to write data in google sheet.

How can we prompt the chatGPT to use available functions from our library only and write a custom method only if the related method is not found in our library?

Hello @vivek4m ,

Welcome to the community.

For this case what you can do is :

Give instances to chatgpt of how to use the functions of your library with purposes of each(just as if you are training chatgpt).If chatgpt generates code without using the library functions from your given list, give it feedback learning. It can learn from feedback.
You can add a code that if the required task can’t find a function, chatgpt can use it’s own custom method.

In short, with reinforcement learning, we can optimize and customize it making it more user centric.

With regards,
Nilosree Sengupta

Thanks Nilosree for getting back on this.
I think I am giving enough information about the functions and its library to chatGPT. This is the content which I am providing it to understand the library and its functions: Code Node Syntax - Google Docs

But still its not working for me for a task like:

Read the user's name, mobile number and email id from the session data and write this information in a google sheet as a new entry.

I am expecting chatGPT to use following functions of the library for this task, which it doesnt:

Yubo.getSessionData
Yubo.updateGoogleSpreadSheet

Can you please see and let me know what I might be missing here?


Vivek