Re:Show HN: Code2prompt – Generate LLM prompts from your cod...
by smcleod on Tuesday March 12, 2024 @03:48PM
(#39684095)
This would be good to have in the README.md, I've submitted a PR with your comment here: https://github.com/mufeedvh/code2prompt/pull/1 :)
I could see this tool being useful for a few of my use cases, thank you.
Re:Show HN: Code2prompt – Generate LLM prompts from your cod...
by mufeedvh on Tuesday March 12, 2024 @04:55PM
(#39684838)
Merged, thank you! :)
Re:Show HN: Code2prompt – Generate LLM prompts from your cod...
by myyke on Tuesday March 12, 2024 @03:34PM
(#39683912)
Ah, now I get it, thanks, makes sense.
Re:Show HN: Code2prompt – Generate LLM prompts from your cod...
by printvoid on Tuesday March 12, 2024 @07:18PM
(#39686074)
What do you mean my small codebase. I hope not the normal todo repos or basic apps. Can this be run on production codebase like a java application having dozens of microservices inside it.
Re:Show HN: Code2prompt – Generate LLM prompts from your cod...
by mufeedvh on Tuesday March 12, 2024 @08:39PM
(#39686687)
Yes, this just depends on the model you're using. Small-medium size codebases would fit inside Claude's 200K context window and Gemini 1.5 has a 1M context window which would essentially fit 99% of codebases.
For reference:
- The Flask web framework for Python: 131880 tokens
- The Spring Framework for Java: 11070559 tokens
- Rewrite the code to another language.
- Find bugs/security vulnerabilities.
- Document the code.
- Implement new features.
You can customize the prompt template to achieve any of the desired use cases. It essentially traverses a codebase and creates a prompt with all source files combined. In short, it automates copy-pasting multiple source files into your prompt and formatting them along with letting you know how many tokens your code consumes.