Skip to content

allow updating remote model api_key#1944

Merged
kishorenc merged 14 commits into
typesense:v28from
krunal1313:remote_model_apikey_update
Sep 25, 2024
Merged

allow updating remote model api_key#1944
kishorenc merged 14 commits into
typesense:v28from
krunal1313:remote_model_apikey_update

Conversation

@krunal1313

@krunal1313 krunal1313 commented Sep 11, 2024

Copy link
Copy Markdown
Contributor

Change Summary

  • allow updating remote model api_key by patch endpoint of collection
  • refactor collection metadata updation flow
  • update related tests

Updating api_key of a remote model

To update api_key of remote model, one need to send patch request to collection with model_name and new api_key.
Below is sample curl request to update api_key of companies collection.

curl "http://localhost:8108/collections/companies" \
       -X PATCH \
       -H "Content-Type: application/json" \
       -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \
       -d '{
         "fields": [
          {
            "name": "embedding",
            "embed": {
              "from": ["product_name"],
              "model_config": {
                "model_name": "openai/text-embedding-3-small",
                "api_key": "haskhcxkkck21989878dsd-asdkjasjcbb"
              }
            }
          }
        ]
       }'

Here api_key is the new api_key to be updated.
All fields are mandatory; the update request will not succeed without them.

PR Checklist

Comment thread src/collection_manager.cpp
Comment thread src/collection_manager.cpp Outdated
@kishorenc kishorenc merged commit b256736 into typesense:v28 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants