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

langchain4j+milvus实战

nanshan 2025-03-07 22:22 7 浏览 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

相关推荐

小白初学linux之无法修改系统分辨率

/*此文是做为自己的一个总结还有就是最好也可以给大家提供一些帮助。*/时间:2020年7月14日11:28:41我安装的是Ubuntu20.04LTS,昨天处理的是,grub的引导问题,因为是...

Ubuntu 如何启动、停止或重启服务

在本文中,我们向您介绍在Ubuntu中启动、停止和重启服务的方法。列出Ubuntu中的所有服务在开始之前,先获取计算机上所有服务的列表,因为我们需要知道服务名称来管理服务。service--...

Win11学院:如何在Windows 11上使用WSL安装Ubuntu

IT之家2月18日消息,科技媒体pureinfotech昨日(2月17日)发布博文,介绍了3中简便的方法,让你轻松在Windows11系统中,使用WindowsSubs...

Linux安装中文输入法-Google拼音输入法,搜狗输入法

主要步骤,选择适合自己的尝试:1)卸载之前没装好的搜狗输入法。@:~/Downloads$sudoapt-getremovefcitx*删除依赖库@:~/Downloads$sudoap...

Ubuntu 22.04 请谨慎使用搜狗输入法,可能是你当机原因

在Ubunutu下没有什么有名的输入法,也就听说搜狗输入法有Linux版本,所以特意到官网去找了下载。在Ubuntu新版本里,他仍然用的是fcitx框架的输入引擎,而不是默认的ibus,所以要先把i...

前钢后胶!徐工XMR403VT小型压路机有点意思

【第一工程机械网原创】在越来越注重施工品质,对项目管理越来越精细化的今天,施工方在施工设备选择上,也越来越讲究设备的配套分工,因此小型压路机的应用场景也越来越多。徐工XMR403VT小型压路机高度集...

图大明白 | 404错误为什么是Not Found?为什么是404?

“404错误”大家都不陌生吧?常规来讲它长这样或者长这样艺术一点的长这样404NotFound意思就是所请求的页面不存在或者已被删除被称为“互联网最后一个界面”有很多同学发出疑问:为什么是404?...

Nginx负载均衡安全配置说明2(nginx负载均衡部署)

上一节,我们对Nginx安全配置的几个知识点做了一个说明,例如限制IP访问、文件目录禁止访问限制、需要防止DOS攻击、请求方法的限制和限制文件上传的大小这个进行了一个分析说明,详细的文章请关注我的头条...

惊艳写真系列第403期,本期主人公—叶青

惊艳写真系列第403期,本期主人公—叶青制作不易,欢迎各位看官提供宝贵意见。如果您喜欢记得关注,么么哒。您的每一份点赞和关注都是对作者的最大认可(图片素材均来源于网络,如有侵权联系删除。)本篇是写惊艳...

先秦布币之尖足布、圆足布、方足布,今年圆足最高拍卖价16万一枚

在战国魏、韩地区诞生桥足平首布、锐角平首布之后,赵也诞生了尖足平首布,并且在尖足布的基础上,后来相继派生出了圆足布、三孔布,以及类圆足布和类方足布。一尖足布尖足布是从耸肩尖足空首布演变而来的,是黄河...

403 禁止访问错误的全面排查与解决方案

当遇到403Forbidden错误时,意味着服务器已接收并理解请求,但拒绝执行访问操作。以下从用户端、服务器端等多个维度,提供分步排查与解决方法。一、用户端基础排查1.检查URL准确性确认...

这才是2019年夏最高颜值的泳装(2019夏季泳装秀)

最近的天气是越来越热了,又到了暑期泳衣勇闯海滩的时刻了,打开ins,微博满满地都是各大博主晒的泳装照,明星们也纷纷跑到海边去度假了。虽然我们没有超模般地身材,但是到了海边我们也要成为人群中最亮眼的那颗...

朋友圈爆火!这组《衡中班主任的一天》漫画,感动了无数人!

很多人觉得做老师很轻松他们说有些老师一天一节课就下班了有双休,还有寒暑假,真让人羡慕呀······但事实真是这样吗?最近衡水中学的赵心扬同学画了一组漫画形象地还原了衡中班主任一天的生活那么衡中班主任一...

国家安全教育 | 一组漫画,带你走进国家安全!

当前,我国面临哪些安全威胁?下面带你来看一组漫画!①你要配合,注意保密。我绝不对别人讲。②这件事,千万别对别人讲。③咱单位的…喂!老k!你要当心,有风声了!④你的泄密行为已触犯了国家法律!①请你协助了...

400、403、404、405,访问网页时出现这些代码是什么意思?

今天小泽访问一个页面时,出现了403,很抱歉,您的访问请求被禁止的提示。相信经常用电脑访问网页的朋友都遇到过这种情况,有的网页提示错误代码403,有的提示404,那这些代码都代表了什么呢?有什么含义呢...

取消回复欢迎 发表评论: