Skip to content

Commit

Permalink
Merge pull request #10 from qdrant/test-sync
Browse files Browse the repository at this point in the history
upd snippet to test CI
  • Loading branch information
generall committed May 14, 2024
2 parents 072feee + 400ded6 commit 433cdaa
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: preview-docs

on: pull_request
on:
workflow_run:
workflows: ["sync-openapi"]
# branches: [main]
types:
- completed

jobs:
run:
Expand Down
28 changes: 10 additions & 18 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
2 changes: 1 addition & 1 deletion fern/apis/master/openapi-overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <apiKey>\" \\\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: <apiKey>\" \\\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: <apiKey>\" \\\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: <apiKey>\" \\\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"
Expand Down
2 changes: 1 addition & 1 deletion fern/apis/v1.9.x/openapi-overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: <apiKey>\" \\\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: <apiKey>\" \\\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: <apiKey>\" \\\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: <apiKey>\" \\\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"
Expand Down
1 change: 1 addition & 0 deletions qdrant
Submodule qdrant added at 34f7f8
2 changes: 1 addition & 1 deletion snippets/curl/create_collection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions tools/sync-openapi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 433cdaa

Please sign in to comment.