MCPcopy Index your code
hub / github.com/danielpatrickhug/GitModel

github.com/danielpatrickhug/GitModel @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
94 symbols 272 edges 26 files 23 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GitModel (Graph Intelligence Tensor)

Self Portrait

GitModel is a pipeline that can generate high quality topic models of github repos using GPT, GNN message passing layers and BERTopic.

⚠️Warning: Not under active development. A more expansive system is actively being developed @ https://github.com/Neural-Dragon-AI - currently private. A preview from the org can be seen here including the openbugger and babydragon package https://www.youtube.com/live/BbUOoGfpjvQ?feature=share&t=18645 - Generate documentation for Python repos and create enriched subgraphs for your codebases - Swap system prompt tasks(bug hunting, todo, documentation labeling, etc) for enriching semantic graph and dataset building. - The generated data is saved to context folder. - in src/format_system_prompts. w/ tree works but it requires manual changing one line of code. will fix soon - Pre-commit for isort, prettier, detect private_keys, black, flake8, and more. - GNN Message Passing and Topic modeling pipeline as an inductive bias (GRNN) - BERTopic is highly customizable and can compose several different clustering, embedding, vectorizers, bag of words and dimensionality reduction techniques.

  • https://github.com/huggingface/diffusers/blob/main/CONTRIBUTING.md

How to Use

python3.10 -m venv venv && source venv/bin/activate && pip install -U pip setuptools wheel
pip install -r requirements.txt
python __main__.py

main.py

import argparse
from getpass import getpass

import openai

from src import Pipeline

if __name__ == "__main__":
    argsparse = argparse.ArgumentParser()
    argsparse.add_argument("--config", type=str, default="./test_config.yaml")
    argsparse.add_argument("--repo", type=str, default="https://github.com/danielpatrickhug/GitModel.git")
    argsparse.add_argument("--repo_name", type=str, default="gitmodel")

    args = argsparse.parse_args()

    openai_secret = getpass("Enter the secret key: ")
    # Set up OpenAI API credentials
    openai.api_key = openai_secret

    print("starting pipeline")
    pipeline = Pipeline.from_yaml(args.config)
    gnn_head_outputs, topic_model_outputs = pipeline.run(args.repo, args.repo_name)
    for i, topic_model_output in enumerate(topic_model_outputs):
        topic_model_output["data"].to_csv(f"context/{args.repo_name}_topic_model_outputs_{i}.csv")
        topic_model_output["topic_info"].to_csv(f"context/{args.repo_name}_topic_info_{i}.csv")
        with open(f"context/{args.repo_name}_tree_{i}.txt", "w", encoding="utf-8") as f:
            f.write(topic_model_output["tree"])

Topic model your dependencies.

If you have enough patience or a lot of money to afford more then one computer. run GitModel on /venv/lib/python3.10/site-packages

Examples

Gitmodel

  • https://github.com/danielpatrickhug/GitModel
  • uses Deepminds clrs topic tree in system prompt during semantic graph generation

