create new albatross sdk client instance
initializes client with authentication credentials and optional custom configurations.
api authentication bearer token
tenant/instance identifier (same value used for both auth header types)
api base url (default: https://app.usealbatross.ai/api)
optional client configuration
api authentication bearer token
tenant/instance identifier (same value used for both auth header types)
api base url (default: https://app.usealbatross.ai/api)
PrivategetPrivategenerate http headers based on endpoint type
implements dual authentication strategy by sending different headers depending on which service is being called.
"robin" for prediction/content-selection, "catalog" for events/catalog
headers object with authentication and content-type
PrivatevalidatePrivatevalidate base64 image size
enforces 50mb size limit on images to prevent memory issues and ensure reasonable api request sizes. checks base64 string length (not decoded size).
base64-encoded image string (with or without data url prefix)
perform content selection (core method)
low-level content selection method that all convenience methods use internally. supports all search modes: text, image, vector, item similarity, user recommendations. use specific convenience methods (search, searchByImage, etc.) for common use cases.
content selection request configuration
promise resolving to search results with items, metadata, and optional debug info
perform text-based content search
searches content using semantic text matching. ideal for product search, document retrieval, or any text-based similarity search. supports filtering, pagination, and performance tuning.
search query text
use case identifier for search
Optionaloptions: { optional search configuration
Optionallimit?: numbermax results to return (1-1000, default: varies)
Optionalfilters?: ContentSelectionFilterfilter conditions to apply (use FilterBuilder to create)
Optionalhnsw_hnsw search parameter for speed/accuracy tradeoff (higher = more accurate but slower)
Optionalwith_include item metadata in results (default: false)
Optionalwith_include embedding vectors in results (default: false)
Optionaldebug?: booleanenable debug info in response (default: false)
promise resolving to search results with matching items and metadata
get personalized recommendations for user
retrieves content recommendations based on user behavior and action history. can use user_id/session_id context or action sequence.
use case identifier
recommendation parameters
Optionaluser_user identifier (optional, pairs with session_id)
Optionalsession_session identifier (optional, pairs with user_id)
Optionalaction_array of item ids representing user actions (optional)
Optionallimit?: numbermax results to return (1-1000, default: 100)
Optionalfilters?: ContentSelectionFilterfilter conditions to apply
Optionalwith_include item metadata in results (default: true)
Optionalwith_include embedding vectors in results (default: true)
Optionalhnsw_hnsw parameter (default: 256 when context provided, otherwise not set)
Optionaldebug?: booleanenable debug info in response (default: false)
promise resolving to personalized recommendations
find similar items by item id
retrieves items similar to a given item. ideal for "similar products", "you may also like", or "related items" features.
id of the reference item to find similarities for
use case identifier
Optionaloptions: { optional configuration
Optionallimit?: numbermax results to return (1-1000, default: 100)
Optionalwith_include item metadata in results (default: true)
Optionalwith_include embedding vectors in results (default: false)
Optionaldebug?: booleanenable debug info in response (default: false)
promise resolving to similar items
search by image (visual/multimodal search)
searches content using image similarity or combined image+text (multimodal). ideal for visual search, "find similar products by photo", or "search by image" features. supports combining image with text query for multimodal search.
base64-encoded image string (max 50mb)
use case identifier
Optionaloptions: { optional search configuration
Optionalquery?: stringoptional text query for multimodal search (image + text)
Optionallimit?: numbermax results to return (1-1000, default: 100)
Optionalfilters?: ContentSelectionFilterfilter conditions to apply
Optionalwith_include item metadata in results (default: true)
Optionaluse_use knn instead of hnsw for search (slower but potentially more accurate)
Optionaldebug?: booleanenable debug info in response (default: false)
promise resolving to visually similar items
search by embedding vector (direct vector similarity)
searches content using a provided embedding vector. useful when you have pre-computed embeddings or want direct control over the search vector. bypasses text/image encoding and searches directly in vector space.
embedding vector (array of numbers, typically 64-1536 dimensions)
use case identifier
Optionaloptions: { optional search configuration
Optionallimit?: numbermax results to return (1-1000, default: 100)
Optionalfilters?: ContentSelectionFilterfilter conditions to apply
Optionalwith_include item metadata in results (default: true)
Optionalwith_include embedding vectors in results (default: false)
Optionaldebug?: booleanenable debug info in response (default: false)
promise resolving to items with similar embeddings
add items to catalog
uploads items to the catalog for a specific entity type (e.g., products, articles). automatically flattens nested objects unless formatData is set to false.
catalog add configuration
promise resolving when catalog add completes
add items to catalog via csv format
uploads items to catalog using csv format instead of json. more efficient for large bulk uploads. converts data to csv automatically. does not use makeRequest retry logic (uses raw fetch).
catalog add configuration
promise resolving when catalog upload completes
send single event
tracks user interactions. supports all event types.
event data
Optionaloptions: { optional event configuration
Optionalnotrace?: booleanskip storing event in analytics (default: false)
promise resolving when event is recorded
send batch of events
efficiently tracks multiple events in a single api call. ideal for bulk event uploads, offline event syncing, or high-throughput event tracking. supports up to 500 events per batch.
array of events to send (max 500)
Optionaloptions: { optional batch configuration
Optionalnotrace?: booleanskip storing events in analytics (default: false)
promise resolving when all events are recorded
get content ranking prediction
requests ranked ordering of content items based on context and user preferences. used for personalized ranking, A/B testing, or contextual bandit scenarios. returns ordered ranking with scores and associated datapoint.
prediction request payload
promise resolving to prediction with ordering, datapoint, and prediction id
send feedback for prediction
submits outcome feedback for a previous prediction.
feedback payload
Optionalmodeloptional specific model uuid to send feedback to
id of the prediction to provide feedback for (from ranking() response)
feedback data (e.g., { reward: 1 }, { clicked: true }, { rating: 4.5 })
promise resolving when feedback is recorded
albatross sdk client for content selection, predictions, events, and catalog management
main entry point for interacting with albatross apis. provides methods for search, recommendations, predictions, event tracking, and catalog operations. handles authentication, retries, and validates all inputs automatically.