Hello Community,
I’ve successfully fine-tuned a model and I’m trying to implement it using a Python script. I’ve followed all the guidelines from the OpenAI documentation, but I’m encountering issues when I try to run the script.
Here are the steps I’ve taken:
Reading the Literature Review and Fine-Tuning Dataset: The script successfully reads my literature review and fine-tuning dataset.
Format Validation: No format errors were found in the dataset.
API Call: I’m using openai.ChatCompletion.create() to call the fine-tuned model.
The problems arise here. The script throws the following errors:
The model ‘ft:gpt-3.5-turbo:my-org:custom_suffix:id’ does not exist - Even though the fine-tuning job was successful.
Invalid API Key - I’ve triple-checked the API key, and it’s correct.
Module ‘openai’ has no attribute ‘Error’ - When I try to catch exceptions.
Here’s a simplified version of the script for reference:
python
Copy code
… (code to read and validate dataset)
… (code to set up logging)
try:
response = openai.ChatCompletion.create(
model=“ft:gpt-3.5-turbo:my-org:custom_suffix:id”, # Note: This is a placeholder
messages=[
{“role”: “system”, “content”: “You are an academic writing assistant.”},
{“role”: “user”, “content”: “Please review my literature.”},
# … (other messages)
]
)
except openai.Error as e: # This line throws an AttributeError
logging.error(f"OpenAI API error: {e}")
… (rest of the code)
Has anyone encountered similar issues or have any insights on what I might be doing wrong?
Thank you in advance for your help!