I am using squirrel to build my sql command with postgres,.
Since I starting to use pgvector extension, I need to generate sql command with vector like:
SELECT * FROM embedding WHERE catrgory_id = 1 ORDER BY embedding <=> '[-0.014099856, 0.015509841,-0.024045289]' LIMIT 2;
since there need to have comma between floating points, i need to do things like:
// embedding type : []float64
strSlice := make([]string, len(embedding))
for i, v := range embedding {
strSlice[i] = fmt.Sprintf("%v", v)
}
// ....... some code
Suffix(fmt.Sprintf("<=> '[%s]' LIMIT 2", strings.Join(strSlice, ", "))).
ToSql()
can we have a syntax like CosineDistence(embedding) to handle this kind of case?
I am using squirrel to build my sql command with postgres,. Since I starting to use pgvector extension, I need to generate sql command with vector like:
since there need to have comma between floating points, i need to do things like:
can we have a syntax like
CosineDistence(embedding)
to handle this kind of case?