Reference
Configuration
Set the SDK up with environment variables or constructor options, and control timeouts, retries, and the API address.
The SDK is built to run with no settings in code. Set a few environment variables, and every Dock and Lynk you create picks them up. Pass a constructor option when one instance needs something different.
Environment variables
| Variable | Used by | Description |
|---|---|---|
DOCKLEE_API_KEY | Dock, Lynk | Your API key. Required. See API keys. |
DOCKLEE_MEMORY_SPACE_ID | Dock, Lynk | The memory space to write to and recall from. |
DOCKLEE_ENGINE_ID | Lynk | The engine to query and retrieve from. |
DOCKLEE_END_USER | Dock, Lynk | A default end user. See End users. |
DOCKLEE_CONTAINER | Dock | vector or okf. See Containers. |
DOCKLEE_DIMENSION | Dock | The vector dimension, as a positive whole number. |
DOCKLEE_URL | Dock, Lynk | The API address. Leave it unset to use https://api.docklee.com. |
export DOCKLEE_API_KEY="your-api-key"
export DOCKLEE_MEMORY_SPACE_ID="your-memory-space-id"
export DOCKLEE_ENGINE_ID="your-engine-id"DOCKLEE_BASE_URL is also read as the API address, after DOCKLEE_URL.
A DOCKLEE_DIMENSION that isn't a positive whole number raises an error as soon as Dock is created, so a typo never sends writes to the wrong dimension.
Which value wins
For every setting, the SDK uses the first of these that's set:
- The option passed to one method call, such as
end_useronrecall. - The option passed to the constructor.
- The environment variable.
- The default.
Dock options
| Python | TypeScript | Default | Description |
|---|---|---|---|
api_key | apiKey | DOCKLEE_API_KEY | Your API key. |
memory_space_id | memorySpaceId | DOCKLEE_MEMORY_SPACE_ID | The memory space to write to. |
container | container | DOCKLEE_CONTAINER | vector or okf. |
dimension | dimension | DOCKLEE_DIMENSION | The vector dimension. |
end_user | endUser | DOCKLEE_END_USER | The default end user. |
base_url | baseUrl | DOCKLEE_URL | The API address. |
buffer_size | bufferSize | 10 | Events that trigger a send. |
flush_interval | flushInterval | 5000 ms in TypeScript | How often TypeScript sends the buffer. |
max_retries | maxRetries | 3 | Retries per request. |
timeout | timeout | 30 seconds | How long to wait for a response. |
Lynk options
| Python | TypeScript | Default | Description |
|---|---|---|---|
api_key | apiKey | DOCKLEE_API_KEY | Your API key. |
engine_id | engineId | DOCKLEE_ENGINE_ID | The engine to read from. |
memory_space_id | memorySpaceId | DOCKLEE_MEMORY_SPACE_ID | The memory space to recall from. |
end_user | endUser | DOCKLEE_END_USER | The default end user. |
base_url | baseUrl | DOCKLEE_URL | The API address. |
max_retries | maxRetries | 3 | Retries per request. |
timeout | timeout | 30 seconds | How long to wait for a response. |
timeout is in seconds in Python and in milliseconds in TypeScript. Pass timeout=60 in Python or timeout: 60000 in TypeScript for a 60-second timeout.
Pass options in code
import os
from docklee import Dock, Lynk
dock = Dock(
api_key=os.environ["SUPPORT_BOT_DOCKLEE_KEY"],
memory_space_id="your-memory-space-id",
buffer_size=25,
timeout=60,
)
lynk = Lynk(engine_id="your-engine-id", max_retries=5)Every request carries a User-Agent of docklee-python/2.0.0 or docklee-js/2.0.0.
Next steps
Your SDK is configured. See every method for your language next.