Comments (9)
yep - at bottom of batch update section of points docs it says
To batch many points with a single operation type, please use batching functionality in that operation directly.
which from earlier in the same page (under upload points) would suggest to me that client.update_vectors
should accept a models.Batch
set of points.
Not a major issue if just clarified that instead it requires the record-oriented equivalent using PointVectors
, like
client.update_vectors(
collection_name="test",
points=[
models.PointVectors(
id="test-point", vector={"test-vec": [np.random.rand() for _ in range(768)]},
)
],
)
which works
from qdrant-client.
Could you please provide an example?
I tried running this code and there is no error for me
from qdrant_client import QdrantClient, models
client = QdrantClient()
client.recreate_collection('test', vectors_config=models.VectorParams(size=2, distance=models.Distance.COSINE))
client.upsert('test', points=models.Batch(ids=[1,2], vectors=[[0.0, 0.2], [0.1, 0.2]]), wait=True)
My dependencies:
python3.10.12
qdrant-client==1.7.0
pydantic==2.5.3
pydantic_core==2.14.6
from qdrant-client.
I have same dependencies other than python3.10.13 - issue is specifically for client.update_vectors
rather than client.upsert
, which in the source code has specific handling for models.Batch
type points argument. Have tested with
client.update_vectors(
collection_name="test",
points=models.Batch(
ids=["test-point"],
vectors={"test-vec": [[np.random.rand() for _ in range(768)]]},
),
)
for an existing collection
from qdrant-client.
Some versions of pydantic used to convert numpy arrays to lists implicitly, however it is no longer the case.
Batch structure does not accept numpy arrays on its own, you need to convert it to a list
from qdrant-client.
in example given, np.random.rand()
just returns a float, so that shouldn't be the issue (i.e. vectors is of type Dict[StrictStr, List[List[StrictFloat]]]
as required for models.Batch
) - it's not models.Batch(...)
that throws the error, but client.update_vectors
itself
from qdrant-client.
I checked the documentation at qdrant.tech
https://qdrant.tech/documentation/concepts/points/#update-vectors
Example here is indeed incorrect, we will fix it!
It should be a sequence of PointVectors
. Batch or PointStruct models contain payload field, which is not relevant for update_vectors operation.
from qdrant-client.
A correct example may look like this:
client.update_vectors(
collection_name=collection_name,
points=[
models.PointVectors(
id=1,
vector={
[0.1, 0.1,],
},
),
models.PointVectors(
id=2,
vector={
[0.2, 0.2],
},
),
],
)
from qdrant-client.
from qdrant-client.
the documentation has been updated
from qdrant-client.
Related Issues (20)
- Regression: payloads cannot contain python builtin datetime objects in 1.7.1 HOT 2
- Error: Payload Limit Exceeded HOT 16
- Unable to close grpc_channel. Connection was interrupted on the server side HOT 12
- grpc options are not parsed correctly when https is set
- PointStruct is very slow HOT 8
- update scoring in local mode in discovery api HOT 1
- Missing import statement in documentation (Get Started) HOT 2
- Local Qdrant db Error on loading: KeyError: '__pydantic_fields_set__' HOT 4
- query_text param not working for qdrant_client.search HOT 8
- Upgrade fastembed version from 0.1.1 to 0.2.1 (latest) HOT 3
- Deleting points by ID not working HOT 3
- Trigger nighly tests against latest qdrant dev build
- Tracking issue: local mode for Qdrant v1.8 HOT 3
- Feature Request: Progress bar for batch upload_points function HOT 2
- Check vectors for NaN in local mode HOT 2
- qdrant_client.get_fastembed_vector_params() with upload_collection HOT 4
- Python Application Crashes on Attempting to Retrieve Non-existent Collection via QdrantClient in GRPC Mode HOT 2
- Add note about batching into README.md HOT 1
- grpc.PointStruct.PayloadEntry errror HOT 2
- How to upload collection asynchronous HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qdrant-client.