stargate / data-api

JSON document API for Apache Cassandra (formerly known as JSON API)
https://stargate.io
Apache License 2.0
13 stars 16 forks source link

(BUG 1.0.12) The absence of modelName makes findCollections(explain=true) error #1182

Open hemidactylus opened 3 months ago

hemidactylus commented 3 months ago

On 1.0.12.

Collections with HF dedicated make the findCollections command break when explain=true is passed. Steps:

pre-requisites

a working setup with scoped secret for HF Dedicated

step 1: create

curl -XPOST \
   "$ASTRA_DB_API_ENDPOINT/api/json/v1/default_keyspace" \
   -H "token: $ASTRA_DB_APPLICATION_TOKEN" \
   -H "Content-Type: application/json" \
   -d '
        {
            "createCollection": {
                "name": "vec_h_huggingfacededicatedendpointde_aderf",
                "options": {
                    "vector": {
                        "dimension": 384,
                        "metric": "cosine",
                        "service": {
                            "parameters": {
                                "cloudName": "aws",
                                "endpointName": "*REDACTED*",
                                "regionName": "us-east-1"
                            },
                            "provider": "huggingfaceDedicated"
                        }
                    }
                }
            }
        }
' | jq

returns

{
  "status": {
    "ok": 1
  }
}

step 2: simple findCollections

this

curl -XPOST \
   "$ASTRA_DB_API_ENDPOINT/api/json/v1/default_keyspace" \
   -H "token: $ASTRA_DB_APPLICATION_TOKEN" \
   -H "Content-Type: application/json" \
   -d '
        {
            "findCollections": {}
        }
' | jq

works and returns

{
  "status": {
    "collections": [
      "vec_h_huggingfacededicatedendpointde_aderf"
    ]
  }
}

step 3: explain=true

this

curl -XPOST \
   "$ASTRA_DB_API_ENDPOINT/api/json/v1/default_keyspace" \
   -H "token: $ASTRA_DB_APPLICATION_TOKEN" \
   -H "Content-Type: application/json" \
   -d '
        {
            "findCollections": {
                "options": {
                    "explain": true
                }
            }
        }
' | jq

errors with

{
  "errors": [
    {
      "message": "The provided options are invalid: 'modelName' is not needed for provider huggingfaceDedicated",
      "errorCode": "INVALID_CREATE_COLLECTION_OPTIONS"
    }
  ]
}