Call for Rust Developers Interested in AI(LLM)

A few days ago I published an article Building a Code Generation Tool with Rust and Local LLMs from Ollama

The Rustns project aims to make life easier for Rust developers by automating tedious tasks. My tool generates Rust code snippets from user explanations, compiles them, resolves dependencies, and generates tests.

Initially, the project was conceived as a universal solution for generating code for the most popular programming languages, including Java, Python, and TypeScript. I wanted to create a tool that would make the work of developers easier by providing the ability to generate code in several languages ​​at once. However, when I started implementing multilingualism, I encountered serious difficulties.

Trying to unify code across languages ​​turned out to be a much more difficult task than I expected. Each programming language has its own peculiarities, which makes it much more difficult to code and maintain all of these languages ​​in one project.

Ultimately, I came to the conclusion that I needed to concentrate my efforts on one programming language. In my case, it was Rust, which was used to write the project that generated Rust code.

Here is a simplified diagram of how the project works:

You can get acquainted with the detailed logic of the program's operation by looking at the state diagram that the program parses and uses in its work: https://github.com/evgenyigumnov/rustsn/blob/main/logic.md

Also all the prompts that the system sends to LLM based on the state diagram can be seen in this file: https://github.com/evgenyigumnov/rustsn/blob/main/prompt.txt

Recently I have made the following changes to the project:

  1. Version 0.2.0: Moved text queries from code to file prompt.txt and the processing logic – into a file logic.md

  2. Version 0.3.0: Added support for OpenAI API.

  3. Version 0.4.0: Made changes to the functions for extracting the results of LLM work. Function Extract_code was replaced by three new functions: extract_code, extract_dep And extract_testThis separation allows for finer control over how code, dependencies, and tests are extracted from the LLM generation results.

You can visit my GitHub repository here: https://github.com/evgenyigumnov/rustsn

Please check my README.md file for setup instructions and recommendations for making code changes.

P.S.

Overall, the code is quite versatile and can be used for personal purposes if you are not interested in the topic of code generation in Rust. For example:

  1. Write a code generator for your favorite programming language.

  2. Write a telegram chatbot for some business.

  3. Write a mock English teacher.

etc.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *