How can I use "Advanced Data Analysis" feature in python

Hello,

In webpage, I can use “Advanced Data Analysis” feature after enable"Advanced Data Analysis" feature in Beta features. and I’m trying to write python code to use this feature using openai python package.
But I can’t find the way how to set parameter or use API for this.

My questions are

  1. How can I use “Advanced Data Analysis” feature with gpt-4 in python code?
  2. How can I provide csv data file to model?
    (besically, there is 8K token limit, so it is difficult to add data table in prompt)

Thank you in advance.

Regards,

Welcome @hoshins

The ADA(earlier Code Interpreter) should have a + symbol to attach file in the LHS of message composer.

Thank you for your reply.
Is there anyway to do this with openai python package instead of open api?

I am not familiar with ChatGPT, so I would appreciate it if you could explain it in detail.
Thank you.

There is no “executing python” by API unless you have your own python virtual sandbox environment and do the coding yourself to run arbitrary scripts the AI writes, and return the results to it.

      "message": {
        "role": "assistant",
        "content": null,
        "function_call": {
          "name": "python",
          "arguments": "import math\n\npi = str(math.pi)\nfirst_10_digits = pi.replace(\".\", \"\")[:10]\nresult = 1\nfor digit in first_10_digits:\n    result *= int(digit)\n\nresult"
        }
      },

If you can’t see what to do with the AI response above from your programming knowledge and platform knowledge, you need to update your skill set first.

Thank you for your reply in detail.

As far as I understood, the example response seems like that model give this response by function call feature, and user who receive this response need to execute the code in arguments to get the result in his or her environment.

What I want to do with “Advanced Data Analysis” feature is to ask the model to analyze provided data and give some insights, or to describe the data in natural language or to suggest charts that represnet the data well. and I want to do this in python code, not openai web page.
and regarding chart, it could be done by similar way that your example.

Thank you.

If you just have the simple goal of having a python program be able to take data and process it and produce an analysis or graphic, you can simply ask for the AI’s help in developing such software. Then run it on your local python environment.

Advanced data analysis within ChatGPT is an AI that when it receives a complex task, has been trained on writing python scripts in order to run them in a provided environment, and get results that can answer a question or satisfy the request. We can get the similar AI skill with functions, but all the remaining pieces must be made by the programmer.

1 Like

As @_j pointed out, you’d have to implement an environment that lets the model “see” the file, write its code and execute it.

While it may be technologically complex to do on your own, there’s a very recent open-source project called open-interpreter that could, to an extent, replicate that functionality natively on your terminal.

2 Likes

Thanks, I’ll try with open-interpreter.

À quand remonte ta dernière mise à jour de connaissance ?