Installation
Usage
secret_key
keyword argument,
we recommend using python-dotenv
to add RACCOON_SECRET_KEY="My Secret Key"
to your .env
file
so that your Secret Key is not stored in source control.
Async usage
Simply importAsyncRaccoonAI
instead of RaccoonAI
and use await
with each API call:
Streaming responses
Retries
Certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors are all retried by default. You can use themax_retries
option to configure or disable retry settings:
Timeouts
By default, requests time out after 1 minute. You can configure this with atimeout
option,
which accepts a float or an httpx.Timeout
object:
APITimeoutError
is thrown.
Note that requests that time out are retried twice by default.
Advanced
Managing HTTP resources
By default the library closes underlying HTTP connections whenever the client is garbage collected. You can manually close the client using the.close()
method if desired, or with a context manager that closes when exiting.