Llm agent to search within a graph
Project description
code-base-agent
Introduction
This repo introduces a method to represent a local code repository as a graph structure. The objective is to allow an LLM to traverse this graph to understand the code logic and flow. Providing the LLM with the power to debug, refactor, and optimize queries. However, several tasks are yet unexplored
Technology Stack
We used a combination of llama-index
, CodeHierarchy
module, and tree-sitter-languages
for parsing code into a graph structure, Neo4j
for storing and querying the graph data, and langchain
to create the agents.
Installation
Install the package:
pip install blar-graph
Set the env variables
NEO4J_URI=neo4j+s://YOUR_NEO4J.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=YOUR_NEO4J_PASSWORD
OPENAI_API_KEY=YOUR_OPEN_AI_KEY
If you are new to Neo4j you can deploy a free instance of neo4j with Aura. Also you can host your own version in AWS or GCP
Quick start guide
To build the graph, you have to instantiate the graph manager and constructor. The graph manager handles the connection with Neo4j, and the graph constructor processes the directory input to create the graph.
from blar_graph.graph_construction.graph_builder import GraphConstructor
from blar_graph.graph_construction.neo4j_manager import Neo4jManager
graph_manager = Neo4jManager()
graph_constructor = GraphConstructor(graph_manager)
graph_constructor.build_graph("YOUR_LOCAL_DIRECTORY", "python")
graph_manager.close()
Note: The supported language for now is python, we are going to include Typescript (or other language) if you ask for it enough. So don't hesitate to reach out through the issues or directly to benjamin@blar.io or jose@blar.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for blar_graph-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9244b22c181ce4072af45e5bb3d703abc1c356fce453639ee5298de08756400e |
|
MD5 | 2e99090cba60649d573665f47378dc13 |
|
BLAKE2b-256 | 6dc0e2eb5ef9a6dec2c634fcfdf321c9d873489da7be2c1c80045f82a24c7a77 |