patterns-ai-core / weaviate-ruby

Ruby wrapper for the Weaviate vector search database API
https://rubydoc.info/gems/weaviate-ruby
MIT License
47 stars 16 forks source link

Use `PATCH` not `PUT` for updating objects #36

Open asgeo1 opened 11 months ago

asgeo1 commented 11 months ago

Hello!

I want to use skip property in Weaviate, so some properties on my schema are not part of the generated vector.

I then want to be able to update a skip'd property, and it should not regenerate the vector, because that was the only property I updated, and it is not part of the vector.

It doesn't work currently. This is because weaviate-ruby is sending PUT rather than PATCH. I.e. it's replacing the entire object, which results in it regenerating the vector anyway, even if I'm only wanting to update a single, skipped property.

Suggest you have separate update and replace methods, which trigger PATCH and PUT respectively.

I forked the repo, and made this change myself, and it seems to work OK for me.

andreibondarev commented 11 months ago

@asgeo1 Would you be open to issuing a PR for this change please?

obie commented 10 months ago

Any progress on this? Just ran into the same issue. @andreibondarev maybe you can pull the changes from Adam's fork?

andreibondarev commented 10 months ago

@obie I didn't see @asgeo1's fork. Is there one?

obie commented 10 months ago

Sorry I didn’t actually check, just going off what he said On Nov 18, 2023 at 11:29 AM -0600, Andrei Bondarev @.***>, wrote:

@obie I didn't see @asgeo1's fork. Is there one? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

asgeo1 commented 10 months ago

Hello, sorry I hadn't gotten back to looking at this issue. My fork is here: https://github.com/bluefrogsoftware/weaviate-ruby, I sent a PR if you want to look at my changes. If it doesn't pass CI, I'll take a look at the specs tomorrow.

The change I made is a breaking change though, since is changes how the existing update method works. Not sure if you're OK with that?

I think there was also some issue with replacing existing properties on a class, but I haven't resolved that one yet.