examples/gliner2/README.md
Note: The
GLiNER2Clientis experimental and may change in future releases.
This example demonstrates using GLiNER2 as a hybrid LLM client for Graphiti. GLiNER2 handles entity extraction (NER) locally on CPU, while a general-purpose LLM client handles edge/fact extraction, deduplication, summarization, and other reasoning tasks.
# Install graphiti with the gliner2 extra
pip install graphiti-core[gliner2]
# Copy and configure environment variables
cp .env.example .env
The GLiNER2 model weights are downloaded automatically on first run.
The example uses Google Gemini (gemini-2.5-flash-lite) for the LLM and embeddings, but GLiNER2Client accepts any Graphiti LLMClient. To swap providers, replace GeminiClient and GeminiEmbedder with the equivalent from another provider:
graphiti_core.llm_client.openai_client.OpenAIClientgraphiti_core.llm_client.anthropic_client.AnthropicClientgraphiti_core.llm_client.groq_client.GroqClientgraphiti_core.embedder.openai.OpenAIEmbeddergraphiti_core.embedder.voyage.VoyageAIEmbedder| Parameter | Description | Default |
|---|---|---|
threshold | GLiNER2 confidence threshold (0.0-1.0). Higher values reduce spurious extractions. | 0.5 |
GLINER2_MODEL | HuggingFace model ID | fastino/gliner2-large-v1 |
python gliner2_neo4j.py