By connecting OpenAI Semantic Search with Neo4j graph database, you can provide
More than 75% of Fortune 100 companies are using Neo4j graph technology. Check this image for reference.
In fact, most of our enterprise clients prefer using the Neo4j graph database in their software solution.
Reason?
Neo4j can easily handle transactional and analytical workloads.
And while developing enterprise-level software using OpenAI, we often need to retrieve data from the Neo4j graph database. This is mostly the case when we are developing a cloud-based software solution. In fact, recently, we have helped our enterprise clients in the US and Canada to use this advanced OpenAI semantic search technology to improve their search accuracy.
In this blog, you will learn step by step process on how to connect and use OpenAI semantic search with the Neo4j graph database. You need to follow these 6 simple steps.
Contents
First, you need to have a basic understanding of the Neo4j graph database and the Cypher query language.
Along with that, you should have:
Ready?
Sounds good.
Now, the second step.
In this step, you need to create nodes in Neo4j by using the Cypher query language.
For example, to create a node with the label “Person” and the property “name”:
CREATE (n:Person { name: "Georgia O'Keeffe" })
Next, you need to create and define relationships between two different nodes.
For example, use this code to create a relationship between two nodes in the graph database with the label “Person” and the relationship type “KNOWS”:
MATCH (a:Person), (b:Person) WHERE a.name = "Edward Hopper" AND b.name = "Norman Rockwell" CREATE (a)-[r:KNOWS]->(b)
So far, we have created different nodes and defined the relation between them.
Further, we will learn how to install OpenAI semantic search in step 3.
But, how do you install OpenAI Semantic Search in your Python environment?
It is simple.
You just need to use this one-line code to install the OpenAI Semantic Search library in your Python environment.
pip install openai-semantic-search
Copy this code and run.
Done?
Now, let’s connect the recently installed OpenAI Semantic Search with Neo4j.
How do you connect Neo4j with OpenAI Semantic Search?
First, you need to import the OpenAI Semantic Search library in your Python script.
Then, connect to your Neo4j database.
When you connect your Neo4j database, you need to provide these two details:
Use the following code to establish a connection to the Neo4j database.
from openai_semantic_search import SemanticSearch
ss = SemanticSearch(neo4j_url= "bolt://localhost:7687", neo4j_username="neo4j", neo4j_password="password")
That’s it.
If you have properly followed these 4 steps, you have successfully connected OpenAI with the Neo4j graph database.
The ground is ready now.
In the next step, you will learn a simple use case.
Now, let’s use the search method of the SemanticSearch object.
Purpose?
To search the Neo4j database and find the required items.
Remember: We will be using natural language queries here.
For example, to search for nodes with the label “Person” and the property “name” containing the keyword “Andy Warhol”:
result = ss.search("Person named Andy Warhol", labels=["Person"], properties=["name"]) print(result)
The purpose of this code is to retrieve nodes from the Neo4j database.
Now, we will visualize this result to get a better understanding.
To visualize the results, you need to take these steps.
That’s it.
You will a result of something like this.
If you have these types of software, you definitely need to use this combination of OpenAI and Neo4j graph database to improve semantic search performance. There are certain examples where construction software are developed using OpenAI
Software Category | Example |
---|---|
Knowledge Management Systems (KMS) |
|
Customer Relationship Management (CRM) |
|
Enterprise Resource Planning (ERP) |
|
Supply chain management and logistics systems |
|
Healthcare and life sciences research systems |
|
If you have any of such software solutions, we can help you integrate OpenAI semantic search technology with the Neo4j graph database. Schedule your free consultation below.
Moreover, if you are looking to explore more about the different blogs related to OpenAI technology, check the following section.
Want to Improve Search Performance in Your Software?
Let’s get in touch. We can help you. We have experience in improving the semantic search of enterprise-level clients.
Here are the benefits you get by using OpenAI semantic search with Neo4j.
Here are the steps to get started with OpenAI semantic search with the Neo4j database.
Here are the multiple types of queries you can perform with OpenAI semantic search and Neo4j.
With our experience in OpenAI models, APIs, and software development, we can help you in these two cases:
If you want to
Let’s get in touch.