Installation
How to install Graphiti
Requirements:
- Python 3.10 or higher
- Neo4j 5.21 or higher
- OpenAI API key (Graphiti defaults to OpenAI for LLM inference and embedding)
Optional:
- Gemini, Anthropic, or Groq API key (for alternative LLM providers)
The simplest way to install Neo4j is via Neo4j Desktop. It provides a user-friendly interface to manage Neo4j instances and databases.
or
Alternative LLM Providers
Graphiti supports multiple LLM providers beyond OpenAI. However, Graphiti works best with LLM services that support Structured Output (such as OpenAI and Gemini). Using other services may result in incorrect output schemas and ingestion failures. This is particularly problematic when using smaller models.
To install Graphiti with support for alternative providers, use the following package extras with Poetry:
Note that even when using Anthropic for LLM inference, OpenAI is still required for embedding functionality. Make sure to set both OPENAI_API_KEY
and ANTHROPIC_API_KEY
environment variables when using Anthropic.
These extras automatically install the required dependencies for each provider.
OpenAI Compatible LLM Providers
Please use the OpenAIGenericClient
to connect to OpenAI compatible LLM providers. Graphiti makes use of OpenAI Structured Output, which is not supported by other providers.
The OpenAIGenericClient
ensures that required schema is injected into the prompt, so that the LLM can generate valid JSON output.
Graphiti works best with LLM services that support Structured Output (such as OpenAI and Gemini). Using other services may result in incorrect output schemas and ingestion failures. This is particularly problematic when using smaller models.
Using Graphiti with Azure OpenAI
Graphiti supports Azure OpenAI for both LLM inference and embeddings. To use Azure OpenAI, you’ll need to configure both the LLM client and embedder with your Azure OpenAI credentials:
Make sure to replace the placeholder values with your actual Azure OpenAI credentials and specify the correct embedding model name that’s deployed in your Azure OpenAI service.
Using Graphiti with Google Gemini
To use Graphiti with Google Gemini, install the required package:
When using Google Gemini, you’ll need to set the GOOGLE_API_KEY
environment variable with your Google API key.
Here’s how to configure Graphiti with Google Gemini:
Optional Environment Variables
In addition to the provider-specific API keys, Graphiti supports several optional environment variables:
USE_PARALLEL_RUNTIME
: A boolean variable that can be set to true to enable Neo4j’s parallel runtime feature for several search queries. Note that this feature is not supported for Neo4j Community Edition or for smaller AuraDB instances, so it’s off by default.