2024-03-04 15:07:56 +08:00
|
|
|
from ctypes import Union
|
2024-03-06 13:50:26 +08:00
|
|
|
from typing import List
|
2024-03-04 15:07:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
class MockMilvusClass(object):
|
|
|
|
|
|
|
|
@staticmethod
|
2024-03-06 13:50:26 +08:00
|
|
|
def insert() -> List[Union[str, int]]:
|
|
|
|
result = [447829498067199697]
|
|
|
|
return result
|
2024-03-04 15:07:56 +08:00
|
|
|
|
|
|
|
@staticmethod
|
2024-03-06 13:50:26 +08:00
|
|
|
def delete() -> List[Union[str, int]]:
|
|
|
|
result = [447829498067199697]
|
|
|
|
return result
|
2024-03-04 15:07:56 +08:00
|
|
|
|
|
|
|
@staticmethod
|
2024-03-06 13:50:26 +08:00
|
|
|
def search() -> List[dict]:
|
|
|
|
result = [
|
|
|
|
{
|
|
|
|
'id': 447829498067199697,
|
|
|
|
'distance': 0.8776655793190002,
|
|
|
|
'entity': {
|
|
|
|
'page_content': 'Dify is a company that provides a platform for the development of AI models.',
|
|
|
|
'metadata':
|
|
|
|
{
|
|
|
|
'doc_id': '327d1cb8-15ce-4934-bede-936a13c19ace',
|
|
|
|
'doc_hash': '7ee3cf010e606bb768c3bca7b1397ff651fd008ef10e56a646c537d2c8afb319',
|
|
|
|
'document_id': '6c4619dd-2169-4879-b05a-b8937c98c80c',
|
|
|
|
'dataset_id': 'a2f4f4eb-75eb-4432-8c5f-788100533454'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2024-03-04 15:07:56 +08:00
|
|
|
return result
|
|
|
|
|
|
|
|
@staticmethod
|
2024-03-06 13:50:26 +08:00
|
|
|
def query() -> List[dict]:
|
|
|
|
result = [
|
|
|
|
{
|
|
|
|
'id': 447829498067199697,
|
|
|
|
'distance': 0.8776655793190002,
|
|
|
|
'entity': {
|
|
|
|
'page_content': 'Dify is a company that provides a platform for the development of AI models.',
|
|
|
|
'metadata':
|
|
|
|
{
|
|
|
|
'doc_id': '327d1cb8-15ce-4934-bede-936a13c19ace',
|
|
|
|
'doc_hash': '7ee3cf010e606bb768c3bca7b1397ff651fd008ef10e56a646c537d2c8afb319',
|
|
|
|
'document_id': '6c4619dd-2169-4879-b05a-b8937c98c80c',
|
|
|
|
'dataset_id': 'a2f4f4eb-75eb-4432-8c5f-788100533454'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2024-03-04 15:07:56 +08:00
|
|
|
return result
|
|
|
|
|
|
|
|
@staticmethod
|
2024-03-06 13:50:26 +08:00
|
|
|
def create_collection_with_schema():
|
|
|
|
pass
|
2024-03-04 15:07:56 +08:00
|
|
|
|
|
|
|
@staticmethod
|
2024-03-06 13:50:26 +08:00
|
|
|
def has_collection() -> bool:
|
|
|
|
return True
|
2024-03-04 15:07:56 +08:00
|
|
|
|