-
Notifications
You must be signed in to change notification settings - Fork 618
initial nebula docs #5720
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
Merged
Merged
initial nebula docs #5720
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0497cb1
initial nebula docs
saminacodes 857334d
Merge branch 'main' into nebula-docs
saminacodes 09763b0
fixed camel casing on svg
saminacodes 9fa1640
changed md and svg
saminacodes 813a7bc
updated reference and added erc-20 guide
saminacodes df03f8e
Merge branch 'main' into nebula-docs
saminacodes dd23f50
Merge branch 'main' into nebula-docs
gregfromstl 4285c9e
Merge branch 'main' into nebula-docs
saminacodes 26a8210
fixed code snippet formatting
saminacodes ea56eee
Merge branch 'main' into nebula-docs
saminacodes 84e4ce3
Merge branch 'main' into nebula-docs
saminacodes 8b18782
added execute command and removed from tsconfig
saminacodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,266 @@ | ||
| # Nebula API Reference | ||
|
|
||
| Nebula provides a conversational interface to interact with blockchain data and services, and access to thirdweb tools. | ||
|
|
||
| ## Authentication | ||
|
|
||
| All API endpoints require authentication using the thirdweb secret key. | ||
|
|
||
| Add the following header to your requests: | ||
|
|
||
| ``` | ||
| x-secret-key: YOUR_THIRDWEB_SECRET_KEY | ||
| ``` | ||
|
|
||
| ## Sessions | ||
|
|
||
| A session represents a conversation thread with the AI. Sessions can be: | ||
|
|
||
| - Created explicitly via the `/session` endpoint | ||
| - Created automatically when sending a message without a session_id | ||
| - Reused to maintain context across multiple messages | ||
| - Configured with specific execution parameters | ||
|
|
||
| Sessions persist your conversation history and any custom configurations you've set for interacting with blockchain data and thirdweb tools. | ||
|
|
||
| ## Context Filtering | ||
|
|
||
| The context filter allows you to control what blockchain data is used to inform AI responses: | ||
|
|
||
| - Specify which blockchain networks to search via chain IDs (e.g. 1 for Ethereum mainnet) | ||
| - Filter data by specific contract addresses | ||
| - Control the context scope for more relevant AI responses | ||
| - Optimize response relevance and token usage | ||
|
|
||
| Example context filter: | ||
| ```json | ||
| { | ||
| "context_filter": { | ||
| "chain_ids": [1], // Ethereum mainnet | ||
| "contract_addresses": ["0x..."] // Target contract address | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Endpoints | ||
|
|
||
| ### Chat | ||
|
|
||
| #### Send Message | ||
|
|
||
| ```http | ||
| POST /chat | ||
| ``` | ||
|
|
||
| Send a message and get a response. Supports both streaming and non-streaming responses. | ||
|
|
||
| Request body: | ||
|
|
||
| ```json | ||
| { | ||
| "message": "Find the last 5 blocks", | ||
| "session_id": "abc", // Optional - will create new session if omitted | ||
| "stream": true, // Optional, default false | ||
| "context_filter": { // Optional: Filter data sources for context | ||
| "chain_ids": [137], // Optional: Array of chain IDs to search (e.g. 137 for Polygon) | ||
| "contract_addresses": ["0x.."] // Optional: Array of contract addresses | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| For non-streaming responses (stream: false): | ||
|
|
||
| ```json | ||
| { | ||
| "result": { | ||
| "message": "The last 5 blocks on polygon are...", | ||
| "session_id": "abc", | ||
| "message_id": "1234", | ||
| "created_at": "2024-01-01T00:00:00Z", | ||
| "usage": { | ||
| "prompt_tokens": 10, | ||
| "completion_tokens": 15, | ||
| "total_tokens": 25 | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| For streaming responses (stream: true), returns Server-Sent Events (SSE) with the following event types: | ||
|
|
||
| - `message`: Contains a chunk of the response text | ||
| - `error`: Contains error information if something goes wrong | ||
| - `done`: Signals the end of the stream with complete message details | ||
|
|
||
| Example SSE stream: | ||
|
|
||
| ``` | ||
| event: message | ||
| data: {"text": "Hello", "message_id": "123"} | ||
|
|
||
| event: message | ||
| data: {"text": " world!", "message_id": "123"} | ||
|
|
||
| event: done | ||
| data: { | ||
| "message_id": "123", | ||
| "session_id": "abc", | ||
| "created_at": "2024-01-01T00:00:00Z", | ||
| "usage": { | ||
| "prompt_tokens": 10, | ||
| "completion_tokens": 15, | ||
| "total_tokens": 25 | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Execute | ||
|
|
||
| #### Execute Command | ||
|
|
||
| ```http | ||
| POST /execute | ||
| ``` | ||
|
|
||
| Execute a specific command or action. | ||
|
|
||
| Request body: | ||
|
|
||
| ```json | ||
| { | ||
| "message": "Deploy a new ERC20 contract", | ||
| "session_id": "sess_01HKW2ZH45JNQRTM0YPKJ6QXXX", // Optional | ||
| "config": { | ||
| "chain": "ethereum", | ||
| "contract_name": "MyToken", | ||
| "symbol": "MTK" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| ### Sessions | ||
|
|
||
| #### List Sessions | ||
|
|
||
| ```http | ||
| GET /session/list | ||
| ``` | ||
|
|
||
| Returns a list of available sessions for the authenticated account. | ||
|
|
||
| Response: | ||
|
|
||
| ```json | ||
| { | ||
| "result": [ | ||
| { | ||
| "id": "string", | ||
| "title": "string", | ||
| "model_name": "string", | ||
| "is_public": boolean, | ||
| "created_at": "datetime", | ||
| "updated_at": "datetime" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| #### Get Session | ||
|
|
||
| ```http | ||
| GET /session/{session_id} | ||
| ``` | ||
|
|
||
| Retrieves details for a specific session. | ||
|
|
||
| Response: | ||
|
|
||
| ```json | ||
| { | ||
| "result": { | ||
| "id": "string", | ||
| "title": "string", | ||
| "model_name": "string", | ||
| "is_public": boolean, | ||
| "created_at": "datetime", | ||
| "updated_at": "datetime", | ||
| "messages": [] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| #### Create Session | ||
|
|
||
| ```http | ||
| POST /session | ||
| ``` | ||
|
|
||
| Create a new chat session. | ||
|
|
||
| Request body: | ||
|
|
||
| ```json | ||
| { | ||
| "title": "My DeFi Research", // Optional: Custom session title | ||
| "is_public": true, // Optional: Make session publicly accessible | ||
| "context_filter": { // Optional: Filter data sources for context | ||
| "chain_ids": [1], // Optional: Array of chain IDs (e.g. 1 for Ethereum) | ||
| "contract_addresses": ["0x..."] // Array of contract addresses | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| #### Update Session | ||
|
|
||
| ```http | ||
| PUT /session/{session_id} | ||
| ``` | ||
|
|
||
| Update an existing session. | ||
|
|
||
| Request body: | ||
|
|
||
| ```json | ||
| { | ||
| "title": "string", | ||
| "is_public": boolean, | ||
| } | ||
| ``` | ||
|
|
||
| #### Clear Session | ||
|
|
||
| ```http | ||
| POST /session/{session_id}/clear | ||
| ``` | ||
|
|
||
| Clears the message history of a session. | ||
|
|
||
| #### Delete Session | ||
|
|
||
| ```http | ||
| DELETE /session/{session_id} | ||
| ``` | ||
|
|
||
| Deletes a session. | ||
|
|
||
|
|
||
| ## Error Handling | ||
|
|
||
| The API uses standard HTTP status codes and returns error messages in the following format: | ||
|
|
||
| ```json | ||
| { | ||
| "error": { | ||
| "message": "Error description" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Common status codes: | ||
|
|
||
| - 400: Bad Request | ||
| - 401: Unauthorized | ||
| - 404: Not Found | ||
| - 500: Internal Server Error |
This file contains hidden or 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,17 @@ | ||
| import { DocLayout } from "@/components/Layouts/DocLayout"; | ||
| import { createMetadata } from "@doc"; | ||
| import { sidebar } from "./sidebar"; | ||
|
|
||
| export default async function Layout(props: { children: React.ReactNode }) { | ||
| return ( | ||
| <DocLayout sideBar={sidebar} editPageButton={true}> | ||
| {props.children} | ||
| </DocLayout> | ||
| ); | ||
| } | ||
|
|
||
| export const metadata = createMetadata({ | ||
| title: "Engine", | ||
| description: | ||
| "Engine is a backend HTTP server that calls smart contracts using your managed backend wallets.", | ||
| }); | ||
This file contains hidden or 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,20 @@ | ||
| # What is Nebula? | ||
|
|
||
| Natural language model with blockchain reasoning, autonomous transaction capabilities and real-time access to the blockchain. | ||
|
|
||
| Nebula is currently available in Alpha. [Join the waitlist.](https://thirdweb.com/nebula) | ||
|
|
||
| ### With Nebula, you can: | ||
|
|
||
| - Chat with an AI with blockchain context - answer questions about transactions, wallets, and smart contracts in real-time | ||
| - Create code editors that can write web3 apps & games | ||
| - Build blockchain explorers that explain complex transactions in plain English | ||
| - Build automated trading agents that can monitor and execute trades based on specific conditions | ||
| - Perform smart contract security analysis and audit assistance | ||
| - Wallet management assistants that help users track portfolios and suggest optimizations | ||
| - Create DeFi strategy advisors that analyze yields and risks across protocols | ||
| - Create NFT collection managers that can mint, list, and track market activity | ||
| - Enable automated customer support for web3 products | ||
|
|
||
| ### Supported Chains | ||
| Nebula is supported on every EVM compatible chain. To view the full list, visit [thirdweb chainlist](https://thirdweb.com/chainlist). |
This file contains hidden or 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,15 @@ | ||
| import type { SideBar } from "@/components/Layouts/DocLayout"; | ||
|
|
||
| export const sidebar: SideBar = { | ||
| name: "Nebula", | ||
| links: [ | ||
| { | ||
| name: "Overview", | ||
| href: "/nebula", | ||
| }, | ||
| { | ||
| name: "API Reference", | ||
| href: "/nebula/api-reference", | ||
| }, | ||
| ], | ||
| }; |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.