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 assistant for stablecoin and real world asset #408

Merged
merged 9 commits into from
Nov 18, 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
4 changes: 2 additions & 2 deletions packages/ui/api/ai.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import OpenAI from 'https://esm.sh/openai@4.11.0'
import { OpenAIStream, StreamingTextResponse } from 'https://esm.sh/ai@2.2.16'
import { erc20Function, erc721Function, erc1155Function, governorFunction, customFunction } from '../src/wiz-functions.ts'
import { erc20Function, erc721Function, erc1155Function, stablecoinFunction, realWorldAssetFunction, governorFunction, customFunction } from '../src/wiz-functions.ts'
import { Redis } from 'https://esm.sh/@upstash/redis@1.25.1'

export default async (req: Request) => {
Expand Down Expand Up @@ -39,7 +39,7 @@ export default async (req: Request) => {
model: 'gpt-4-1106-preview',
messages,
functions: [
erc20Function, erc721Function, erc1155Function, governorFunction, customFunction
erc20Function, erc721Function, erc1155Function, stablecoinFunction, realWorldAssetFunction, governorFunction, customFunction
],
temperature: 0.7,
stream: true
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/Wiz.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
erc721: 'ERC721',
erc1155: 'ERC1155',
stablecoin: 'Stablecoin',
realworldasset: 'RealWorldAsset',
governor: 'Governor',
custom: 'Custom',
}
Expand Down Expand Up @@ -109,6 +110,8 @@
if (opts.access === 'false') { opts.access = false }
if (opts.upgradeable === 'false') { opts.upgradeable = false }
if (opts.timelock === 'false') { opts.timelock = false }
if (opts.votes === 'false') { opts.votes = false }
if (opts.limitations === 'false') { opts.limitations = false }
if (opts.proposalThreshold) { opts.proposalThreshold = opts.proposalThreshold.toString() }
if (opts.quorumAbsolute) { opts.quorumAbsolute = opts.quorumAbsolute.toString() }
if (opts.premint) { opts.premint = opts.premint.toString() }
Expand Down
22 changes: 22 additions & 0 deletions packages/ui/src/wiz-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,28 @@ export const erc1155Function = {
}
}

export const stablecoinFunction = {
name: 'stablecoin',
description: 'Make a stablecoin token that uses the ERC-20 standard. Emphasize that this is experimental, and some features are not audited and subject to change.',
parameters: {
type: 'object',
properties: {
...erc20Function.parameters.properties,
custodian: { type: 'boolean', description: 'Whether authorized accounts can freeze and unfreeze accounts for regulatory or security purposes. This feature is experimental, not audited and is subject to change.' },
// 'false' gets converted to false
limitations: { type: 'string', enum: ['false', 'allowlist', 'blocklist'], description: 'Whether to restrict certain users from transferring tokens, either via allowing or blocking them. This feature is experimental, not audited and is subject to change.' },
upgradeable: { type: 'string', enum: ['false'], description: 'Upgradeability is not yet available for features that use @openzeppelin/community-contracts' },
},
required: ['name', 'symbol'],
}
}

export const realWorldAssetFunction = {
name: 'realworldasset',
description: 'Make a real-world asset token that uses the ERC-20 standard. Emphasize that this is experimental, and some features are not audited and subject to change.',
parameters: stablecoinFunction.parameters,
}

export const governorFunction = {
name: 'governor',
description: 'Make a contract to implement governance, such as for a DAO',
Expand Down