Skip to content

Commit 69c2064

Browse files
[AI] Rename Chat API to Blockchain LLM and add transaction execution docs
1 parent bdcbe0e commit 69c2064

File tree

7 files changed

+72
-9
lines changed

7 files changed

+72
-9
lines changed

apps/playground-web/src/app/ai/chat/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ export default function ChatPage() {
1313
}
1414

1515
export const metadata = {
16-
title: "AI Chat API - Playground",
16+
title: "Blockchain LLM - Playground",
1717
description: "Chat with thirdweb AI for blockchain interactions",
1818
};

apps/playground-web/src/app/navLinks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const ai: ShadcnSidebarLink = {
1818
links: [
1919
{
2020
href: "/ai/chat",
21-
label: "Chat API",
21+
label: "Blockchain LLM",
2222
},
2323
],
2424
};

apps/portal/src/app/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const apisLinks = [
144144
const aiLinks = [
145145
{
146146
href: "/ai/chat",
147-
name: "Chat API",
147+
name: "Blockchain LLM",
148148
},
149149
{
150150
href: "/ai/mcp",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import {OpenApiEndpoint} from "@doc";
2+
3+
# Transaction Execution
4+
5+
thirdweb AI can either auto execute transactions or prepare them for signing.
6+
7+
- **Auto Execute**: The API will auto execute the transaction. Requires wallet authentication.
8+
- **Prepare for Signing**: The API will only prepare the transaction for signing. The user will need to sign the transaction manually.
9+
10+
## Auto Execute
11+
12+
Requirements:
13+
14+
- The context object must be set with:
15+
- `from` set to the wallet address to execute the transaction from
16+
- `auto_execute_transaction` set to `true`
17+
- (Optional) `chain_ids` set to the chain IDs to execute the transaction on
18+
- The API must be called with either:
19+
- your `x-secret-key` header for server wallet authentication
20+
- OR a `Authorization` header with a valid wallet JWT for user wallet authentication
21+
22+
Model behavior:
23+
24+
If all the requirements are met, the transaction will be executed automatically and the model will return a message with the transaction ID.
25+
26+
It will also include an `actions` array with a `monitor_transaction` action. This action can be used to monitor the transaction status and get the transaction receipt via the thirdweb API.
27+
28+
<OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={{
29+
"messages": [
30+
{
31+
"role": "user",
32+
"content": "Transfer 10 USDC to vitalik.eth"
33+
}
34+
],
35+
"context": {
36+
"from": "0x...",
37+
"auto_execute_transaction": true,
38+
"chain_ids": [8453]
39+
}
40+
}} responseExampleOverride={{
41+
"message": "I've sent 10 USDC to Vitalik's wallet with transaction ID 11cd95e3-c0ee-4468-97c1-fd05dc919cdb. It should be confirmed in a few seconds.",
42+
"session_id": "123",
43+
"request_id": "456",
44+
"actions": [{
45+
"session_id": "8d1bfac4-e6c0-473b-bbb6-649f459d37e6",
46+
"request_id": "79066871-b86f-4814-8027-5f34d99df389",
47+
"source": "model",
48+
"type": "monitor_transaction",
49+
"data": {
50+
"transaction_id": "11cd95e3-c0ee-4468-97c1-fd05dc919cdb"
51+
}
52+
}]
53+
}} />
54+
55+
## Prepare for Signing
56+
57+
When the `auto_execute` parameter is set to `false` or omitted, the API will prepare the transaction for signing and return the transaction data in the `actions` array as a 'sign_transaction' action type.
58+
59+
<OpenApiEndpoint path="/ai/chat" method="POST" />

apps/portal/src/app/ai/chat/page.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Tabs, TabsContent, TabsList, TabsTrigger, OpenApiEndpoint } from "@doc";
22

3-
# Chat API
3+
# Blockchain LLM
44

5-
The thirdweb AI chat API is a standard OpenAI-compatible chat completion API that allows you to interact with the thirdweb AI model, optimized for blockchain interactions.
5+
The thirdweb API exposes a standard OpenAI-compatible chat completion API that allows you to interact with the thirdweb AI model, optimized for blockchain interactions.
66

77
- Query real-time data from the blockchain
88
- Analyze transactions
99
- Fetch token balances, prices and metadata
10-
- Prepare any contract call or transaction for signing
11-
- Prepare swaps from/to any token pair
10+
- Execute or prepare any contract call or transaction
11+
- Execute or prepare swaps from/to any token pair
1212
- Deploy contracts
1313
- Generate images
1414
- Search the web

apps/portal/src/app/ai/sidebar.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { SideBar } from "@/components/Layouts/DocLayout";
44
export const sidebar: SideBar = {
55
links: [
66
{
7-
name: "Chat API",
7+
name: "Blockchain LLM",
88
isCollapsible: false,
99
links: [
1010
{
@@ -17,6 +17,10 @@ export const sidebar: SideBar = {
1717
href: "https://playground.thirdweb.com/ai/chat",
1818
icon: <ExternalLinkIcon />,
1919
},
20+
{
21+
name: "Transaction Execution",
22+
href: "/ai/chat/execution",
23+
},
2024
{
2125
name: "Streaming Responses",
2226
href: "/ai/chat/streaming",

apps/portal/src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function AISection() {
8484
description="Integrate the most advanced blockchain model into your applications"
8585
href="/ai/chat"
8686
icon={MessageCircleIcon}
87-
title="Chat API"
87+
title="Blockchain LLM"
8888
/>
8989
<ArticleCardIndex
9090
description="For agents and humans. Use the thirdweb API with natural language"

0 commit comments

Comments
 (0)