Official Python SDK for GetABrain.ai — real human judgment as an API
Project description
getabrain
Official Python SDK for GetABrain.ai — real human judgment as an API.
Install
pip install getabrain
Quickstart
from getabrain import GetABrain, InsufficientBalanceError
gab = GetABrain(api_key="gab_k_...", api_secret="gab_s_...")
# Submit a query (returns immediately)
query = gab.queries.create(
type="ab_test",
title="Which headline converts better?",
content_data={
"question": "Which is more compelling?",
"variant_a": {"description": "Save 20% today"},
"variant_b": {"description": "Your future self will thank you"},
},
required_responses=5,
bid_amount_cents=25,
)
# Wait for humans to answer (polls for you)
try:
responses = gab.queries.wait_for_responses(query["id"], min_responses=5, timeout_s=600)
for r in responses:
print(r["response_data"])
except InsufficientBalanceError:
print("Top up your balance at https://getabrain.ai")
API
gab.queries.create(type=..., title=..., content_data={...}, required_responses=..., bid_amount_cents=...)gab.queries.get(query_id)·gab.queries.list(status=..., limit=...)·gab.queries.cancel(query_id)gab.queries.wait_for_responses(query_id, min_responses=..., timeout_s=600, poll_interval_s=5)gab.responses.rate(query_id, response_id, score=5, feedback_text="...")·gab.responses.get_rating(query_id, response_id)gab.account.stats()·gab.account.balance()
Query types: text, multiple_choice, rating_scale, image_comparison, ranking, yes_no, sentiment, image_selection, free_form_text, video_review, audio_review, image_analysis, ab_test.
Errors
All errors subclass GetABrainError: ValidationError, AuthError, InsufficientBalanceError, ForbiddenError, NotFoundError, ConflictError, RateLimitError (.retry_after_ms), ServerError, TimeoutError, NetworkError.
Full API docs: https://getabrain.ai/docs/api
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file getabrain-0.1.1.tar.gz.
File metadata
- Download URL: getabrain-0.1.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d229071643c0d7588a1a49f81ea46a8d62dbdc5d1699958599b4e3ea546c2f83
|
|
| MD5 |
a81d74a199d45843b5f07c2228dce6da
|
|
| BLAKE2b-256 |
952296778fe807c36ec74e0d50a895c8c35db53fb712f8eb674d15d7f3c38e60
|
File details
Details for the file getabrain-0.1.1-py3-none-any.whl.
File metadata
- Download URL: getabrain-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
758cc37378eb47ca47fc9356ecece3fea56f1fe9ef606c4d5a0b0ba610cb80aa
|
|
| MD5 |
0a602f2f1172b0186b166e4312e12306
|
|
| BLAKE2b-256 |
52e1e27fc4427d14444275d7ae530492d88f9a6e9d6a59da9bb7557630c4764f
|