I have build chat bot using "gpt-3.5-turbo-0613" when i ask to make chart from given data model is not able to provide me that?

I have build chatbot which take csv file and upload them database, i was try some promt but whenever i ask to create some trendline to Chatbot using “gpt-3.5-turbo-0613” model it’s not able to generate that ? can anyone tell me what should i add or change to make sure my chatbot can give ans for it ?

No, you would have to create a function to use something like python on the csv to create graphs or analyze data.
Thats a feature built into chatGPT (code interpreter/advanced data analysis) using the functions in the API

Code interpreter or Advanced Data Analysis in not in the API nor in the models. Thats just something they built into chatGPT using the functions and python.

chatGPT is just example application using the API

you would have to recreate that part yourself with functions and python. Should be possible, but might not be simple

1 Like

Can you please give me a reference on how to create a function using Python?

There is some documentation here

Never actually used functions myself, so I cant give you many tips.

Functions are like hands for GPT to use external tools.
You need to give GPT functions which will somehow call python and use it.

  1. You make the function definition - a particular JSON format which doesn’t support many options or keys:
function_list=[
{
  "name": "sum_numbers",
  "description": "Add mixed int and float numbers together",
  "parameters": {
    "type": "object",
    "properties": {
      "numbers_list": {
        "type": "string",
        "description": "required format: python list of individual numbers to add"
      }
    },
    "required": ["numbers_list"]
  }
}
]
  1. You add that to your chat completions endpoint call’s parameters:
response = openai.ChatCompletion.create(
    messages=[{"role": "system", "content": "You are a helpful AI assistant."},
              {"role": "user", "content": "Find the first 20 digits of pi. Then add the individual digits together."}],
    model="gpt-3.5-turbo",
    top_p=0.5,
    functions=function_list,
    function_call="auto",
)

(we use top_p so that alternate token choices can’t mess up our output formatting)
(older models don’t support functions)

  1. You get an assistant response back not in “content”, but in “function_call” when the AI decides to use it.
{
  "role": "assistant",
  "content": null,
  "function_call": {
    "name": "sum_numbers",
    "arguments": "{\n  \"numbers_list\": \"3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4\"\n}"
  }
}
  1. Do whatever the function needs with your programming and outside services.

  2. Call the AI the same way again, but adding another role message “function” with the return value from the function.

The AI can now answer with the new information or status report.

2 Likes

Can you please give me a reference on how to create a function using Python?

The explanation I gave is clearer introduction than API reference link on the left of this forum, where you can go to create chat completion, expand at “function calling”, and look at guide and schema.

(maybe this question was about simply writing pythonic functions themselves. That’s “ask a chatbot how to program” territory…)

plus you have the whole cookbook with tons of examples mentioned in the API reference

This is not a task where you just copy paste some code from the internet.
It will not be that simple.
You need functions in GPT as these examples show, then some kind of python environment where it will load the csv and process the data and output something based on the function which GPT executed and some way to get the python output back to your chat.
(GPT only tells python to run the analysis and it gets some data back, GPT does not process any of it, thats what the python part does and gives the output back to the chat/GPT)
Something in that way

But there might be apps other people built which implemented something like Code Interpreter / Advanced Data Analysis which you could use with your own API key.
But you will have to find them.