yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
6.29k stars 229 forks source link

feature: extract the most relevant parts using NetworkX in repo-map #634

Open yetone opened 3 weeks ago

yetone commented 3 weeks ago

Feature request

Use NetworkX to extract repo-map to reduce token usage

Motivation

No response

Other

No response

jmmarotta commented 3 weeks ago

After considering the problem further, @aarnphm was likely right. Something like ColBERT would be the best approach to retrieve definitions that are important to the prompt when requesting an action from the LLM.

Initially, I thought that including the structure of the code would be more important than the semantics of the definitions. However, after further consideration, I've come to the conclusion that semantic relevance of definitions is crucial to include for context.

Let's consider a scenario where we're developers making a hypothetical change to lua/avante/repo_map.lua, and we've added lua/avante/colbert.lua.

We prompt the LLM:

_"Change the get_repo_map() method to retrieve n number of tokens passed in as a parameter of the method via ColBERT."_

If we were developing this ourselves, we would likely use tools like ripgrep to search for colbert or read colbert.lua to get an understanding of it. When doing this we are focusing on semantic content rather than the structural hierarchy of the codebase.

That being said, I'm not sure that using NetworkX for ranking is the right approach. Does anyone else have thoughts on this?