# Nebula Python SDK
A Python client for interacting with the Nebula API, providing a seamless interface for chat-based interactions with thirdweb's Nebula service.
## Installation
```bash
pip install nebula-python
```
## Quick Start
```python
from nebula import Nebula
# Initialize the client
client = Nebula(
base_url="https://nebula-api.thirdweb.com",
secret_key="your-secret-key"
)
# Basic chat request
response = client.chat("Hello, Nebula!")
print(response.message)
# Streaming chat request
for chunk in client.chat("Hello, Nebula!", stream=True):
print(chunk, end="")
```
## Features
- Synchronous and streaming chat responses
- Session management
- Configurable execution environments
- Context filtering capabilities
- Custom model selection
- Type-safe request/response handling with Pydantic
## Advanced Usage
### Context Filtering
Filter the context of your chat based on specific blockchain parameters:
```python
from nebula import ContextFilter
context = ContextFilter(
chain_ids=["1", "137"],
contract_addresses=["0x..."],
wallet_addresses=["0x..."]
)
response = client.chat(
"Tell me about my contracts",
context_filter=context
)
```
### Execution Configuration
Configure how your requests are executed:
```python
from nebula import ExecuteConfig
config = ExecuteConfig(
mode="client",
signer_wallet_address="0x...",
engine_url="https://your-engine.com"
)
response = client.chat(
"Execute this transaction",
execute_config=config
)
```
### Session Management
Maintain conversation context across multiple messages:
```python
response = client.chat(
"Remember this conversation",
session_id="unique-session-id"
)
```
## Error Handling
The SDK provides custom exceptions for proper error handling:
```python
from nebula import NebulaAPIError
try:
response = client.chat("Hello")
except NebulaAPIError as e:
print(f"API Error: {e}")
```
## Configuration
The client can be configured with:
- `base_url`: The base URL for the Nebula API (defaults to "https://nebula-api.thirdweb.com")
- `secret_key`: Your thirdweb API secret key for authentication
## Development
### Requirements
- Python 3.12+
- `requests`
- `pydantic`
### Running Tests
```bash
pytest tests/
```
## License
[License Type] - See LICENSE file for details
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Raw data
{
"_id": null,
"home_page": "https://github.com/gwszeto/nebula-python",
"name": "thirdweb-nebula",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "nebula, thirdweb, api, sdk, blockchain",
"author": "Stanley",
"author_email": "gw.stanley.szeto@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/02/88/071c2aeb41637709c5679b33779770f9a2bdc09eb44f3b2c5c45deb9ae4b/thirdweb_nebula-0.1.0.tar.gz",
"platform": null,
"description": "# Nebula Python SDK\n\nA Python client for interacting with the Nebula API, providing a seamless interface for chat-based interactions with thirdweb's Nebula service.\n\n## Installation\n\n```bash\npip install nebula-python\n```\n\n## Quick Start\n\n```python\nfrom nebula import Nebula\n\n# Initialize the client\nclient = Nebula(\n base_url=\"https://nebula-api.thirdweb.com\",\n secret_key=\"your-secret-key\"\n)\n\n# Basic chat request\nresponse = client.chat(\"Hello, Nebula!\")\nprint(response.message)\n\n# Streaming chat request\nfor chunk in client.chat(\"Hello, Nebula!\", stream=True):\n print(chunk, end=\"\")\n```\n\n## Features\n\n- Synchronous and streaming chat responses\n- Session management\n- Configurable execution environments\n- Context filtering capabilities\n- Custom model selection\n- Type-safe request/response handling with Pydantic\n\n## Advanced Usage\n\n### Context Filtering\n\nFilter the context of your chat based on specific blockchain parameters:\n\n```python\nfrom nebula import ContextFilter\n\ncontext = ContextFilter(\n chain_ids=[\"1\", \"137\"],\n contract_addresses=[\"0x...\"],\n wallet_addresses=[\"0x...\"]\n)\n\nresponse = client.chat(\n \"Tell me about my contracts\",\n context_filter=context\n)\n```\n\n### Execution Configuration\n\nConfigure how your requests are executed:\n\n```python\nfrom nebula import ExecuteConfig\n\nconfig = ExecuteConfig(\n mode=\"client\",\n signer_wallet_address=\"0x...\",\n engine_url=\"https://your-engine.com\"\n)\n\nresponse = client.chat(\n \"Execute this transaction\",\n execute_config=config\n)\n```\n\n### Session Management\n\nMaintain conversation context across multiple messages:\n\n```python\nresponse = client.chat(\n \"Remember this conversation\",\n session_id=\"unique-session-id\"\n)\n```\n\n## Error Handling\n\nThe SDK provides custom exceptions for proper error handling:\n\n```python\nfrom nebula import NebulaAPIError\n\ntry:\n response = client.chat(\"Hello\")\nexcept NebulaAPIError as e:\n print(f\"API Error: {e}\")\n```\n\n## Configuration\n\nThe client can be configured with:\n\n- `base_url`: The base URL for the Nebula API (defaults to \"https://nebula-api.thirdweb.com\")\n- `secret_key`: Your thirdweb API secret key for authentication\n\n## Development\n\n### Requirements\n\n- Python 3.12+\n- `requests`\n- `pydantic`\n\n### Running Tests\n\n```bash\npytest tests/\n```\n\n## License\n\n[License Type] - See LICENSE file for details\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python SDK for interacting with the Nebula API",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/gwszeto/nebula-python#readme",
"Homepage": "https://github.com/gwszeto/nebula-python",
"Repository": "https://github.com/gwszeto/nebula-python"
},
"split_keywords": [
"nebula",
" thirdweb",
" api",
" sdk",
" blockchain"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f68ff55e6310347679fc230bd32979ff3359e94ba8aa4ab9df06b0d334e1ad23",
"md5": "4ebd4a61ee00ed71c1b72639d605a874",
"sha256": "a7647ebb0c919d9e5c2db87f3378cdf9c31afbedea0dd7d5ea49ad28b0a68403"
},
"downloads": -1,
"filename": "thirdweb_nebula-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4ebd4a61ee00ed71c1b72639d605a874",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 5214,
"upload_time": "2025-01-04T05:55:34",
"upload_time_iso_8601": "2025-01-04T05:55:34.569539Z",
"url": "https://files.pythonhosted.org/packages/f6/8f/f55e6310347679fc230bd32979ff3359e94ba8aa4ab9df06b0d334e1ad23/thirdweb_nebula-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0288071c2aeb41637709c5679b33779770f9a2bdc09eb44f3b2c5c45deb9ae4b",
"md5": "ed9a17fcb8f77c5c16e4bc8f9cb962bb",
"sha256": "f95696e97dee8ab484125521c1d40012dec6c9d2f3ab1c0c81345ec6a602b3b0"
},
"downloads": -1,
"filename": "thirdweb_nebula-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ed9a17fcb8f77c5c16e4bc8f9cb962bb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.12",
"size": 4957,
"upload_time": "2025-01-04T05:55:36",
"upload_time_iso_8601": "2025-01-04T05:55:36.961543Z",
"url": "https://files.pythonhosted.org/packages/02/88/071c2aeb41637709c5679b33779770f9a2bdc09eb44f3b2c5c45deb9ae4b/thirdweb_nebula-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-04 05:55:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gwszeto",
"github_project": "nebula-python",
"github_not_found": true,
"lcname": "thirdweb-nebula"
}