diff --git a/README.md b/README.md index 17c9c75..7197345 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,103 @@ For example: curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "/Users/roilipman/Dev/GraphRAG-SDK", "ignore": ["./.github", "./build"]}' -H "Authorization: OpenSesame" ``` +## API Reference + +### Retrieve a graph + +Fetch graph entities from a repository: + +```bash +curl -X GET "http://127.0.0.1:5000/graph_entities?repo=" -H "Authorization: <.ENV_SECRET_TOKEN>" +``` + +For example: + +```bash +curl -X GET "http://127.0.0.1:5000/graph_entities?repo=GraphRAG-SDK" -H "Authorization: OpenSesame" +``` + +Response: +```json +{ + "status": "success", + "entities": { + "nodes": [...], + "edges": [...] + } +} +``` + +### Send Query + +Query your code graph using natural language: + +```bash +curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "", "msg": ""}' -H "Authorization: <.ENV_SECRET_TOKEN>" +``` + +For example: + +```bash +curl -X POST http://127.0.0.1:5000/chat -H "Content-Type: application/json" -d '{"repo": "GraphRAG-SDK", "msg": "What are the main classes in this project?"}' -H "Authorization: OpenSesame" +``` + +Response: +```json +{ + "status": "success", + "response": "The main classes in this project are..." +} +``` + +### History change + +List all commits in a repository: + +```bash +curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": ""}' -H "Authorization: <.ENV_SECRET_TOKEN>" +``` + +For example: + +```bash +curl -X POST http://127.0.0.1:5000/list_commits -H "Content-Type: application/json" -d '{"repo": "GraphRAG-SDK"}' -H "Authorization: OpenSesame" +``` + +Response: +```json +{ + "status": "success", + "commits": [ + { + "hash": "abc123", + "date": 1234567890, + "author": "John Doe", + "message": "Initial commit" + } + ] +} +``` + +Switch repository to a specific commit: + +```bash +curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "", "commit": ""}' -H "Authorization: <.ENV_SECRET_TOKEN>" +``` + +For example: + +```bash +curl -X POST http://127.0.0.1:5000/switch_commit -H "Content-Type: application/json" -d '{"repo": "GraphRAG-SDK", "commit": "abc123"}' -H "Authorization: OpenSesame" +``` + +Response: +```json +{ + "status": "success" +} +``` + ## Working with your graph Once the source code analysis completes your FalkorDB DB will be populated with diff --git a/api/llm.py b/api/llm.py index bd45a95..4ffaecc 100644 --- a/api/llm.py +++ b/api/llm.py @@ -235,8 +235,6 @@ def _define_ontology() -> Ontology: ontology = _define_ontology() def _create_kg_agent(repo_name: str): - global ontology - model_name = os.getenv('MODEL_NAME', 'gemini/gemini-2.0-flash') model = LiteModel(model_name)