百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 技术文章 > 正文

langchain4j+milvus实战

nanshan 2025-03-07 22:22 10 浏览 0 评论

本文主要研究一下如何使用langchain4j来对接向量数据库milvus

步骤

docker运行milvus

docker run -d \
        --name milvus-standalone \
        --security-opt seccomp:unconfined \
        -e ETCD_USE_EMBED=true \
        -e ETCD_DATA_DIR=/var/lib/milvus/etcd \
        -e ETCD_CONFIG_PATH=/milvus/configs/embedEtcd.yaml \
        -e COMMON_STORAGETYPE=local \
        -v $(pwd)/volumes/milvus:/var/lib/milvus \
        -v $(pwd)/embedEtcd.yaml:/milvus/configs/embedEtcd.yaml \
        -v $(pwd)/user.yaml:/milvus/configs/user.yaml \
        -p 19530:19530 \
        -p 9091:9091 \
        -p 2379:2379 \
        --health-cmd="curl -f http://localhost:9091/healthz" \
        --health-interval=30s \
        --health-start-period=90s \
        --health-timeout=20s \
        --health-retries=3 \
        docker.1ms.run/milvusdb/milvus:v2.5.5 \
        milvus run standalone  1> /dev/null

启动之后访问
http://127.0.0.1:9091/webui

这里需要提前创建embedEtcd.yaml

listen-client-urls: http://0.0.0.0:2379
advertise-client-urls: http://0.0.0.0:2379
quota-backend-bytes: 4294967296
auto-compaction-mode: revision
auto-compaction-retention: '1000'

user.yaml内容为空即可

pom.xml


    dev.langchain4j
    langchain4j-milvus
    1.0.0-beta1

example

public class JlamaMilvusExample {

    public static void main(String[] args) throws InterruptedException {
        EmbeddingModel embeddingModel = JlamaEmbeddingModel.builder()
                .modelName("intfloat/e5-small-v2")
                .build();

        MilvusServiceClient customMilvusClient = new MilvusServiceClient(
                ConnectParam.newBuilder()
                        .withHost("localhost")
                        .withPort(19530)
                        .build()
        );
        MilvusEmbeddingStore embeddingStore = MilvusEmbeddingStore.builder()
                .milvusClient(customMilvusClient)
                .collectionName("example_collection")      // Name of the collection
                .dimension(384)                            // Dimension of vectors
                .indexType(IndexType.FLAT)                 // Index type
                .metricType(MetricType.COSINE)             // Metric type
                .consistencyLevel(ConsistencyLevelEnum.EVENTUALLY)  // Consistency level
                .autoFlushOnInsert(true)                   // Auto flush after insert
                .idFieldName("id")                         // ID field name
                .textFieldName("text")                     // Text field name
                .metadataFieldName("metadata")             // Metadata field name
                .vectorFieldName("vector")                 // Vector field name
                .build();                                  // Build the MilvusEmbeddingStore instance

        TextSegment segment1 = TextSegment.from("I like football.");
        Embedding embedding1 = embeddingModel.embed(segment1).content();
        embeddingStore.add(embedding1, segment1);

        TimeUnit.SECONDS.sleep(60);

        TextSegment segment2 = TextSegment.from("The weather is good today.");
        Embedding embedding2 = embeddingModel.embed(segment2).content();
        embeddingStore.add(embedding2, segment2);

        TimeUnit.SECONDS.sleep(60);

        String userQuery = "What is your favourite sport?";
        Embedding queryEmbedding = embeddingModel.embed(userQuery).content();
        int maxResults = 1;
        List<EmbeddingMatch> relevant = embeddingStore.findRelevant(queryEmbedding, maxResults);
        EmbeddingMatch embeddingMatch = relevant.get(0);

        System.out.println("Question: " + userQuery); // What is your favourite sport?
        System.out.println("Response: " + embeddingMatch.embedded().text()); // I like football.
    }
}

最后输出

WARNING: Using incubator modules: jdk.incubator.vector
INFO  c.g.tjake.jlama.model.AbstractModel - Model type = F32, Working memory type = F32, Quantized memory type = F32
WARN  c.g.t.j.t.o.TensorOperationsProvider - Native operations not available. Consider adding 'com.github.tjake:jlama-native' to the classpath
INFO  c.g.t.j.t.o.TensorOperationsProvider - Using Panama Vector Operations (OffHeap)
Question: What is your favourite sport?
Response: I like football.

quotaAndLimits

quotaAndLimits:
  enabled: true # `true` to enable quota and limits, `false` to disable.
  # quotaCenterCollectInterval is the time interval that quotaCenter
  # collects metrics from Proxies, Query cluster and Data cluster.
  # seconds, (0 ~ 65536)
  quotaCenterCollectInterval: 3
  limits:
    allocRetryTimes: 15 # retry times when delete alloc forward data from rate limit failed
    allocWaitInterval: 1000 # retry wait duration when delete alloc forward data rate failed, in millisecond
    complexDeleteLimitEnable: false # whether complex delete check forward data by limiter
    maxCollectionNum: 65536
    maxCollectionNumPerDB: 65536 # Maximum number of collections per database.
    maxInsertSize: -1 # maximum size of a single insert request, in bytes, -1 means no limit
    maxResourceGroupNumOfQueryNode: 1024 # maximum number of resource groups of query nodes
    maxGroupSize: 10 # maximum size for one single group when doing search group by
  ddl:
    enabled: false # Whether DDL request throttling is enabled.
    # Maximum number of collection-related DDL requests per second.
    # Setting this item to 10 indicates that Milvus processes no more than 10 collection-related DDL requests per second, including collection creation requests, collection drop requests, collection load requests, and collection release requests.
    # To use this setting, set quotaAndLimits.ddl.enabled to true at the same time.
    collectionRate: -1
    # Maximum number of partition-related DDL requests per second.
    # Setting this item to 10 indicates that Milvus processes no more than 10 partition-related requests per second, including partition creation requests, partition drop requests, partition load requests, and partition release requests.
    # To use this setting, set quotaAndLimits.ddl.enabled to true at the same time.
    partitionRate: -1
    db:
      collectionRate: -1 # qps of db level , default no limit, rate for CreateCollection, DropCollection, LoadCollection, ReleaseCollection
      partitionRate: -1 # qps of db level, default no limit, rate for CreatePartition, DropPartition, LoadPartition, ReleasePartition
  indexRate:
    enabled: false # Whether index-related request throttling is enabled.
    # Maximum number of index-related requests per second.
    # Setting this item to 10 indicates that Milvus processes no more than 10 partition-related requests per second, including index creation requests and index drop requests.
    # To use this setting, set quotaAndLimits.indexRate.enabled to true at the same time.
    max: -1
    db:
      max: -1 # qps of db level, default no limit, rate for CreateIndex, DropIndex
  flushRate:
    enabled: true # Whether flush request throttling is enabled.
    # Maximum number of flush requests per second.
    # Setting this item to 10 indicates that Milvus processes no more than 10 flush requests per second.
    # To use this setting, set quotaAndLimits.flushRate.enabled to true at the same time.
    max: -1
    collection:
      max: 10 # qps, default no limit, rate for flush at collection level.
    db:
      max: -1 # qps of db level, default no limit, rate for flush
  compactionRate:
    enabled: false # Whether manual compaction request throttling is enabled.
    # Maximum number of manual-compaction requests per second.
    # Setting this item to 10 indicates that Milvus processes no more than 10 manual-compaction requests per second.
    # To use this setting, set quotaAndLimits.compaction.enabled to true at the same time.
    max: -1
    db:
      max: -1 # qps of db level, default no limit, rate for manualCompaction
  dml:
    enabled: false # Whether DML request throttling is enabled.
    insertRate:
      # Highest data insertion rate per second.
      # Setting this item to 5 indicates that Milvus only allows data insertion at the rate of 5 MB/s.
      # To use this setting, set quotaAndLimits.dml.enabled to true at the same time.
      max: -1
      db:
        max: -1 # MB/s, default no limit
      collection:
        # Highest data insertion rate per collection per second.
        # Setting this item to 5 indicates that Milvus only allows data insertion to any collection at the rate of 5 MB/s.
        # To use this setting, set quotaAndLimits.dml.enabled to true at the same time.
        max: -1
      partition:
        max: -1 # MB/s, default no limit
    upsertRate:
      max: -1 # MB/s, default no limit
      db:
        max: -1 # MB/s, default no limit
      collection:
        max: -1 # MB/s, default no limit
      partition:
        max: -1 # MB/s, default no limit
    deleteRate:
      # Highest data deletion rate per second.
      # Setting this item to 0.1 indicates that Milvus only allows data deletion at the rate of 0.1 MB/s.
      # To use this setting, set quotaAndLimits.dml.enabled to true at the same time.
      max: -1
      db:
        max: -1 # MB/s, default no limit
      collection:
        # Highest data deletion rate per second.
        # Setting this item to 0.1 indicates that Milvus only allows data deletion from any collection at the rate of 0.1 MB/s.
        # To use this setting, set quotaAndLimits.dml.enabled to true at the same time.
        max: -1
      partition:
        max: -1 # MB/s, default no limit
    bulkLoadRate:
      max: -1 # MB/s, default no limit, not support yet. TODO: limit bulkLoad rate
      db:
        max: -1 # MB/s, default no limit, not support yet. TODO: limit db bulkLoad rate
      collection:
        max: -1 # MB/s, default no limit, not support yet. TODO: limit collection bulkLoad rate
      partition:
        max: -1 # MB/s, default no limit, not support yet. TODO: limit partition bulkLoad rate
  dql:
    enabled: false # Whether DQL request throttling is enabled.
    searchRate:
      # Maximum number of vectors to search per second.
      # Setting this item to 100 indicates that Milvus only allows searching 100 vectors per second no matter whether these 100 vectors are all in one search or scattered across multiple searches.
      # To use this setting, set quotaAndLimits.dql.enabled to true at the same time.
      max: -1
      db:
        max: -1 # vps (vectors per second), default no limit
      collection:
        # Maximum number of vectors to search per collection per second.
        # Setting this item to 100 indicates that Milvus only allows searching 100 vectors per second per collection no matter whether these 100 vectors are all in one search or scattered across multiple searches.
        # To use this setting, set quotaAndLimits.dql.enabled to true at the same time.
        max: -1
      partition:
        max: -1 # vps (vectors per second), default no limit
    queryRate:
      # Maximum number of queries per second.
      # Setting this item to 100 indicates that Milvus only allows 100 queries per second.
      # To use this setting, set quotaAndLimits.dql.enabled to true at the same time.
      max: -1
      db:
        max: -1 # qps, default no limit
      collection:
        # Maximum number of queries per collection per second.
        # Setting this item to 100 indicates that Milvus only allows 100 queries per collection per second.
        # To use this setting, set quotaAndLimits.dql.enabled to true at the same time.
        max: -1
      partition:
        max: -1 # qps, default no limit
  limitWriting:
    # forceDeny false means dml requests are allowed (except for some
    # specific conditions, such as memory of nodes to water marker), true means always reject all dml requests.
    forceDeny: false
    ttProtection:
      enabled: false
      # maxTimeTickDelay indicates the backpressure for DML Operations.
      # DML rates would be reduced according to the ratio of time tick delay to maxTimeTickDelay,
      # if time tick delay is greater than maxTimeTickDelay, all DML requests would be rejected.
      # seconds
      maxTimeTickDelay: 300
    memProtection:
      # When memory usage > memoryHighWaterLevel, all dml requests would be rejected;
      # When memoryLowWaterLevel < memory usage < memoryHighWaterLevel, reduce the dml rate;
      # When memory usage < memoryLowWaterLevel, no action.
      enabled: true
      dataNodeMemoryLowWaterLevel: 0.85 # (0, 1], memoryLowWaterLevel in DataNodes
      dataNodeMemoryHighWaterLevel: 0.95 # (0, 1], memoryHighWaterLevel in DataNodes
      queryNodeMemoryLowWaterLevel: 0.85 # (0, 1], memoryLowWaterLevel in QueryNodes
      queryNodeMemoryHighWaterLevel: 0.95 # (0, 1], memoryHighWaterLevel in QueryNodes
    growingSegmentsSizeProtection:
      # No action will be taken if the growing segments size is less than the low watermark.
      # When the growing segments size exceeds the low watermark, the dml rate will be reduced,
      # but the rate will not be lower than minRateRatio * dmlRate.
      enabled: false
      minRateRatio: 0.5
      lowWaterLevel: 0.2
      highWaterLevel: 0.4
    diskProtection:
      enabled: true # When the total file size of object storage is greater than `diskQuota`, all dml requests would be rejected;
      diskQuota: -1 # MB, (0, +inf), default no limit
      diskQuotaPerDB: -1 # MB, (0, +inf), default no limit
      diskQuotaPerCollection: -1 # MB, (0, +inf), default no limit
      diskQuotaPerPartition: -1 # MB, (0, +inf), default no limit
    l0SegmentsRowCountProtection:
      enabled: false # switch to enable l0 segment row count quota
      lowWaterLevel: 30000000 # l0 segment row count quota, low water level
      highWaterLevel: 50000000 # l0 segment row count quota, high water level
    deleteBufferRowCountProtection:
      enabled: false # switch to enable delete buffer row count quota
      lowWaterLevel: 32768 # delete buffer row count quota, low water level
      highWaterLevel: 65536 # delete buffer row count quota, high water level
    deleteBufferSizeProtection:
      enabled: false # switch to enable delete buffer size quota
      lowWaterLevel: 134217728 # delete buffer size quota, low water level
      highWaterLevel: 268435456 # delete buffer size quota, high water level
  limitReading:
    # forceDeny false means dql requests are allowed (except for some
    # specific conditions, such as collection has been dropped), true means always reject all dql requests.
    forceDeny: false

注意milvus有频率控制,控制不好会报错

ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
WARN  i.m.client.AbstractMilvusGrpcClient - Retry(4) with interval 270ms. Reason: io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
WARN  i.m.client.AbstractMilvusGrpcClient - Retry(5) with interval 810ms. Reason: io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
WARN  i.m.client.AbstractMilvusGrpcClient - Retry(6) with interval 2430ms. Reason: io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed, error code: 8, reason: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
ERROR i.m.client.AbstractMilvusGrpcClient - FlushRequest failed! Exception:{}
io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]
	at io.milvus.client.AbstractMilvusGrpcClient.handleResponse(AbstractMilvusGrpcClient.java:399)
	at io.milvus.client.AbstractMilvusGrpcClient.flush(AbstractMilvusGrpcClient.java:921)
	at io.milvus.client.MilvusServiceClient.lambda$flush$17(MilvusServiceClient.java:520)
	at io.milvus.client.MilvusServiceClient.retry(MilvusServiceClient.java:310)
	at io.milvus.client.MilvusServiceClient.flush(MilvusServiceClient.java:520)
	at dev.langchain4j.store.embedding.milvus.CollectionOperationsExecutor.flush(CollectionOperationsExecutor.java:32)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addAll(MilvusEmbeddingStore.java:246)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.addInternal(MilvusEmbeddingStore.java:226)
	at dev.langchain4j.store.embedding.milvus.MilvusEmbeddingStore.add(MilvusEmbeddingStore.java:184)
	at JlamaMilvusExample.main(JlamaMilvusExample.java:63)
WARN  i.m.client.AbstractMilvusGrpcClient - Retry(7) with interval 3000ms. Reason: io.milvus.exception.ServerException: request is rejected by grpc RateLimiter middleware, please retry later: rate limit exceeded[rate=0.1]

需要配置
/milvus/configs/milvus.yaml,将
quotaAndLimits.flushRate.collection.max调高一点,默认是0.1

小结

langchain4j提供了langchain4j-milvus用于集成对milvus的访问。

doc

  • standalone_embed

相关推荐

使用nginx配置域名及禁止直接通过IP访问网站

前段时间刚搭建好这个网站,一直没有关注一个问题,那就是IP地址也可以访问我的网站,今天就专门研究了一下nginx配置问题,争取把这个问题研究透彻。1.nginx配置域名及禁止直接通过IP访问先来看n...

如何在 Linux 中使用 PID 号查找进程名称?

在Linux的复杂世界中,进程是系统运行的核心,每个进程都由一个唯一的「进程ID」(PID)标识。无论是系统管理员在排查失控进程,还是开发者在调试应用程序,知道如何将PID映射到对应的进程名称都是一项...

Linux服务器硬件信息查询与日常运维命令总结

1.服务器硬件信息查询1.1CPU信息查询命令功能描述示例lscpu显示CPU架构、核心数、线程数等lscpucat/proc/cpuinfo详细CPU信息(型号、缓存、频率)cat/proc/c...

Ubuntu 操作系统常用命令详解(ubuntu常用的50个命令)

UbuntuLinux是一款流行的开源操作系统,广泛应用于服务器、开发、学习等场景。命令行是Ubuntu的灵魂,也是高效、稳定管理系统的利器。本文按照各大常用领域,详细总结Ubuntu必学...

从 0 到 1:打造基于 Linux 的私有 API 网关平台

在当今微服务架构盛行的时代,API网关作为服务入口和安全屏障,其重要性日益凸显。你是否想过,不依赖商业方案,完全基于开源组件,在Linux上构建一个属于自己的私有API网关平台?今天就带你...

Nginx搭建简单直播服务器(nginx 直播服务器搭建)

前言使用Nginx+Nginx-rtmp-module在Ubuntu中搭建简单的rtmp推流直播服务器。服务器环境Ubuntu16.04相关概念RTMP:RTMP协议是RealTi...

Linux连不上网?远程卡?这篇网络管理指南你不能错过!

大家好!今天咱们聊个所有Linux用户都躲不开的“老大难”——网络管理。我猜你肯定遇到过这些崩溃时刻:新装的Linux系统连不上Wi-Fi,急得直拍桌子;远程服务器SSH连不上,提示“Connecti...

7天从0到上线!手把手教你用Python Flask打造爆款Web服务

一、为什么全网开发者都在疯学Flask?在当今Web开发的战场,Flask就像一把“瑞士军刀”——轻量级架构让新手3天速成,灵活扩展能力又能支撑百万级用户项目!对比Django的“重型装甲”,Flas...

nginx配置文件详解(nginx反向代理配置详解)

Nginx是一个强大的免费开源的HTTP服务器和反向代理服务器。在Web开发项目中,nginx常用作为静态文件服务器处理静态文件,并负责将动态请求转发至应用服务器(如Django,Flask,et...

30 分钟搞定 Docker 安装与 Nginx 部署,轻松搭建高效 Web 服务

在云计算时代,利用容器技术快速部署应用已成为开发者必备技能。本文将手把手教你在阿里云轻量应用服务器上,通过Docker高效部署Nginx并发布静态网站,全程可视化操作,新手也能轻松上手!一、准...

Nginx 配置实战:从摸鱼到部署,手把手教你搞定生产级配置

各位摸鱼搭子们!今天咱不聊代码里的NullPointerException,改聊点「摸鱼必备生存技能」——Nginx配置!先灵魂拷问一下:写了一堆接口却不会部署?服务器被恶意请求打崩过?静态资源加载...

如何使用 Daphne + Nginx + supervisor部署 Django

前言:从Django3.0开始支持ASGI应用程序运行,使Django完全具有异步功能。Django目前已经更新到5.0,对异步支持也越来越好。但是,异步功能将仅对在ASGI下运行的应用程序可用...

Docker命令最全详解(39个最常用命令)

Docker是云原生的核心,也是大厂的必备技能,下面我就全面来详解Docker核心命令@mikechen本文作者:陈睿|mikechen文章来源:mikechen.cc一、Docker基本命令doc...

ubuntu中如何查看是否已经安装了nginx

在Ubuntu系统中,可以通过以下几种方法检查是否已安装Nginx:方法1:使用dpkg命令(适用于Debian/Ubuntu)bashdpkg-l|grepnginx输出...

OVN 概念与实践(德育概念的泛化在理论和实践中有什么弊端?)

今天我们来讲解OVN的概念和基础实践,要理解本篇博客的内容,需要前置学习:Linux网络设备-Bridge&VethPairLinux网络设备-Bridge详解OVS+Fa...

取消回复欢迎 发表评论: