Skip to content

Commit

Permalink
Merge pull request #3204 from ethereum/aiRem
Browse files Browse the repository at this point in the history
update ai-doc text
  • Loading branch information
ryestew authored Jul 20, 2024
2 parents 9d93971 + 0f0c538 commit 4138bc4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions docs/ai.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
AI Tools
========

Remix has integrated two AI tools:
- ChatGPT
- Remix's Solidity Copilot which uses our own LLM (large language model) called Solcoder.
Remix has its own AI tool named **RemixAI** and a sub-project called **RemixAI Copilot** for code completion.

## Remix's Solidity Copilot
Solidity Copilot helps in writing code using code completion. The switch to activate Solidity Copilot is at the top of the Editor.
RemixAI is also used in the:
- **Explain this contract** icon at the top of the Editor
- **Explain this error** button when an error is thrown in the Solidity Compiler
- **Right-click menu options** of the Editor
- **Triple slash** (///) for prepending an AI code request in a file in the Editor

![](images/a-ai-switch.png)
## Code Completion
When you type a space or a new line, the RemixAI Copilot will propose some code. The proposed code is a technique called, **code completion**. The RemixAI Copilot's suggested code will take into account what has already been written in the file.

The Solidity Copilot is specifically for help with Solidity coding. Although it is thousands of times smaller than ChatGPT, it could be slower than ChatGPT.
The switch to activate it is at the top of the Editor.

## ChatGPT in Remix
Remix is currently using ChatGPT v3.5.
![](images/a-ai-switch.png)

## Editor: Right-click Menu
Both ChatGPT and Solidity Copilot are integrated into the Editor's Right-click popup menu.
All other RemixAI tools are always on.

## Editor: Right-click Menu
![](images/a-ai-editor-popup-menu.png)

In both cases the answer will be printed out in Remix's Terminal.
For both **Explain this function** or **Explain this code**, the answer will be printed out in Remix's Terminal.

### GPT: Explain a Function and Generate Documentation
### Explain a Function and Generate Documentation
In the Right-click menu, select the options **Explain the function** and **Generate documentation**.

### Solcoder: Explain this code
The "Explain this code" option in the Editor's Right-click menu can be triggered with, or without, highlighting a block of code.
### Explain this code
The "Explain this code" option in the Editor's Right-click menu can be triggered with, or without, highlighting a block of code. If some code has not been highlighted, RemixAI will take into account the code surrounding the cursor.

## Editor: Code Completion
With the Solidity Copilot switch on, just start typing. When you put a space after a word, the Copilot will make a suggestion.

**NOTE: the suggestion will take into account everything that preceded it in this contract.**
As explained above, with the RemixAI Copilot switched on, when you put a space after a word or make a new line, the Copilot will make a suggestion.

![](images/a-ai-completion-proposal.png)

Expand All @@ -40,24 +39,23 @@ Hit tab to accept the suggestion.
![](images/a-ai-completion-accepted.png)


## Editor: Ask Solidity Copilot with ///
## Editor: Ask RemixAI with ///
In the Editor, when the Solidity Copilot is on, you can ask it a coding question with the `///` prompt.
For example:

```
/// write a function that returns an array with 3 elements from the function's parameters
```

## Terminal Queries to AI
## Terminal Queries using RemixAI
Before your question, either type `gpt` or `sol-gpt`.

### ChatGPT Query Example
`gpt In Solidity what is the goal of modifiers?`
For example:

### Solcoder Queries
`sol-gpt What is the goal of modifiers?`

## Compilers: Explain Error
In the compiler error "cards" of both the Solidity compiler and the Vyper compiler there is a button to "Ask ChatGPT".
In the compiler error "cards" of both the Solidity compiler and the Vyper compiler there is a button to "Ask RemixAI".

![](images/a-ai-solcomp1.png)

Expand Down
Binary file modified docs/images/a-ai-switch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4138bc4

Please sign in to comment.