sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c1d9962bc893972e89ea5af3a27667ee45670938ccec6be9e47fca9659319721 | Rust | 482 | 31 | use std::fmt::{Debug, Display};
use crate::key::KeyWrapper;
pub trait Key: Clone + Debug + Display + Into<KeyWrapper> + PartialEq + Send + Sync {
fn get_size(&self) -> usize;
}
impl Key for &str {
fn get_size(&self) -> usize {
self.len()
}
}
impl Key for f32 {
fn get_size(&self) -> usize {
... |
1abc7f28c72f80303925a692ae47f24b18c27f8eb2aac5d76d77a43980dd7d92 | Rust | 494 | 13 | //! gRPC client for heap tender service.
//!
//! This module provides a client for interacting with the heap tender service,
//! which is colocated with the log service on the same nodes but listens on
//! a different port (50052 vs 50051).
/// Configuration types for the heap service client.
pub mod config;
/// gRPC ... |
02135a079d98ac73f9b26e1cc693c6345927c1fa03b6df5b189b3f5280c36550 | Rust | 495 | 23 | pub fn euclidean_distance_scalar(a: &[f32], b: &[f32]) -> f32 {
let mut sum = 0.0;
for i in 0..a.len() {
sum += (a[i] - b[i]).powi(2);
}
sum
}
pub fn cosine_distance_scalar(a: &[f32], b: &[f32]) -> f32 {
let mut sum = 0.0;
for i in 0..a.len() {
sum += a[i] * b[i];
}
1.0_... |
779498d445959d8075a218b7f8a007c09664e4995fade4d078188baeaaa2d956 | Rust | 495 | 20 | use chroma_error::{ChromaError, ErrorCodes};
use std::fmt::Debug;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum BlockfileError {
#[error("Key not found")]
NotFoundError,
#[error("Block not found")]
BlockNotFound,
}
impl ChromaError for BlockfileError {
fn code(&self) -> ErrorCodes {
... |
96805bc6f3b96fb6923697e1664bdd2a8d932b59d432f9abd5b427a30a5ce50f | Rust | 497 | 19 | use chroma_system::thread_stack_size_bytes;
use worker::query_service_entrypoint;
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
fn main() {
tokio::runtime::Builder::new_multi_thread()
.enable_all(... |
4be6dc9ada3bc321883b079fe4f31ecebc5926569499e4c472b2533fde54f7ef | Rust | 508 | 16 | mod builder_storage;
pub(super) mod data_record;
pub(super) mod data_record_size_tracker;
mod ordered_block_delta;
pub(super) mod quantized_cluster_delta;
pub(super) mod single_column_size_tracker;
pub(super) mod single_column_storage;
pub(super) mod spann_posting_list_delta;
pub(super) mod spann_posting_list_size_trac... |
5ef5e33ab16dacdfdd2450904d8e3a31fac3f060b206798da6ed49dfdd13dbf7 | Rust | 512 | 19 | use chroma_system::thread_stack_size_bytes;
use worker::compaction_service_entrypoint;
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
fn main() {
tokio::runtime::Builder::new_multi_thread()
.enable... |
22a1bcb3e96bdce6c1ff8a4489127a436c40a54669961ae83b35a092452032e1 | Rust | 528 | 19 | use chroma_system::thread_stack_size_bytes;
use worker::fn_consumer::fn_consumer_service_entrypoint;
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
fn main() {
tokio::runtime::Builder::new_multi_thread()
... |
35b32c51db67697b1e4e17700a112b66b471e6d7a64c64fad6d09a179969dfcc | Rust | 538 | 15 | //! `/api/agent` tests, split by type and numbered for readability.
//!
//! - `00_unit` — pure synchronous tests: model-string mapping, event
//! projections, and event serialization.
//! - `01_drive` — the async loop driver exercised with stub inference models
//! and tools, asserting the emitted event sequence.
/... |
0f6396fc038c58b88ff77d0b5c0a23159d9d370d975a00cc7acdb642532ef9f9 | Rust | 548 | 17 | use proptest_helpers::{
frontend_reference::{FrontendReferenceState, FrontendReferenceStateMachine},
frontend_under_test::FrontendUnderTest,
proptest_types::CollectionRequest,
};
use proptest_state_machine::prop_state_machine;
mod proptest_helpers;
prop_state_machine! {
#![proptest_config(proptest::te... |
d6d82362a2cc86a1507a165fb60b8cda6086572c0ca360c9388df0616de24f21 | Rust | 567 | 19 | use chroma_types::{CollectionUuid, DatabaseName, TopologyName};
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum DatabaseOrTopology {
Database(DatabaseName),
Topology(TopologyName),
}
#[derive(Default, Debug)]
pub struct GetCollectionsOptions {
pub collection_id: Option<CollectionUuid>,
pub colle... |
2b0304045284213bd72664794970a5c7d7b5cc88b4512ce27554ef254fbce3a5 | Rust | 578 | 25 | #![recursion_limit = "256"]
mod common;
mod ms_01_blockfile_roundtrip;
mod ms_02_writer_basic;
mod ms_03_writer_incremental;
mod ms_04_writer_edge_cases;
mod ms_05_cursor;
mod ms_06_correctness;
mod ms_07_masks;
mod ms_08_edge_cases;
mod ms_09_recall;
mod ms_10_incremental_query;
mod ms_11_vectorized_scoring;
mod ms_... |
3a48ba2b20423905a057c04dacce5cdf52b3b6866cb19f990dd99041d11df94f | Rust | 604 | 20 | use crate::{ChromaError, ErrorCodes};
use thiserror::Error;
#[derive(Debug, Error)]
#[error("Validation error: {0}")]
pub struct ChromaValidationError(#[from] validator::ValidationErrors);
impl ChromaError for ChromaValidationError {
fn code(&self) -> ErrorCodes {
ErrorCodes::InvalidArgument
}
}
impl... |
3b25d93276d5259a138f7634673097b897668e5d29e633567562aafb72775909 | Rust | 649 | 17 | mod core;
mod errors;
mod receiver;
mod types;
pub use {
core::{
close, create, get_current, with_current, CollectionForkContext, CollectionReadContext,
CollectionWriteContext, Enterable, ExternalCollectionReadContext, FinishRequest,
FtsQueryLength, LatestCollectionLogicalSizeBytes, LogSize... |
f96d885fa5a9ce645b701ed06dc3702847aaca562f9be51fa0870d9a46101118 | Rust | 660 | 14 | //! Wiki-domain helpers for foundation-api.
//!
//! foundation-api does not embed the Chroma data plane. Instead it acts as a
//! Chroma client and proxies record I/O to the frontend (FE), letting the FE
//! enforce auth, quota, metering, and billing against the caller's
//! `x-chroma-token`. The generic proxying clien... |
8e2f00c40e8f96a21ca64746c6c1afb26bf61c081b8996ebdd2f7240de835415 | Rust | 671 | 27 | use std::future::Future;
use criterion::Criterion;
use tokio::runtime::Runtime;
pub fn tokio_multi_thread() -> Runtime {
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.expect("Tokio runtime should be set up correctly.")
}
pub fn bench_run<'t, Arg, Fut>(
name: &'t ... |
ec136de81346334dec23de233604034b62859e5c96c05913394fa28e6113be78 | Rust | 682 | 17 | //! `chroma-agent` tool implementations backed by foundation-api's retrieval
//! cores.
//!
//! Each tool reuses a route core ([`crate::routes::search`] /
//! [`crate::routes::read_page`] / [`crate::routes::subagent_search`]) so the
//! agent loop and the bare HTTP routes share one retrieval implementation.
//! Per-req... |
75c38f0ac2e02099a3b0254bae45daf2caeed03f32d273cdc0888984656fd9b8 | Rust | 694 | 25 | pub mod config;
#[cfg(feature = "grpc")]
pub mod grpc_client_trace_layer;
#[cfg(feature = "grpc")]
pub mod grpc_server_trace_layer;
pub mod init_tracer;
mod server;
#[cfg(feature = "middleware")]
mod tower_tracing;
pub mod util;
pub use config::OpenTelemetryConfig;
pub use server::init_server_otel_tracing;
#[cfg(feat... |
62606719605d73e551996e420e77819890321dedbd9a78353e6fbea4633b5827 | Rust | 700 | 20 | use chroma_types::{
AddCollectionRecordsRequest, DeleteCollectionRecordsRequest, GetRequest, QueryRequest,
UpdateCollectionRecordsRequest, UpsertCollectionRecordsRequest,
};
#[derive(Debug, Clone)]
pub(crate) enum CollectionRequest {
Init {
dimension: usize,
},
Add(AddCollectionRecordsReque... |
cae7d418b73d167d324de51612da873d465e49fedbcd22ec25064ef0712ed8c9 | Rust | 705 | 19 | //! Client configuration and connection management for Chroma.
//!
//! This module contains:
//! - [`ChromaHttpClient`] - The main client handle for database operations
//! - [`ChromaHttpClientOptions`] - Configuration builder for client initialization
//! - [`ChromaAuthMethod`] - Authentication strategy enumeration
//... |
735e6b03ad7bacafec57a5d1276115059ea83a3dfa5d5e9bf8efb17839da7335 | Rust | 708 | 16 | use chroma_types::{CollectionUuid, TopologyName};
/// CollectionInfo is a struct that contains information about a collection for the
/// compacting process.
/// Fields:
/// - collection_id: the id of the collection that needs to be compacted
/// - topology_name: the topology this collection belongs to (if any)
/// - ... |
0401412b394aa2bff3baeb9793b61b69021cbb1171bec90a6d513e3bc7ff00c7 | Rust | 716 | 29 | use crate::utils::CliError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum WebPageError {
#[error("Failed to open browser. {0}")]
BrowserOpenFailed(String),
}
pub enum WebPageCommand {
Discord,
Docs,
}
impl WebPageCommand {
fn url(&self) -> &'static str {
match self {
... |
75c5e09a08936afd0cd83cae8709173874b21c531fdb19127eb5c110ce3aa090 | Rust | 724 | 31 | #![recursion_limit = "256"]
pub mod config;
pub mod fulltext;
mod hnsw;
pub mod hnsw_provider;
pub mod metadata;
pub mod quantization;
pub mod spann;
pub mod sparse;
pub mod types;
#[cfg(feature = "usearch")]
pub mod usearch;
pub mod utils;
// Re-export types
use chroma_cache::new_non_persistent_cache_for_test;
use ... |
26a19db32f4ac153c022d73b8377ccf6543925bd65d8b74ede0972d6f50751fe | Rust | 750 | 18 | #[derive(Clone, Debug)]
pub struct SpannPostingList<'referred_data> {
pub doc_offset_ids: &'referred_data [u32],
pub doc_versions: &'referred_data [u32],
// Flattened out embeddings for all documents.
// Can extract individual embedding by slicing
// the 1D array at the suitable start and end offset... |
d52a2c1e89d0c54f976843d540bec935383009717cad5b11fc31a19d5d788580 | Rust | 752 | 30 | pub mod distance;
pub mod distance_avx;
pub mod distance_avx512;
pub mod distance_neon;
pub mod distance_sse;
pub mod types;
#[cfg(all(
target_feature = "avx512f",
target_feature = "avx512dq",
target_feature = "avx512bw",
target_feature = "avx512vl",
target_feature = "fma"
))]
pub use distance_avx5... |
a4855cb3aecfc590ec6e8427a1ca129c88973728e843422f06d4fbcaf4bb158a | Rust | 754 | 22 | //! Pure scaffolding shared by HTTP frontends in this workspace.
//!
//! Per ADR "Foundation API: Long-Term Home", `frontend-core` is library-only
//! scaffolding that any HTTP server binary in the workspace can embed
//! (currently `chroma-frontend`; soon `foundation-api`). It contains no
//! product-specific route ha... |
645e192aada72aca26dd3f9741d435d393565d77b86e772e5b6e8bbe6eedd2f8 | Rust | 760 | 29 | use crate::chroma_proto::TenantLastCompactionTime;
#[derive(Debug, Clone)]
pub struct Tenant {
pub id: String,
pub last_compaction_time: i64,
pub resource_name: Option<String>,
}
impl TryFrom<TenantLastCompactionTime> for Tenant {
type Error = ();
fn try_from(proto_tenant: TenantLastCompactionTim... |
228a900fb09011f37bc8de104aff035d2c7fe2a09dde54ca4d8c28438dd32bdf | Rust | 767 | 24 | use crate::common;
use chroma_types::SignedRoaringBitmap;
fn all_mask() -> SignedRoaringBitmap {
SignedRoaringBitmap::Exclude(Default::default())
}
#[tokio::test]
async fn query_after_incremental_update() {
let docs = vec![(0u32, vec![(1u32, 0.5)]), (1, vec![(1, 0.3)])];
let (_dir, provider, reader) = com... |
585ef8d019d2c6f948c62e67c2e7eb368cd93df7730c4a35e4318f42702017b3 | Rust | 833 | 19 | /// Bound the byte length of every generated Chroma record key.
pub const KEY_MAX_BYTES: usize = 128;
/// Bound the byte length of every generated Chroma record document.
pub const VALUE_MAX_BYTES: usize = 16 * 1024;
/// Bound a chunkset base so `/metadata` and `/chunks/{index}` suffixes fit.
pub const CHUNKSET_BASE_... |
182002d164993a59ba3cf8e273c0617379ef905045601baa0c11bc0a5c338899 | Rust | 849 | 24 | use std::collections::HashSet;
use std::sync::Arc;
use chroma_types::CollectionUuid;
use crate::execution::operators::fragment_fetch::FragmentFetcher;
/// Return the fragment fetcher for `collection_id`, or `None` when fragment fetch is disabled.
///
/// Fragment fetch is enabled when `use_fragment_fetch` is true or... |
2fa3de52e6ffb50a751d2c2d3c6986318b2d5d2f5ff1813f6a7b8dfd2a511bdf | Rust | 871 | 27 | pub mod assignment_policy;
pub mod config;
pub mod rendezvous_hash;
use crate::{registry::Registry, Configurable};
use self::{assignment_policy::AssignmentPolicy, config::AssignmentPolicyConfig};
use async_trait::async_trait;
use chroma_error::ChromaError;
#[async_trait]
impl Configurable<AssignmentPolicyConfig> for ... |
c36c45e1978e5c87fbdd4d2f8ad4a80d61589794a6927faaa1e422388a10c61d | Rust | 899 | 28 | use opentelemetry::global;
use opentelemetry::propagation::Injector;
use tracing_opentelemetry::OpenTelemetrySpanExt;
struct ReqwestHeaderInjector<'a>(&'a mut reqwest::header::HeaderMap);
impl Injector for ReqwestHeaderInjector<'_> {
fn set(&mut self, key: &str, value: String) {
let Ok(name) = reqwest::he... |
f10ae4797bd3d58bc5b67add042c688e9a2adaadd752d5b008827f5df3f15c02 | Rust | 911 | 24 | use std::str::FromStr;
use wal3::{FragmentSeqNo, Garbage, LogPosition, Manifest};
fn main() {
let args = std::env::args().skip(1).collect::<Vec<_>>();
if args.len() != 3 {
eprintln!("USAGE: wal3-construct-garbage-from-manifest MANIFEST FRAG_SEQ_NO OFFSET");
std::process::exit(13);
}
le... |
c1775cdbcbc9d0d4a641f76becb0c090a5c3035b671a1f826151422e263110b7 | Rust | 913 | 29 | //! Shared OpenTelemetry configuration for Chroma services.
use serde::{Deserialize, Serialize};
use crate::{OtelFilter, OtelFilterLevel};
fn default_otel_service_name() -> String {
"chromadb".to_string()
}
fn default_otel_filters() -> Vec<OtelFilter> {
vec![OtelFilter {
crate_name: "chroma_frontend... |
83fc6f397f308057e43becaad09040e60bd0446201d5a1847539972f125a4ac3 | Rust | 934 | 30 | use std::io::Cursor;
use murmur3::murmur3_32;
use crate::embed::TokenHasher;
/// Hasher that uses MurmurHash3 with absolute value.
///
/// This matches Python's abs(mmh3.hash(token)) behavior, where the signed i32
/// hash is converted to its absolute value.
///
/// The seed field is public for direct customization.... |
11d2a18098dc06831bf161277cfa23b2e81d071cfa94681a81b2fddc173f7eec | Rust | 954 | 31 | use crate::chroma_proto;
use crate::Metadata;
use prost::Message;
#[derive(Debug, Clone)]
pub struct DataRecord<'a> {
pub id: &'a str,
pub embedding: &'a [f32],
pub metadata: Option<Metadata>,
pub document: Option<&'a str>,
}
impl DataRecord<'_> {
pub fn get_size(&self) -> usize {
let id_s... |
a66c0f3070063bdc566620e7e72146bef53a4365ef9c57431678597a460fdd82 | Rust | 954 | 29 | //! Well-known operator IDs and names that are pre-populated in the database.
//!
//! ⚠️ **DO NOT EDIT THIS FILE MANUALLY** ⚠️
//!
//! These constants are auto-generated from the Go source file:
//! `go/pkg/sysdb/metastore/db/dbmodel/constants.go`
//!
//! ## To add a new operator:
//!
//! 1. Create a database migratio... |
9bb6f6bc6fad07fcf80734f1087ffabf4837ec40d6590637b61310811c2cdb0c | Rust | 957 | 30 | use chroma_system::thread_stack_size_bytes;
use garbage_collector_library::garbage_collector_service_entrypoint;
use tracing::{error, info};
#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;
fn main() {
tokio... |
5835eb19d496af98d45f360fdddb131cee655f4c0165378b33bfb211dd9f27a1 | Rust | 967 | 36 | use crate::{ChromaError, ErrorCodes};
use thiserror::Error;
/// Implements `ChromaError` for `sqlx::Error`.
#[derive(Debug, Error)]
#[error("Database error: {0}")]
pub struct WrappedSqlxError(pub sqlx::Error);
impl ChromaError for WrappedSqlxError {
fn code(&self) -> crate::ErrorCodes {
match self.0 {
... |
07ddf70266fc63a81c5485eb67c406f3ddc01b335d6c372736a1546136d67836 | Rust | 985 | 34 | #![recursion_limit = "256"]
pub mod types;
pub mod arrow;
pub mod config;
pub mod key;
pub mod memory;
pub mod provider;
// This module is not gated as [#cfg(test)] because it is used in crates external to blockstore.
pub mod test_utils;
use crate::arrow::config::BlockManagerConfig;
use chroma_cache::new_cache_for_t... |
a200332502db6bd64dc92070a5c12ddccba4ab4b9866892b191f8795046e57fe | Rust | 988 | 37 | #![recursion_limit = "256"]
mod bindings;
mod errors;
use crate::bindings::cli;
use bindings::{
Bindings, ConditionalCommitPayload, ConditionalCommitResult, ConditionalTransaction,
PythonBindingsConfig,
};
use pyo3::prelude::*;
//////////////////////// Config Imports ////////////////////////
use chroma_sqlite... |
8de1d186aa41a54a4098a8b7622c834d0f425fabbed5ce17704a1703f628936f | Rust | 995 | 30 | use tonic::transport::Channel;
use uuid::Uuid;
use chroma_types::chroma_proto::log_service_client::LogServiceClient;
use chroma_types::chroma_proto::SealLogRequest;
use chroma_types::CollectionUuid;
#[tokio::main]
async fn main() {
let args = std::env::args().skip(1).collect::<Vec<_>>();
if args.len() != 2 {
... |
a3594c4ea75752677cbf0d891748a9dcec5e39ec526fb8239d001a3f0ccece10 | Rust | 1,010 | 30 | use tonic::transport::Channel;
use uuid::Uuid;
use chroma_types::chroma_proto::log_service_client::LogServiceClient;
use chroma_types::chroma_proto::MigrateLogRequest;
use chroma_types::CollectionUuid;
#[tokio::main]
async fn main() {
let args = std::env::args().skip(1).collect::<Vec<_>>();
if args.len() != 2... |
cac69a12d22a7d3a79ee350a3c888fd92c3c7a267c7ab0b4e1d8c678dd59d08a | Rust | 1,011 | 38 | pub mod assignment;
pub mod helpers;
pub mod registry;
pub mod spanner;
pub use spanner::{
SpannerChannelConfig, SpannerConfig, SpannerEmulatorConfig, SpannerGcpConfig,
SpannerSessionPoolConfig,
};
use async_trait::async_trait;
use chroma_error::ChromaError;
use registry::Registry;
use thiserror::Error;
/// ... |
fb81cf3c0f75aaea5185fd4fe7ab2b06ce79c269578a5450d58d57c5d22a9765 | Rust | 1,016 | 42 | use reqwest::header::HeaderMap;
use reqwest::{Client, Method};
use serde::de::DeserializeOwned;
use serde::Serialize;
use std::error::Error;
use std::fmt::Debug;
pub async fn send_request<T, R>(
url: &String,
method: Method,
route: &str,
headers: Option<HeaderMap>,
body: Option<&T>,
) -> Result<R, ... |
36883ae77537811e2fa282bf642c039de8dabc518afc66fea270d9ad863083f9 | Rust | 1,045 | 34 | use std::sync::Arc;
use crate::{Error, Snapshot, SnapshotPointer};
/// A cache for snapshots.
#[async_trait::async_trait]
pub trait SnapshotCache: Send + Sync + 'static {
/// Get a snapshot from the cache.
async fn get(&self, ptr: &SnapshotPointer) -> Result<Option<Snapshot>, Error>;
/// Put a snapshot in... |
705e9acb24d420fa2616dd33befde68faa02a25a523e7e9d7a332dc930776a4c | Rust | 1,050 | 39 | use opentelemetry::trace::{TraceContextExt, TraceId};
use tracing_opentelemetry::OpenTelemetrySpanExt;
pub use chroma_metrics::{StopWatchUnit, Stopwatch};
pub fn get_current_trace_id() -> TraceId {
let span = tracing::Span::current();
span.context().span().span_context().trace_id()
}
pub struct LogSlowOperat... |
ee1aaacc631aad9890f38f03e344c52ff66b459b71f35413fe192019e84fddcb | Rust | 1,056 | 35 | #![recursion_limit = "256"]
use chroma_config::Configurable;
use crate::config::RootConfig;
pub mod backend;
pub mod config;
pub mod server;
pub mod spanner;
pub mod types;
const CONFIG_PATH_ENV_VAR: &str = "CONFIG_PATH";
pub async fn sysdb_service_entrypoint() {
let config = match std::env::var(CONFIG_PATH_EN... |
d4b9f8ab06f5b7bc5a60dad24024f4242e7ce8846bfb830c25c6ae0dca04104b | Rust | 1,084 | 26 | //! Shared tracing initialization for Chroma servers.
use crate::{
init_global_filter_layer, init_otel_layer, init_panic_tracing_hook, init_stdout_layer,
init_tracing, OpenTelemetryConfig,
};
/// Initialize OTEL/stdout tracing for an HTTP server. If `otel_config` is
/// provided, both OTEL and stdout layers a... |
cfe48a2ada3d70d9ea8cd6f7cdb0a79cc11b8d42c6efeacb77733ce1be282429 | Rust | 1,089 | 41 | use super::segment_file_strategies::SegmentGroup;
use chroma_types::{CollectionAndSegments, CollectionUuid, SegmentUuid};
#[derive(Clone, Debug)]
pub enum Transition {
CreateCollection {
collection_id: CollectionUuid,
segments: SegmentGroup,
},
IncrementCollectionVersion {
collectio... |
43fd7a07621be7097bc2653f3b86829f62461757ac14b0b7c6372b3b5c2d7534 | Rust | 1,125 | 36 | use serde::{Deserialize, Serialize};
#[derive(Default, Deserialize, Clone, Serialize, Debug)]
/// The type of hasher to use.
/// # Options
/// - Murmur3: The murmur3 hasher.
pub enum HasherType {
#[default]
Murmur3,
}
#[derive(Deserialize, Clone, Serialize, Debug)]
/// The configuration for the assignment pol... |
e2e4321eac91f180983a17ac96c578e5e26a660d21ca8d19ef9dee28ad59196e | Rust | 1,137 | 44 | pub mod apply_log_to_segment_writer;
pub mod commit_segment_writer;
pub mod count_records;
pub mod execute_task;
pub mod fetch_log;
pub mod finish_async_work;
pub mod finish_attached_function;
pub mod flush_segment_writer;
pub mod fragment_fetch;
pub mod get_attached_function;
pub mod get_collection_and_segments;
pub m... |
c6ce72fc030b9e695e130222eef2f0418041b1f2481c1be7dc7a7b3eba86531b | Rust | 1,141 | 31 | #![allow(missing_docs)]
use super::error::TrajectoryError;
use super::ids::encode_index;
use super::limits::{CALL_INDEX_WIDTH, ENTRY_INDEX_WIDTH};
use super::model::{ReasoningEntry, ReasoningTrajectoryFile};
/// Validate a pruned reasoning trajectory before it is split into records.
pub(crate) fn validate_file(file: ... |
92c3fd915f6586da11aa68a24ab231361e7a42525881d5664f4e62883f89a805 | Rust | 1,167 | 44 | use super::{CacheError, StorageKey, StorageValue, Weighted};
use std::fmt::Debug;
use std::hash::Hash;
/// A zero-configuration cache that doesn't evict.
pub struct NopCache;
#[async_trait::async_trait]
impl<K, V> super::Cache<K, V> for NopCache
where
K: Clone + Send + Sync + Eq + PartialEq + Hash + 'static,
... |
62432503297d61801fe7f7803da37927e5a19c54c71547d9338bd131d837f7ab | Rust | 1,169 | 42 | use chroma_error::ChromaError;
use std::any::Any;
use thiserror::Error;
#[derive(Error)]
#[error("Panic {:?}", get_panic_message(.0))]
pub struct PanicError(Box<dyn std::any::Any + Send>);
impl std::fmt::Debug for PanicError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
... |
4f39563040daaa01a6b8ca401da8913ac0b65bb45bce26fb8092048b606fc7e3 | Rust | 1,191 | 36 | #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct GrpcConfig {
#[serde(default = "GrpcConfig::default_max_encoding_message_size")]
pub max_encoding_message_size: usize,
#[serde(default = "GrpcConfig::default_max_decoding_message_size")]
pub max_decoding_message_size: usize,
#[... |
472c924f9f2435a898c51d51f4f7a29500b4fccab6e62d085e1519883b3d7700 | Rust | 1,217 | 48 | use std::mem::size_of_val;
#[derive(Clone, Debug)]
pub struct QuantizedCluster<'data> {
pub center: &'data [f32],
pub codes: &'data [u8],
pub ids: &'data [u32],
pub versions: &'data [u32],
}
impl QuantizedCluster<'_> {
pub fn compute_size(&self) -> usize {
size_of_val(self.center)
... |
6075c868dffe074d6bb6d1d96b1617e404d5c15b7a2fc8944aa271e2a09b73a0 | Rust | 1,243 | 44 | use std::path::Path;
#[cfg(unix)]
use std::os::unix::process::ExitStatusExt;
const KNOWN_PATH: &str = "/opt/homebrew/share/google-cloud-sdk/bin/spanner-cli";
#[cfg(unix)]
fn exit_code(exit: std::process::ExitStatus) -> i32 {
exit.code()
.unwrap_or_else(|| exit.signal().map_or(1, |signal| 128 + signal))
}... |
8e535f4ee82b2dfff79ee4429a9f333419d6b50abdbd71685e03512407bd7d20 | Rust | 1,253 | 33 | //! Provider format dispatch.
//!
//! Only [`ProviderFormat::Anthropic`] exists for now, but keeping this as an
//! enum preserves the dispatch seam so additional inference providers can slot
//! in without churning the `to_provider_format` APIs on `ToolSchema` and
//! `Trajectory` (added in later milestones).
use ser... |
4bfab6a69ffc56bc6fb643476ca6f25c9ef4755c8f073e8ceb92273a2ff2ea0f | Rust | 1,272 | 46 | pub mod config;
pub mod grpc_log;
pub mod in_memory_log;
pub mod local_compaction_manager;
#[allow(clippy::module_inception)]
mod log;
pub mod sqlite_log;
pub mod test;
pub mod types;
use chroma_config::{registry::Injectable, Configurable};
use chroma_error::ChromaError;
use chroma_system::System;
use config::LogConfi... |
171b401af0e1b3f06d7ae788105440af2bae15a37de2186c44b6e3f05d18f4fc | Rust | 1,322 | 43 | use super::operator::ScanToProtoError;
use crate::{
CollectionConversionError, MetadataValueConversionError, SegmentConversionError,
VectorConversionError, WhereConversionError,
};
use thiserror::Error;
use tonic::Status;
#[derive(Debug, Error)]
pub enum QueryConversionError {
#[error("Error parsing collec... |
a14e46d5bba742bce282692ec2d778949d40a09707dcfc53afd58599ad2f1a5c | Rust | 1,343 | 45 | use crate::common;
#[tokio::test]
async fn writer_single_doc() {
let docs = vec![(0u32, vec![(1u32, 0.5f32)])];
let (_dir, _provider, reader) = common::build_index(docs).await;
let entries = common::get_all_entries(&reader, 1).await;
assert_eq!(entries.len(), 1);
assert_eq!(entries[0].0, 0);
c... |
491e7a8194f3353822b56fcca99422e68fac8d60c4756ebd54295c3efa4b7d01 | Rust | 1,371 | 37 | use proc_macro2::{Ident, TokenStream};
use quote::quote;
/// Represents a user-defined capability for a context. A capability means that a context
/// is able to handle the receipt of a specific set of information.
#[derive(Clone, Debug)]
pub struct Capability {
pub capability_name_ident: Ident,
pub capability... |
9253e3317940d86dfbd7c4c0938d592ce1005c62925c8ec4c63c6900661b64d6 | Rust | 1,375 | 45 | use uuid::Uuid;
use wal3::{Manifest, ManifestConsumer, ManifestManagerFactory, ReplicatedManifestManagerFactory};
mod common;
use common::setup_spanner_client;
#[tokio::test]
async fn test_k8s_mcmr_integration_repl_00_empty_and_initialize() {
// Test that a manifest does not exist and comes into existence after ... |
3ac264d69eeab6f0bf38f4bce279014e4c386b75aa50991277998f90c8dfd61b | Rust | 1,423 | 36 | fn main() -> Result<(), Box<dyn std::error::Error>> {
// Compile the protobuf files in the chromadb proto directory.
let mut proto_paths = vec![
"idl/chromadb/proto/chroma.proto",
"idl/chromadb/proto/compactor.proto",
"idl/chromadb/proto/coordinator.proto",
"idl/chromadb/proto/he... |
592810f89b7d7baf4bc57209f3d82a9c999f4ee7fdaf7809f3331321ecaa6e50 | Rust | 1,439 | 50 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{create_repl_factories, LogWriter, LogWriterOptions, StorageWrapper};
mod common;
use common::{default_repl_options, setup_spanner_client};
#[tokio::test]
async fn test_k8s_mcmr_integration_repl_01_empty_and_open()... |
1f7a3eedf82d51d4dec2bddbf2c68587b2247ff71bfc3f7b2b19179b3f2521eb | Rust | 1,462 | 50 | use crate::common;
use chroma_types::SignedRoaringBitmap;
#[tokio::test]
async fn maxscore_include_mask() {
let docs = vec![
(0u32, vec![(1u32, 0.5)]),
(1, vec![(1, 0.8)]),
(2, vec![(1, 0.3)]),
(3, vec![(1, 0.9)]),
];
let (_dir, _provider, reader) = common::build_index(docs... |
b11a66fcd1b57ef25deed3f5e82bf103c52e5f631dcb41aadbd87c9e2c561570 | Rust | 1,466 | 42 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, FragmentManagerFactory, LogReaderOptions, LogWriterOptions, Manifest,
ManifestManagerFactory,
};
mod common;
use common::{assert_conditions, Condition, ManifestCondition};
#[tokio::test]
async fn te... |
5a2fbad498a2cb084184c2401f65996d7484fdbee4d8d4e425b397964b8f8776 | Rust | 1,475 | 53 | use crate::arrow::{
block::delta::{BlockKeyArrowBuilder, BlockStorage},
types::{ArrowReadableKey, ArrowReadableValue, ArrowWriteableKey},
};
use arrow::{
array::{Array, AsArray, StringBuilder, UInt32Array, UInt32Builder},
datatypes::UInt32Type,
};
use std::sync::Arc;
impl ArrowWriteableKey for u32 {
... |
8f58366f99fe677f4640c5be33e3178b979d73e9b65d88855196b49173b4dcf9 | Rust | 1,482 | 53 | use crate::arrow::{
block::delta::{BlockKeyArrowBuilder, BlockStorage},
types::{ArrowReadableKey, ArrowReadableValue, ArrowWriteableKey},
};
use arrow::{
array::{Array, AsArray, Float32Array, Float32Builder, StringBuilder},
datatypes::Float32Type,
};
use std::sync::Arc;
impl ArrowWriteableKey for f32 {... |
65634a9de9736cedc41dcedfcdab4c9cba1639925dda8370786b7d58fb6dc50e | Rust | 1,490 | 51 | use crate::arrow::{
block::delta::{BlockKeyArrowBuilder, BlockStorage},
types::{ArrowReadableKey, ArrowReadableValue, ArrowWriteableKey},
};
use arrow::array::{Array, AsArray, BooleanArray, BooleanBuilder, StringBuilder};
use std::sync::Arc;
impl ArrowWriteableKey for bool {
type ReadableKey<'referred_data... |
8e94d77579301144d1cc4ddbb20e1b75ec1a7686463d6e93fa137663740150df | Rust | 1,495 | 39 | use std::collections::HashMap;
use arrow::array::RecordBatch;
use uuid::Uuid;
use crate::arrow::{
block::Block,
types::{ArrowWriteableKey, ArrowWriteableValue},
};
/// A block delta tracks a source block and represents the new state of a block. Blocks are
/// immutable, so when a write is made to a block, a ... |
086687bfd6522a7ddfc0bea30c82def674c5cdbc1e076fe8b96a83230469868d | Rust | 1,539 | 53 | use std::sync::Arc;
use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::quantized_spann::{
QuantizedSpannSegmentError, QuantizedSpannSegmentReaderShard,
};
use chroma_system::Operator;
use chroma_types::operator::Knn;
use thiserror::Error;
#[derive(Debug)]
pub struct Qua... |
365bc21846ecc37e0add10dc24c53dc7aa1d4d4b309fea3880ffa682dabae0f3 | Rust | 1,608 | 66 | use serde::Deserialize;
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, serde::Serialize)]
#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))]
pub struct DatabaseName(String);
impl<'de> Deserialize<'de> for DatabaseName {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
... |
0d89239a5d8e75b707054438a69acdc7e351065bf20a392ad47b1cbdaa01709b | Rust | 1,637 | 46 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, FragmentManagerFactory, LogReaderOptions, LogWriter, LogWriterOptions,
};
mod common;
use common::{assert_conditions, Condition};
#[tokio::test]
async fn test_k8s_integration_01_empty_and_open() {
/... |
a0f9e34f6c36f30a120808a6a8df30aa453a9a7f49df379a1b1cce05d03d2240 | Rust | 1,647 | 63 | use s3heap::{HeapReader, HeapWriter, Limits};
mod common;
use common::{setup_test_environment, verify_bucket_count};
#[tokio::test]
async fn test_k8s_integration_01_empty_heap() {
let prefix = "test_k8s_integration_01_empty_heap";
let (storage, scheduler) = setup_test_environment().await;
// Initialize ... |
faadfa8e25e4b6f1aa4d80246168b582dfe091c6e7c8d38ad03838e28ce12d3a | Rust | 1,659 | 46 | use crate::common;
#[tokio::test]
async fn empty_writer_commit() {
let docs: Vec<(u32, Vec<(u32, f32)>)> = vec![];
let (_dir, _provider, reader) = common::build_index(docs).await;
let dims = reader.get_all_dimension_ids().await.unwrap();
assert!(dims.is_empty());
}
#[tokio::test]
async fn single_doc_m... |
9e83f0bc34976d6b5eb60113898400b2c3cf408d666471e0536e0c35bb82b106 | Rust | 1,681 | 54 | #![deny(missing_docs)]
//! Persist user-facing reasoning projections as structured Chroma records.
//!
//! A [`ReasoningTrajectoryFile`] is the projection of generated trajectory JSON
//! that can be shown through reasoning and citation views. Producer metadata,
//! tools, parameters, observations, and reasoning signat... |
1d9c90fd793d69464ef5b3f1d6e56da54d932913505a78e46f554caa45ee459c | Rust | 1,683 | 59 | pub mod panic;
pub use panic::*;
pub mod guard;
pub use guard::*;
use std::time::Duration;
/// Convert a Duration to fractional milliseconds.
pub fn duration_ms(d: Duration) -> f64 {
d.as_secs_f64() * 1000.0
}
const DEFAULT_THREAD_STACK_SIZE_BYTES: usize = 16 * 1024 * 1024;
/// Returns the configured stack s... |
9631efa03a01292c1a578f6bfd5886b12f449c9bca49e0d5338d3083d69cdee8 | Rust | 1,702 | 59 | use async_trait::async_trait;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::{blockfile_record::partition_logs_to_shard, bloom_filter::BloomFilterManager};
use chroma_system::{Operator, OperatorType};
use chroma_types::Segment;
use thiserror::Error;
... |
2c00f222200622881e5dbf4ed3cc5981adfb82fd1728d51afbce0d459408f6f7 | Rust | 1,715 | 60 | use std::collections::HashSet;
use chroma_types::{CollectionUuid, DatabaseName, JobId, SegmentScope};
use tokio::sync::oneshot;
#[derive(Clone, Debug)]
pub struct RebuildInfo {
/// Segment scopes to rebuild. If empty, rebuilds all segments (metadata + vector).
pub segment_scopes: HashSet<SegmentScope>,
//... |
133e0a0b2a369f874f6958174df0b727ef103f6492b431e9d7f62729c6eb302c | Rust | 1,730 | 53 | use crate::arrow::{
block::delta::{BlockKeyArrowBuilder, BlockStorage},
types::{ArrowReadableKey, ArrowReadableValue, ArrowWriteableKey},
};
use arrow::{
array::{Array, AsArray, StringArray, StringBuilder},
util::bit_util,
};
use std::sync::Arc;
impl ArrowWriteableKey for &str {
type ReadableKey<'r... |
61347acf20a166f328afd0b6a5905edd654feeafda139ab7adb47f5c76656464 | Rust | 1,736 | 51 | //! `chroma-agent`: a provider-agnostic agent core ported from the Python
//! search-agent research framework.
//!
//! This crate provides the [`ProviderFormat`] dispatch seam, the crate-wide
//! [`AgentError`] type, the tool abstraction ([`Tool`] / [`DynTool`] /
//! [`ToolSet`]) with a dummy [`GetWeatherTool`], the [`... |
f5f023567dde6a37ead34f79829a560964768aaae356f3d403b90f2021dd5aae | Rust | 1,742 | 52 | use std::path::PathBuf;
use anyhow::{Context, Result};
use arrow::array::AsArray;
use futures::{stream, StreamExt, TryStreamExt};
use hf_hub::api::tokio::Api;
use parquet::arrow::ParquetRecordBatchStreamBuilder;
use tokio::fs::File;
pub struct TheStackDedupRust {
pub shard_paths: Vec<PathBuf>,
}
impl TheStackDed... |
0de52a774f25823535424c565eee7576cd79c559cf65441daa0d44aab87010ca | Rust | 1,745 | 60 | //! A dummy `get_weather` tool used to exercise the full tool pipeline:
//! schema generation -> provider format -> typed deserialization -> execution.
use async_trait::async_trait;
use schemars::JsonSchema;
use serde::Deserialize;
use crate::error::AgentError;
use crate::tool::{Tool, ToolCallMetadata};
/// Model-su... |
cdee26ca822fdd09c28f90fe17e5393c7c66c37c234cec45b8a5513fe43cc83a | Rust | 1,777 | 83 | #[macro_use]
mod types;
mod api_types;
mod base64_decode;
mod collection;
mod collection_configuration;
mod collection_schema;
mod conditional_transaction;
mod data_chunk;
mod data_record;
mod database_name;
mod execution;
mod flush;
mod grpc;
mod hnsw_configuration;
mod log;
mod metadata;
mod operation;
pub mod operat... |
227aff2261f5d8614fd14b9bc7913b70fa1c27698f8018fc8a542b784e1b71c5 | Rust | 1,791 | 52 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, now_micros, upload_parquet, FragmentIdentifier, FragmentSeqNo,
LogPosition, LogReaderOptions, LogWriter, LogWriterOptions,
};
mod common;
#[tokio::test]
async fn test_k8s_integration_07_open_or_initi... |
b30822c4ac3a020b7f3cfe16b12972ad37fc3020e370a5b100020583a0fe61ae | Rust | 1,802 | 57 | use std::sync::Arc;
use setsum::Setsum;
use chroma_storage::{Storage, StorageError};
use crate::interfaces::FragmentConsumer;
use crate::{Error, Fragment, LogPosition, LogReaderOptions};
pub struct S3FragmentPuller {
storage: Arc<Storage>,
prefix: String,
}
impl S3FragmentPuller {
pub fn new(_: LogRead... |
e0553399c827b77a668631c30504ede384b99cef8dcaf91f4461e49b3f611045 | Rust | 1,825 | 104 | use std::mem::size_of;
use chroma_types::{DataRecord, QuantizedCluster, SpannPostingList, SparsePostingBlock};
use roaring::RoaringBitmap;
pub trait Value: Clone + Send + Sync {
fn get_size(&self) -> usize;
}
impl Value for Vec<u32> {
fn get_size(&self) -> usize {
self.len() * size_of::<u32>()
}
... |
b7f4230e3b51843eda0f880b7ef589cfd132bc487af2819df9af94a54f1f9415 | Rust | 1,847 | 61 | use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::{
quantized_spann::{QuantizedSpannSegmentError, QuantizedSpannSegmentReaderShard},
spann_provider::SpannProvider,
};
use chroma_system::{Operator, OperatorType};
use chroma_types::{Collection, Segment, SegmentShard, S... |
989c9e560ff0453b4644a2837378b4dab8767469807146357d4035953b588ca7 | Rust | 1,852 | 68 | use crate::common;
use chroma_types::SignedRoaringBitmap;
fn all_mask() -> SignedRoaringBitmap {
SignedRoaringBitmap::Exclude(Default::default())
}
#[tokio::test]
async fn query_no_matching_dims() {
let docs = vec![(0u32, vec![(1u32, 0.5)])];
let (_dir, _provider, reader) = common::build_index(docs).await... |
6f352e4a6207add2164ea972f8ea5b2b2b85e38ef82c9c20f843ad94d5585014 | Rust | 1,857 | 56 | use crate::arrow::flusher::ArrowBlockfileFlusher;
use crate::arrow::types::{ArrowWriteableKey, ArrowWriteableValue};
use crate::key::KeyWrapper;
use crate::memory::reader_writer::MemoryBlockfileFlusher;
use crate::memory::storage::Writeable;
use chroma_error::ChromaError;
use super::{Key, Value};
#[allow(clippy::larg... |
e0480fa9fdfe211c90631eca6a7de6edaa636f3bfe153162cc650e36d9185018 | Rust | 1,863 | 56 | use std::str::FromStr;
use chroma_types::{chroma_proto, CollectionUuid, ConversionError, SegmentScope};
use crate::compactor::{OneOffCompactMessage, RebuildMessage};
impl TryFrom<chroma_proto::CompactRequest> for OneOffCompactMessage {
type Error = ConversionError;
fn try_from(value: chroma_proto::CompactRe... |
6919324b732673d5510adb820b06150b09abed011a06e798fd7f1c96f3972516 | Rust | 1,903 | 56 | use async_trait::async_trait;
use chroma_system::ComponentHandle;
use chroma_types::chroma_proto::{
fn_consumer_server::{FnConsumer, FnConsumerServer},
FnConsumerInProgressJobInfo, ListFnConsumerInProgressJobsRequest,
ListFnConsumerInProgressJobsResponse,
};
use tonic::{Request, Response, Status};
use supe... |
700db5cc760402484c819c226dfbd63491e048d17b419e370152faf3bf463231 | Rust | 1,958 | 76 | use std::time::Duration;
use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_log::Log;
use chroma_system::{Operator, OperatorType};
use chroma_types::{CollectionUuid, TopologyName};
use thiserror::Error;
use tokio::time::{error::Elapsed, timeout};
/// The `PurgeDirtyLog` operator add... |
4cb6d7e304fc1e29d3e77a768dc1c33e5591da1c84401306c6486d047e067e3e | Rust | 1,981 | 74 | use std::collections::HashMap;
use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::quantized_spann::{
QuantizedSpannSegmentError, QuantizedSpannSegmentReaderShard,
};
use chroma_system::{Operator, OperatorType};
use chroma_types::QuantizedClusterOwned;
use futures::future... |
2cba3f029b147fca004b2736ec45cdac82059ac9f62771d29379f0b8e207be1c | Rust | 1,996 | 55 | use serde::{Deserialize, Serialize};
/// The configuration for the memberlist provider.
/// # Options
/// - CustomResource: Use a custom resource to get the memberlist
#[derive(Deserialize, Clone, Serialize, Debug)]
pub enum MemberlistProviderConfig {
#[serde(alias = "custom_resource")]
CustomResource(CustomRe... |
f056962d549807688c83b76f1cbcbe4cf21216a79e37db10500fd41fb1c52133 | Rust | 2,029 | 46 | use chroma_error::{ChromaError, ErrorCodes};
use chroma_types::{
Base64DecodeError, CollectionConfigurationToInternalConfigurationError, GetCollectionError,
UpdateCollectionError,
};
use thiserror::Error;
// Generic HTTP server error types live in `frontend-core::errors` so that any
// HTTP frontend in this wo... |
3184a24e865b5b989f45e4178500d2866f53560d630507291e1a5f57f99466b1 | Rust | 2,031 | 61 | #![recursion_limit = "256"]
use chroma_benchmark::benchmark::{bench_run, tokio_multi_thread};
use chroma_log::test::{upsert_generator, LoadFromGenerator};
use chroma_segment::test::TestDistributedSegment;
use chroma_system::Operator;
use chroma_types::operator::Limit;
use chroma_types::{Chunk, SignedRoaringBitmap};
us... |
aafdeedd129e2e768b39c63aeac310beed7bcce53ec1eaa0614f27a7943f4b3a | Rust | 2,038 | 69 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, Limits, LogPosition, LogReader, LogReaderOptions, LogWriter,
LogWriterOptions, SnapshotOptions,
};
#[tokio::test]
async fn test_k8s_integration_83_bootstrap() {
let options = LogWriterOptions {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.