. ├─Function description and comparison including Gaussian kernel and sparse
matrices\_**\_ │ ├─■──Understanding the Purpose and Handling of a Function for
Sparse Matrices with Inputs, Outputs, and P ── Topic: 9 │ └─Understanding
kernels and functions in the 'kernels.py' file for estimating PDF and computing
simila │ ├─■──Purpose and functions of kernel-related functions in kernels.py
file of a Python program, including ── Topic: 22 │ └─■──Understanding the
cos_sim and cos_sim_torch functions in kernels.py file\_\_** ── Topic: 25
└─Graph message passing and adjacency matrix computation using embeddings\_**\_
├─k-hop message passing and cosine similarity kernel computation for graph
embeddings\_\_** │ ├─k-hop message passing with adjacency matrix and node
features\_**\_ │ │ ├─Computation of Gaussian Kernel Matrix between Two Sets of
Embeddings using PyTorch\_\_** │ │ │ ├─■──Cosine Similarity with PyTorch Tensors
and Functional.\_**_ ── Topic: 1 │ │ │ └─■──Function to compute adjacency matrix
for embeddings using specified kernel type and threshold value_ ── Topic: 19 │ │
└─Message Passing and K-hop Aggregation in Graphs using Sparse Matrices and Node
Features\_\_** │ │ ├─■──Document pruning and adjacency matrix recomputation
using embeddings and thresholding\_**\_ ── Topic: 11 │ │ └─k-hop message passing
and adjacency matrix computation in sparse graphs.\_\_** │ │ ├─■──Computing
graph laplacian and degree matrix from pairwise distances using a given
function.\_**\_ ── Topic: 7 │ │ └─■──Message Passing with K-hop Adjacency and
Aggregated Features in Sparse Matrices\_\_** ── Topic: 8 │ └─"Outlier Reduction
Using Count-TF-IDF and OpenAI Representation Model"\_**\_ │ ├─Topic Modeling and
Outlier Reduction in Natural Language Processing (NLP)\_\_** │ │ ├─Understanding
the compose\*inference function in a chatbot system.\_**\_ │ │ │ ├─■──Processing
conversation transcripts with Python functions\_\_** ── Topic: 18 │ │ │
└─Understanding the compose_inference function in a chatbot conversation with
message templates\_\*\*\* │ │ │ ├─■──Understanding the `compose_inference`
Function in Chatbot Conversation Generation with OpenAI GPT\_** ── Topic: 2 │ │
│ └─■──Function to create prompt message template with role and text input
parameters and validation of rol ── Topic: 17 │ │ └─Outlier Reduction with
Machine Learning Models\_**\_ │ │ ├─Document processing and reduction techniques
for topic modeling with various machine learning models │ │ │ ├─MiniLM language
model for sentence embedding\_\_** │ │ │ │ ├─■──Embedding sentences using MiniLM
language model with multiprocessing and GPU acceleration\_**\_ ── Topic: 15 │ │
│ │ └─■──Embedding Sentences using Pre-Trained Language Model with
SentenceTransformer Library\_\_** ── Topic: 23 │ │ │ └─■──Topic modeling
algorithms and document reduction techniques\_**\_ ── Topic: 0 │ │ └─SQLalchemy
migrations in online mode with engine configuration\_\_** │ │ ├─■──Probability
Density Estimation with Gaussian Kernel Density Estimator\_**\_ ── Topic: 12 │ │
└─Running database migrations with SQLAlchemy and Alembic\_\_** │ │ ├─■──Graph
network message passing & Mobile App Navigation System Design\_**\_ ── Topic: 21
│ │ └─■──Running migrations with SQLAlchemy and Alembic in online mode\_\_** ──
Topic: 6 │ └─Class Settings definition using BaseSettings and its purpose for
managing configuration in a third-p │ ├─■──Empty class definition for managing
application settings using Pydantic's BaseSettings\_**\_ ── Topic: 3 │
└─■──MemoryTreeManager class implementation\_\_** ── Topic: 16 └─Codebase
decomposition and analysis with Git repository and AST nodes.\_**\_ ├─Code
decomposition and processing in Git repositories.\_\_** │ ├─■──Python code
parsing and analysis\_**\_ ── Topic: 4 │ └─Code decomposition in a Git
repository\_\_** │ ├─■──Decomposing Git Repositories with System Prompts.\_**\_
── Topic: 10 │ └─Parsing and pruning files in a GitHub repository\_\_** │
├─■──parsing and pruning files in a local Git repository\_**\_ ── Topic: 5 │
└─■──purpose of `get_repo_contents` function in `repo_graph_generation.py` for
retrieving and pruning Git ── Topic: 24 └─Analyzing chatbot main capabilities in
a codebase using natural language processing and notable fram ├─■──summarizing
code in a GitHub repository using ChatGPT\_\_** ── Topic: 14 └─Understanding
Codebase Structure and Functionality with Hierarchical Trees and
Frameworks\_**\_ ├─■──Analyzing codebase structure and functionalities using a
hierarchical topic tree\_\_\*\* ── Topic: 13 └─■──Understanding the difference
between format_system_prompts and format_system_prompts_with_tree in a ── Topic:
20

w/ graph code bert embeddings


