Why can't I connect remote Milvus server in Python SDK? #36226
Replies: 9 comments 87 replies
-
Hello, this is an urgent issue. Can you please help me with this? Thank you |
Beta Was this translation helpful? Give feedback.
-
This is not a problem of milvus/pymilvus. Search the keyword "Received http2 header with status: 401" to get more info. |
Beta Was this translation helpful? Give feedback.
-
@yhmo Is it possible that langchain can also provide a version of MilvusCollectionHybridSearchRetriever that can return the scores as the non-hybrid version does as below?
Although I can create multiple partitions in one collection in Milvus in hybrid search, that also requires to create a single keyword index for the whole document set. If I have documents from different sources it is logical to create one collection for each data source, and this will reduce the bm25 index building's scalability requirement. Does this make sense, or any recommendation on this concern? |
Beta Was this translation helpful? Give feedback.
-
@xiaofan-luan and @yhmo For MilvusCollectionHybridSearchRetriever,
If I change top_k from 5 to 20 without changing anything else, the orders of ranked results are not exactly the same. No matter I use 5 or 20, the top 5 results should be exactly the same, right? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi, @yhmo
Do I need to use a lock for the insert() function when adding entities into milvus in an async context? Or internally it already takes care of concurrency issue so I don' t need to worry about it? |
Beta Was this translation helpful? Give feedback.
-
I have a query "What is CRM-S-SOM?", which generates an empt sparse vector, and because of that, it triggered an internal exception, like this one: #35463 Is there a better way to handle this in Milvus 2.5.0? For example, if sparse vector is empty, can the hybrid_search just use dense_vector to search, instead of throw an exception with a warning message?
|
Beta Was this translation helpful? Give feedback.
-
Hi, @yhmo I need to benchmark our existing RAG and Milvus hybrid rag prototype latency. Do you have benchmark scripts that I can refer to? Milvus 2.4.11 is deployed in a cluster |
Beta Was this translation helpful? Give feedback.
-
Very helpful. Looks like the parameter isn't passed correctly, and even the
use_default_consistency=True doesn't use Bounded. I will use Bounded to
create a new collection by defining Bounded in the schema, not depending on
it in query time, and test to see.
…On Thu, Dec 19, 2024, 12:38 AM groot ***@***.***> wrote:
Pretty easy to test:
import random
import time
from pymilvus import (
connections,
FieldSchema, CollectionSchema, DataType,
Collection,
utility,
)
connections.connect(host='localhost', port=19530)
print(utility.get_server_version())
collection_name = "AAA"
dim = 512
fields = [
FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=False),
FieldSchema(name="vector", dtype=DataType.FLOAT_VECTOR, dim=dim),
]
schema = CollectionSchema(fields)
utility.drop_collection(collection_name)
collection = Collection(collection_name, schema)
print(collection_name, "created")
desc = collection.describe()
# 0 is Strong, 1 is Session, 2 is Bounded, 3 is Eventually
assert desc["consistency_level"] == 2
batch = 10000
for i in range(100):
data = [
[i*batch+k for k in range(batch)],
[[random.random() for _ in range(dim)] for _ in range(batch)],
]
collection.insert(data=data)
print("inserted", i)
collection.flush()
print("indexing...")
collection.create_index(field_name="vector", index_params={
"index_type": "IVF_FLAT",
"metric_type": "L2",
"params": {"nlist": 256},
})
collection.load()
collection = Collection(collection_name)
print("row count:", collection.query(expr="", output_fields=["count(*)"]))
def search_test(level:str):
print("====================================================================")
print("test search with consistency level:", level)
repeat = 10
start = time.time()
for i in range(repeat):
t1 = time.time()
results = collection.search(data=[[random.random() for _ in range(dim)]],
limit=10,
param={'nprobe': 16},
anns_field="vector",
consistency_level=level)
t2 = time.time()
print(f"search time cost: {(t2-t1)*1000} ms")
# for res in results[0]:
# print(res)
end = time.time()
cost = (end-start)*1000
print(f"total time cost: {cost} ms")
print(f"average time cost per request: {cost/repeat} ms")
print("====================================================================")
search_test("Strong")
search_test("Bounded")
search_test("Eventually")
row count: data: ["{'count(*)': 1000000}"]
====================================================================
test search with consistency level: Strong
search time cost: 444.4272518157959 ms
search time cost: 199.91588592529297 ms
search time cost: 192.0621395111084 ms
search time cost: 419.44003105163574 ms
search time cost: 188.24410438537598 ms
search time cost: 393.41282844543457 ms
search time cost: 406.45408630371094 ms
search time cost: 200.07729530334473 ms
search time cost: 192.39377975463867 ms
search time cost: 407.3817729949951 ms
total time cost: 3044.2254543304443 ms
average time cost per request: 304.42254543304443 ms
====================================================================
====================================================================
test search with consistency level: Bounded
search time cost: 14.234542846679688 ms
search time cost: 16.038894653320312 ms
search time cost: 11.225700378417969 ms
search time cost: 7.4920654296875 ms
search time cost: 6.23774528503418 ms
search time cost: 5.858898162841797 ms
search time cost: 6.477832794189453 ms
search time cost: 5.587339401245117 ms
search time cost: 6.140708923339844 ms
search time cost: 6.526947021484375 ms
total time cost: 86.1048698425293 ms
average time cost per request: 8.61048698425293 ms
====================================================================
====================================================================
test search with consistency level: Eventually
search time cost: 5.95402717590332 ms
search time cost: 5.578517913818359 ms
search time cost: 6.160497665405273 ms
search time cost: 5.881071090698242 ms
search time cost: 12.094497680664062 ms
search time cost: 6.348848342895508 ms
search time cost: 5.700111389160156 ms
search time cost: 6.645679473876953 ms
search time cost: 6.487369537353516 ms
search time cost: 5.950450897216797 ms
total time cost: 66.95914268493652 ms
average time cost per request: 6.695914268493652 ms
====================================================================
—
Reply to this email directly, view it on GitHub
<#36226 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB4J634S4HI4PAWW4QMWYDL2GKAZJAVCNFSM6AAAAABOEKBZKCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNRRGQ2TKMQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
A remote Milvus distributed instance is deployed. And I can access it through "curl":
But then in my Python client, it reports this error:
The error message is:
In both cases, the credentials are the same: "xxx:xxx". My version:
pymilvus==2.4.6
Why is that?
Beta Was this translation helpful? Give feedback.
All reactions