Documentation Index
Fetch the complete documentation index at: https://docs.shannon.run/llms.txt
Use this file to discover all available pages before exploring further.
インストール
ソースから(開発):
git clone https://github.com/Kocoro-lab/Shannon.git
cd Shannon/clients/python
pip install -e .
オプション(WebSocketストリーミングサポート):
クイック検証
from shannon import ShannonClient
client = ShannonClient(base_url="http://localhost:8080")
print("✓ SDK ready")
from shannon import ShannonClient
client = ShannonClient(
base_url="http://localhost:8080",
api_key="sk_test_123"
)
環境変数を使用:
import os
from shannon import ShannonClient
client = ShannonClient(
base_url=os.getenv("SHANNON_BASE_URL", "http://localhost:8080"),
api_key=os.getenv("SHANNON_API_KEY"),
)
クライアントオプション
| パラメータ | 型 | デフォルト | 備考 |
|---|
base_url | str | http://localhost:8080 | ゲートウェイHTTP URL |
api_key | str | None | X-API-Keyとして送信 |
bearer_token | str | None | 代替のAuthorization: Bearer |
default_timeout | float | 30.0 | 秒 |
非同期クライアント
import asyncio
from shannon import AsyncShannonClient
async def main():
async with AsyncShannonClient(base_url="http://localhost:8080") as client:
h = await client.submit_task("Analyze data")
s = await client.wait(h.task_id)
print(s.result)
asyncio.run(main())
CLI
python -m shannon.cli --base-url http://localhost:8080 submit "What is 2+2?" --wait