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

Generate agent #5870

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Generate agent #5870

wants to merge 13 commits into from

Conversation

STetsing
Copy link
Collaborator

@STetsing STetsing commented Mar 12, 2025

Introducing an AI contract generation support based on user prompt.

How to use it

In the chat window, start a new generation request with the prefix/generate.

E.g.

/generate a simple storage contract

Provided the AI generates a valid contract, a new workspace will be instantiate

  • The workspace name is relative to the request.
  • The workspace will have a generation UTC timestamp as surfix: The user request above could yield SimpleStorage-1742323922
  • The generated workspace will be set as current one

There is a total of 3 provider:

  • OpenAI (less reliable, broad features)
  • MistralAI (reliable, super fast)
  • Anthropic Claude (slow, very reliable solutions)

The default provider is set to be mistralai,
Use openai or anthropic keyword to select model providers relatively as below

Change the AI provider in the chat window

Use the following command to change the AI provider to either openai, mistralai, or anthropic

/setProvider mistralai

@STetsing STetsing added the WIP label Mar 12, 2025
Copy link

netlify bot commented Mar 12, 2025

Deploy Preview for remixproject ready!

Name Link
🔨 Latest commit 8c421ff
🔍 Latest deploy log https://app.netlify.com/sites/remixproject/deploys/67e138a824349b0008a2bc98
😎 Deploy Preview https://deploy-preview-5870--remixproject.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

async compilecontracts(fileName, fileContent): Promise<CompilationResult> {

const contract = {}
contract[fileName] = { content : fileContent }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you have to put all the files in there:

contract[fileName1] = { content : fileContent1 }
contract[fileName2] = { content : fileContent2 }

etc...

so you should not loop over the files and compile them one by one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already tried this, the issue might me the import name not including the folder

console.log('Generation attempts', this.generationAttempts)
if (this.nAttempts > this.generationAttempts) {
console.error('Failed to generate the code')
return "Failed to generate secure code on this prompt ```" + userPrompt + "````"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should throw an error instead of returning a string.

return "Failed to generate secure code on this prompt ```" + userPrompt + "````"
}

for (const file of parsedFiles.files) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't handle yet solidity import?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I handle imports by adding all files for compilation see line 33, which make sense, the generation must be complete ( from a compilation point of view)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants