Skip to content

Commit

Permalink
Added remove_texts method on qvrant vectorsearch (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregogalante authored Mar 5, 2024
1 parent c43cfa6 commit 19813e5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/langchain/vectorsearch/qdrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ def update_texts(texts:, ids:)
add_texts(texts: texts, ids: ids)
end

# Remove a list of texts from the index
# @param ids [Array<Integer>] The ids to remove
# @return [Hash] The response from the server
def remove_texts(ids:)
client.points.delete(
collection_name: index_name,
points: ids
)
end

# Get the default schema
# @return [Hash] The response from the server
def get_default_schema
Expand Down
10 changes: 10 additions & 0 deletions spec/langchain/vectorsearch/qdrant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@
end
end

describe "remove_texts" do
before do
allow(subject.client).to receive_message_chain(:points, :delete).and_return(true)
end

it "removes texts" do
expect(subject.remove_texts(ids: [1])).to eq(true)
end
end

describe "#similarity_search_by_vector" do
before do
allow(subject.client).to receive_message_chain(:points, :search).and_return(
Expand Down

0 comments on commit 19813e5

Please sign in to comment.