5
5
** CodeMage** is a tool that translates a source file written in one programming language into another language.
6
6
The translation will be done by Large Language Model AI(such as ChatGPT)
7
7
8
- ## Release 1.0.0
9
8
10
- ### Features
9
+
10
+ ## Features (Release 1.1.2)
11
11
12
12
1. Supported Languages: Javascript, Python, C++, Java
13
13
2. Default target Language is Python
14
14
3. Supported LLM model: openrouter, groq
15
15
4. Default LLM model is openrouter(sao10k/l3-euryale-70b)
16
16
17
- # Getting Started with ` PyPI `
17
+
18
+
19
+ <br >
20
+ <br >
21
+
22
+ # Getting started
23
+
24
+ ### Prerequisite
25
+
26
+
27
+ 1 . Python
28
+ - You need python 3.12 or later version to use this tool
29
+ - Install Python : https://www.python.org/downloads/
30
+
31
+
32
+
33
+ <br >
34
+ <br >
35
+
36
+ ## Start with ` PyPI `
18
37
19
38
### 1. Download the package using PyPI
20
39
``` bash
40
+ # for window user
21
41
pip install code-mage
42
+
43
+ # for mac user
44
+ pip3 install code-mage
22
45
```
23
46
47
+ <br >
48
+
24
49
### 2. Create your API_KEY at [ openrouter] ( https://openrouter.ai/docs/api-keys ) Or [ Groq] ( https://console.groq.com/keys )
25
50
26
51
It's free with sign-up. You can easily sign-up with your google account
27
52
53
+ <br >
54
+
28
55
### 3.a Set-up the API_KEY using ` Variable ` (option 1)
29
56
30
57
``` bash
31
- export API_KEY=YOUR-API-KEY
58
+ export GROQ_API_KEY=YOUR-API-KEY # if you use groq model
59
+ export OPENROUTER_API_KEY=YOUR-API-KEY # if you use openrouter model
32
60
```
33
61
62
+ <br >
63
+
34
64
### 3.b Set-up with ` .toml ` file (option 2)
35
65
36
- With this option, you can also set other tool options.
66
+ With this option, you can also set other tool options more easily
37
67
38
68
- Start by creating a ` .codemage-config.toml ` in your home directory.
39
69
40
70
``` bash
41
- mkdir ~ /.codemage-config.toml
71
+ vi ~ /.codemage-config.toml
42
72
```
43
73
44
- - Add the following information to the file:
74
+ - Add the following environment settings in the file:
45
75
46
76
``` toml
77
+ # the double quotes for string values are necessary.
78
+
47
79
model =" groq" # if you wish to use OPEN ROUTER you can just delete this line
48
80
GROQ_API_KEY =" <YOUR-GROQ-API-KEY>"
49
81
OPENROUTER_API_KEY =" <YOUR-OPEN-ROUTER-API-KEY>"
@@ -53,37 +85,42 @@ token_usage=false # if you wish to get token_usage info, set it `true`
53
85
output =" result" # type any name for the output file without the extension
54
86
```
55
87
88
+ <br >
89
+
56
90
### 4. Run the tool
57
91
58
92
``` bash
59
93
codemage < file-you-want-to-convert>
94
+
60
95
# For example,
61
96
codemage test.js
97
+ codemage test.js -s
98
+ codemage test.js -m openrouter # specify your model, or the default model is "groq"
62
99
```
63
100
64
- # Getting Started by cloning the github repo
101
+ < br >
65
102
66
- ### 1. Install Python : https://www.python.org/downloads/
103
+ # Start by cloning the github repo
67
104
68
- < br >
105
+ If you are using the tool by cloning the repo, you need poetry package manager.
69
106
70
- ### 2 . Install Poetry
107
+ ### 1 . Install Poetry (if not installed yet)
71
108
72
109
``` console
73
110
curl -sSL https://install.python-poetry.org | python3 -
74
111
```
75
112
76
113
** OR** if you have ` pipx ` installed on your local machine, you can use the following commend
77
114
78
- [ How to download ` pipx ` ] ( https://github.com/pypa/pipx )
79
-
80
115
``` console
81
116
pipx install poetry
82
117
```
83
118
119
+ Refer to [ How to download pipx] ( https://github.com/pypa/pipx )
120
+
84
121
<br >
85
122
86
- ### 3 . Clone the repository
123
+ ### 2 . Clone the repository
87
124
88
125
``` console
89
126
git clone https://github.com/gitdevjin/code-mage.git
@@ -92,35 +129,44 @@ cd code_mage
92
129
93
130
<br >
94
131
95
- ### 4 . Install Poetry Package
132
+ ### 3 . Install Poetry Dependencies
96
133
97
134
``` console
98
135
poetry install
99
136
```
100
137
101
138
<br >
102
139
103
- ### 5 . Create your API_KEY at [ openrouter] ( https://openrouter.ai/docs/api-keys ) Or [ Groq] ( https://console.groq.com/keys )
140
+ ### 4 . Create your API_KEY at [ openrouter] ( https://openrouter.ai/docs/api-keys ) Or [ Groq] ( https://console.groq.com/keys )
104
141
105
142
It's free with sign-up. You can easily sign-up with your google account
106
143
107
144
<br >
108
145
109
- ### 6. Create ` .env ` file in the root directory and save the following:
146
+ ### 5-a Create ` .env ` file in the root directory and save the following:
110
147
111
148
```
112
149
OPENROUTER_API_KEY=your_open_router_api_key
113
150
GROQ_API_KEY=your_groq_api_key
114
151
```
152
+ <br >
153
+
154
+ ### 5-b Using TOML files
155
+
156
+ You can also use ` .toml ` file with this method
157
+ Refer to [ this] ( #3b-set-up-with-toml-file-option-2 )
115
158
116
159
Now you are ready to use the tool!
117
160
118
161
<br >
119
162
120
163
# Usage
121
164
165
+ - Run the command
166
+
122
167
``` console
123
168
poetry run codemage <source_file>
169
+ poetry run codemage ./example/test.js
124
170
```
125
171
126
172
## Examples
@@ -155,34 +201,6 @@ You can stream out the result onto `stdout` with `-s, --stream` flag:
155
201
poetry run codemage ./example/test.js -s
156
202
```
157
203
158
- ### Using TOML files
159
-
160
- If you wish, you can specify all of your options in a TOML formatted configuration.
161
-
162
- - Start by creating a ` .codemage-config.toml ` in your home directory.
163
-
164
- ``` bash
165
- mkdir ~ /.codemage-config.toml
166
- ```
167
-
168
- - Add the following information to the file:
169
-
170
- ``` toml
171
- model =" groq" # if you wish to use OPEN ROUTER you can just delete this line
172
- GROQ_API_KEY =" <YOUR-GROQ-API-KEY>"
173
- OPENROUTER_API_KEY =" <YOUR-OPEN-ROUTER-API-KEY>"
174
- language =" java" # you can use any of the supported languages
175
- stream =false /true
176
- token_usage =false /true
177
- output =" result" # type any name for the output file without the extension
178
- ```
179
-
180
- - Run the command
181
-
182
- ```
183
- poetry run codemage ./example/test.js
184
- ```
185
-
186
204
## Options
187
205
188
206
-h, --help : display help message and exit
0 commit comments