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
18
import com.algolia.client.api.RecommendClient
import com.algolia.client.configuration.*
import com.algolia.client.transport.*

val client = RecommendClient(appId = "ALGOLIA_APPLICATION_ID", apiKey = "ALGOLIA_API_KEY")

var response = client.getRecommendations(
  getRecommendationsParams = GetRecommendationsParams(
    requests = listOf(
      RelatedQuery(
        indexName = "ALGOLIA_INDEX_NAME",
        objectID = "objectID",
        model = RelatedModel.entries.first { it.value == "related-products" },
        threshold = 42.1,
      ),
    ),
  ),
)
Did you find this page helpful?
Kotlin API clients v3