Skip to content

Commit

Permalink
Add dspy integration (#72)
Browse files Browse the repository at this point in the history
* Add dspy integration

* fix tags
  • Loading branch information
tomasonjo authored Apr 6, 2024
1 parent 5a6e24b commit 0b119e5
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions modules/genai-ecosystem/pages/dspy.adoc
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")
----
2 changes: 2 additions & 0 deletions modules/genai-ecosystem/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ image::https://cdn.graphacademy.neo4j.com/assets/img/courses/banners/llm-fundame
* xref:langchain4j.adoc[LangChain4j]
* xref:haystack.adoc[Haystack]
* xref:semantic-kernel.adoc[Semantic Kernel]
* xref:dspy.adoc[DSPy]


== Highlighted Articles

Expand Down

0 comments on commit 0b119e5

Please sign in to comment.