-
-
Notifications
You must be signed in to change notification settings - Fork 239
Add sqlite-vec support #906
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
base: main
Are you sure you want to change the base?
Conversation
@@ -15,7 +15,12 @@ class VersionError < ScriptError; end | |||
# @raise [VersionError] If the gem is installed, but the version does not meet the requirements | |||
# | |||
def depends_on(gem_name, req: true) | |||
gem(gem_name) # require the gem | |||
if gem_name == "sqlite_vec" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CarlQLange Why is this if/else statement needed? Isn't the gem version what gets required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woof, I have no memory of this. I think it was something to do with using the gem locally from something else. Sorry, I pretty much have no idea what I was doing back then!
# @return [Array<Integer>] The ids of the added texts | ||
def add_texts(texts:, ids: nil) | ||
if ids.nil? || ids.empty? | ||
max_rowid = @db.execute("SELECT MAX(rowid) FROM #{table_name}").first.first || 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't the rowid
auto increment?
This PR adds some support for sqlite-vec.
Unfortunately I am brand new to Ruby so there was plenty of help from professor ChatGPT, so I would strongly recommend a close inspection to make sure I got things right. Having said that, the example script appears to work on my machine. I hope if nothing else that this may be a useful starting point to add SQLite support to this library.