Tips for better use
This section provides some tips to get the most out of CodeGenX.
1. Keep it Short and Specific
CodeGenX is great at helping you with short and specific commands and finding nuances in various API's. But it does not perform well when given very high level instructions. If you are trying to do a complex task which requires a lot of steps, try to break down the instructions into small bite-sized pieces.
2. Add as much context as possible
CodeGenX requires a bit more context than other code generation systems. For example, if you want to write a function which returns a list of numbers divisible by a certain divisor. You can include a prompt like so:
def return_div(min_num, max_num, divisor): """return a list of numbers divisible by divisor between min and max""" lst =  for x in range(min_num, max_num): if
for loop and the
if statement in the end guides CodeGenX to the right approach and prevents it from getting lost. Here is another example, the
(x_train, y_train), (x_test, y_test) guides CodeGenX to the right api:
from tensorflow.keras.datasets import mnist from tensorflow import keras def load_mnist(normalize=True) """Load the mnist dataset""" (x_train, y_train), (x_test, y_test) =
These are just some examples, just remember to include some indication of which approach you want to use, this will greatly improve the performance of CodeGenX.
3. Use functions whenever possible
CodeGenX also performs better when you use functions. Try to create functions with descriptive names and create docstring with short and specific instructions as given above.
4. Use the word
return in logical and mathematical operations
If you want CodeGenX to provide an answer which involves logic and mathematical operations, use the word
return in your command. For example:
import numpy as np def circumference_of_circle(radius): """return the circumference of a circle with given radius""" circumference =