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
19
20
import algoliasearch.api.RecommendClient
import algoliasearch.config.*

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

val response = Await.result(
  client.getRecommendations(
    getRecommendationsParams = GetRecommendationsParams(
      requests = Seq(
        RelatedQuery(
          indexName = "ALGOLIA_INDEX_NAME",
          objectID = "objectID",
          model = RelatedModel.withName("related-products"),
          threshold = 42.1
        )
      )
    )
  ),
  Duration(100, "sec")
)
Did you find this page helpful?
Scala API clients v2