. ├─"The Pipeline Class and Its Methods in GitModel Project"\_**\_ │
├─Probability Density Estimation using Gaussian KDE in SciPy\_\_** │ │
├─Probability density function estimation using Gaussian kernel density
estimation\_**\_ │ │ │ ├─■──Probability density estimation with Gaussian
kernel\_\_** ── Topic: 16 │ │ │ └─■──Understanding cos\*sim_torch function and
configuring context with URL and target metadata\_**\_ ── Topic: 14 │ │ └─Empty
class definition for MessageTreeManagerConfiguration in Python\_\_** │ │ ├─Empty
class definition in MessageTreeManagerConfiguration with BaseModel
inheritance.\_**\_ │ │ │ ├─■──Questions about bug fixing with system prompts in
kernel computation with tensors and matrices.\_\_** ── Topic: 13 │ │ │ └─Empty
class definitions and inability to determine expected behavior of
MemoryTreeManager class\_**\_ │ │ │ ├─■──Purpose of run_migrations_online in
Alembic environment file\_\_** ── Topic: 12 │ │ │ └─■──Empty class definition of
MessageTreeManagerConfiguration inheriting from BaseModel\_\*\*\* ── Topic: 25 │
│ └─Understanding the purpose of SemanticGraphContextGenerator and TopicModel
classes in the codebase\_** │ │ ├─■──Purpose of Pipeline class in codebase with
SemanticGraphContextGenerator, MessageTreeManagerConfigur ── Topic: 15 │ │
└─■──Understanding the purpose and usage of TopicModel class in dimensional
tensors and input shape setti ── Topic: 20 │ └─GitModel Pipeline class with
find_files_with_substring method\_**\_ │ ├─GitModel Pipeline Class and
find_files_with_substring Method Description\_\_** │ │ ├─■──Understanding the
`clone_and_create_context_folder` Function\_**\_ ── Topic: 4 │ │ └─GitModel
Pipeline class and methods for searching files with substring\_\_** │ │
├─GitModel Pipeline class and methods for file searching\_**\_ │ │ │ ├─■──Python
class for loading and initializing configuration values from a YAML file with
dynamic imports ── Topic: 9 │ │ │ └─■──The Pipeline class and its methods in
GitModel project configuration and file searching.\_\_** ── Topic: 10 │ │
└─■──Python Pipeline Class for Generating a Semantic Graph Context for Git
Repository Data Processing\_**\_ ── Topic: 8 │ └─■──Cloning and Storing
Repository in "Work" Folder with Custom Name using Python Function\_\_** ──
Topic: 22 └─Understanding the purpose and input of a Pipeline class in a project
involving semantic graphs and e ├─Topic Modeling with Hierarchical Topics and
Outlier Reduction Strategies in Python\_**\_ │ ├─Working with context folders
and creating directories using os module.\_\_** │ │ ├─■──Creating a work folder
and cloning a repository to create a context folder in Python\_**\_ ── Topic: 18
│ │ └─■──Working with context and folder paths in Python\_\_** ── Topic: 3 │
└─■──Topic modeling and representation using hierarchical and ctfidf
models\_**\_ ── Topic: 5 └─PyTorch function for computing Gaussian kernel matrix
and k-hop message passing on an adjacency matr ├─Compute k-hop adjacency matrix
and aggregated features using message passing in graph analysis.\_\_** │ ├─k-hop
message passing with adjacency matrix and node features\_**\_ │ │ ├─■──Document
Pruning and Adjacency Matrix Recomputation\_\_** ── Topic: 23 │ │ └─Computing
k-hop adjacency matrix with message passing in graph neural networks.\_**\_ │ │
├─■──Computing k-hop adjacency matrix and aggregated features using message
passing\_\_** ── Topic: 0 │ │ └─■──GNNHead class for computing kernel matrix
with node features in numpy array\_**\_ ── Topic: 1 │ └─Data Migrations in
Offline Mode.\_\_** │ ├─■──Degree matrix computation using adjacency distance
matrix and pairwise distances in Python\_**\_ ── Topic: 21 │ └─■──SQLAlchemy
migration in 'offline' mode\_\_** ── Topic: 11 └─Understanding code inputs and
purpose in a Pipeline class\_**\_ ├─Parsing Python files using AST module and
extracting specific information\_\_** │ ├─■──Cosine Similarity Computation using
PyTorch and NumPy\_**\_ ── Topic: 6 │ └─■──Python code parsing and data
extraction using AST\_\_** ── Topic: 17 └─Code Structure and Purpose of Pipeline
Class with Config and Semantic Graph Context Generator in Pyt ├─Code for a
Pipeline with Semantic Graph Context Generator\_**\_ │ ├─■──Understanding
Pipeline Class and Semantic Graph Context Generation in Python Code\_\_** ──
Topic: 24 │ └─■──Summarizing code in a GitHub repository using ChatGPT\_**\_ ──
Topic: 2 └─Semantic Graph Context Generator Class and Methods\_\_**
├─■──Semantic Graph Context Generation for Git Repositories.\_**\_ ── Topic: 19
└─■──Implementation of class instantiation using configuration and dictionary
mapping.\_\_\*\* ── Topic: 7

