Reference
Configuration
The client's arguments and environment variables: download key, cache folder, API root, timeouts, retries, your own httpx client and logging.
Settings and where they come from
| Setting | Argument | Environment |
|---|---|---|
| Download key | Intura(api_key=...) | INTURA_API_KEY |
| Cache folder | load(..., cache_dir=...) | INTURA_CACHE_DIR, then XDG_CACHE_HOME |
| API root | Intura(base_url=...) | INTURA_BASE_URL (default https://ai.intura.co/api) |
An argument wins over the environment. With no cache folder set, models go in ~/.cache/intura.
The client's arguments
Intura(
api_key=None, # your download key; falls back to INTURA_API_KEY
*,
base_url=None, # falls back to INTURA_BASE_URL, then https://ai.intura.co/api
timeout=None, # seconds to wait for one API response; 30 by default
max_retries=2, # retries for connection errors, timeouts, 429 and 5xx
default_headers=None, # sent on every API request
http_client=None, # your own httpx.Client
)AsyncIntura takes the same arguments, with an httpx.AsyncClient for http_client.
api_keyis needed only by the calls that reach the API, so loading a cached model works without one. See Download keys.timeoutapplies to each API call. Left unset with anhttp_clientof your own, that client's timeout is used rather than overwritten.max_retriescounts retries for a call the service never answered, rate limited or failed on. A request rejected for its content is never retried. See Errors.default_headersare for a proxy or a trace header, not for auth.
Bring your own httpx client
For a proxy or a custom transport, bring your own httpx client. The package sets the URL and headers on each request, and never closes a client it did not open:
import httpx
from intura_ai import Intura
client = Intura(http_client=httpx.Client(proxy="http://proxy:3128"))Closing the client
A client opens a connection pool for its API calls. Use it as a context manager, or call close() (await aclose() on AsyncIntura) when you are done:
with Intura() as client:
model = client.models.load("chat-commerce-intent-id")
model.predict("ongkirnya berapa?") # the model doesn't need the clientLogging
The package logs through the standard logging module, under the intura_ai logger, and is silent until your application attaches a handler. For a script or a notebook, set_verbose() prints its lines to stderr, including a line when a model starts downloading:
import intura_ai
intura_ai.set_verbose() # INFO and above
intura_ai.set_verbose(False) # back to warnings onlyThe installed version
import intura_ai
intura_ai.__version__or intura-ai --version in a shell.