Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Crawl docs of dependencies + RAG #73

Open
Boscop opened this issue Sep 19, 2024 · 1 comment
Open

Idea: Crawl docs of dependencies + RAG #73

Boscop opened this issue Sep 19, 2024 · 1 comment
Labels
discussion enhancement New feature or request

Comments

@Boscop
Copy link

Boscop commented Sep 19, 2024

I'm not sure if any of the available AI coding assistants do this (if you know, please tell me), but this is the main feature I'm missing:
Ideally it should crawl the docs of dependencies of the project and use this info when generating code.
This allows it to better respond to user requests because the user uses natural language that's mostly found in documentation of symbols, not in the symbols themselves.
Too often these coding assistants hallucinate fake symbols because they were trained on outdated docs (e.g. ChatGPT and Claude always use outdated crate versions if you tell them to generate Rust code).
If they could read the docs that wouldn't happen :)
This feature would open the door to really low-code coding, just telling the LLM what to do and what to change!

In practice, how it would look like: E.g. lets say I have a Rust project with many deps and transitive deps.
I want to build a complex component using multiple symbols from different deps.
The assistant in the background inspects Cargo.toml to identify the deps, then crawls the docs.rs of the deps, adds these as vector embeddings etc. In addition, it also detects from the docs (or from rust-analyzer) which transitive deps are re-exported, and crawls their docs too. (Similar with other languages that have conventions around docs.)
Then, user prompts to the LLM via the LSP adapter use this contextual info, to generate code that uses the correct names/types/shapes/signatures.

@SilasMarvin
Copy link
Owner

This could be pretty cool and we actually already have most of the hard part written: https://github.com/SilasMarvin/lsp-ai/blob/main/crates/lsp-ai/src/memory_backends/vector_store.rs

We would need to write some configuration for which directories to crawl and maybe some way to watch for changes to them?

Feel free to take a swing at it!

@SilasMarvin SilasMarvin added enhancement New feature or request discussion labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants