Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qdrant client causes Pydantic validation error if QDRANT__SERVICE__HARDWARE_REPORTING=true is passed #935

Open
shahad-mahmud opened this issue Mar 25, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@shahad-mahmud
Copy link

I'm running Qdrant locally with docker using docker compose. When I pass QDRANT__SERVICE__HARDWARE_REPORTING=true and try to use it with python client, it causes Pydantic validation error.

Current Behavior

It raises the following exception:

Traceback (most recent call last):
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/http/api_client.py", line 109, in send
    return parse_as_type(response.json(), type_)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/http/api_client.py", line 228, in parse_as_type
    return model_type(obj=obj).obj
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 2 validation errors for ParsingModel[InlineResponse2006] (for parse_as_type)
obj.usage.io_read
  Field required [type=missing, input_value={'cpu': 0, 'payload_io_re...vector_io_write': 16384}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
obj.usage.io_write
  Field required [type=missing, input_value={'cpu': 0, 'payload_io_re...vector_io_write': 16384}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/shahad/Documents/codes/delineate/ai-infra/qdrant-db/minimal.py", line 43, in <module>
    vector_store.add_documents(users)
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/langchain_core/vectorstores/base.py", line 286, in add_documents
    return self.add_texts(texts, metadatas, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/langchain_qdrant/qdrant.py", line 444, in add_texts
    self.client.upsert(
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/qdrant_client.py", line 1567, in upsert
    return self._client.upsert(
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/qdrant_remote.py", line 1908, in upsert
    http_result = self.openapi_client.points_api.upsert_points(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/http/api/points_api.py", line 987, in upsert_points
    return self._build_for_upsert_points(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/http/api/points_api.py", line 512, in _build_for_upsert_points
    return self.api_client.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/http/api_client.py", line 89, in request
    return self.send(request, type_)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/delineate/lib/python3.11/site-packages/qdrant_client/http/api_client.py", line 111, in send
    raise ResponseHandlingException(e)
qdrant_client.http.exceptions.ResponseHandlingException: 2 validation errors for ParsingModel[InlineResponse2006] (for parse_as_type)
obj.usage.io_read
  Field required [type=missing, input_value={'cpu': 0, 'payload_io_re...vector_io_write': 16384}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
obj.usage.io_write
  Field required [type=missing, input_value={'cpu': 0, 'payload_io_re...vector_io_write': 16384}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing

Steps to Reproduce

  1. Use the following docker compose:
services:
  qdrant:
    image: qdrant/qdrant:v1.13.5
    restart: always
    container_name: qdrant
    ports:
      - 7233:6333
      - 7234:6334
    expose:
      - 6333
      - 6334
      - 6335
    volumes:
      - ./data/qdrant_data:/qdrant/storage
    environment:
      - QDRANT__SERVICE__API_KEY=123456
      - QDRANT__SERVICE__JWT_RBAC=true
      - QDRANT__SERVICE__HARDWARE_REPORTING=true

configs:
  qdrant_config:
    content: |
      log_level: INFO

Then you can use the following code:

from qdrant_client import QdrantClient
from qdrant_client.models import VectorParams, Distance
import json

from langchain_qdrant import QdrantVectorStore
from langchain_openai import OpenAIEmbeddings
from langchain_core.documents import Document

from dotenv import load_dotenv

load_dotenv()


client = QdrantClient(url="http://localhost:7233", api_key="123456", https=True)

if not client.collection_exists("users"):
    client.create_collection(
        "users", vectors_config=VectorParams(size=2048, distance=Distance.COSINE)
    )

vector_store = QdrantVectorStore(
    client=client,
    collection_name="users",
    embedding=OpenAIEmbeddings(
        model="text-embedding-3-large",
        dimensions=2048,
        disallowed_special=(),
    ),
)

users = [
    Document(
        page_content="admin",
        metadata={"user": "admin", "role": "admin", "revoked": False},
    ),
    Document(
        page_content="canary",
        metadata={"user": "canary", "role": "admin", "revoked": False},
    ),
]


vector_store.add_documents(users)

Expected Behavior

The client should not get any issue after some points are pushed.

Context (Environment)

using the following qdrant related packages:

langchain-qdrant==0.2.0
qdrant-client==1.13.3

docker tag: qdrant/qdrant:v1.13.5

@shahad-mahmud shahad-mahmud added the bug Something isn't working label Mar 25, 2025
@timvisee timvisee transferred this issue from qdrant/qdrant Mar 25, 2025
@joein
Copy link
Member

joein commented Mar 25, 2025

hey @shahad-mahmud

This feature is not stable yet, I'd recommend to disable it

Once it is supported in qdrant, qdrant-client won't throw exceptions, but access to these metrics in qdrant-client has not been planned yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants