-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add dspy integration * fix tags
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
= DSPy Neo4j Integration | ||
:slug: dspy | ||
:author: Tomaz Bratanic | ||
:category: labs | ||
:tags: dspy, rag, vector search, neo4j | ||
:neo4j-versions: 5.x | ||
:page-pagination: | ||
:page-product: dspy | ||
|
||
|
||
DSPy is a framework for algorithmically optimizing LM prompts and weights, especially when LMs are used one or more times within a pipeline. | ||
|
||
The Neo4j integration allows for vector search. | ||
|
||
Here is an overview of the https://dspy-docs.vercel.app/api/retrieval_model_clients/Neo4jRM[DSPy Integrations^]. | ||
|
||
== Installation | ||
|
||
[source,shell] | ||
---- | ||
pip install dspy neo4j | ||
---- | ||
== Functionality Includes | ||
|
||
* `Neo4jRM` - is a typical retriever component which can be used to query vector store index and find related Documents. | ||
|
||
[source,python] | ||
---- | ||
from dspy.retrieve.neo4j_rm import Neo4jRM | ||
import os | ||
os.environ["NEO4J_URI"] = 'bolt://localhost:7687' | ||
os.environ["NEO4J_USERNAME"] = 'neo4j' | ||
os.environ["NEO4J_PASSWORD"] = 'password' | ||
os.environ["OPENAI_API_KEY"] = 'sk-' | ||
retriever_model = Neo4jRM( | ||
index_name="vector", | ||
text_node_property="text" | ||
) | ||
results = retriever_model("Explore the significance of quantum computing", k=3) | ||
for passage in results: | ||
print("Document:", passage, "\n") | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters