Files
wehub-resource-sync 4a19d70af1
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Tests / database-integration-tests (push) Waiting to run
MCP Server Tests / live-mcp-tests (push) Waiting to run
Server Tests / live-server-tests (push) Waiting to run
Pyright Type Check / pyright (push) Waiting to run
Tests / unit-tests (push) Waiting to run
Lint with Ruff / ruff (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:54 +08:00
..

GLiNER2 Hybrid LLM Client Example (Experimental)

Note: The GLiNER2Client is 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.

Prerequisites

  • Python 3.11+
  • Neo4j 5.26+ (Neo4j Desktop or Docker)
  • An LLM provider API key (Google, OpenAI, Anthropic, etc.)

Setup

# 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.

LLM and Embedding Providers

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.OpenAIClient
  • graphiti_core.llm_client.anthropic_client.AnthropicClient
  • graphiti_core.llm_client.groq_client.GroqClient
  • graphiti_core.embedder.openai.OpenAIEmbedder
  • graphiti_core.embedder.voyage.VoyageAIEmbedder

Configuration

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

Running

python gliner2_neo4j.py