View Source TxtaiEx.Similarity (txtai_ex v0.1.1)

txtai similarity instance for interfacing with a remote txtai service via REST API calls, providing functionality for computing similarities between texts.

Summary

Functions

Computes the similarity between a list of queries and a list of texts in batch.

Computes the similarity between a query and a list of texts.

Functions

Link to this function

batchsimilarity(api, queries, texts)

View Source

Computes the similarity between a list of queries and a list of texts in batch.

Parameters

  • api: The API struct containing configuration for URL and token.
  • queries: A list of query texts.
  • texts: A list of texts to compare against each query for similarity.

Returns

  • on success, with results for each query.
  • on failure.
Link to this function

similarity(api, query, texts)

View Source

Computes the similarity between a query and a list of texts.

Parameters

  • api: The API struct containing configuration for URL and token.
  • query: The query text.
  • texts: A list of texts to compare against the query for similarity.

Returns

  • on success, where similarity_scores is a list of {id, score} tuples sorted by highest score.
  • on failure.