Chat with Nebula.
import { Nebula } from "thirdweb/ai"; const response = await Nebula.chat({ client: TEST_CLIENT, message: "What's the symbol of this contract: 0xe2cb0eb5147b42095c2FfA6F7ec953bb0bE347D8", contextFilter: { chains: [sepolia], },});
Multi message prompt:
const response = await Nebula.chat({ client, messages: [ { role: "user", content: "What's my balance?" }, { role: "assistant", content: "Your balance is 0.023 ETH" }, { role: "user", content: "What about my NFTs?" }, ], contextFilter: { chains: [sepolia], },});
Extracting and sending transactions from a chat response:
const response = await Nebula.chat({ ... });const transactions = response.transactions;for (const transaction of transactions) { await sendTransaction({ transaction, account });}
The input for the chat.
let input: { contextFilter?: { contractAddresses?: Array<string>; walletAddresses?: Array<string>; }; sessionId?: string;} & ( | { messages: Array<{ content: string; role: "user" | "assistant"; }>; } | { message: string });
The chat response. This API is in early access and might change in the future.