File-to-file translation tasks based on C# and LLM can be realized through a simple dialog.
The software is completely open source and free under the MIT agreement, but there may be a cost to call LLM's API, but that's okay, Cyberbuddha Silicon Flow and Wisdom Spectrum AI, among others, have free models available for tuning now.
This Translation AI Agent is just a simple AI Agent sample application, and many of you probably don't need it.
Open source out mainly for interested students can look at the source code, you can also use C# + LLM to build a more interesting and more efficient to improve their own work efficiency of their own exclusive AI Agent application!
You can choose the right model based on the complexity of the AI Agent application you are building. When the application is relatively simple, a free model may be sufficient, but when the application is more complex, a stronger model may be needed. Nowadays, almost all major platforms have sent some token experience, so you can take these tokens to try it out first.
GitHub Address:/Ming-jiayou/SimpleTranslationAIAgent
Now glm-4-flash is free and tested for some simple AI Agent tasks.
Let's start with a simple task that automatically writes the content to a file after it has been translated:
I don't have it on my desktop right now.
Created this file and wrote the contents:
Record the whole thing on screen and take a look:
The md file is also available:
Record the screen to see the whole thing:
Now try the more difficult task of taking text out of one file and translating it before writing it into another.
For example, I have a file that looks like this:
I want to let Translation AI Agent help me translate into Chinese, and then stored in another file, if the file does not exist then create a new file, it can be written like this, just provide the file path:
Failed:
Try switching to a stronger glm-4 model:
Successfully completed this task now:
Now try putting this file:
Translate to English and write to another file:
View Effect:
Omit automatically...
You can debug to see the process.
The first step is to get the contents of the file first:
Successfully fetched the contents of the file:
The second step went wrong:
I should try again with the Qwen/Qwen2-72B-Instruct provided by Silicon Flow:
That's right now.
Successfully obtained translation results:
The third step is to write the result after translation to a file:
has been successfully written:
Step 4: Return the completion message:
View Effect:
If a model returns an error, you can retry it, and if you can't retry it, you can try a different model, and the stronger the model, the higher the chance of success.
Quick Start
GitHub Address:/Ming-jiayou/SimpleTranslationAIAgent
Notice there's a Releases here:
Click on it and there are two zips:
One dependent on the .net8.0-windows framework and one independent.
installed .net8.0-windows framework you can choose the small size of that, I have installed the .net8.0-windows framework on the choice of the small size of that one, click on the download, download and then unzip, as follows:
Now just open appsettings and fill in your API KEY to use it, very easy!
Open the file as shown below:
Once filled in, click to run:
Test if the configuration is successful:
Configuration has been successful, test if Function Calling works:
Function Calling is working fine and you can now start using the Translation AI Agent!
Source Code Build Guide
After git clone to local, it looks like this:
Open the file as shown below:
Wisdom Spectrum AI glm-4-flash is free, take this LLM as an example, after filling in the API KEY, change the name of the file to or create a new one, and copy the contents of the file into it:
IDE:vs2022
.net version: .net 8
Open the solution:
The runtime reports an error:
Right-click the file, click Properties, and change to Embedded Resources:
Run it again and verify via dialog that the configuration was successful:
Configuration has been successful, test if Function Calling works:
Function Calling is working fine and you can now start using the Translation AI Agent!