DeepMind CLRS

  • https://github.com/deepmind/clrs

```

. ├─Purpose and Attributes of the Net Class in Graph Neural Networks__ │ ├─Graph Attention Networks and DAG Shortest Paths in JAX.__ │ │ ├─Graph Attention Networks (GAT and GATv2) code implementation__ │ │ │ ├─Code for DAG shortest path and depth-first search algorithms__ │ │ │ │ ├─■──String Matching and Maximum Subarray__ ── Topic: 10 │ │ │ │ └─Depth-First Search and DAG Shortest Path Algorithms implemented in Python__ │ │ │ │ ├─■──Description of string probe functions in probing.py file for Hash Table probing.__ ── Topic: 1 │ │ │ │ └─Graph Algorithms - DFS and DAG Shortest Paths__ │ │ │ │ ├─■──Graph algorithms (DFS and DAG shortest path) in Python__ ── Topic: 0 │ │ │ │ └─■──Functions for decoding diff and graph features in PyTorch graph neural networks.__ ── Topic: 6 │ │ │ └─■──Graph Attention Networks (GAT and GATv2)__ ── Topic: 20 │ │ └─■──Message Passing with _MessagePassingScanState, _MessagePassingOutputChunked and MessagePassingStateC ── Topic: 17 │ └─Implementing a Baseline Model with Selectable Message Passing Algorithm and its Dataset Sampler.__ │ ├─Handling of untrained parameters in optimization updates__ │ │ ├─■──Updating parameters with filtered gradients from multiple algorithms.__ ── Topic: 8 │ │ └─■──Processing trajectory hints with variable-length time dimension using batching.__ ── Topic: 9 │ └─Processing time-chunked data with batched samplers and message passing nets.__ │ ├─Model processing of time-chunked data with dataset sampling and batch processing_**_ │ │ ├─■──CLRS dataset download and URL retrieval on Google Cloud Platform

Core symbols most depended-on inside this repo

gaussian_kernel_torch
called by 4
src/ml_models/graph_networks/kernels.py
run
called by 3
src/pipeline.py
compose_inference
called by 3
src/ml_models/transformers/semantic_graph_context_generator.py
process_transcript
called by 3
src/ml_models/transformers/semantic_graph_context_generator.py
cos_sim
called by 3
src/ml_models/graph_networks/kernels.py
from_yaml
called by 2
src/config.py
create_prompt_message_template
called by 2
src/ml_models/transformers/category_decomposition.py
compose_inference
called by 2
src/ml_models/transformers/category_decomposition.py

Shape

Method 43
Function 37
Class 13
Route 1

Languages

Python96%
TypeScript4%

Modules by API surface

src/ml_models/graph_networks/gnn_head.py20 symbols
src/ml_models/topic_modeling/topic_model.py10 symbols
src/ml_models/graph_networks/kernels.py10 symbols
src/pipeline.py9 symbols
src/ml_models/transformers/semantic_graph_context_generator.py9 symbols
src/config.py6 symbols
src/ml_models/transformers/category_decomposition.py4 symbols
src/community_detection/extract_connected_components.py4 symbols
src/system_prompts/format_system_prompts.py3 symbols
src/ast_parsers/python_ast_parser.py3 symbols
main.py3 symbols
git-frontend/src/App.js3 symbols

Datastores touched

postgresDatabase · 1 repos

For agents

$ claude mcp add GitModel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact