/v1/classifications invalid_request_error or Invalid Url

I’m trying to use this endpoints. https://platform.openai.com/docs/guides/classifications I want to classify some text by sentiment.

Dataset sample:

{"prompt": "This film exceeded my expectations. The visuals were stunning, and the performances were top-notch.", "completion": "Positive"}
{"prompt": "I couldn't connect with the characters, and the story felt predictable. Not a memorable movie for me.", "completion": "Negative"}

I added a file using this curl for request and got a successful response:

curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F purpose="fine-tune" \
  -F file="@train.jsonl"

I got this reponse:

"object": "file",
    "id": "file-..dcndnjnjdsjn",
    "purpose": "fine-tune",
    "filename": "train.jsonl",
    "bytes": 3208,
    "created_at": 1686572774,
    "status": "uploaded",
    "status_details": null

After adding file succesfully I’m trying to use this file_id in this endpoint:

curl https://api.openai.com/v1/classifications  \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json"  \
  -d '{
    "file": "file-hRsoFZ4J3dNoiTeudHesgPoh", 
    "query": "movie is very good", 
    "search_model": "ada", 
    "model": "curie", 
    "max_examples": 3

Then I got this error constantly:

    "error": {
        "message": "Invalid URL (POST /v1/classifications)",
        "type": "invalid_request_error",
        "param": null,
        "code": null

Am I sending request to the wrong endpoint?

Welcome to the community @cengparoxy

This looks like a very bad ChatGPT hallucination. The classification endpoint has been deprecated - which is why it says invalid url.

What are you trying to achieve?

Firstly, thank you for responding.

I’m trying to create a sentiment model by fine-tuning. Then I’m trying to use it to classify some given samples. If I had to give an example:

Sample: Movie is very good
Result: Positive

How can I achieve this?