diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index ffc2164..f3a7d64 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,6 +1,11 @@ name: preview-docs -on: pull_request +on: + workflow_run: + workflows: ["sync-openapi"] + # branches: [main] + types: + - completed jobs: run: diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 14ef927..290ae6f 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -2,10 +2,15 @@ name: sync-openapi on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + pull_request: jobs: sync: runs-on: ubuntu-latest + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write steps: - uses: actions/checkout@v2 - name: Set up Python @@ -25,21 +30,8 @@ jobs: - name: Sync Docs run: | bash -x tools/sync-openapi.sh - - name: Commit and push changes - run: | - if [[ `git status --porcelain` ]]; then - # Changes - echo "Changes detected" - else - # No changes - echo "No changes detected" - exit 0 - fi - git config --global user.name 'qdrant' - git config --global user.email 'qdrant@users.noreply.github.com' - git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY - git checkout $GITHUB_HEAD_REF - git add fern/apis - git add fern/versions - git add fern/docs.yml - git commit -am "auto-sync openapi with qdrant core" && git push || true + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Sync OpenAPI" + commit_user_name: "GitHub Actions" + commit_user_email: "team@qdrant.com" diff --git a/fern/apis/master/openapi-overrides.yml b/fern/apis/master/openapi-overrides.yml index 6005245..b890f10 100644 --- a/fern/apis/master/openapi-overrides.yml +++ b/fern/apis/master/openapi-overrides.yml @@ -266,7 +266,7 @@ paths: put: x-fern-examples: - code-samples: - - code: "# Minimal curl command to create a collection with a vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 300,\n \"distance\": \"Cosine\"\n } \n }'\n\n# Or with a sparse vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 300,\n \"distance\": \"Cosine\"\n },\n \"sparse_vectors\": {\n \"splade-model-name\": {\n \"index\": {\n \"on_disk\": true\n }\n }\n }\n }'\n" + - code: "# Minimal curl command to create a collection with a vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 300,\n \"distance\": \"Cosine\"\n } \n }'\n\n# Or with a sparse vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 1536,\n \"distance\": \"Cosine\"\n },\n \"sparse_vectors\": {\n \"splade-model-name\": {\n \"index\": {\n \"on_disk\": true\n }\n }\n }\n }'\n" language: curl - code-samples: - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.createCollection(\"{collection_name}\", {\n vectors: { size: 100, distance: \"Cosine\" },\n});\n" diff --git a/fern/apis/v1.9.x/openapi-overrides.yml b/fern/apis/v1.9.x/openapi-overrides.yml index 6005245..b890f10 100644 --- a/fern/apis/v1.9.x/openapi-overrides.yml +++ b/fern/apis/v1.9.x/openapi-overrides.yml @@ -266,7 +266,7 @@ paths: put: x-fern-examples: - code-samples: - - code: "# Minimal curl command to create a collection with a vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 300,\n \"distance\": \"Cosine\"\n } \n }'\n\n# Or with a sparse vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 300,\n \"distance\": \"Cosine\"\n },\n \"sparse_vectors\": {\n \"splade-model-name\": {\n \"index\": {\n \"on_disk\": true\n }\n }\n }\n }'\n" + - code: "# Minimal curl command to create a collection with a vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 300,\n \"distance\": \"Cosine\"\n } \n }'\n\n# Or with a sparse vector field\n\ncurl -X PUT http://localhost:6333/collections/collection_name \\\n -H \"api-key: \" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"vectors\": {\n \"size\": 1536,\n \"distance\": \"Cosine\"\n },\n \"sparse_vectors\": {\n \"splade-model-name\": {\n \"index\": {\n \"on_disk\": true\n }\n }\n }\n }'\n" language: curl - code-samples: - code: "import { QdrantClient } from \"@qdrant/js-client-rest\";\n\nconst client = new QdrantClient({ host: \"localhost\", port: 6333 });\n\nclient.createCollection(\"{collection_name}\", {\n vectors: { size: 100, distance: \"Cosine\" },\n});\n" diff --git a/qdrant b/qdrant new file mode 160000 index 0000000..34f7f8e --- /dev/null +++ b/qdrant @@ -0,0 +1 @@ +Subproject commit 34f7f8ec2d8455c0b3fe0f1fb134907ba7816a08 diff --git a/snippets/curl/create_collection.sh b/snippets/curl/create_collection.sh index 98c41e3..b46d9bd 100644 --- a/snippets/curl/create_collection.sh +++ b/snippets/curl/create_collection.sh @@ -17,7 +17,7 @@ curl -X PUT http://localhost:6333/collections/collection_name \ -H "Content-Type: application/json" \ -d '{ "vectors": { - "size": 300, + "size": 1536, "distance": "Cosine" }, "sparse_vectors": { diff --git a/tools/sync-openapi.sh b/tools/sync-openapi.sh index 78c7bdf..b7964fe 100644 --- a/tools/sync-openapi.sh +++ b/tools/sync-openapi.sh @@ -31,6 +31,8 @@ python tools/generate_snippet_overwrites.py --openapi qdrant/docs/redoc/master/o yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' fern/openapi-overrides-template.yml overwrite-snippets.yml > $PROJECT_ROOT/fern/apis/master/openapi-overrides.yml +rm overwrite-snippets.yml + # Find latest version inside the repository `docs/redoc` starting with `v*` latest_version=$(ls qdrant/docs/redoc | grep -oP 'v\d.*' | sort -V | tail -n 1)