Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ai-doc text #3204

Merged
merged 2 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.