Fix Callable reference in QdrantVectorSearchTool (#304)

The built-in `callable` type is not subscriptable, and thus not usable
in a type annotation. When this tool is used, this warning is generated:

```
.../_generate_schema.py:623: UserWarning: <built-in function callable> is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`.
```

This change fixes the warning.
This commit is contained in:
Mark McDonald
2025-05-14 05:13:07 +08:00
committed by GitHub
parent 8ecc958e4c
commit 8b887b4eb3

View File

@@ -1,6 +1,6 @@
import json
import os
from typing import Any, Optional, Type
from typing import Any, Callable, Optional, Type
try:
@@ -70,7 +70,7 @@ class QdrantVectorSearchTool(BaseTool):
default=None,
description="The API key for the Qdrant server",
)
custom_embedding_fn: Optional[callable] = Field(
custom_embedding_fn: Optional[Callable] = Field(
default=None,
description="A custom embedding function to use for vectorization. If not provided, the default model will be used.",
)