Skip to main content
Neo4j is a graph database that stores data as nodes, relationships, and properties instead of in tables or documents. This structure allows you to organize your data in an intuitive way, similar to sketching ideas on a whiteboard. With SambaNova, you can power Neo4j applications with state-of-the-art language models for enhanced graph analytics and natural language queries.

Prerequisites

Before getting started, ensure you have:

Setup

  1. Install UV package manager
    pip install uv
    
  2. Clone the example repository and naviagte to the project directory.
    git clone <repository-url>
    cd neo4j-sambanova-integration
    
  3. Synchronize and install all required dependencies using UV.
    uv sync
    
    This command reads the project configuration and installs all necessary packages including:
    • SambaNova Cloud SDK
    • Neo4j Python driver
    • FastAPI (for web interface)
    • Promptfoo (for evaluation)
  4. Create environment configuration file from the temaplate
    cp sample.env .env
    
  5. Edit the .env file with your credentials.
    # SambaNova Cloud Configuration
     SAMBANOVA_API_KEY=your_sambanova_api_key_here
     SAMBANOVA_BASE_URL=https://api.sambanova.ai/v1
     
     # Neo4j Database Configuration
     NEO4J_URI=bolt://localhost:7687
     NEO4J_USER=neo4j
     NEO4J_PASSWORD=your_neo4j_password
     
     # Optional: Model Configuration
     MODEL_NAME=Meta-Llama-3.3-70B-Instruct
    

Running the integration

Direct execution mode

Execute evaluation tests directly using the command line:
uv run promptfoo eval -o output.html --no-cache
  • Output: Generates output.html containing evaluation results and performance metrics.
  • Flags
    1. -o output.html: Specifies the output file path
    2. —no-cache: Forces fresh evaluation without using cached results

FastAPI server mode

For interactive testing and web-based access:
  1. Start the FastAPI development server:
    uv run main.py
    
    The server will start on http://localhost:8000 by default.
  2. In a separate terminal, run the evaluation suite:
    promptfoo eval -o output.html --no-cache
    

Neo4j documentation

See the official Neo4j documentation for more details.
I