Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: parse slice of floating-point to vector #366

Open
kevin19930919 opened this issue Aug 3, 2023 · 1 comment
Open

Request: parse slice of floating-point to vector #366

kevin19930919 opened this issue Aug 3, 2023 · 1 comment

Comments

@kevin19930919
Copy link

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?

@kevin19930919
Copy link
Author

Would love to contribute to this if needed~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant