I asked ChatGPT about my CSV data, and ChatGPT answered:
"Here is an example of how you can read a CSV file using pandas, and then use the data to train or fine-tune GPT-3 using the OpenAI API:"
import pandas as pd
import openai_secret_manager
# Read the CSV file
df = pd.read_csv("example.csv")
# Get the OpenAI API key
secrets = openai_secret_manager.get_secrets("openai")
openai_api_key = secrets["api_key"]
# Use the data from the CSV file to train or fine-tune GPT-3
# (Assuming you have the OpenAI API key and the OpenAI Python library installed)
import openai
openai.api_key = openai_api_key
response = openai.Completion.create(
engine="text-davinci-002",
prompt=(f"train on data from example.csv{df}"),
max_tokens=2048,
n = 1,
stop=None,
temperature=0.5,
)
print(response["choices"][0]["text"])
But, I got this error:
ModuleNotFoundError: No module named 'openai_secret_manager'
No need to use openai_secret_manager. I faced the same problem and deleted it and you need to generate & place an API from your account on OpenAI directly to the code.
import pandas as pd
import openai_secret_manager
# Read the CSV file
df = pd.read_csv("example.csv")
# Use the data from the CSV file to train or fine-tune GPT-3
# (Assuming you have the OpenAI API key and the OpenAI Python library installed)
import openai
openai.api_key = openai_api_key
response = openai.Completion.create(
engine="text-davinci-002",
prompt=(f"train on data from example.csv{df}"),
max_tokens=2048,
n = 1,
stop=None,
temperature=0.5,
)
print(response["choices"][0]["text"])
Copy and paste the API and replace openai_api_key here
openai.api_key = "PLACE_YOUR_API_IN_HERE"