Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
lint
  • Loading branch information
TomeHirata committed Jun 11, 2025
commit 01abf74b47fd760f3759ae9c2315798e60701966
7 changes: 4 additions & 3 deletions dspy/retrievers/weaviate_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
from dspy.primitives.prediction import Prediction

try:
from uuid import uuid4

import weaviate
from weaviate.util import get_valid_uuid
from uuid import uuid4
except ImportError as err:
raise ImportError(
"The 'weaviate' extra is required to use WeaviateRM. Install it with `pip install dspy-ai[weaviate]`",
Expand Down Expand Up @@ -109,7 +110,7 @@ def forward(self, query_or_queries: Union[str, List[str]], k: Optional[int] = No
passages.extend(dotdict({"long_text": d}) for d in parsed_results)

return passages

def get_objects(self, num_samples: int, fields: List[str]) -> List[dict]:
"""Get objects from Weaviate using the cursor API."""
if self._client_type == "WeaviateClient":
Expand All @@ -127,7 +128,7 @@ def get_objects(self, num_samples: int, fields: List[str]) -> List[dict]:
return objects
else:
raise ValueError("`get_objects` is not supported for the v3 Weaviate Python client, please upgrade to v4.")

def insert(self, new_object_properties: dict):
if self._client_type == "WeaviateClient":
self._weaviate_collection.data.insert(
Expand Down