How can I return vector_cosine_distance from search results?
I'm currently testing AshAi's embeddings support, and implemented a search based on the docs. I struggle to return the result of
vector_cosine_distance(full_text_vector, ^search_vector)
for debugging purposes. I tried to use a calculation, but I won't have access to search_vector
. In Ecto I'd use a virtual field and use select_merge
. What is the correct approach in Ash here?
Solution:Jump to solution
You can use calculations with arguments, and load that calculation in this preparation
3 Replies
Solution
You can use calculations with arguments, and load that calculation in this preparation
load(vector_cosine_distance: %{search: search})
Thanks!
For reference: