-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from ainft-team/release/2.1.0
Release/2.1.0
- Loading branch information
Showing
72 changed files
with
3,414 additions
and
2,688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// To run this example, you must own an ainft object and token; create one if you don't. | ||
// https://docs.ainetwork.ai/ainfts/developer-reference/ainft-tutorial/create-ainft-object-and-mint | ||
|
||
const AinftJs = require('@ainft-team/ainft-js').default; | ||
const { privateKey, objectId, appId, tokenId } = require('../config.json'); // TODO(user): set these in config.json | ||
|
||
const ainft = new AinftJs({ | ||
privateKey, | ||
baseUrl: 'https://ainft-api-dev.ainetwork.ai', | ||
blockchainUrl: 'https://testnet-api.ainetwork.ai', | ||
chainId: 0, | ||
}); | ||
|
||
async function main() { | ||
try { | ||
console.log('Creating assistant...\n'); | ||
|
||
await ainft.connect(); | ||
|
||
const { assistant, tx_hash } = await ainft.assistant.create(objectId, tokenId, { | ||
model: 'gpt-4', // TODO(user): update this | ||
name: 'QuickSupport', // TODO(user): update this | ||
instructions: 'Answer tech support questions.', // TODO(user): update this | ||
description: 'A chatbot for quick tech-related queries.', // TODO(user): update this | ||
metadata: { topic: 'Tech', language: 'en' }, // TODO(user): update this | ||
}); | ||
|
||
await ainft.disconnect(); | ||
|
||
console.log(`\nSuccessfully created assistant with ID: ${assistant.id}`); | ||
console.log(`assistant: ${JSON.stringify(assistant, null, 4)}`); | ||
console.log(`txHash: ${tx_hash}`); | ||
console.log(`\nView more details at: https://testnet-insight.ainetwork.ai/database/values/apps/${appId}/tokens/${tokenId}/ai`); | ||
} catch (error) { | ||
console.error('Failed to create assistant: ', error.message); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// To run this example you must create a thread (see examples/chat/thread.js) | ||
|
||
const AinftJs = require('@ainft-team/ainft-js').default; | ||
const { privateKey, objectId, appId, tokenId } = require('../config.json'); // TODO(user): set these in config.json | ||
|
||
const ainft = new AinftJs({ | ||
privateKey, | ||
baseUrl: 'https://ainft-api-dev.ainetwork.ai', | ||
blockchainUrl: 'https://testnet-api.ainetwork.ai', | ||
chainId: 0, | ||
}); | ||
|
||
async function main() { | ||
try { | ||
console.log('Creating message...\n'); | ||
|
||
await ainft.connect(); | ||
|
||
const threadId = '<YOUR_THREAD_ID>'; // TODO(user): update this | ||
const { messages, tx_hash } = await ainft.message.create(objectId, tokenId, threadId, { | ||
role: 'user', | ||
content: 'What is git?', // TODO(user): update this | ||
metadata: { language: 'en' }, // TODO(user): update this | ||
}); | ||
|
||
await ainft.disconnect(); | ||
|
||
console.log(`\nSuccessfully created new message with reply:`); | ||
console.log(`messages: ${JSON.stringify(messages, null, 4)}`); | ||
console.log(`txHash: ${tx_hash}`); | ||
console.log(`\nView more details at: https://testnet-insight.ainetwork.ai/database/values/apps/${appId}/tokens/${tokenId}/ai/history`); | ||
} catch (error) { | ||
console.error('Failed to create message: ', error.message); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const AinftJs = require('@ainft-team/ainft-js').default; | ||
const { privateKey, objectId, appId, tokenId } = require('../config.json'); // TODO(user): set these in config.json | ||
|
||
const ainft = new AinftJs({ | ||
privateKey, | ||
baseUrl: 'https://ainft-api-dev.ainetwork.ai', | ||
blockchainUrl: 'https://testnet-api.ainetwork.ai', | ||
chainId: 0, | ||
}); | ||
|
||
async function main() { | ||
try { | ||
console.log('Creating thread...\n'); | ||
|
||
await ainft.connect(); | ||
|
||
const { thread, tx_hash } = await ainft.thread.create(objectId, tokenId, {}); | ||
|
||
await ainft.disconnect(); | ||
|
||
console.log(`\nSuccessfully created thread with ID: ${thread.id}`); | ||
console.log(`thread: ${JSON.stringify(thread, null, 2)}`); | ||
console.log(`txHash: ${tx_hash}`); | ||
console.log(`\nView more details at: https://testnet-insight.ainetwork.ai/database/values/apps/${appId}/tokens/${tokenId}/ai/history`); | ||
} catch (error) { | ||
console.error('Failed to create thread: ', error.message); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
main(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.