Commit Graph

103 Commits

Author SHA1 Message Date
Tim Visée
74e51f7339 Claude: simplify codebase (#8627)
* [ai] Replace manual into mappings with Into::into

* Reformat

* [ai] Use implicit .iter

* Don't iterate over keys too

* [ai] Replace unwrap_or

* Reformat

* [ai] Use as_deref and then_some

* [ai] Use more to_string

* [ai] Use explicitly typed into conversions

* Reformat

* [ai] More explicit into conversions

* Reformat
2026-04-09 10:02:45 +02:00
xzfc
628195fafe Remove shard dependency on api (#8284)
* Move `DenseVector`/`MultiDenseVector` from `api` to `segment`

* Move `OrderByInterface` from `api` to `segment`

Reason: it's used in `edge` which shouldn't depend on `api`.

* Make `shard` -> `api` dependency optional

* Remove `api` from the amalgamation

* Don't install protoc in edge Actions
2026-03-05 04:38:02 +00:00
generall
730439a62a new formatter rules 2026-02-28 23:21:07 +01:00
Andrey Vasnetsov
6e79f8bf02 Untagged Enum for FeedbackStrategy (#8171)
* [manual] make untagged enum for consistent API for FeedbackStrategy

* add #[validate(nested)]

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
2026-02-18 16:55:47 +01:00
Luis Cossío
a43780941b [relevance feedback] add rest and grpc interfaces (#7399)
* add rest and grpc interfaces

Also handle inference for this query

* follow refactor from base branch

* renaming from Ms Cooper

* get started on validation testing

* more validations

* test equivalence with query when less than 2 feedback elements

* rename feedback query to relevance_feedback query

* fix extraction of context pairs

* rename feedback vector to example

* make coderabbit happier

* upd test

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2026-02-11 16:05:11 +01:00
Andrey Vasnetsov
4437edb775 Weighted rrf (#8063)
* weighted rrf implementation

* test

* fmt

* fix edge

* validate number of sources and number of weights

* do not partial match

* upd schema

* review fixes

* update formula

* remove calcualtions from tests

* update comment, because AI have OCD

* fmt
2026-02-06 19:36:27 +01:00
Andrey Vasnetsov
81e7ab72fe introduce update_mode parameter for upsert operation to control if we want to insert, update, or upsert (#7963)
* introduce update_mode parameter for upsert operation to control if we want to insert, update, or upsert

* add test

* upd dockstring

* require resharding once all peers have updated version

* use service error

* fix clippy again

* wait for same version before resharding in tests
2026-01-27 00:39:25 +01:00
Andrey Vasnetsov
921b1ce83d Prevent unoptimized updates (#7643)
* wip: wait for optimization before applying update

* implement api parameter

* nits

* fix deadloack when no optimizers are running

* release handle mutex

* Derive PartialEq

* Remove unused function

* fix missing kb conversion in threshold

* Update lib/api/src/grpc/proto/collections.proto

Co-authored-by: Tim Visée <tim+github@visee.me>

* sync comment change

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2026-01-14 16:37:03 +01:00
AMIR
4f13b994e3 Add list shard keys API (#7615) 2025-11-28 21:50:09 -03:00
Kumar Shivendu
bd744f5f61 Introduce fallback shard key for read and write requests (#7356)
* Allow passing fallback shard key on request level

* clippy & fmt

* Check target shard key replica states for routing

* fmt

* clippy

* Add shard fallback in gRPC

* updates

* clippy fix

* Check for empty replicas

* review: validate grpc shard key selector with fallback

* write routing logic (doesnt work yet)

* Don't hold shard holder guard for too long

---------

Co-authored-by: generall <andrey@vasnetsov.com>
Co-authored-by: timvisee <tim@visee.me>
2025-10-28 19:02:53 +01:00
Andrey Vasnetsov
b037910c2f Implement logging of slow requests for scroll, facet, count, and retrieve (#7291)
* reorder arguments of scroll_by

* add slow request log for scroll request

* add slow request log for facet request

* add slow request log for count request

* add slow request log for retrieve request

* Remove obsolete clone

* generic implementation of Loggable for Arc

* Refactor scroll by arguments (#7296)

* separate internal scroll operation from the one used by user

* fmt

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-10-27 11:19:25 +01:00
eltu
aa0f49798e Full-Text Index ASCII Folding (Normalization) (#7408)
* Add ASCII folding to tokenization process

Introduced an optional ASCII folding feature within the `TokensProcessor` to normalize non-ASCII characters to their ASCII equivalents. Updated tests and documentation to reflect the changes.

* Refactor tokenization code for improved readability and maintainability

Reorganized and reformatted the tokenization module, including `TokensProcessor` initialization and ASCII folding mappings for better clarity. Updated tests to align with the changes.

* Update test cases to reflect optional tokenizer settings changes

Adjusted `ascii_folding`, `lowercase`, and `phrase_matching` settings in tests to `None` where applicable, aligning with updates in tokenizer configuration defaults.

* address review remarks

* fix codespell

* thx coderabbit

* Don't copy tokens that are already ASCII

* Shrink folded string to fit

---------

Co-authored-by: Luis Cossío <luis.cossio@outlook.com>
Co-authored-by: timvisee <tim@visee.me>
2025-10-16 13:53:01 +02:00
Andrey Vasnetsov
e86d60e6b0 slow requests log (#7188)
* wip: generalization trait for queries

* implement generalization for point operations

* fmt

* log priority queue

* wip: SlowRequestsListener

* fmt

* fix clippy

* simplify generalization

* fmt

* implement collection of requests profiles for update API

* implement API for viewing slow requests log

* add collection name to update worker

* add datetime to log

* fmt

* probabilistic counter of unique requests

* rename

* compute hash before converting into json value

* move logable out of generalizable

* fmt

* log query request

* fmt

* some fixes

* move measurement into local shard

* fmt

* upd openapi (not important)

* For enum variants, has discriminant

* Make SearchParams Copy

* Hash 0.0 and -0.0 the same

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Correctly hash enum variants and float values

* Hash through ordered float instead

* Fix priority queue not keeping longest request for hash

* SearchParams implements Copy

* Fix clippy warning

* Add unordered_hash_unique

* skip serialization if none

* Use OrderedFloat for hashing a float

* Use OrderedFloat for hashing a float

* only log updates if they are performed

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: xzfc <xzfcpw@gmail.com>
2025-09-19 19:59:25 +02:00
Arnaud Gourlay
a45897568d Fix missing REST API validations misc. (#7220)
* Fix missing REST API validations misc.

* add validation for deleted_threshold

* backport vacuum_min_vector_number validation from gRPC
2025-09-08 12:48:14 +02:00
Arnaud Gourlay
dd30fce77f Fix missing REST API Filter validations (#7218) 2025-09-05 13:53:18 +02:00
Luis Cossío
a2d3270eb8 Custom RRF k parameter (#7065)
* allow custom K parameter for RRF

* generate grpc docs and openapi

* use tagged type approach for parametrized fusions

* use params approach in grpc

* simplify api structure

* upd schema

* nits

* rest: parameterized rrf as query variant

* consistency in doc comments

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2025-08-20 15:05:27 -04:00
Andrey Vasnetsov
c188f5b7c4 Update if (#7006)
* implement condition parameter for upsert operation

* fmt

* update api schema

* implement conditional update for update-vectors op

* rename to update_filter for consistency

* add tests

* explicilty ignore strict mode for conditional updates

* rabbit review fix

* Also assert vector element before, confirm we don't normalize

* Simplify filter creation using new helper

* Rename merge_with_ids to with_point_ids

---------

Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
2025-08-15 15:47:43 +02:00
Andrey Vasnetsov
4a3008e77a Fix bm25 params (#7056)
* make bm25 parameters compatible with default fastembed params

* bm25 params in openapi schema

* fmt

* improve bm25 config deserialization

* more explicit docstring for disabling english
2025-08-14 14:23:29 +02:00
Arnaud Gourlay
255dd51e5a Fix Clippy 1.89 (#6981) 2025-08-05 18:06:04 +02:00
Luis Cossío
a7701587f4 [decay formula] allow [0,1] range for midpoint in lin_decay (#6959)
* allow [0,1] range for midpoint in lindecay

* clippyyyyy

* Better error message
2025-08-01 13:49:54 -06:00
Luis Cossío
6307510476 [MMR] expose as query variant in rest and grpc (#6797)
* expose mmr in rest and grpc

* fix referenced vectors in mmr queries

* rename to MmrInput in grpc for consistency

* mmr is now an optional parameter of nearest query

* fix score_threshold at local shard

* fix conversion of rest -> collection

* fix and refactor planned query

* nits

* rename `lambda` to `diversity` in interface

* handle score_threshold within mmr calculation

* add openapi test

* fix candidate limit at collection level

* candidate_limit -> candidates_limit

* finish rename to candidates_limit

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-07-11 10:39:12 -04:00
Jojii
2a29432983 Fix duplicates in hardware counter metrics (#6803)
* Fix duplicates in hardware counter metrics

* Minor cleanup
2025-07-03 17:04:13 +02:00
Roman Titov
d0f8a552bd Tweak partial snapshot recover and recover_from response (#6610) 2025-06-12 13:34:04 +02:00
n0x29a
01e5fab950 InferenceUsage in grpc (#6601)
* InferenceUsage in grpc

* Update documentation for InferenceUsage

* Update lib/api/src/grpc/ops.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* clearer inference usage tracking

* remove unused inference token from delete_points

* review

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: generall <andrey@vasnetsov.com>
2025-05-29 21:48:35 +02:00
n0x29a
1dfebb5ea0 Add inference usage tracking to REST API (#6563)
* Add inference usage tracking to REST API

---------

Co-authored-by: Andrey Vasnetsov <andrey@vasnetsov.com>
2025-05-27 11:48:20 +02:00
n0x29a
73e7b17ee8 Refactor: move HardwareUsage to the Usage map (#6532)
---------

Co-authored-by: jojii <jojii@gmx.net>
2025-05-14 21:01:49 +02:00
Arnaud Gourlay
7f0b48a8a3 Fix missing API validations (#6499) 2025-05-07 19:10:14 +02:00
LesserPanda
82439deaf2 fix-typo (#6465)
* fix-typo

* Update openapi.json fix-typo
2025-04-29 16:12:31 -04:00
Luis Cossío
f9a537174c [strict mode | score boosting] Strict mode for formula queries (#6317)
* move problems.rs to collection crate

* change type on datetime_key expression

* extract from expression

* check for unindexed fields in formula

* clippy

* dedup code

* Only implement verification for `CollectionQuery` types (#6319)

* verify CollectionQuery's Prefetch

* remove implementation for REST query

* remove implementation for REST query groups

* add basic openapi test
2025-04-04 13:52:01 -03:00
Luis Cossío
5670a7c917 sum_scores recommendation strategy (#6256)
* Add in rest and grpc

* add to QueryEnum

* implement Query trait

* connect to scorer creation

* upd tests

* additional changes

* fmt

* gen openapi and grpc docs

* coderabbit fix

* add changes in async scorer

* test sum_scores in more places, refactor to remove repetition
2025-04-03 09:01:39 +02:00
Luis Cossío
ec544ff627 [score boosting] support datetime expressions (#6196)
* use f64 as internal expression score

* allow datetime as expression

* add test cases

* fix schema, generate openapi and grpc docs

* fmt

* clippy

* fix test precision

* graceful handling of too large numbers, more tests

* rename to DatetimeExpression for consistency

* use datetime's timestamp as seconds

* capture variable name when parsing

* homogenize DateTime into Datetime

* use interface distinction between datetime strings and payload keys

* fix rebase

* fix after rebase
2025-04-02 12:40:00 -03:00
Jojii
ae64690c7a Measure Payload Index IO Writes (#6137)
* Prepare measurement of index creation + Remove vector deletion
measurement

* add hw_counter to add_point functions

* Adjust add_point(..) function signatures

* Add new measurement type: payload index IO write

* Measure payload index IO writes

* Some Hw measurement performance improvements

* Review remarks

* Fix measurements in distributed setups

* review fixes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-03-24 19:39:17 +01:00
Luis Cossío
e86629e8e4 [score boosting] Add decay expressions (#6154)
* Add decay expressions

* remove code duplication in conversion

* test and fix lambda roundtrip

* Remove debug print in decay midpoint validation

* Improve error messages for decay midpoint and scale validation

* use similar lambda for gauss and exp decays

* avoid abs before squaring

* add comment about decay range

* add debug assertion
2025-03-18 17:09:55 -03:00
xzfc
70c4c5a7e4 Add Anonymize macro (#6160)
* Add Anonymize macro

* Use Anonymize macro

* anonymize metadata

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-03-13 12:07:42 +01:00
Jojii
faeba71849 IO read measurements for most Payload indices (#5951)
* Add payload index filtering IO measurements for some indices

* Add payload index metric to api and telemetry

* Also account for index access overhead

* Review remarks

* Anonymize new HardwareUsage field

* Fix tests
2025-03-12 14:31:48 +01:00
xzfc
749b9b2c90 Anonymize ShardKey in ReplicaSetTelemetry (#6115)
* Anonymize ShardKey in ReplicaSetTelemetry

* Anonymize vector names in CollectionConfigInternal

* no-op: impl HardwareUsage for HardwareUsage (used in HardwareTelemetry)

* no-op: impl Anonymize for OptimizersStatus (used in OptimizerTelemetry and CollectionsAggregatedTelemetry)

* no-op: impl Anonymize for TrackerStatus in (used in TrackerTelemetry)

* no-op: Anonymize VectorParams in VectorsConfig

* no-op: Copy fields explicitly in OperationDurationStatistics

* no-op: `.clone().map(|x| x.anonymize())` -> `.anonymize()`

* no-op: impl Anonymize for ConsensusThreadStatus (used in PeerInfo and ClusterStatusTelemetry)
2025-03-05 19:04:55 +01:00
Luis Cossío
64a117f81e [score boosting] openapi test for formula (#6064)
* add formula to internal grpc api

* add openapi test for formula
2025-02-26 10:28:12 -03:00
Luis Cossío
64ff5f0af5 [score boosting] add more expressions (#6054)
* sqrt, pow, exp, log, ln, abs

* upd openapi and grpc

* handle undefined math as negative infinity
2025-02-26 09:31:50 -03:00
Arnaud Gourlay
69a9150bbd Struct deconstruction in conversions (#6066)
* Struct deconstruction in conversions

* payload ops conversions

* inference conversions

* RecordInternal conversion

* shard operation conversions
2025-02-26 12:42:10 +01:00
Luis Cossío
b494771e61 [score boosting] add gRPC structures (#6035)
* add grpc structures

* grpc docs

* make by_zero_default optional
2025-02-24 10:44:46 -03:00
Luis Cossío
08cf86c421 [score boosting] Connect formula to query (#6024)
* finish connecting formula query

* upd openapi
2025-02-21 09:36:18 -03:00
Luis Cossío
c2312d0e50 [score boosting] create query structures and parse them (#5990)
* create REST, CollectionQuery, and ShardQuery structures. Parse all variables and conditions

* move stuff around, rename segment Expression to ParsedExpression

* rename to MultExpression

* add Div in REST, use unique geo_distance tag

* review fixes

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2025-02-21 09:03:25 -03:00
Arnaud Gourlay
d88e76f90d Fix Clippy 1.85 (#6011)
* Fix Clippy 1.85

* fix false positive
2025-02-18 10:41:28 +01:00
Kumar Shivendu
9d56dcfa7a fix typo (#5960) 2025-02-08 17:05:53 +05:30
Jojii
bae4c08a2a Measure IO reads for vectors (#5912) 2025-02-03 11:56:43 +01:00
Jojii
5a321d6f09 HwCounter rename IO metrics (#5898)
* Rename io metrics and add vector_io_write

* Chore: Cleanup obsolete TODOs and simplify retrieving HardwareCounterCells (#5899)
2025-01-30 10:23:35 +01:00
xzfc
d90a68137b Add VectorName type alias (#5763)
* Add VectorName/VectorNameBuf type aliases [1/2]

* Add VectorName/VectorNameBuf type aliases [2/2]
2025-01-24 01:29:01 +00:00
Arnaud Gourlay
4dee0c5bf4 Strict mode multivector (#5757)
* strict mode for multivector

* simplify impl

* regen docs
2025-01-20 15:53:35 +01:00
Jojii
9ad886691e IO metrics in hw counter types (#5769)
* io metrics in hw counter types

* Add new metrics to `new_with`
2025-01-10 18:28:34 +01:00
Luis Cossío
daef7134e2 Enable resetting max_optimization_threads to automatic (#5634)
* Allow max-optimization-thread config to be set to null on update

* add new field. Support both, but prepare for deprecation.

* better openapi

* only introduce change in OptimizersConfigDiff

* move to `api::rest::schema`

* update openapi

* improve test, fix diff to config conversion

* upd grpc docs

* clippy

* remove schemars from common common

---------

Co-authored-by: Gulshan Kumar <kumargu@amazon.com>
2024-12-18 17:17:47 -03:00