sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e77acea8cea1ac68ef8f95f7caf60d08b8a4e0797cd38bf16a5a4a5f84dbd7ac | Rust | 5,701 | 165 | use thiserror::Error;
/// A token instance is a unique value containing a trigram, an offset ID, and optionally a position within a document.
/// These three attributes are packed into a single u128 value:
/// - The trigram is a 63-bit value, packed into the top 64 bits.
/// - The offset ID is a 32-bit value, packed i... |
c9625d3153a696e8e780b62e59a399ce706dac5a64bcb4a97d73bff11fa7473a | Rust | 5,725 | 149 | use std::sync::Arc;
use std::time::Duration;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, FragmentIdentifier, FragmentManagerFactory, FragmentSeqNo, LogPosition,
LogReaderOptions, LogWriter, LogWriterOptions, Manifest, ManifestManagerFactory,
};
mod common;
use co... |
b01d1c9a31a5037bd01bebaa7e31972103e49a191ad28d7f1711b88b811182b8 | Rust | 5,751 | 169 | use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::{
blockfile_metadata::MetadataSegmentError,
blockfile_record::{
ApplyMaterializedLogError, RecordSegmentReader, RecordSegmentReaderShardCreationError,
},
types::{ChromaSegmentWriter, LogMaterializerErr... |
d17e9bcbdbc990db3886b13cdad691e7bed6f5638a0e83a1ce00e49057b09684 | Rust | 5,774 | 211 | use chrono::Utc;
use s3heap::{HeapPruner, HeapReader, HeapWriter, Limits};
mod common;
use common::{setup_test_environment, verify_bucket_count, TestItemBuilder};
#[tokio::test]
async fn test_k8s_integration_04_prune_completed_items() {
let prefix = "test_k8s_integration_04_prune_completed";
let (storage, sc... |
2cc054f087fce6b0936eabf000dd23d84a03355a071d09e4db4c0e15b62de880 | Rust | 5,861 | 187 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, FragmentManagerFactory, LogPosition, LogReader, LogReaderOptions,
LogWriter, LogWriterOptions, Manifest, ManifestManagerFactory,
ReplicatedManifestManagerFactory, SnapshotOptions,... |
504f782b9d9df77bb924ac9d1c61efcea8da1fe4071ec856e437c9316d2a56b9 | Rust | 5,866 | 150 | use figment::Jail;
use serial_test::serial;
use worker::config::RootConfig;
#[test]
#[serial]
#[allow(clippy::result_large_err)]
fn test_config_without_cache_directive() {
Jail::expect_with(|jail| {
let _ = jail.create_file(
"random_path.yaml",
r#"
query_service:
... |
4428a214ebebe6f3bbdaebed44edc1a848b98fa06a0bc0363d4d205a92f8ae1f | Rust | 5,890 | 179 | //! Model snapshots, `anthropic-beta` flags, and the tunable request knobs.
//!
//! These are the parts of the request that the caller chooses, separated
//! from the parts the agent loop builds.
use std::str::FromStr;
/// Opt-in feature flags sent in the `anthropic-beta` header.
///
/// The header is a comma-separat... |
40c7808e23a526a0dff970131505d27ae53ab8ee0758ac0b25f6778c6e9887bb | Rust | 5,930 | 180 | use crate::commands::profile::ProfileError;
use crate::utils::{CliConfig, CliError, Profile, Profiles, UtilsError};
use std::fs;
use std::path::PathBuf;
pub trait ConfigStore {
fn read_profiles(&self) -> Result<Profiles, CliError>;
fn write_profiles(&self, profiles: &Profiles) -> Result<(), CliError>;
fn r... |
3223a65a8518d6476c91731c6865bc08c3cd2d130c3dc0e9857fb0307c631949 | Rust | 6,019 | 195 | #![allow(missing_docs)]
use std::collections::BTreeMap;
use chroma::types::Metadata;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use super::chunkset::{push_chunkset, push_json_record, read_chunkset, read_json};
use super::citations::{read_citations, write_citations};
use super::error::TrajectoryError;
use s... |
1b584c859ccf9ebc6f27f363d59e24bf9ae757c2ec5d3338c2a4bd0457fd2142 | Rust | 6,067 | 199 | use crate::{arrow::types::ArrowWriteableValue, key::CompositeKey};
use std::collections::BTreeMap;
pub struct BTreeBuilderStorage<V: ArrowWriteableValue> {
storage: BTreeMap<CompositeKey, V>,
}
impl<V: ArrowWriteableValue> BTreeBuilderStorage<V> {
fn add(&mut self, key: CompositeKey, value: V) {
self.... |
595f04e5fd8473ad384bb1c73d54b71585b4df2f4e7ca3a44b4641bbab983b75 | Rust | 6,128 | 195 | #![recursion_limit = "256"]
mod compactor;
pub mod fn_consumer;
mod server;
mod utils;
pub mod work_queue;
use chroma_config::registry::Registry;
use chroma_config::Configurable;
use chroma_memberlist::memberlist_provider::{
CustomResourceMemberlistProvider, MemberlistProvider,
};
use clap::Parser;
use compactor:... |
3fd1f6af941b1b5a7d2f53eb975cd1467f387a977cb76f74a7d9c720c51a9b3c | Rust | 6,149 | 198 | #![allow(missing_docs)]
use std::collections::BTreeMap;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use super::error::TrajectoryError;
use super::ids::{encode_index, sha256_base36};
use super::limits::{CHUNKSET_BASE_MAX_BYTES, CHUNK_INDEX_WIDTH, KEY_MAX_BYTES, VALUE_M... |
d2edc97cd3aaa690410b3c7c4c777d445b20a5d415a7f76a9d4a517dcf413053 | Rust | 6,167 | 199 | //! Foundation API HTTP server.
//!
//! Per ADR "Foundation API: Long-Term Home", this crate hosts the foundation
//! HTTP route surface (`/api/{ask,recall,brief,init}`, future
//! sync-domain endpoints). It depends on `frontend-core` for Axum scaffolding,
//! middleware, the `AuthenticateAndAuthorize` trait, config pr... |
c5227e5302870e00c5c27228d590d8d85c56afdd2f377dfba0be9e9ff55daeaf | Rust | 6,196 | 127 | //! Metrics for storage operations.
use opentelemetry::metrics::{Counter, Histogram};
/// Metrics for tracking S3 and object storage operations.
///
/// All metrics are registered under the `chroma.storage` meter.
#[derive(Clone)]
pub(crate) struct StorageMetrics {
/// Number of S3 get operations.
pub(crate) ... |
858936ed305fc37d9b9390abaeee2b05947f13394edeb530fab7009a25a517fb | Rust | 6,241 | 200 | use crate::config::RootConfig;
use crate::fn_consumer::fn_consumer_manager::FnConsumerManager;
use crate::fn_consumer::grpc::FnConsumerGrpcServer;
use crate::work_queue::work_queue_client::WorkQueueClient;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_config::registry::Registry;
use chroma_config::Conf... |
c5c5515eb0ddb641fc6bc00f9c88b95376e3ea4ae52034f569c44426ac03782f | Rust | 6,303 | 197 | use std::{
io::SeekFrom,
ops::{Bound, RangeBounds},
};
use anyhow::{anyhow, Ok, Result};
use tokio::{
fs::File,
io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, BufReader},
};
use super::util::get_or_populate_cached_dataset_file;
pub struct Sift1MData {
pub base: BufReader<File>,
pub query: Bu... |
1741a8ed77cb1f2370b16b7cd63335458da278e0352a66a2e555ec56b4199bdb | Rust | 6,310 | 179 | use std::sync::Arc;
use chroma_storage::{DeleteOptions, GetOptions, Storage, StorageError};
use crate::cursors::CursorStore;
use crate::interfaces::{FragmentPointer, ManifestPublisher};
use crate::manifest::{snapshot_prefix, snapshot_setsum, unprefixed_manifest_path};
use crate::{
parse_fragment_path, CursorStore... |
a39a8ed81626c2d1552dd236cc901929e464180a8f2bc68cd7b2d8dbb9856819 | Rust | 6,348 | 180 | mod mocks;
use std::sync::Arc;
use setsum::Setsum;
use uuid::Uuid;
use proptest::prelude::{ProptestConfig, Strategy};
use rand::RngCore;
use wal3::{
Error, Fragment, FragmentIdentifier, FragmentUuid, Garbage, LogPosition, Manifest, Snapshot,
SnapshotPointer,
};
use mocks::MockManifestPublisher;
/// A muta... |
28be6e0e3991801753927f532d6bbb45089a5ca056bca0f5817dc7f023a14a26 | Rust | 6,519 | 171 | use chroma_types::chroma_proto::{
compactor_client::CompactorClient, CollectionIds, CompactRequest,
GetCollectionAssignmentRequest, ListInProgressJobsRequest, RebuildRequest, SegmentScope,
};
use clap::{Parser, Subcommand};
use std::io::Write;
use std::time::Duration;
use thiserror::Error;
use tonic::transport:... |
f6120029fb19d8bc6989531763af5d44b57cd390abeb2aa9ae070af45f2c8a53 | Rust | 6,538 | 184 | //! Extended RaBitQ quantization for approximate nearest neighbor search.
//!
//! ## Assumptions
//!
//! Data, centroid, and query vectors have been transformed by the same random rotation.
//!
//! ## Notation
//!
//! | Symbol | Description |
//! |--------|-------------|
//! | `c` | Cluster centroid |
//! | `d` | Origi... |
4c7fa5e3fcd0c6b75ed337bb3c2ec88a6b3f81fdd6b484505153303ddc3fef2d | Rust | 6,547 | 189 | //! Rust client library for the Chroma AI-native database.
//!
//! This crate provides a comprehensive, production-ready client for interacting with [Chroma](https://www.trychroma.com),
//! the open-source data infrastructure for AI. Chroma transforms embeddings into queryable databases,
//! enabling similarity search,... |
e1b58b62d01a110d75c78f750c85ac3c017ffab31aadb00f1ff9d5d56b8b2b73 | Rust | 6,555 | 182 | //! Agent query budget debits (CHR-773).
//!
//! After each `/api/agent` response stream completes, foundation-api prices
//! the run's per-model token usage against the Foundation price card and
//! posts one debit to the sync-frontend's `POST /foundation/budget-debit`,
//! on a detached task with the querying caller'... |
128e18fae5fcf0b1b0d56336a94641b6caad937df3e0e23a19451cde4fa8f470 | Rust | 6,561 | 180 | use crate::common;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_blockstore::{
arrow::provider::BlockfileReaderOptions, test_arrow_blockfile_provider, BlockfileWriterOptions,
};
use chroma_index::sparse::maxscore::{MaxScoreReader, SPARSE_POSTING_BLOCK_SIZE_BYTES};
use chroma_index::sparse::types::e... |
d3e5c85fdcb09a44c1e30b73a105d25813e68670d77efe06752aefec8bcc71b0 | Rust | 6,617 | 204 | use async_trait::async_trait;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::bloom_filter::BloomFilterManager;
use chroma_system::{
wrap, ChannelError, ComponentContext, ComponentHandle, Dispatcher, Handler, Orchestrator,
OrchestratorContext,... |
f2ea95e9e025c91c7be5f7aab8200f86fe2b7a14fcd47d8373386bc6485caf64 | Rust | 6,642 | 170 | use crate::{
arrow::{
block::delta::{
single_column_size_tracker::SingleColumnSizeTracker,
single_column_storage::SingleColumnStorage, BlockStorage, UnorderedBlockDelta,
},
types::{ArrowReadableValue, ArrowWriteableKey, ArrowWriteableValue},
},
key::KeyWrapper... |
db426c2907c886f4b385f097010de8a65360be25970b49eb4b1e358039feab2a | Rust | 6,659 | 233 | #![recursion_limit = "256"]
#[allow(dead_code)]
mod load;
use chroma_benchmark::benchmark::{bench_run, tokio_multi_thread};
use chroma_config::{registry::Registry, Configurable};
use chroma_segment::test::TestDistributedSegment;
use chroma_system::{ComponentHandle, Dispatcher, Orchestrator, System};
use criterion::{c... |
c8a356246182984b943e0c9a7f3146f094c8465f4d21a44d0781363f9cbddc7c | Rust | 6,660 | 200 | use chroma_types::SparseVector;
use thiserror::Error;
use crate::embed::bm25_tokenizer::Bm25Tokenizer;
use crate::embed::murmur3_abs_hasher::Murmur3AbsHasher;
use crate::embed::{EmbeddingFunction, TokenHasher, Tokenizer};
/// Error type for BM25 sparse embedding.
///
/// This is an empty enum (uninhabited type), mean... |
23882e444a396fd2ebdec9088d9708e27c3b51bec119e0949c71401538d20a18 | Rust | 6,677 | 196 | use crate::common;
use chroma_index::sparse::maxscore::PostingCursor;
use chroma_index::sparse::types::encode_u32;
use chroma_types::SignedRoaringBitmap;
fn all_mask() -> SignedRoaringBitmap {
SignedRoaringBitmap::Exclude(Default::default())
}
/// Lazy cursor with only some blocks loaded. Unloaded blocks should
/... |
94d2bbdb33681c2d7fe5912224fa26879d8478e492af3368b03f1204bddf5bee | Rust | 6,692 | 212 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, FragmentManagerFactory, LogPosition, LogReader, LogReaderOptions,
LogWriter, LogWriterOptions, Manifest, ManifestManagerFactory,
ReplicatedManifestManagerFactory, SnapshotOptions,... |
b771aaae26e0f86be30146d24ea6311b29e71b0caa5a39b8e542f4864540a6ee | Rust | 6,767 | 192 | //! Parses an Anthropic Messages API response into an [`Action`] and the
//! token counts that back billing.
//!
//! Kept free of I/O so it can be tested without network access.
use serde_json::Value;
use super::AnthropicModel;
use crate::error::AgentError;
use crate::inference::InferenceUsage;
use crate::tool::ToolS... |
9d7a2adcadd5576c6bc0a0d5c6a91c5fa58e032b940096babb17de6d54492b40 | Rust | 6,831 | 195 | use async_trait::async_trait;
use chroma_jemalloc_pprof_server::spawn_pprof_server;
use chroma_system::ComponentHandle;
use chroma_types::chroma_proto::{
compactor_server::{Compactor, CompactorServer},
CompactRequest, CompactResponse, GetCollectionAssignmentRequest,
GetCollectionAssignmentResponse, InProgre... |
546426ebabfeb60bf3bd81b2e1800f0fb72b728089ffd1fd23426260b76fada5 | Rust | 6,906 | 208 | use std::path::PathBuf;
use anyhow::{Context, Result};
use arrow::{
array::AsArray,
datatypes::{Float32Type, Int32Type},
record_batch::RecordBatch,
};
use futures::{stream, Stream, StreamExt, TryStreamExt};
use hf_hub::api::tokio::Api;
use parquet::arrow::ParquetRecordBatchStreamBuilder;
use sprs::CsVec;
u... |
9a8052ca46cc99b2d46bb1365481fbe1046895e4450061e2991bdecdaddde8c6 | Rust | 6,947 | 186 | /// Module for generating Rust operator constants from Go source code.
///
/// This module is used by the build script to automatically generate operator constants
/// by parsing the Go constants file at build time.
use std::fs;
use std::path::Path;
pub fn generate_operator_constants() -> Result<(), Box<dyn std::error... |
47595d0ea7055f5611879735e02786b907bd7d4c745f489d1ebd9de4df3983f4 | Rust | 6,951 | 170 | #[cfg(test)]
mod tests {
use crate::{
arrow::{
config::{BlockManagerConfig, TEST_MAX_BLOCK_SIZE_BYTES},
provider::{ArrowBlockfileProvider, BlockfileReaderOptions},
},
BlockfileWriterOptions,
};
use chroma_cache::new_cache_for_test;
use chroma_storage::{loc... |
8513f6eb184aa9beca8ab130d218f39202ecbc71623f516df930b12b3d94c93c | Rust | 6,996 | 202 | //! Anthropic Messages API inference model (non-streaming, thinking enabled).
//!
//! Split by request lifecycle: [`config`] holds the caller-chosen model,
//! beta flags and knobs, [`request`] builds the Messages API body,
//! [`response`] parses what comes back, and [`diagnostics`] renders a
//! redacted copy of a fa... |
0f419629f3c0d77ace2c976dbc80b5ec924a25fcc03fb83d52711648f0a9b2a0 | Rust | 7,036 | 221 | use crate::arrow::provider::BlockfileReaderOptions;
use crate::arrow::root::RootReader;
use crate::BlockfileWriterOptions;
use super::arrow::block::Block;
use super::arrow::provider::ArrowBlockfileProvider;
use super::arrow::types::{
ArrowReadableKey, ArrowReadableValue, ArrowWriteableKey, ArrowWriteableValue,
};
... |
ae54ea207a4da664f9df60339007903399b9bd2c93a6e61b7e228472754adda5 | Rust | 7,041 | 202 | use crate::CollectionRequest;
use chroma_frontend::impls::in_memory_frontend::InMemoryFrontend;
use chroma_types::{Collection, CreateCollectionRequest, DatabaseName, GetRequest, IncludeList};
use proptest::prelude::*;
use proptest_state_machine::ReferenceStateMachine;
use std::sync::Arc;
use super::arbitrary::Collecti... |
1f3c46bda7cdfa5aacc935d19dae99b952c22860c0fd1c71c19719519c6e4166 | Rust | 7,202 | 193 | use std::fmt::Debug;
use std::hash::Hash;
use ::foyer::{StorageKey, StorageValue};
use chroma_error::{ChromaError, ErrorCodes};
use serde::{Deserialize, Serialize};
use thiserror::Error;
mod async_partitioned_mutex;
pub mod foyer;
pub mod nop;
mod unbounded;
use crate::nop::NopCache;
use crate::unbounded::UnboundedC... |
a18b8dce0d6b9e8cf176dc92a3e062040a534e3597a0e4aa237b6b1aa8cc8ebe | Rust | 7,222 | 235 | use std::sync::Arc;
use chroma_storage::{s3_client_for_test_with_new_bucket, GetOptions};
use chrono::{DateTime, Duration, DurationRound, TimeDelta, Utc};
use s3heap::{HeapWriter, Schedule};
mod common;
use common::{create_test_triggerable, test_nonce, MockHeapScheduler};
#[tokio::test]
async fn test_k8s_integratio... |
a91026318959508c39c91e3734c39fa8a8910e8ec08d5e35110a1dd1f965f62b | Rust | 7,250 | 209 | use chroma_types::chroma_proto;
use clap::{Parser, Subcommand};
use prost_types::value::Kind;
use tonic::transport::Channel;
#[derive(Parser)]
#[command(name = "chroma-function-manager")]
#[command(about = "CLI client for Chroma coordinator attached function management", long_about = None)]
struct Cli {
#[arg(
... |
f9d5e89f2dc1b153bb13c94e77ec25798abab35a891822d9eba06392f7315239 | Rust | 7,282 | 221 | #![allow(dead_code)]
use chroma_blockstore::provider::BlockfileProvider;
use chroma_blockstore::{
arrow::provider::BlockfileReaderOptions, test_arrow_blockfile_provider, BlockfileWriterOptions,
};
use chroma_index::sparse::maxscore::{
MaxScoreReader, MaxScoreWriter, SPARSE_POSTING_BLOCK_SIZE_BYTES,
};
use chro... |
09455d897bc27470abf606beb2abfebd87f644b23d167f5ab91101b7091a938f | Rust | 7,386 | 213 | //! Shared HTTP routes that any frontend binary in this workspace can embed.
//!
//! These cover the generic "System" endpoints (heartbeat, healthcheck,
//! pre-flight checks, version) and the auth identity ("whoami") endpoint —
//! the handlers that are identical across binaries. A binary supplies backing
//! state im... |
d8ea83e26cdbbbffb79c1a96f9a4f32209ce8e865d6598e94ba53c5dda7b2025 | Rust | 7,426 | 214 | // This implementation mirrors the rendezvous hash implementation
// in the go and python services.
// The go implementation is located go/internal/utils/rendezvous_hash.go
// The python implementation is located chromadb/utils/rendezvous_hash.py
use chroma_error::{ChromaError, ErrorCodes};
use std::io::Cursor;
use th... |
93e74a1d96e9883f5053d808b729a592c58c2a9972de564250681986707edd9b | Rust | 7,499 | 221 | use std::collections::HashSet;
use std::fmt::{Display, Formatter};
use std::future::{ready, Future};
use std::pin::Pin;
use axum::http::HeaderMap;
use axum::http::StatusCode;
use chroma_api_types::GetUserIdentityResponse;
use chroma_types::Collection;
use serde::Serialize;
#[derive(Clone, Copy, Debug, Eq, PartialEq,... |
b1d24dbf48d20673ca0dee985369a11e8a847a9ee4dd97e156cdd8cfe48feebe | Rust | 7,565 | 234 | use crate::config::MigrationHash;
use core::str;
use regex::Regex;
use rust_embed::Embed;
use sha2::{Digest, Sha256};
use std::{borrow::Cow, sync::LazyLock};
use thiserror::Error;
///////////// Migration Types //////////////
// A migration is a single SQL file that is executed to update the database schema
// ## Fiel... |
5883e8fd532165296c75a0f69f97228f1c7ecc0614d3b6599c841cb665d5ecb9 | Rust | 7,568 | 229 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, FragmentManagerFactory, Limits, LogPosition, LogReader,
LogReaderOptions, LogWriter, LogWriterOptions, Manifest, ManifestManagerFactory,
ReplicatedManifestManagerFactory, Snapshot... |
ffec0e73ffea788cc09a7797878db76c4232b82c42c631d2703d1509c0f8d618 | Rust | 7,603 | 196 | //! SPLADE sparse embedding for wiki pages.
//!
//! A SPLADE sparse vector is computed client-side for every chunk and stored
//! under the `sparse_embedding` metadata key; the dense Qwen vector is produced
//! by the collection's schema-bound embedding function on `add`. Build a Chroma
//! Cloud SPLADE embedding funct... |
31b8a5a809564bcf369eb92acbc5c52c1fefa59a855f965a358df6b2a1206c14 | Rust | 7,636 | 224 | use crate::execution::operators::projection::ProjectionInput;
use async_trait::async_trait;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::ChromaError;
use chroma_segment::bloom_filter::BloomFilterManager;
use chroma_system::Operator;
use chroma_types::{
operator::{KnnProjection, KnnProjectio... |
212a81850493f8adce15100fc3281cf820b57398cc0f99bc3188a7335ed0c84a | Rust | 7,737 | 254 | use std::cmp::Ordering;
use std::collections::BinaryHeap;
use base64::{prelude::BASE64_STANDARD, DecodeError, Engine};
use thiserror::Error;
pub const DEFAULT_BLOCK_SIZE: u32 = 128;
// NOTE: This is a temporary hack to store dimension id in prefix of blockfile.
// This should be removed once we have generic prefix t... |
1cd3971d4dd5bde4a343e982fa1096d9139cc6d9112e93f41ac0702090a69ecf | Rust | 7,773 | 254 | use super::scheduler::Scheduler;
use super::ComponentContext;
use super::ComponentRuntime;
use super::ComponentSender;
use super::ConsumableJoinHandle;
use super::Message;
use super::{executor::ComponentExecutor, Component, ComponentHandle, Handler, StreamHandler};
use crate::utils::thread_stack_size_bytes;
use futures... |
40e6e91034b8cc42af0488b5fa1b6d52ab920551fc0754d71e5471e47f04af21 | Rust | 7,813 | 204 | //! Renders a failed request as a log-safe copy: the full structure and
//! provider knobs are kept, while prompts, retrieved text, reasoning and
//! tool parameters are replaced with their sizes.
use serde_json::{json, Value};
use super::ANTHROPIC_VERSION;
/// Retain the complete request structure and provider knob... |
6082d9b14517b88c293763d3548d41ec918e776b4336c4e9850316a0cc43206a | Rust | 7,815 | 213 | use super::{BlockfileError, Key, Value};
use crate::arrow::blockfile::ArrowBlockfileReader;
use crate::arrow::types::{ArrowReadableKey, ArrowReadableValue};
use crate::key::{InvalidKeyConversion, KeyWrapper};
use crate::memory::reader_writer::MemoryBlockfileReader;
use crate::memory::storage::Readable;
use chroma_error... |
05673b187f6a2dd9832f5f4e0053f1289ff53cbe97702250b1c58cdf0de09c91 | Rust | 7,823 | 220 | use backon::ConstantBuilder;
use chroma_cache::{AysncPartitionedMutex, Cache, CacheError, Weighted};
use chroma_config::Configurable;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_sysdb::SysDb;
use chroma_types::{
CollectionAndSegments, CollectionUuid, DatabaseName, GetCollectionWithSegmentsError, Schema,... |
369451f133594f0b5ab760f98dcc73ad6f10ecd3e5621ccbb1295af104ed1062 | Rust | 7,832 | 252 | use crate::client::dashboard_client::DashboardClientError;
use crate::commands::browse::BrowseError;
use crate::commands::copy::CopyError;
use crate::commands::db::DbError;
use crate::commands::install::InstallError;
use crate::commands::login::LoginError;
use crate::commands::profile::ProfileError;
use crate::commands... |
3da59a67c93990db2cdfa7e1b141347d3e446eed807b9df4bbd03af620b27aed | Rust | 7,863 | 232 | use httpmock::prelude::*;
use serde_json::json;
use super::rates::TokenRate;
use super::*;
const LAUNCH_RATES: TokenRates = TokenRates {
planner: TokenRate {
input_micros_per_m_tokens: 3_000_000,
output_micros_per_m_tokens: 18_000_000,
cache_read_micros_per_m_tokens: None,
cache_wr... |
fedfb255d888f5096272b7a7e9d5c74697eb8a0b5e64381f81352fff62605fba | Rust | 7,869 | 230 | use std::sync::Arc;
use chroma_storage::ETag;
use chroma_storage::Storage;
use crate::interfaces::s3::ManifestManager;
use crate::interfaces::{ManifestConsumer, ManifestWitness};
use crate::Cursor;
use crate::CursorStore;
use crate::CursorStoreOptions;
use crate::CursorWitness;
use crate::Error;
use crate::FragmentSe... |
2aad61e10be0fcb27af7bef5d22b30634dcd755e3ba2e73fa2824b475031aab2 | Rust | 7,890 | 242 | use axum::extract::MatchedPath;
use axum::http::{header, HeaderMap, Request, Response};
use axum::Router;
use futures::future::BoxFuture;
use opentelemetry::propagation::Extractor;
use opentelemetry::trace::TraceContextExt;
use opentelemetry::{global, Context};
use std::time::Duration;
use tower::Service;
use tower_htt... |
6fef6b90614a9d96c318f7dfaecc771c6f577de9ada6019b521b4b3af24e9b8f | Rust | 7,927 | 209 | use std::fmt::Debug;
use crate::client::config::GrpcHeapServiceConfig;
use async_trait::async_trait;
use chroma_config::assignment::assignment_policy::AssignmentPolicy;
use chroma_config::registry::Registry;
use chroma_config::Configurable;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_memberlist::client_man... |
93f5f25476e061233a2cc990aef234cc53224c1aa0f0b3b59fab62ebac2e0578 | Rust | 7,957 | 265 | #![recursion_limit = "256"]
#[allow(dead_code)]
mod load;
use chroma_benchmark::{
benchmark::{bench_run, tokio_multi_thread},
datasets::sift::Sift1MData,
};
use chroma_config::{registry::Registry, Configurable};
use chroma_segment::test::TestDistributedSegment;
use chroma_system::{ComponentHandle, Dispatcher,... |
f66e325b5dcb6f034cbbf0b81172b98434d310016f98738bd7cb5bedcad8ec16 | Rust | 7,987 | 244 | //! K8s integration tests for fork count functionality.
//!
//! These tests require a deployed Chroma cluster with gRPC sysdb.
//! They are designed to run in a Kubernetes environment where the
//! coordinator service is available.
//!
//! To run these tests locally, ensure you have a local cluster running
//! or confi... |
615030c211ae62f2b7a953eb48d0863fd13c8e859a79b32d7769da4ce44f3582 | Rust | 8,010 | 231 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, Cursor, CursorName, CursorStore, CursorStoreOptions, Error,
GarbageCollectionOptions, LogPosition, LogReaderOptions, LogWriter, LogWriterOptions,
SnapshotOptions,
};
/// GC fails with NoSuchCursor... |
1a38fa1d445f4bc11b79cda99ea7bf3711a4134f80ca98c551ba0be1e7b8d898 | Rust | 8,119 | 218 | //! Typed model of the deep-research agent's event schema.
//!
//! [`AgentEvent`] is what we parse *from* the deep-research dependency;
//! [`SubagentSearchEvent`] is what we emit *to* our callers. Both share the
//! `action`/`observation` payload structs so re-emitting a step event is a
//! faithful, typed round-trip ... |
85ae36a39d1931acac18357260d1384c0f718858cdf0e950416c78c5a9d86b87 | Rust | 8,164 | 234 | #![recursion_limit = "256"]
use anyhow::Result;
use chroma_benchmark::datasets::types::Record;
use chroma_benchmark::datasets::{
ms_marco_queries::MicrosoftMarcoQueriesDataset, scidocs::SciDocsDataset, types::RecordDataset,
};
use chroma_blockstore::arrow::config::BlockManagerConfig;
use chroma_blockstore::arrow::... |
6728ff50ae789dad20cdbde139b539720886c3b899119b1f37665364f9502c7d | Rust | 8,166 | 231 | #![recursion_limit = "256"]
use std::{
env,
process::{Command, Output},
sync::Arc,
};
use chroma_blockstore::arrow::config::BlockManagerConfig;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_cache::{new_cache_for_test, new_non_persistent_cache_for_test};
use chroma_config::{registry::Regis... |
92401ff09c2287cf78d556feb1b8c205c43d235b1cb95567fa6de74c5c309d5b | Rust | 8,192 | 256 | use super::config::StorageConfig;
use super::StorageConfigError;
use async_trait::async_trait;
use bytes::Bytes;
use chroma_config::registry::Registry;
use chroma_config::Configurable;
use chroma_error::ChromaError;
use futures::{Stream, StreamExt};
use std::hash::{Hash, Hasher};
use std::path::PathBuf;
use std::sync::... |
77d1e31cea3007d713aa54bb61551d716beb338e209ff2e77241b321e8a8bc19 | Rust | 8,234 | 250 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, Cursor, CursorName, CursorStoreOptions, FragmentManagerFactory,
GarbageCollectionOptions, Limits, LogPosition, LogReader, LogReaderOptions, LogWriter,
LogWriterOptions, ManifestMa... |
25e527a8556e8dfb80c3c4ca5a06c0b437d352121128c803078f81b9e5179621 | Rust | 8,320 | 244 | //! Load generated trajectories into Chroma and verify projected reads.
//!
//! Run against a Chroma server that supports conditional transactions:
//!
//! ```bash
//! CHROMA_ENDPOINT=http://localhost:8000 \
//! cargo run -p foundation-api --example trajectory-load-chroma -- \
//! --collection generated_trajectories ... |
dfafd586bcea3da4b338d6968a5994ba624d80f0e7f79a05242ce9f7174d6e12 | Rust | 8,332 | 248 | use std::sync::Arc;
use tokio::sync::Barrier;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, FragmentManagerFactory, LogPosition, LogReader, LogReaderOptions,
LogWriter, LogWriterOptions, Manifest, ManifestManagerFactory,
ReplicatedManifestManag... |
48e654bcae9e2d69f6b95e3349630df52669f4187abe8b08333c7a65aa35e726 | Rust | 8,339 | 214 | //! This test covers a case where the root snapshot to be installed also exists as a snapshot to
//! remove. In the buggy case, this would yield a 0000 != XXXX error because the setsum to discard
//! exactly matched the root.
use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
... |
90dfe0cbb79f4d201462f361de3acf8e8c8e62c4e4f7dc077456bdfcfae74a17 | Rust | 8,364 | 252 | use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::ChromaError;
use chroma_system::{Operator, OperatorType};
use chroma_types::{Segment, SegmentType};
use futures::{stream::FuturesUnordered, StreamExt};
use thiserror::Error;
use tonic::async_trait;
#[derive(Debug, Default)]
pub struct PrefetchSegmen... |
df259d94fc5cf9ea218a6a56ea5a664033d44e571c6f55a0c89e74c2acce76ba | Rust | 8,367 | 236 | use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_system::{Operator, OperatorType};
use chroma_types::chroma_proto::{CollectionVersionFile, VersionListForCollection};
use chrono::{DateTime, Utc};
use humantime::format_duration;
use std::{sync::Arc, time::Duration};
use thiserror::Err... |
f929bb6e895fbae8154d51b9ef81bd2f2536cd6490f127c3634ab4cc58c38f1e | Rust | 8,403 | 235 | use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TaskRunnerConfig {
#[serde(default = "TaskRunnerConfig::default_enabled")]
pub enabled: bool,
#[serde(default = "TaskRunnerConfig::default_compaction_manager_queue_size")]
pub compaction_manager_queue_size: ... |
368e6bf2db0215e92f6f691c561539c8b486106d62058a38b692730d1fad501c | Rust | 8,446 | 256 | //! Synchronous unit tests: event parsing/serialization, SSE line decoding, and
//! request-body building. No network or async runtime.
use super::super::events::{
parse_ranked_documents, ActionData, AgentEvent, ErrorData, RankedDocument, SubagentSearchEvent,
UsageData,
};
use super::super::{
format_ranked... |
c1c0dd664f53a92d825b85409aac82bf3a44319535f6426309a509dc88785684 | Rust | 8,454 | 244 | //! The tool abstraction.
//!
//! You implement [`Tool`] (a typed trait with associated `ModelSuppliedParams`
//! and `RuntimeParams`); a blanket impl turns any `Tool` into the object-safe
//! [`DynTool`] stored in a [`ToolSet`]. The params JSON schema is derived
//! automatically from `ModelSuppliedParams` via `schema... |
dfe6ed32e38baee8acf906ccc9ed0247595f8d49247cfdf8063fa78511392396 | Rust | 8,470 | 232 | #![allow(missing_docs)]
use sha2::{Digest, Sha256};
use uuid::Uuid;
use super::error::TrajectoryError;
use super::limits::{ITEM_ID_WIDTH, TID_WIDTH};
/// Encode a UUID into the fixed-width base36 trajectory identifier used in keys.
///
/// # Errors
///
/// Returns [`TrajectoryError::SizeLimit`] if the configured tra... |
19ffd0d43357384c04b8963c8a0113aa3d68cb7ab0d86da74e0092ada4e279b4 | Rust | 8,539 | 246 | //! Deterministic interleavings of GC runs. Local storage supplies durable files;
//! mutations are sequenced explicitly, so these tests do not rely on its CAS support.
use std::sync::Arc;
use chroma_storage::{test_storage, GetOptions, PutOptions, Storage};
use setsum::Setsum;
use wal3::{
create_s3_factories, unp... |
d7557bb827a483f431c281d86522368ad721f43b180182e0e4b82403f9653c0b | Rust | 8,546 | 292 | #![recursion_limit = "256"]
use std::collections::HashMap;
use std::time::Duration;
use chroma_benchmark::benchmark::{bench_run, tokio_multi_thread};
use chroma_benchmark::datasets::rust::TheStackDedupRust;
use chroma_log::test::{int_as_id, random_embedding};
use chroma_segment::test::TestDistributedSegment;
use chro... |
88cef661c1c0b9d64c5b6b40a2c63bd6267f73f6981440234dbf9620314acf6b | Rust | 8,648 | 285 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use chrono::Utc;
use s3heap::{HeapPruner, HeapReader, HeapWriter, Limits, Schedule};
mod common;
use common::{create_test_triggerable, test_nonce, test_time_at_minute_offset, MockHeapScheduler};
#[tokio::test]
async fn test_k8s_integration_... |
c50ede042a7e072c53046155faa167def6af88b22c605a7a7d205c3d2bc1c648 | Rust | 8,667 | 267 | //! Chroma Cloud embedding collection example.
//!
//! This example demonstrates the default Chroma Cloud Qwen dense embedding
//! function and Splade sparse embedding function by writing embedded records
//! to a Chroma collection and searching them back.
//!
//! # Running
//!
//! Source your environment first, then r... |
144b7a5dd0918b57aa2456d2955f3b63ba90baed3c4f2fb51ad0bc078888b577 | Rust | 8,677 | 237 | //! Exercise the actual gRPC client with a secondary SysDB configured.
use super::*;
use parking_lot::Mutex;
use std::{
convert::Infallible,
sync::Arc,
task::{Context, Poll},
};
use tonic::{
body::Body,
codegen::{http, BoxFuture},
server::{NamedService, UnaryService},
};
#[derive(Clone)]
struct... |
08ed286a1da63fdbe1c00d485ba65afd6630ac071f7e6d58896103bba87d2092 | Rust | 8,701 | 292 | use std::collections::BTreeMap;
use serde::de::Deserializer;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use uuid::Uuid;
const WIKI_WRITE_TOOLS: [&str; 3] = ["wiki_add_backlink", "wiki_apply_patch", "wiki_upsert_file"];
/// Represents the pruned trajectory data shown through reasoning views.
///
/// ... |
d710891eb01d0a2a2d07dc0b1c4384be624104a932db89e27e4466733b84f6b0 | Rust | 8,715 | 271 | use std::sync::Arc;
use std::time::Duration;
use tokio::sync::Mutex;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, Cursor, CursorName, CursorStoreOptions, Error, GarbageCollectionOptions,
LogReaderOptions, LogWriter, LogWriterOptions, Manifest, ManifestManagerFactor... |
17ea2933e606796c3bfc47b3742f8346aaac8cdeb1cec975f30c48d60d8e6a7f | Rust | 8,717 | 223 | use chroma_index::config::{HnswGarbageCollectionPolicyConfig, PlGarbageCollectionPolicyConfig};
use figment::Jail;
use worker::config::RootConfig;
#[test]
#[allow(clippy::result_large_err)]
fn test_missing_default_field() {
Jail::expect_with(|jail| {
let _ = jail.create_file(
"chroma_config.yam... |
69442ac554f536ad54bcb4e12e2d2506b0b1d17a0c453b601b59a08806dbece8 | Rust | 8,717 | 271 | //! Operator for GC. Fetches the collection version file from S3.
//!
//! Input:
//! - Version file path. Full file path without the bucket name.
//! - Storage
//!
//! Output:
//! - Version file content Vec<u8>
use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_storage::admissioncont... |
53fd34520de0ad824d54084625d6c235944c18e9804c87e1665e2cf2d079e9b8 | Rust | 8,756 | 281 | //! Loop-driver tests: drive [`drive_agent`] with stub inference models and
//! tools, asserting the emitted [`AgentSseEvent`] sequence (incl. the
//! tool-error-as-observation and inference-error paths) without any network.
use super::super::events::AgentSseEvent;
use super::super::{drive_agent, record_search_agent_u... |
4cbd126e9573085e4c33592e5120a9152c89f8953aa1283abffa7dc1576c2347 | Rust | 8,812 | 244 | use std::{collections::BTreeMap, mem::size_of, sync::Arc};
use arrow::{array::RecordBatch, util::bit_util};
use chroma_types::{QuantizedCluster, QuantizedClusterOwned};
use parking_lot::RwLock;
use crate::{
arrow::{
block::value::quantized_cluster_value::QuantizedClusterSizeTracker,
types::{ArrowW... |
085b232aebbd01eabb5bce2ca02819d11e368990bc4418c7137f6230e6981e95 | Rust | 8,844 | 239 | use serde::{Deserialize, Serialize};
use std::time::SystemTime;
use crate::CollectionUuid;
const MAX_EXACT_INTEGER_IN_F64: f64 = (1_u64 << 53) as f64;
fn prost_value_to_json(v: &prost_types::Value) -> serde_json::Value {
match &v.kind {
Some(prost_types::value::Kind::NullValue(_)) => serde_json::Value::N... |
b45b58d5ade0735c092df8b2745469c4b9b379a8ba42f9fc07d27fd277a9dd1e | Rust | 8,901 | 264 | use super::{AttachedFunctionUuid, CollectionUuid, ConversionError, DatabaseName, Schema};
use crate::{
chroma_proto::{self, FilePaths, FlushSegmentCompactionInfo},
SegmentUuid,
};
use chroma_error::{ChromaError, ErrorCodes};
use std::{collections::HashMap, sync::Arc};
use thiserror::Error;
use uuid::Uuid;
#[de... |
203c5c2018285afdf918f277894f5e495bef54602b44d8a1cb67eaa6c2af299c | Rust | 8,922 | 280 | #![allow(missing_docs)]
use std::collections::{BTreeMap, BTreeSet};
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use super::chunkset::{
direct_chunkset_bases, push_chunkset, push_json_record, read_chunkset, read_json,
};
use super::error::TrajectoryError;
use super::ids::sha256_base36;
use ... |
f3dc90b3923019f2049f0d5a4dca8a70e9739c252b0a5670d3cf2d525e6cc563 | Rust | 8,954 | 277 | use std::sync::Arc;
use std::time::Duration;
use tokio::sync::Mutex;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, Cursor, CursorName, CursorStoreOptions, Error, GarbageCollectionOptions,
LogReaderOptions, LogWriter, LogWriterOptions, Manifest, Man... |
735fff09594b268ba928c039da77e017ac8c1b8dbb2e5221a3d15834bc264ddb | Rust | 8,957 | 259 | use chroma_config::assignment::assignment_policy::AssignmentPolicy;
use chroma_config::{registry::Registry, Configurable};
use chroma_log::{config::GrpcLogConfig, Log};
use chroma_memberlist::client_manager::{ClientAssigner, ClientManager, ClientOptions};
use chroma_memberlist::memberlist_provider::Member;
use chroma_s... |
6ea8a3f7b27b770af3c882d7fcbce0488e3de5344e6e6e2f6a191f5c1712318d | Rust | 9,073 | 255 | // Defines 17 standard error codes based on the error codes defined in the
// gRPC spec. https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// Custom errors can use these codes in order to allow for generic handling
use std::error::Error;
#[cfg(feature = "tonic")]
mod tonic;
#[cfg(feature = "tonic")]
pub use ton... |
d48a249bb56817daa7ff5b1a3d9a547593e1fc74504712f517805c1ee677371b | Rust | 9,078 | 213 | use super::{
scheduler::Scheduler, system::System, utils::duration_ms, Component, ComponentContext,
ComponentSender, WrappedMessage,
};
use crate::types::ComponentRuntimeStats;
use std::sync::Arc;
use tokio::{select, time::timeout};
use tracing::{Instrument, Span};
struct Inner<C>
where
C: Component,
{
... |
0ea4dc1637151b56e273233f49d1f6eb7122d1ec0ba753f253b4f0e6933eedc5 | Rust | 9,111 | 318 | #![recursion_limit = "256"]
use chroma_benchmark::{
benchmark::{bench_run, tokio_multi_thread},
datasets::rust::TheStackDedupRust,
};
use chroma_blockstore::{
arrow::{
config::BlockManagerConfig,
provider::{ArrowBlockfileProvider, BlockfileReaderOptions},
},
provider::BlockfileProvi... |
e03a61d6e24decaa088c475280287490c6e55039d30f3941071b9bcf0ae95f54 | Rust | 9,124 | 254 | //! A circuit breaker is like a semaphore except instead of queueing up requests, it rejects them.
//! It is adaptive and circuit-switched so that when the system encounters saturation---as
//! determined by a standing queue---it will reject requests.
//!
//! Initialize the CircuitBreaker with a parallelism (the number... |
77c9a7a0ec08653633c66e27f64e80e8503c911fe70bf890bcd96c758fad69d3 | Rust | 9,134 | 298 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, Cursor, CursorName, CursorStoreOptions, LogWriterOptions, Manifest,
ManifestConsumer, ManifestManagerFactory, ReplicatedManifestManagerFactory, SnapshotOptions,
StorageWrapper,
};... |
5be85a77aa33d2689e089798747aff2a9df7e8821fc1ca89548657a57e54f21a | Rust | 9,244 | 279 | #![recursion_limit = "256"]
use chroma_blockstore::{
arrow::{
config::BlockManagerConfig,
provider::ArrowBlockfileProvider,
types::{ArrowWriteableKey, ArrowWriteableValue},
},
BlockfileWriterOptions,
};
use chroma_cache::UnboundedCacheConfig;
use chroma_storage::{local::LocalStorage... |
85ae7159dec080048794ede624b023015e2709d51de2223a5f7a670505a84bd8 | Rust | 9,322 | 304 | //! Common test utilities for s3heap integration tests.
//!
//! This module provides mock implementations and helper functions
//! for testing s3heap functionality without requiring actual external
//! dependencies.
#![allow(dead_code)]
use std::collections::HashMap;
use std::sync::Arc;
use chroma_storage::{GetOption... |
9daa66eb0265f768a8d4f560a5dcb27ce8fe849c8398e7c1e74f05d66ed8bf6f | Rust | 9,324 | 261 | use anyhow::Result;
use rand::prelude::SliceRandom;
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, future::Future, path::PathBuf, sync::Arc};
use tantivy::{
collector::TopDocs,
doc,
query::QueryParser,
schema::{IndexRecordOption, Schema, TextFieldIndexing, TextOptions},
tokeniz... |
722b3441601386b3b23800c7bfbd488e0bd2074f9c02f2e441771ebe5fd5e800 | Rust | 9,329 | 242 | use std::error::Error;
use std::fmt;
use std::num::TryFromIntError;
use std::str::Utf8Error;
use chroma::client::ChromaHttpClientError;
use chroma_error::{ChromaError, ErrorCodes};
use uuid::Uuid;
use super::model::WriteState;
/// Reports a failure to encode, validate, persist, or rehydrate trajectory data.
#[derive... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.