Method: Langchain::Vectorsearch::Milvus#similarity_search_by_vector

Defined in:
lib/langchain/vectorsearch/milvus.rb

#similarity_search_by_vector(embedding:, k: 4) ⇒ Object



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/langchain/vectorsearch/milvus.rb', line 127

def similarity_search_by_vector(embedding:, k: 4)
  load_default_schema

  client.entities.search(
    collection_name: index_name,
    anns_field: "vector",
    data: [embedding],
    limit: k,
    output_fields: ["content", "id", "vector"]
  )
end