docs/design-docs/design_docs/20260227-yc-text-embedding-provider.md
yc)This proposal introduces a new text embedding provider yc for Milvus TextEmbedding function.
The provider integrates with Yandex Cloud AI Studio text embedding API and enables users to generate embeddings during insert/search pipelines in the same way as existing providers (openai, cohere, tei, etc.).
The feature includes:
internal/util/function/embedding.TextEmbeddingFunction.paramtable/milvus.yaml.Milvus currently supports multiple external embedding providers but does not provide a built-in Yandex Cloud provider. Users on Yandex Cloud currently need custom middleware or external embedding jobs, which creates:
Adding yc keeps user experience consistent across cloud providers and reduces integration friction.
No new function type is introduced. Existing FunctionType_TextEmbedding is reused with:
provider=ycmodel_name=<yandex modelUri>dim=<optional, must match output field dim>credential=<optional, preferred>New config group keys under:
function.textEmbedding.providers.yc.enablefunction.textEmbedding.providers.yc.credentialfunction.textEmbedding.providers.yc.urlNew environment variable:
MILVUS_YC_API_KEYThe provider follows existing textEmbeddingProvider interface:
MaxBatch() intFieldDim() int64CallEmbedding(ctx, texts, mode) (any, error)The yc provider is selected in NewTextEmbeddingFunction(...) switch by provider=yc.
Milvus provider parameters map to Yandex API fields:
model_name -> modelUriAuthorization headerProvider output type:
[][]float32 onlyValidation rules:
dim param is provided, it must match output field dimension (existing Milvus rule).Batch behavior follows existing providers:
maxBatchextraInfo.BatchFactorDefault values:
maxBatch = 128timeoutSec = 30These defaults align with existing provider implementations and can be tuned later by follow-up changes if needed.
Credential parsing uses existing utility models.ParseAKAndURL(...) with standard precedence:
credential)milvus.yaml provider configMILVUS_YC_API_KEY)This keeps behavior consistent with other providers and avoids introducing a provider-specific credential flow.
Provider reuses existing HTTP utility models.PostRequest(...) for:
Provider-level errors are normalized to existing embedding provider style:
Yandex documentation may evolve request/response schema over time. To reduce tight coupling risk, the provider supports response adaptation for both:
If API contract changes in future, the adaptation layer can be extended without changing function runtime interfaces.
Initial version relies on existing error surfaces from function execution path. Follow-up (optional) improvements:
yc_embedding_provider_test.go)text_embedding_function_test.go)provider=yc function creation and insert path.yc.enable=false).Run existing embedding package test suites with required Milvus flags:
go test -tags dynamic,test -gcflags="all=-N -l" -count=1 ./internal/util/function/embedding/...
go test -tags dynamic,test -gcflags="all=-N -l" -count=1 ./pkg/util/paramtable/...
Rejected because it duplicates runtime logic and creates inconsistent UX.
Rejected because provider extension is sufficient and aligns with existing architecture.
Rejected because existing models.PostRequest already provides retries, timeout, and standardized behavior.
This section is a draft outline for the user-facing documentation page (similar in structure to existing provider pages such as OpenAI).
Yandex CloudTextEmbedding provider ycmodelUri compatible with Yandex text embedding API.function:
textEmbedding:
providers:
yc:
credential: yandex_cred
enable: true
url: https://llm.api.cloud.yandex.net/foundationModels/v1/textEmbedding
credential:
yandex_cred:
apikey: <YOUR_YC_API_KEY>
provider (required): must be ycmodel_name (required): mapped to Yandex modelUridim (optional): must match output field dimension if specifiedcredential (recommended): credential name from Milvus credential configTextEmbedding function with provider=yc.function.textEmbedding.providers.yc.enable is false.internal/util/function/embeddingpkg/util/paramtable/function_param.go