Skip to content

Commit

Permalink
Merge pull request stanfordnlp#317 from CShorten/main
Browse files Browse the repository at this point in the history
Refactor Integration Examples and WeaviateRM Bug Fixes
  • Loading branch information
okhat authored Jan 31, 2024
2 parents 8990cdf + 00e504b commit 395177d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
3 changes: 1 addition & 2 deletions dspy/retrieve/weaviate_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def forward(self, query_or_queries: Union[str, List[str]], k: Optional[int]) ->

results = results["data"]["Get"][self._weaviate_collection_name]
parsed_results = [result["content"] for result in results]
passages.extend(parsed_results)
passages.extend(dotdict({"long_text": d}) for d in results)
passages.extend(dotdict({"long_text": d}) for d in parsed_results)

return dspy.Prediction(passages=passages)
19 changes: 19 additions & 0 deletions dspy/retrieve/weaviate_rm_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ToDo

# Start Weaviate Embedded

# Add Toy Data

# Connect DSPy

# Test this API
"""
from dspy.retrieve.weaviate_rm import WeaviateRM
retriever_model = WeaviateRM("WeaviateBlogChunk", weaviate_client=weaviate_client)
dspy.settings.configure(rm=retriever_model)
retrieve = dspy.Retrieve(k=1)
topK_passages = retrieve("what are the stages in planning, sanctioning and execution of public works").passages
assert(type(topK_passages))
"""
File renamed without changes.
13 changes: 13 additions & 0 deletions examples/integrations/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Integration Examples
This folder contains a cookbook of using DSPy with 3rd party integrations.

DSPy currently supports integrations with: (sorted alphabetically):
- ChromadbRM
- ClarifaiRM
- MarqoRM
- MongoDBAtlasRM
- PineconeRM
- QdrantRM
- VectaraRM
- WeaviateRM
- YouRM

0 comments on commit 395177d

Please sign in to comment.