Ash AI vector_cosine_distance

When attempting to use vector_cosine_distance as shown here https://github.com/ash-project/ash_ai?tab=readme-ov-file#using-the-vectors, the compiler can't find the function. I also can't find anything with that name in the ash_ai repo. How does this work?
GitHub
GitHub - ash-project/ash_ai: Structured outputs, vectorization and ...
Structured outputs, vectorization and tool calling for your Ash application - ash-project/ash_ai
10 Replies
ZachDaniel
ZachDaniel3mo ago
Can you make sure that the vector extension is in your repo?
def installed_extensions() do
["pg_trgm", "uuid-ossp", "vector", YourCustomExtension]
end
def installed_extensions() do
["pg_trgm", "uuid-ossp", "vector", YourCustomExtension]
end
bhelms
bhelmsOP3mo ago
Oh thank you! That was it. Where is that code defined?
ZachDaniel
ZachDaniel3mo ago
What code?
bhelms
bhelmsOP3mo ago
vector_cosine_distance
ZachDaniel
ZachDaniel3mo ago
its in ash_postgres
bhelms
bhelmsOP3mo ago
Ah! I did not look there. I appreciate it.
ZachDaniel
ZachDaniel3mo ago
likely what we could do is change it from conditionally adding those functions to instead raising when we try to use them that way we can say "you need to go do X"
bhelms
bhelmsOP3mo ago
Yeah that would be a nice DX.
ZachDaniel
ZachDaniel3mo ago
Could you open a proposal for that on ash_postgres?

Did you find this page helpful?