Q Remix Documentation
  • INTRODUCTION
    • Welcome to Q-Remix IDE's documentation
    • Navigating Q-Remix
    • Using Q-Remix Safely
    • Q-Remix Links
    • FAQ
  • CORE MODULES
    • File Explorer
    • Search in Files
    • Settings
    • Editor
    • Autocompletion & Suggestions in Editor
    • Contract Creation & Compiling
    • Deploy & Run
    • Accessing and Interacting with the Deployed Contracts
    • Terminal
  • Solidity modules
    • Solidity Compiler
    • AI Assistant
    • Q-Remix Chatbot
    • AI Code Generation
    • Multi AI Models switch
    • AI Project Generation
    • Debugger
  • Guide
    • Creating and Deploying a Contract
    • Importing and Loading Source Files in Solidity
  • Unit Testing
    • Testing by Example
  • MISCELLANEOUS
    • Q-Remix as Code Viewer
    • Code Contribution Guide
Powered by GitBook
On this page
  1. Solidity modules

AI Code Generation

This functionality allows users to quickly generate code snippets or full contracts by providing a simple natural language prompt.

How to Use:

  • Press Ctrl + I on Windows/Linux or Command + I on macOS.

  • An input pop-up box will appear, asking you to enter your prompt. For example, you can type: "Create an ERC20 token contract"

  • Based on your prompt, the AI engine will:

    • Parse your intent.

    • Generate a valid Solidity contract or code snippet.

    • Display the result directly within the Q-Remix code editor.

  • Caution:

    • The prompt needs to be well structured and as detailed as possible for an accurate generation of code

Interactions:

  • After code generation, a small window will display the suggested code.

  • Two options will be presented:

    • Cancel: Closes the pop-up without accepting the suggestion.

    • Get Suggestion: Confirms the prompt and generates the code.

Additionally, two icons will appear with the generated code:

  • A checkmark to accept and integrate the code into your editor.

  • A cross to discard the generated code.

Use Case:

Perfect for quickly scaffolding components of a smart contract, like token standards (ERC20, ERC721), DAO mechanics, or custom functions, especially when you want to avoid boilerplate or remember specific syntax.

You can modify the prompt to regenerate different variations of the code if needed.

There are two options: Cancel and Get Suggestion. If you click on Cancel , the popup will close. When you click on Get Suggestion, it will generate a suggestion

When you send your prompt for fetching suggestion, it shall display the corresponding response in the following format embedded in the current file itself, highlighted for the user to understand that this code snippet was generated as a suggestion from our AI model.

Alongwith the code snippet we get options to accept and reject the changes suggested by AI, after acceptance it gets embedded as a part of the editor otherwise it is totally removed leaving the screen clean for the user to write a contract.

After acceptance of the changes the extra highlightings get removed and the file would look like the following example:

PreviousQ-Remix ChatbotNextMulti AI Models switch

Last updated 13 days ago