milvus-io--milvus
498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
31 行
914 B
Go
31 行
914 B
Go
package helper
|
|
|
|
import (
|
|
"github.com/milvus-io/milvus/client/v2/entity"
|
|
)
|
|
|
|
// TNewBM25Function creates a new BM25 function with the given input and output fields
|
|
func TNewBM25Function(inputField, outputField string) *entity.Function {
|
|
return entity.NewFunction().
|
|
WithName(inputField + "_bm25_emb").
|
|
WithInputFields(inputField).
|
|
WithOutputFields(outputField).
|
|
WithType(entity.FunctionTypeBM25)
|
|
}
|
|
|
|
// TNewTextEmbeddingFunction creates a text embedding function for different providers
|
|
func TNewTextEmbeddingFunction(inputField, outputField string, params map[string]any) *entity.Function {
|
|
function := entity.NewFunction().
|
|
WithName(inputField + "_text_emb").
|
|
WithInputFields(inputField).
|
|
WithOutputFields(outputField).
|
|
WithType(entity.FunctionTypeTextEmbedding)
|
|
|
|
// Add all parameters including provider
|
|
for key, value := range params {
|
|
function.WithParam(key, value)
|
|
}
|
|
|
|
return function
|
|
}
|