Skip to Content

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

VariableUsed byDescription
DOCKLEE_API_KEYDock, LynkYour API key. Required. See API keys.
DOCKLEE_MEMORY_SPACE_IDDock, LynkThe memory space to write to and recall from.
DOCKLEE_ENGINE_IDLynkThe engine to query and retrieve from.
DOCKLEE_END_USERDock, LynkA default end user. See End users.
DOCKLEE_CONTAINERDockvector or okf. See Containers.
DOCKLEE_DIMENSIONDockThe vector dimension, as a positive whole number.
DOCKLEE_URLDock, LynkThe 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:

  1. The option passed to one method call, such as end_user on recall.
  2. The option passed to the constructor.
  3. The environment variable.
  4. The default.

Dock options

PythonTypeScriptDefaultDescription
api_keyapiKeyDOCKLEE_API_KEYYour API key.
memory_space_idmemorySpaceIdDOCKLEE_MEMORY_SPACE_IDThe memory space to write to.
containercontainerDOCKLEE_CONTAINERvector or okf.
dimensiondimensionDOCKLEE_DIMENSIONThe vector dimension.
end_userendUserDOCKLEE_END_USERThe default end user.
base_urlbaseUrlDOCKLEE_URLThe API address.
buffer_sizebufferSize10Events that trigger a send.
flush_intervalflushInterval5000 ms in TypeScriptHow often TypeScript sends the buffer.
max_retriesmaxRetries3Retries per request.
timeouttimeout30 secondsHow long to wait for a response.

Lynk options

PythonTypeScriptDefaultDescription
api_keyapiKeyDOCKLEE_API_KEYYour API key.
engine_idengineIdDOCKLEE_ENGINE_IDThe engine to read from.
memory_space_idmemorySpaceIdDOCKLEE_MEMORY_SPACE_IDThe memory space to recall from.
end_userendUserDOCKLEE_END_USERThe default end user.
base_urlbaseUrlDOCKLEE_URLThe API address.
max_retriesmaxRetries3Retries per request.
timeouttimeout30 secondsHow 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.

On this page