跳到主要内容

construct_from_dict()

此操作从字典表示中构造一个 Function 对象。

请求语法​

python
construct_from_dict(
raw: dict
)

参数:

  • raw (dict)

    包含用于构造 Collection Schema 的原始数据的字典。

返回类型:

Function

返回:

一个 Function 对象。

异常:

  • MilvusException

    当此操作期间发生任何错误时,将引发此异常。

示例​

python
from pymilvus import Function

function_dict = {
"name": "bm25",
"type": "BM25",
"input_field_names": ["text"],
"output_field_names": ["score"],
"description": "BM25 text search function",
}

function = Function.construct_from_dict(function_dict)

print(function)
最低 SDK 版本v2.5.x