Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

fix ruff errors and missing updated poetry.lock

Jettro Coenradie9499dfa6b0ab
diff --git a/dspy/retrieve/weaviate_rm.py b/dspy/retrieve/weaviate_rm.py
index ea78f014f..86916496a 100644
--- a/dspy/retrieve/weaviate_rm.py
+++ b/dspy/retrieve/weaviate_rm.py
@@ -5,8 +5,8 @@ from dsp.utils import dotdict
try:
import weaviate
- from weaviate.collections.classes.grpc import HybridFusion
import weaviate.classes as wvc
+ from weaviate.collections.classes.grpc import HybridFusion
except ImportError:
raise ImportError(
"The 'weaviate' extra is required to use WeaviateRM. Install it with `pip install dspy-ai[weaviate]`",
@@ -53,7 +53,7 @@ class WeaviateRM(dspy.Retrieve):
k: int = 3,
weaviate_collection_text_key: Optional[str] = "content",
weaviate_alpha: Optional[float] = 0.5,
- weaviate_fusion_type: Optional[HybridFusion] = HybridFusion.RELATIVE_SCORE
+ weaviate_fusion_type: Optional[HybridFusion] = HybridFusion.RELATIVE_SCORE,
):
self._weaviate_collection_name = weaviate_collection_name
self._weaviate_client = weaviate_client
@@ -87,7 +87,7 @@ class WeaviateRM(dspy.Retrieve):
alpha=self._weaviate_alpha,
fusion_type=self._weaviate_fusion_type,
return_metadata=wvc.query.MetadataQuery(
- distance=True, score=True)
+ distance=True, score=True),
)
parsed_results = [result.properties[self._weaviate_collection_text_key] for result in results.objects]
diff --git a/poetry.lock b/poetry.lock
index 5ac28fd12..717a23b49 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1439,6 +1439,21 @@ files = [
[package.extras]
protobuf = ["grpcio-tools (>=1.62.0)"]
+[[package]]
+name = "grpcio-health-checking"
+version = "1.62.0"
+description = "Standard Health Checking Service for gRPC"
+optional = true
+python-versions = ">=3.6"
+files = [
+ {file = "grpcio-health-checking-1.62.0.tar.gz", hash = "sha256:7fc26304530fd8ac06ba4bedbdc194a563c55e218abff409cbaf1de71914937b"},
+ {file = "grpcio_health_checking-1.62.0-py3-none-any.whl", hash = "sha256:8836163002d0db6f6e80b498d806f3472529da809ec553e073b19b9a156a4964"},
+]
+
+[package.dependencies]
+grpcio = ">=1.62.0"
+protobuf = ">=4.21.6"
+
[[package]]
name = "grpcio-tools"
version = "1.62.0"
@@ -2902,6 +2917,7 @@ description = "Nvidia JIT LTO Library"
optional = false
python-versions = ">=3"
files = [
+ {file = "nvidia_nvjitlink_cu12-12.4.99-py3-none-manylinux2014_aarch64.whl", hash = "sha256:75d6498c96d9adb9435f2bbdbddb479805ddfb97b5c1b32395c694185c20ca57"},
{file = "nvidia_nvjitlink_cu12-12.4.99-py3-none-manylinux2014_x86_64.whl", hash = "sha256:c6428836d20fe7e327191c175791d38570e10762edc588fb46749217cd444c74"},
{file = "nvidia_nvjitlink_cu12-12.4.99-py3-none-win_amd64.whl", hash = "sha256:991905ffa2144cb603d8ca7962d75c35334ae82bf92820b6ba78157277da1ad2"},
]
@@ -3951,6 +3967,7 @@ files = [
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
+ {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"},
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
@@ -5771,22 +5788,24 @@ files = [
[[package]]
name = "weaviate-client"
-version = "3.26.2"
+version = "4.5.4"
description = "A python native Weaviate client"
optional = true
python-versions = ">=3.8"
files = [
- {file = "weaviate-client-3.26.2.tar.gz", hash = "sha256:63ec70839b64909810a64aa7b3e5b85088462e93c7e2ed3c32ebefb702f36723"},
- {file = "weaviate_client-3.26.2-py3-none-any.whl", hash = "sha256:ca43bfb9c06b8ae3fd938dc9158acd93d4cbf4622192e173333e1ff63cf97164"},
+ {file = "weaviate-client-4.5.4.tar.gz", hash = "sha256:fc53dc73cd53df453c5e6dc758e49a6a1549212d6670ddd013392107120692f8"},
+ {file = "weaviate_client-4.5.4-py3-none-any.whl", hash = "sha256:f6d3a6b759e5aa0d3350067490526ea38b9274ae4043b4a3ae0064c28d56883f"},
]
[package.dependencies]
authlib = ">=1.2.1,<2.0.0"
+grpcio = ">=1.57.0,<2.0.0"
+grpcio-health-checking = ">=1.57.0,<2.0.0"
+grpcio-tools = ">=1.57.0,<2.0.0"
+httpx = "0.27.0"
+pydantic = ">=2.5.0,<3.0.0"
requests = ">=2.30.0,<3.0.0"
-validators = ">=0.21.2,<1.0.0"
-
-[package.extras]
-grpc = ["grpcio (>=1.57.0,<2.0.0)", "grpcio-tools (>=1.57.0,<2.0.0)"]
+validators = "0.22.0"
[[package]]
name = "websocket-client"
@@ -6224,4 +6243,4 @@ weaviate = ["weaviate-client"]
[metadata]
lock-version = "2.0"
python-versions = ">=3.9,<3.12"
-content-hash = "2f9d58714338a9b8e635d972aaf82b98736058f2560fa973fa39cbe13ee90bc0"
+content-hash = "ba54468d1f5a451d9aab97af55d8c42c2e5766373ac951b16cc64010ce48c9d3"
diff --git a/pyproject.toml b/pyproject.toml
index d55bb54b3..e864cac73 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -44,7 +44,7 @@ chromadb = ["chromadb~=0.4.14"]
qdrant = ["qdrant-client~=1.6.2", "fastembed~=0.1.0"]
marqo = ["marqo"]
pinecone = ["pinecone-client~=2.2.4"]
-weaviate = ["weaviate-client~=3.26.1"]
+weaviate = ["weaviate-client~=4.5.4"]
docs = [
"sphinx>=4.3.0",
"furo>=2023.3.27",