Retrieve recommendations

Retrieves recommendations from selected AI models.

Usage

Required ACL: search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from algoliasearch.recommend.client import RecommendClientSync

# In an asynchronous context, you can use RecommendClient instead, which exposes the exact same methods.
client = RecommendClientSync("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY")

response = client.get_recommendations(
    get_recommendations_params={
        "requests": [
            {
                "indexName": "ALGOLIA_INDEX_NAME",
                "objectID": "objectID",
                "model": "related-products",
                "threshold": 42.1,
            },
        ],
    },
)
Did you find this page helpful?
Python API clients v4