Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 1.54 KB

File metadata and controls

60 lines (42 loc) · 1.54 KB
description Python SDK overview for Code-Graph-RAG programmatic access.

Python SDK Overview

The cgr package provides short imports for programmatic use of Code-Graph-RAG.

Installation

pip install code-graph-rag

With semantic code search:

pip install 'code-graph-rag[semantic]'

Quick Example

from cgr import load_graph

graph = load_graph("graph.json")
print(graph.summary())

functions = graph.find_nodes_by_label("Function")
for fn in functions[:5]:
    rels = graph.get_relationships_for_node(fn.node_id)
    print(f"{fn.properties['name']}: {len(rels)} relationships")

The Quick Example saved as quick_example.py and run against a graph.json exported with cgr export

Available Modules

Import Purpose
from cgr import load_graph Load and query exported graph data
from cgr import MemgraphIngestor Query Memgraph with Cypher directly
from cgr import CypherGenerator Generate Cypher from natural language
from cgr import embed_code Semantic code search with UniXcoder
from cgr import settings Configure providers programmatically

Configuration

from cgr import settings

settings.set_orchestrator("openai", "gpt-5.6-terra", api_key="sk-...")
settings.set_cypher("google", "gemini-3.5-flash-lite", api_key="your-key")

See individual pages for detailed API usage: