-
Notifications
You must be signed in to change notification settings - Fork 619
[Docs] Rename Chat API to Blockchain LLM and add transaction execution docs #7904
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import {OpenApiEndpoint} from "@doc"; | ||
|
|
||
| # Transaction Execution | ||
|
|
||
| thirdweb AI can either auto execute transactions or prepare them for signing. | ||
|
|
||
| - **Auto Execute**: The API will auto execute the transaction. Requires wallet authentication. | ||
| - **Prepare for Signing**: The API will only prepare the transaction for signing. The user will need to sign the transaction manually. | ||
|
|
||
| ## Auto Execute | ||
|
|
||
| Requirements: | ||
|
|
||
| - The context object must be set with: | ||
| - `from` set to the wallet address to execute the transaction from | ||
| - `auto_execute_transaction` set to `true` | ||
| - (Optional) `chain_ids` set to the chain IDs to execute the transaction on | ||
| - The API must be called with either: | ||
| - your `x-secret-key` header for server wallet authentication | ||
| - OR a `Authorization` header with a valid wallet JWT for user wallet authentication | ||
|
|
||
| Model behavior: | ||
|
|
||
| If all the requirements are met, the transaction will be executed automatically and the model will return a message with the transaction ID. | ||
|
|
||
| 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. | ||
|
|
||
| <OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={{ | ||
| "messages": [ | ||
| { | ||
| "role": "user", | ||
| "content": "Transfer 10 USDC to vitalik.eth" | ||
| } | ||
| ], | ||
| "context": { | ||
| "from": "0x...", | ||
| "auto_execute_transaction": true, | ||
| "chain_ids": [8453] | ||
| } | ||
| }} responseExampleOverride={{ | ||
| "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.", | ||
| "session_id": "123", | ||
| "request_id": "456", | ||
| "actions": [{ | ||
| "session_id": "8d1bfac4-e6c0-473b-bbb6-649f459d37e6", | ||
| "request_id": "79066871-b86f-4814-8027-5f34d99df389", | ||
| "source": "model", | ||
| "type": "monitor_transaction", | ||
| "data": { | ||
| "transaction_id": "11cd95e3-c0ee-4468-97c1-fd05dc919cdb" | ||
| } | ||
| }] | ||
| }} /> | ||
|
|
||
| ## Prepare for Signing | ||
|
|
||
| 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. | ||
|
|
||
| <OpenApiEndpoint path="/ai/chat" method="POST" /> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ import type { SideBar } from "@/components/Layouts/DocLayout"; | |||||||||||||||||||||||||||
| export const sidebar: SideBar = { | ||||||||||||||||||||||||||||
| links: [ | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| name: "Chat API", | ||||||||||||||||||||||||||||
| name: "Blockchain LLM", | ||||||||||||||||||||||||||||
| isCollapsible: false, | ||||||||||||||||||||||||||||
| links: [ | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
|
|
@@ -17,6 +17,10 @@ export const sidebar: SideBar = { | |||||||||||||||||||||||||||
| href: "https://playground.thirdweb.com/ai/chat", | ||||||||||||||||||||||||||||
| icon: <ExternalLinkIcon />, | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| name: "Transaction Execution", | ||||||||||||||||||||||||||||
| href: "/ai/chat/execution", | ||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainNew “Transaction Execution” doc link — verify route exists and is indexed The link points to /ai/chat/execution. It looks like the MDX page was added in this PR; please also ensure it’s discoverable (sitemap/search index) and that the frontmatter includes title/description so it renders well in listings. Run this quick check from repo root: 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# 1) Route file presence
test -f apps/portal/src/app/ai/chat/execution/page.mdx && echo "OK: execution page exists"
# 2) Basic frontmatter or H1
rg -n --hidden -C2 -S $'^---\\n|^title:\\s*|^#\\s*' apps/portal/src/app/ai/chat/execution/page.mdx || {
echo "WARN: frontmatter/H1 not found (ensure title/description or a top-level heading exist)"; exit 1;
}
# 3) Optional: Confirm any sitemap or sidebar ordering includes the new path (heuristic)
rg -nS "/ai/chat/execution" apps/portal || echo "NOTE: /ai/chat/execution not referenced outside sidebar"Length of output: 618 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
echo "----- Head of page.mdx -----"
head -n20 apps/portal/src/app/ai/chat/execution/page.mdx
echo "----- Frontmatter start lines -----"
grep -n -E '^---' apps/portal/src/app/ai/chat/execution/page.mdx || true
echo "----- Title lines -----"
grep -n -E '^\s*title:' apps/portal/src/app/ai/chat/execution/page.mdx || true
echo "----- Description lines -----"
grep -n -E '^\s*description:' apps/portal/src/app/ai/chat/execution/page.mdx || true
echo "----- H1 lines -----"
grep -n -E '^# ' apps/portal/src/app/ai/chat/execution/page.mdx || true
echo "----- References to /ai/chat/execution in apps/portal -----"
rg -n "/ai/chat/execution" apps/portal || trueLength of output: 1805 Add frontmatter and ensure indexing for “Transaction Execution” page The new MDX page exists and includes a top-level heading, but it currently lacks frontmatter metadata and isn’t referenced in any sitemap or search‐index configuration. To ensure this doc is discoverable and renders properly in listings: • apps/portal/src/app/ai/chat/execution/page.mdx • Sitemap/search index configuration 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| name: "Streaming Responses", | ||||||||||||||||||||||||||||
| href: "/ai/chat/streaming", | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Confirm header names and JWT format across the codebase
Ensure you’re consistently using exactly
x-secret-keyandAuthorization: Bearer <token>in all AI docs and examples (Playground, Portal, SDK README).🏁 Script executed:
Length of output: 74588
🏁 Script executed:
Length of output: 2494
Consistent
Authorization: Bearerheader in AI chat docsThe AI chat execution docs still reference a generic
Authorizationheader without theBearerprefix, and the code examples don’t explicitly show it. Please update the following:• Change “OR a
Authorizationheader with a valid wallet JWT”to
“OR an
Authorization: Bearer <YOUR_WALLET_JWT>header with a valid wallet JWT”• In the
<OpenApiEndpoint>example, add a headers override:<OpenApiEndpoint path="/ai/chat" method="POST" requestBodyOverride={…} responseExampleOverride={…} -> + components={{ + request: { + headers: { + "x-secret-key": "<YOUR_SECRET_KEY>", + "Authorization": "Bearer <YOUR_WALLET_JWT>" + } + } + }} />• If the streaming endpoint supports user‐wallet authentication, add a note and example:
• Verify that all AI/chat examples use exactly
x-secret-keyfor server callsand
Authorization: Bearer <token>for user calls.This will ensure all AI docs and samples are aligned.
🧰 Tools
🪛 LanguageTool
[grammar] ~16-~16: There might be a mistake here.
Context: ...m -
auto_execute_transactionset totrue- (Optional)chain_idsset to the chain ...(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ... chain IDs to execute the transaction on - The API must be called with either: - ...
(QB_NEW_EN)
[grammar] ~18-~18: There might be a mistake here.
Context: ...on - The API must be called with either: - your
x-secret-keyheader for server wa...(QB_NEW_EN)
[grammar] ~19-~19: There might be a mistake here.
Context: ... header for server wallet authentication - OR a
Authorizationheader with a valid...(QB_NEW_EN)
🤖 Prompt for AI Agents