# Generate Code

Our Code Generation feature supports a list of 30 languages and can generate complex code with the help of carefully curated instructions or natural language pseudo-code.&#x20;

To efficiently generate code, your instructions should completely represent your intent. Try to explain step by step leaving in every minute detail - even names of variables if you can.

### Step 1 :

Log in first with Google Authentication on Kodezi.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FdTYQfAmfu4j93MWL6Okq%2FStep%2003%20(1).png?alt=media&#x26;token=e5c4f5b8-4dff-4e3c-9225-ecb84b56026f" alt=""><figcaption></figcaption></figure>

### Step 2 :

After signing in successfully, click on Generate Code button.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2Ff69R7VhMs2NBfBHtgz8T%2Fgc1.png?alt=media&#x26;token=03ae12b7-9328-48d3-8048-35ff42a978d8" alt=""><figcaption></figcaption></figure>

### Step 3 :

Once inside the Generate Code UI, write the instructions in the text area. *Then select your programming language.* Next click on the Generate button to start the process of generating code.\
\
An example set of instructions to try - "*Write a program of the Fibonacci series."*

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FBA5iNYN4gPHmraEtTL3d%2Fgc2.png?alt=media&#x26;token=ce5c7cb6-3f6c-4c7d-bbb2-669db4e3fd97" alt=""><figcaption></figcaption></figure>

### Step 4 :

After clicking on generate button, the Generate Code process will start.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FZkjsb6QthT8l6uYTnboM%2Fgc3.png?alt=media&#x26;token=242c1ffc-0c16-4110-bd06-19fc04bb2071" alt=""><figcaption></figcaption></figure>

### Step 5 :

You will see results similar to these in your IDE once the code-generating process is finished.

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2Fi7aXCOaaPUV7dMCkeZiZ%2FGenerate%20Documentation%20Select%20Type%20(9).png?alt=media&#x26;token=0e69b4aa-799c-4407-b1b8-35b9d01247fa" alt=""><figcaption></figcaption></figure>

### Step 6 :

Now you can simply click on the Apply button to create a separate folder, "GeneratedCode" and save the file with the name "GeneratedCode" and the current time in the same workspace as the original code.

### Tips

Our AI is as good as the instructions which are input into the Code Generation UI section. If you can explain what you want efficiently we can generate it for you. This feature is for people who know what they want to do in programming but need help with syntax. Famous problems such as Fibonacci or Factorials will be generated without a lengthy example but lesser-known problems will need to be explained, algorithm-wise, so the AI can generate the code for them. Think of this as Natural Language to Code Generation.

**A bad input;**

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FiaerTzIsykuVeUrDecVW%2Fimage.png?alt=media&#x26;token=5b3b508f-b1df-4a1f-9299-fcdf16be602e" alt=""><figcaption><p>A bad input contains spelling mistakes, has no description of the flow of the code and is ambiguous in nature.</p></figcaption></figure>

**A good input;**

<figure><img src="https://1546495129-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuCUGeAGoLnKn0XrQ3cCn%2Fuploads%2FXHPPwzylRj3K0KGzROHb%2Fimage.png?alt=media&#x26;token=dde7c339-c764-4e1d-a560-4afc698e4d68" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kodezi.com/feature-guides/generate-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
