Freigeben über


MilvusBuilderExtensions.AddMilvus Method

Definition

Adds a Milvus container resource to the application model.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Milvus.MilvusServerResource> AddMilvus (this Aspire.Hosting.IDistributedApplicationBuilder builder, string name, Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource>? apiKey = default, int? grpcPort = default);
static member AddMilvus : Aspire.Hosting.IDistributedApplicationBuilder * string * Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.ParameterResource> * Nullable<int> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Milvus.MilvusServerResource>
<Extension()>
Public Function AddMilvus (builder As IDistributedApplicationBuilder, name As String, Optional apiKey As IResourceBuilder(Of ParameterResource) = Nothing, Optional grpcPort As Nullable(Of Integer) = Nothing) As IResourceBuilder(Of MilvusServerResource)

Parameters

name
String

The name of the resource. This name will be used as the connection string name when referenced in a dependency

apiKey
IResourceBuilder<ParameterResource>

The parameter used to provide the auth key/token user for the Milvus resource.

grpcPort
Nullable<Int32>

The host port of gRPC endpoint of Milvus database.

Returns

A reference to the IResourceBuilder<T>.

Examples

Use in application host

var builder = DistributedApplication.CreateBuilder(args);

var milvus = builder.AddMilvus("milvus");
var api = builder.AddProject<Projects.Api>("api")
  .WithReference(milvus);

builder.Build().Run();

Remarks

The .NET client library uses the gRPC port by default to communicate and this resource exposes that endpoint. A web-based administration tool for Milvus can also be added using WithAttu<T>(IResourceBuilder<T>, Action<IResourceBuilder<AttuResource>>, String). This version of the package defaults to the tag of the container image.

Applies to