sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e3255b4c47534bb06c7615d1a18ad767849ada408f65998791cfd607c662f1d5 | Rust | 2,061 | 66 | /// This is a basic partitioned mutex that is not persistent.
/// The mutex is designed to be holdable across await points (hence async).
use std::{
hash::{DefaultHasher, Hash, Hasher},
marker::PhantomData,
sync::Arc,
};
#[derive(Clone, Debug)]
pub struct AysncPartitionedMutex<K, V = (), H = DefaultHasher>... |
7a0fe13d5cb9ddf7af3abf59b44a009697b6703d4d32bcf8dd2b4e51c55ad0bf | Rust | 2,072 | 72 | use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_index::spann::types::SpannPosting;
use chroma_segment::distributed_spann::SpannSegmentReaderShard;
use chroma_system::{Operator, OperatorType};
use thiserror::Error;
#[derive(Debug)]
pub(crate) struct SpannFetchPlInput<'referred_data... |
dfe3696fa8241b5dbbcfd96fc4f0dbd2ce0814d546ec240e2f3691f1f939a94c | Rust | 2,079 | 76 | use std::sync::Arc;
use chroma_storage::{s3_client_for_test_with_new_bucket, PutOptions};
use wal3::{
create_s3_factories, Error, LogReaderOptions, LogWriter, LogWriterOptions, ManifestManager,
SnapshotOptions, ThrottleOptions,
};
#[tokio::test]
async fn test_k8s_integration_97_destroy_wedge() {
let stor... |
ee035ad737ea3319f7dfbc6e8c63d1b14c791bf0df7f595c8361f4e392147ba1 | Rust | 2,110 | 65 | use chroma_types::Cmek;
use uuid::Uuid;
#[derive(Debug, Default, PartialEq, Eq, Clone, Copy)]
pub enum BlockfileWriterMutationOrdering {
#[default]
Unordered,
Ordered,
}
#[derive(Debug, Clone)]
pub struct BlockfileWriterOptions {
pub(crate) mutation_ordering: BlockfileWriterMutationOrdering,
pub(c... |
9484fc9fe18f13141e97b18bcd8051f816950005e61629c6c5e4cc4d376bff53 | Rust | 2,130 | 74 | pub mod optional_u128_as_hex {
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serializer};
/// Serializes `Option<u128>` as lowercase hex string if Some, skips if None.
pub fn serialize<S>(val: &Option<u128>, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{... |
2784f6358fb2381fbf2fe6b2026f9abb8d299ac04eabb757ecdb44c0e50b7ca4 | Rust | 2,137 | 67 | use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::distributed_spann::SpannSegmentReaderShard;
use chroma_system::Operator;
use thiserror::Error;
#[derive(Debug)]
pub(crate) struct SpannCentersSearchInput<'referred_data> {
pub(crate) reader: Option<SpannSegmentReaderShar... |
a729b6b48c18a4507214bb204720af1173c15d35daf6e8d49e11334f89ee3b6c | Rust | 2,179 | 64 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, LogReader, LogReaderOptions, LogWriter, LogWriterOptions, Manifest,
ManifestManagerFactory, S3ManifestManagerFactory, SnapshotOptions,
};
#[tokio::test]
async fn test_k8s_integration_70_load_and_scrub... |
c3a8c1477c2ca1f88ee3f4a4ce3b4a0cf8680351833fe8f2e17b8a162668062f | Rust | 2,204 | 62 | use std::{io, path::PathBuf};
use mdac_service::Config;
use tokio::net::TcpListener;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let path = std::env::var_os("CONFIG_PATH").map(PathBuf::from);
if let Some(path) = &path {
eprintln!("MDAC configuration file: {}", path.displ... |
d7fea9152ba2bfbe2fbfdf5331e9ce1096f5876ce67604d4729de9266e64f2b7 | Rust | 2,205 | 63 | 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... |
7ec1ca5d84ca4185609a8e9bf58d805fb74a4da3a2029169a1a1573e6d642cd3 | Rust | 2,218 | 79 | use async_trait::async_trait;
use chroma_error::ChromaError;
use chroma_error::ErrorCodes;
use chroma_segment::types::ChromaSegmentFlusher;
use chroma_segment::types::ChromaSegmentWriter;
use chroma_system::Operator;
use thiserror::Error;
use tracing::Instrument;
#[derive(Error, Debug)]
pub enum CommitSegmentWriterOpe... |
8a0e0928dfb51b6b65510f10bd6cfec01138718e2c4a7ffef08e95af8d1bb54e | Rust | 2,228 | 90 | use ratatui::buffer::Buffer;
use ratatui::layout::Rect;
use ratatui::style::Style;
use ratatui::widgets::{Block, Borders, Paragraph, StatefulWidget, Widget};
use tui_input::Input;
pub struct InputBox {
block: Block<'static>,
active_style: Style,
active: bool,
}
impl InputBox {
pub fn new(active_style:... |
52a28d7c670fe6ed1f5f0ba0d722f30c48068491913f57d98683a7712a904942 | Rust | 2,231 | 80 | use std::sync::Arc;
use chroma_storage::{s3_client_for_test_with_new_bucket, PutOptions};
use wal3::{
create_s3_factories, unprefixed_fragment_path, FragmentIdentifier, FragmentSeqNo,
LogReaderOptions, LogWriter, LogWriterOptions, ManifestManager, SnapshotOptions,
ThrottleOptions,
};
#[tokio::test]
async... |
4275dd60abc9c9d3f9b5cda0b59fd6c01353c4e7cc82c8cb2a90f55d8c350e1f | Rust | 2,234 | 65 | pub mod hir;
pub mod literal_expr;
use hir::ChromaHir;
use regex::Regex;
use regex_syntax::{hir::Properties, parse};
use thiserror::Error;
/// Chroma custom wrapper for a Regex pattern.
///
/// The `ChromaRegex` struct should represent a regex pattern that is supported by Chroma, and
/// it could be safely used by fu... |
78ecb987b1094f8e0e9884bde4d7dbedf4d31fe9e8c73f7bc1dec31aa5f9733a | Rust | 2,270 | 72 | use async_trait::async_trait;
use chroma_distance::{normalize, DistanceFunction};
use chroma_error::{ChromaError, ErrorCodes};
use chroma_types::{
operator::{Knn, KnnOutput, RecordMeasure},
SignedRoaringBitmap,
};
use thiserror::Error;
use chroma_segment::distributed_hnsw::DistributedHNSWSegmentReader;
use chr... |
1d698ec4245d8509ef867994f9afa71ce5002797f6391fe8866a7aab5c8c586f | Rust | 2,276 | 59 | //! Error types for the agent crate.
use thiserror::Error;
/// Errors surfaced by the agent core, tools, and inference models.
///
/// This is the crate-wide error skeleton; variants are filled in as the tool,
/// trajectory, inference, and driver layers land in subsequent milestones.
#[derive(Debug, Error)]
pub enum... |
14b9a8c93b1bf9232fffd5df65428264403cf79b316c25500cf722b15fd7c8ec | Rust | 2,295 | 78 | use opentelemetry::trace::TraceContextExt;
use opentelemetry::trace::{SpanContext, SpanId, TraceFlags, TraceId, TraceState};
use tracing::instrument::Instrumented;
use tracing::Instrument;
use tracing_opentelemetry::OpenTelemetrySpanExt;
const TRACE_ID_HEADER_KEY: &str = "chroma-traceid";
const SPAN_ID_HEADER_KEY: &st... |
94182d1aef1636877a922e2206d067de13b46f8c4d7d344ec5ffd0da49c43b7b | Rust | 2,305 | 73 | use std::sync::Arc;
use uuid::Uuid;
use wal3::{
Error, Manifest, ManifestConsumer, ManifestManagerFactory, ReplicatedManifestManagerFactory,
};
mod common;
use common::setup_spanner_client;
#[tokio::test]
async fn test_k8s_mcmr_integration_repl_02_initialized_init_again() {
// Double initialization should f... |
046ec217ece463ffcc048e65802a27665dc38c0e8c683392298d1f197ae8da57 | Rust | 2,314 | 67 | use tonic::transport::Channel;
use chroma_types::chroma_proto::log_service_client::LogServiceClient;
use chroma_types::chroma_proto::{
purge_from_cache_request::EntryToEvict, FragmentToEvict, PurgeFromCacheRequest,
};
#[tokio::main]
async fn main() {
let args = std::env::args().skip(1).collect::<Vec<_>>();
... |
02bf92ee864683b8eae7571b71e5d7c17273578315f641b31203a9cc1c9cb95e | Rust | 2,335 | 68 | //! Inference models: turn a [`Trajectory`] into the next [`Action`].
//!
//! [`AgentInferenceModel`] is the provider-agnostic seam; concrete provider
//! implementations live in submodules (see [`anthropic`]). Only Anthropic is
//! supported for now.
mod anthropic;
pub use anthropic::{
AnthropicAgentInferenceMod... |
f031c73d211ed69200acdbcaed966eae7cc52441132cb6155190469d796cbef8 | Rust | 2,355 | 67 | //! Anthropic Messages API rendering for a [`Trajectory`].
//!
//! Mirrors the Python `Trajectory.to_anthropic_format`: each [`Action`] becomes
//! an `assistant` message (optional `thinking` block, then `text` and
//! `tool_use` blocks) and each [`Observation`] becomes a `user` message
//! (`text` and `tool_result` bl... |
ec854bea5a2f8e6f5213e54de4aee2517b8b6241d46e11cc23d85c15ec4b5b88 | Rust | 2,393 | 62 | use axum::http::{header, StatusCode};
use axum::response::IntoResponse;
use axum::{extract::Request, middleware::Next, response::Response, Json};
use chroma_error::ErrorCodes;
/// If the request does not have a `Content-Type` header, set it to `application/json`.
pub async fn default_json_content_type_middleware(mut r... |
bbd753b5fe66448bc024ff565cd55b969d3adfd7f949e52dc0820281348a3065 | Rust | 2,394 | 86 | use async_trait::async_trait;
use chroma_error::ChromaError;
use chroma_sysdb::SysDb;
use chroma_system::{Operator, OperatorType};
use chroma_types::{
CollectionAndSegments, CollectionUuid, DatabaseName, GetCollectionWithSegmentsError,
};
use thiserror::Error;
/// The `GetCollectionAndSegmentsOperator` fetches a c... |
a041cf7ab6676318f81bf922c5472f60299d24024dc6ca3d11f058c2362af59c | Rust | 2,397 | 91 | use crate::tui::collection_browser::app_state::AppState;
use crate::tui::collection_browser::app_ui::AppUI;
use crate::tui::collection_browser::events::{Action, EventsHandler};
use crate::ui_utils::Theme;
use chroma::ChromaCollection;
use chroma_types::Metadata;
use ratatui::DefaultTerminal;
use thiserror::Error;
mod ... |
d4b41830f9de2c32228051443a392b1d590f9e0dbb9c0f0be894ed24b5748824 | Rust | 2,399 | 79 | use axum::http::StatusCode;
use axum::response::IntoResponse;
use tokio::sync::oneshot;
/// Exposes a server on the given port that serves jemalloc pprof data.
///
/// Routes:
/// - `/debug/pprof/flamegraph`: Returns a flamegraph of the heap profile.
/// - `/debug/pprof/heap`: Returns a heap profile in pprof format.
p... |
aaeae82fe7f75ce2d73f72e2e4ca2de3274892296898812d114d261a236c462f | Rust | 2,408 | 69 | use crate::common;
use chroma_types::SignedRoaringBitmap;
fn all_mask() -> SignedRoaringBitmap {
SignedRoaringBitmap::Exclude(Default::default())
}
/// f16 quantization tolerance: scores within this range of the boundary
/// are considered ties that quantization could have swapped.
const F16_TOLERANCE: f32 = 5e-3... |
f61c3fb03faaaecc82f9313b16db02ba5c75f11cfc32e13bcab6dda78e748372 | Rust | 2,428 | 77 | use chroma_cache::{CacheConfig, FoyerCacheConfig};
use serde::{Deserialize, Serialize};
// A small block size for testing, so that triggering splits etc is easier
pub const TEST_MAX_BLOCK_SIZE_BYTES: usize = 16384;
#[derive(Default, Deserialize, Debug, Clone, Serialize)]
pub struct ArrowBlockfileProviderConfig {
... |
97875d72f1fc6aea4f0826c7f4be0351092a1f019c96f842b81fe787288244a4 | Rust | 2,432 | 85 | use std::collections::HashMap;
use std::sync::Arc;
use async_trait::async_trait;
use chroma_distance::DistanceFunction;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_index::spann::utils::query_quantized_cluster;
use chroma_system::Operator;
use chroma_types::{
operator::RecordMeasure, QuantizedCluster, Q... |
4761b25c3106523f6437824a939e772466b11c8fa4ea0320e061a1586fd08673 | Rust | 2,448 | 84 | 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, DatabaseName};
use thiserror::Error;
use tokio::time::{error::Elapsed, timeout};
use tracing::Level;
/// The `RepairL... |
09470827bbe5d108c1ff57a4bbdec680c01c9a8b742ff929fa4758ec7e18e219 | Rust | 2,494 | 70 | use std::sync::atomic::{AtomicBool, Ordering};
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 tes... |
61e25c227373a6d84ac2066f36d0a8e91effe8a460816958a92ce2b13750b752 | Rust | 2,515 | 75 | use std::path::PathBuf;
use anyhow::Result;
use tokio::io::{AsyncReadExt, BufReader};
use super::{
types::{Record, RecordDataset},
util::get_or_populate_cached_dataset_file,
};
pub struct GistDataset {
base_file_path: PathBuf,
dimension: usize,
num_records: usize,
}
const FLOAT32_SIZE: usize = 4... |
81bdbace41015a134cc80dc6e25046c5efa01c0d53f7a19901a7643b9bcde61c | Rust | 2,536 | 86 | use chroma_error::{ChromaError, ErrorCodes};
use chroma_types::{AttachedFunctionUuid, CollectionUuid};
use thiserror::Error;
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, PartialEq)]
#[allow(dead_code)]
pub struct WorkQueueRecord {
pub fn_id: AttachedFunctionUuid,
pub input_coll_id: CollectionUu... |
0fb38e50bf705ce8428f2d84ee1cb727962a515787ef7c1b54cb736a051dcbc5 | Rust | 2,563 | 91 | use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use axum::body::Body;
use axum::http::{Request, StatusCode};
use axum::response::{IntoResponse, Response};
use mdac::{CircuitBreaker, CircuitBreakerConfig};
use tower::Service;
#[derive(Clone)]
pub struct AdmissionControll... |
82f4c2301bdbc00300cbe17aa4ff3d8226d2ce511e3cb9d28d97fd23c5b6cb1f | Rust | 2,588 | 76 | //! The price card's token rates and the agent-run pricing rule.
use chroma_agent::InferenceUsage;
use serde::Deserialize;
/// Micro-USD per million tokens for one model, mirroring the card's
/// `TokenRate` (chroma-core/hosted-chroma `chroma_sync_common`). A cache rate
/// the card leaves out or sets to null prices ... |
f17b96d8333d2a1e37f8f1bede7317fb376dddd0f0472a47642fef0baab22471 | Rust | 2,589 | 84 | use std::sync::Arc;
use chroma_storage::{s3_client_for_test_with_new_bucket, PutOptions};
use uuid::Uuid;
use wal3::{
create_repl_factories, Error, LogWriter, LogWriterOptions, ManifestManagerFactory,
SnapshotOptions, StorageWrapper,
};
mod common;
use common::{default_repl_options, setup_spanner_client};
#... |
755a7cdaa4e06c790ef0620bccfe65c3186e75d4dbfa29a4dca2edc745d12ee2 | Rust | 2,591 | 55 | /// Well-known function IDs and names that are pre-populated in the database
///
/// GENERATED CODE - DO NOT EDIT MANUALLY
/// This file is auto-generated from go/pkg/sysdb/metastore/db/dbmodel/constants.go
/// by the build script in rust/types/build.rs
use uuid::Uuid;
/// UUID for the built-in record_counter function... |
bcba2530e7ed7548ca23d552f9fa6991018d5f937326f8d60315e510632114a8 | Rust | 2,593 | 73 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, FragmentIdentifier, FragmentManagerFactory, FragmentSeqNo,
LogReaderOptions, LogWriter, LogWriterOptions, Manifest, ManifestManagerFactory,
};
mod common;
use common::{assert_conditions, Condition, F... |
11d83096c9a197a55e793f62cb7beba91c782b6a3271a36787138938a7c2dcd6 | Rust | 2,624 | 95 | use async_trait::async_trait;
use chroma_error::ChromaError;
use chroma_error::ErrorCodes;
use chroma_segment::types::ChromaSegmentFlusher;
use chroma_system::Operator;
use chroma_types::SegmentFlushInfo;
use parking_lot::Mutex;
use thiserror::Error;
use tracing::trace_span;
use tracing::Instrument;
#[derive(Error, De... |
c35b0100d730d57cfabe0ede4aa4f002737ad05a573c9c5aec03b0c7db64396a | Rust | 2,624 | 64 | use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{create_s3_factories, LogReaderOptions, LogWriter, LogWriterOptions};
mod common;
#[tokio::test]
async fn test_k8s_integration_06_parallel_open_or_initialize() {
// Multiple concu... |
1680fb58c9fe3ceb7f18ec4532d99167152a132b4c40d02494050ce1a7f091f0 | Rust | 2,649 | 76 | mod proptest_helpers;
// Tip: run with `RUST_LOG=prop_test_garbage_collection=debug,garbage_collector=trace`
//
// Fast/default timing:
// /usr/bin/time -p cargo test -p garbage_collector --test prop_test_garbage_collection -- --exact tests::test_k8s_integration_garbage_collection --nocapture
//
// Deep timing:
// env... |
b0300e57723695da2a049df0ce861e3a9c1f684daa1e6051c02ebe70cca5e309 | Rust | 2,654 | 88 | use std::sync::Arc;
use chroma_storage::{s3_client_for_test_with_new_bucket, PutOptions};
use uuid::Uuid;
use wal3::{
create_repl_factories, unprefixed_fragment_path, FragmentIdentifier, FragmentSeqNo, LogWriter,
LogWriterOptions, ManifestManagerFactory, SnapshotOptions, StorageWrapper,
};
mod common;
use co... |
480e2b57be6c70a05008ed5335c6199d74d299915b88903ad8bdf2477a4aead2 | Rust | 2,668 | 87 | use async_trait::async_trait;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::{ChromaError, ErrorCodes};
use chroma_segment::version_file::{VersionFileError, VersionFileManager};
use chroma_system::{Operator, OperatorType};
use chroma_types::{Collection, Segment};
use thiserror::Error;
use crate:... |
8e156d597e9da4c327c721277c5b175c34ae1a783debe91dc4978b2b7d2ed4a9 | Rust | 2,696 | 76 | //! OpenTelemetry instrumentation for Chroma client operations.
//!
//! This module provides metrics collection when the `opentelemetry` feature is enabled.
//! Metrics include request latency histograms and retry counters, tagged by operation
//! name and status code for detailed observability in production deployment... |
8af20bf9510ee0a1f01861ee14f7fa6a91287ed57bd3ab11790fbe74ebaa5508 | Rust | 2,703 | 93 | use super::{CacheError, StorageKey, StorageValue, Weighted};
use parking_lot::RwLock;
use std::collections::HashMap;
use std::fmt::Debug;
use std::hash::Hash;
use std::sync::Arc;
/// A zero-configuration cache that doesn't evict.
/// Mostly useful for testing.
#[derive(Debug, Default, Clone, serde::Deserialize, serde:... |
d390b7f075614a1cf0f38fdf6c8f836fee035997af353822571f9514e3227cd7 | Rust | 2,727 | 98 | use chroma_error::{ChromaError, ErrorCodes};
use thiserror::Error;
use tonic::Status;
/// Macro to define UUID newtype wrappers with standard implementations.
/// Reduces boilerplate for UUID wrapper types.
///
/// Generates:
/// - Struct with standard derives (Copy, Clone, Debug, etc.)
/// - new() method with configu... |
3afeb4fe82d96fc7d58726140c0bb892f848e52a9259b5b82374d8646bee1f1d | Rust | 2,730 | 94 | use async_trait::async_trait;
use chroma_error::ChromaError;
use chroma_system::{Operator, OperatorType};
use chroma_types::{AttachedFunctionUuid, CollectionUuid};
use thiserror::Error;
use crate::work_queue::work_queue_client::WorkQueueClient;
/// The queue function operator queues async attached functions for exter... |
60b5103ea4456e3c7c2defca02ec211ce944f0375a148522936ac68f7f890d48 | Rust | 2,743 | 96 | use chroma_error::ChromaError;
use parking_lot::Mutex;
use std::{
any::{type_name, Any, TypeId},
collections::HashMap,
sync::Arc,
};
use thiserror::Error;
pub trait Injectable: Any + Send + Sync + Clone {}
impl<T: Injectable> Injectable for Arc<T> {}
/// A simple registry that stores any type that implem... |
4f550043bf3984cc2444bd031148e9aa4c3813a647c0a4512775ba803ad93527 | Rust | 2,786 | 93 | 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,
};
#[tokio::test]
async fn test_k... |
4880db047d0288f913dd158de66539f5415d30b4076bd8273d9b0219da06f833 | Rust | 2,809 | 103 | use crate::work_queue::work_queue_client::WorkQueueClient;
use async_trait::async_trait;
use chroma_error::ChromaError;
use chroma_system::Operator;
use chroma_types::{AttachedFunctionUuid, CollectionUuid};
use std::fmt::Debug;
use thiserror::Error;
#[derive(Debug, Clone)]
pub struct FinishAsyncWorkItem {
pub inpu... |
c7f3f5bde0986c1ec1c5f4da8fc5d4e22f96a1fa5305904d29957c93e4767848 | Rust | 2,826 | 92 | use super::ConversionError;
use crate::chroma_proto;
use chroma_error::{ChromaError, ErrorCodes};
use thiserror::Error;
#[derive(Clone, Debug, PartialEq)]
pub enum ScalarEncoding {
FLOAT32,
INT32,
}
#[derive(Error, Debug)]
pub enum ScalarEncodingConversionError {
#[error("Invalid encoding, valid encodings... |
ddfc3da69c875ba3c40bf9b52fc91510c77941a31f886aeb5c2c55951a400da8 | Rust | 2,827 | 97 | use super::{
block::Block,
provider::{BlockManager, RootManager},
root::RootWriter,
types::{ArrowWriteableKey, ArrowWriteableValue},
};
use chroma_error::ChromaError;
use chroma_types::Cmek;
use futures::{StreamExt, TryStreamExt};
use uuid::Uuid;
pub struct ArrowBlockfileFlusher {
block_manager: Bl... |
61758683962d058ddcd8f13688239c15cafa19f392bac72d86d328702198062a | Rust | 2,845 | 92 | use crate::common;
use chroma_types::SignedRoaringBitmap;
fn all_mask() -> SignedRoaringBitmap {
SignedRoaringBitmap::Exclude(Default::default())
}
#[tokio::test]
async fn maxscore_matches_brute_force_simple() {
let docs = vec![
(0u32, vec![(1u32, 0.5), (2, 0.3)]),
(1, vec![(1, 0.8), (2, 0.1)]... |
bc5c2f3d8b32258a31d1d77db9c88f6fd5ce0e6a001b2eff2771e365b00da0a3 | Rust | 2,871 | 77 | use serde::{Deserialize, Serialize};
#[derive(Clone, Deserialize, Debug, Serialize)]
pub struct DispatcherConfig {
/// The number of worker threads to use
#[serde(default = "DispatcherConfig::default_num_worker_threads")]
pub num_worker_threads: usize,
/// The maximum number of tasks that can be enqueu... |
634fa266fbdcd84b5f4bfef240e2985b8896c4f5dd967ed3e58a54b5aca820b9 | Rust | 2,914 | 82 | //! Attached function handle for interacting with function attachments on collections.
use std::sync::Arc;
use chroma_types::{AttachedFunctionApiResponse, CollectionUuid};
use crate::{client::ChromaHttpClientError, ChromaHttpClient};
/// A handle to an attached function bound to a specific input collection.
///
///... |
94204067eb9d558bd3e72b8f7181402e0de23f2bb759dfd08fa966d640569587 | Rust | 2,929 | 100 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, LogWriter, LogWriterOptions, Manifest, ManifestConsumer,
ManifestManagerFactory, ReplicatedManifestManagerFactory, StorageWrapper,
};
mod common;
use common::{default_repl_options, s... |
6884a48ed26f50a5053112ce27fb07bbefb7b7821a5765918b3a1b699b2f142d | Rust | 2,955 | 106 | 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_84_bootstrap_empty() {
let options = LogWriterOption... |
aa8d258ee39ab592aed1f8652eec5711a8353a517c9b2c31be22526d8a10eb68 | Rust | 2,959 | 100 | use std::collections::HashMap;
use std::sync::Mutex;
use setsum::Setsum;
use wal3::ManifestWitness;
use wal3::{
Error, FragmentSeqNo, Garbage, GarbageCollectionOptions, LogPosition, Manifest,
ManifestAndWitness, ManifestPublisher, Snapshot, SnapshotPointer,
};
/// A mock ManifestPublisher that delegates snap... |
13712f611f75d4bde5f56c96917b2ed680078c4711359a26d98df57d8bdf2149 | Rust | 2,964 | 93 | use crate::terminal::{SystemTerminal, Terminal};
use crate::utils::CliError;
use colored::Colorize;
use regex::Regex;
use semver::Version;
use serde::Deserialize;
use std::error::Error;
use thiserror::Error;
const GITHUB_RELEASES_URL: &str = "https://api.github.com/repos/chroma-core/chroma/releases";
const UNIX_CURL: ... |
fe7060fdea3ac1653a478ecb48e64210749360e129fa01b74a288d710890d998 | Rust | 2,966 | 109 | use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::fmt;
use std::ops::Deref;
use std::sync::RwLock;
use std::sync::{
atomic::{AtomicU64, Ordering},
Arc,
};
use std::time::Instant;
use crate::core::MeteringError;
/// A wrapper around `Arc<AtomicU64>` that implements `Clone`, `Debug`, `Part... |
4ebab82d080dec4cf9cbb0bd915dcd115a6536792d2e03ed284666db8849fe92 | Rust | 2,981 | 100 | use std::sync::atomic::AtomicU64;
use std::sync::Arc;
use chroma_storage::Storage;
use chroma_types::Cmek;
use crate::interfaces::{FragmentUploader, UploadResult};
use crate::{Error, FragmentSeqNo, LogPosition, LogWriterOptions, MarkDirty, StorageWrapper};
/// Uploads fragments to S3 storage.
pub struct S3FragmentUp... |
ab9e77408a66a2cf24d2f1829d39882a7fbd504118aa3d46b218b9912ea08ab7 | Rust | 3,022 | 98 | use chroma_distance::DistanceFunction;
use chroma_error::ChromaError;
use uuid::Uuid;
#[derive(Clone, Debug)]
pub struct IndexConfig {
pub dimensionality: i32,
pub distance_function: DistanceFunction,
}
impl IndexConfig {
pub fn new(dimensionality: i32, distance_function: DistanceFunction) -> Self {
... |
2c8747ceb0253a83077906401c7e438c1af7af810add381b0bc3c414fd33dc26 | Rust | 3,024 | 74 | use crate::CollectionUuid;
////////////////////////////////////// constants and variables /////////////////////////////////////
pub fn dirty_log_path_from_hostname(hostname: &str) -> String {
format!("dirty-{}", hostname)
}
//////////////////////////////////////////// DirtyMarker ////////////////////////////////... |
74519e5eaa16eda1443141550930d187ac8639eb94a87341125978df9eebe13e | Rust | 3,031 | 101 | use crate::utils::{CliError, UtilsError};
use dialoguer::theme::ColorfulTheme;
use dialoguer::{Confirm, Input, Select};
pub trait Terminal {
fn println(&mut self, msg: &str);
fn prompt_input(&mut self) -> Result<String, CliError>;
fn prompt_select(&mut self, items: &[String]) -> Result<usize, CliError>;
... |
dd2e3076189b1096e214416c9b2f6059ca136b231e54017ab7e6a0f3727c3e9f | Rust | 3,040 | 126 | use super::{Component, ComponentSender, Handler, Message};
use async_trait::async_trait;
use chroma_error::{ChromaError, ErrorCodes};
use parking_lot::Mutex;
use std::{fmt::Debug, sync::Arc};
use thiserror::Error;
use tokio::sync::oneshot;
/// A ReceiverForMessage is generic over a message type, and useful if you want... |
44fbafe942ba060e7235b0032311e5d80f6513563103c7dc2bbd381c8c761573 | Rust | 3,059 | 91 | pub use chroma_tracing::OpenTelemetryConfig;
use figment::providers::{Env, Format, Yaml};
use mdac::CircuitBreakerConfig;
use serde::{Deserialize, Serialize};
/// A rule for the scorecard rate limiter. Generic across servers.
#[derive(Deserialize, Serialize, Clone, Debug)]
pub struct ScorecardRule {
pub patterns: ... |
529f6991d316ea54478f39651f785c57fbc0804dc64d485fb6a8fe6617ea4e76 | Rust | 3,097 | 113 | use chroma_error::{ChromaError, ErrorCodes};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum FoundationSourceKindError {
#[error("unknown foundation source collection: {0}")]
UnknownSourceCollection(String),
}
impl ChromaError for FoundationSourceKindError {
fn code(&self) -> ErrorCodes {
E... |
6932190bc93c5afe32ee5fba2492a59db667078d80afeb3e94519610740030a6 | Rust | 3,101 | 109 | use std::ops::Sub;
use crate::arrow::types::ArrowWriteableValue;
#[derive(Clone, Copy, Debug, Default)]
pub struct SpannPostingListSizeTracker {
num_items: usize,
prefix_size: usize,
key_size: usize,
doc_offset_ids_size: usize,
doc_versions_size: usize,
doc_embeddings_size: usize,
embeddin... |
20078ccfd55b31c4d27b3912647096f8b5c5c4b4cedb602c4a9920c31814bd10 | Rust | 3,105 | 95 | use std::{collections::HashMap, path::PathBuf};
use anyhow::{anyhow, Result};
use async_compression::tokio::bufread::BzDecoder;
use futures::{FutureExt, StreamExt, TryStreamExt};
use serde::Deserialize;
use tokio::{fs::File, io::AsyncBufReadExt};
use tokio_stream::wrappers::LinesStream;
use tokio_util::io::StreamReade... |
11d0207fce9421d576f5a29a76700f1a56bfd5f9872f78a66eba44be232256ce | Rust | 3,113 | 93 | use super::ConversionError;
use crate::chroma_proto;
use chroma_error::{ChromaError, ErrorCodes};
use thiserror::Error;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Operation {
Add,
Update,
Upsert,
Delete,
BackfillFn,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MaterializedLogOper... |
70a8e8b9a3e275ffee62cf5d253d5212c88fdacb13d396af935ea88ee119ccdd | Rust | 3,149 | 99 | use axum::{
http::StatusCode,
response::{IntoResponse, Response},
Json,
};
use chroma_api_types::{StaleReadError, STALE_READ_ERROR_NAME};
use chroma_error::{source_chain_contains, ChromaError};
use chroma_log::PushLogsError;
use chroma_types::{ConditionalCommitError, ConditionalTransactionError};
use serde:... |
453454c5418c1324bb9bb6cd078f05575963290acd58d6cedc7aefe75954fc71 | Rust | 3,156 | 97 | use std::collections::HashSet;
use super::{
provider::BlockManager,
root::{RootWriter, Version},
sparse_index::SetCountError,
};
use chroma_error::{ChromaError, ErrorCodes};
use chroma_storage::admissioncontrolleds3::StorageRequestPriority;
use thiserror::Error;
use uuid::Uuid;
#[derive(Error, Debug)]
pub... |
9425b272afc04083c3014aad65978600e9efe58ed3247e609876226220ce3d17 | Rust | 3,160 | 98 | use async_trait::async_trait;
use chroma_blockstore::provider::BlockfileProvider;
use chroma_error::ChromaError;
use chroma_segment::blockfile_metadata::{MetadataSegmentError, MetadataSegmentReaderShard};
use chroma_system::Operator;
use chroma_types::{
operator::RecordMeasure, Segment, SegmentShard, SegmentShardE... |
e78aa25c00be4cd0e4b272b3d057959442253b62a182204f09b1a7e0dfb252bf | Rust | 3,161 | 114 | use crate::{sqlite::SqliteSysDb, GrpcSysDb, SysDb};
use async_trait::async_trait;
use chroma_config::{
registry::{Injectable, Registry},
Configurable,
};
use chroma_error::ChromaError;
use serde::{Deserialize, Serialize};
//////////////////////// GRPC SYSDB CONFIG ////////////////////////
#[derive(Deserialize... |
4485e810ede5169d9c3aff51864aff31789cf014bafbf2223d45b5f9b118d86c | Rust | 3,180 | 101 | //! Configuration for Spanner migrations.
pub use chroma_config::spanner::SpannerConfig;
use chroma_types::Topology;
use figment::providers::{Env, Format, Yaml};
use serde::{Deserialize, Serialize};
use std::default::Default;
use std::env;
const CONFIG_PATH_ENV_VAR: &str = "CONFIG_PATH";
// spanner-migration is in th... |
ac3f061812d5df87328d5a323c2ec1d83d9419d8fa3dc1c5f5b28f92748d1a11 | Rust | 3,189 | 91 | //! Perform fnmatch on text, returning true if it matches pattern.
// NOTE(rescrv): This fnmatch implementation was borrowed from
// https://github.com/rescrv/blue/blob/7b6d16bdcd9ff2f53a7426c6ad67802399124237/utilz/src/fnmatch.rs
// The license is Apache 2.0.
// The original author is also the one doing the borrowin... |
7b5cbec4c61d56b81412d7ab87c489c0eac631d168397b67b06e1d86211ce72d | Rust | 3,192 | 107 | use super::{
config::{AssignmentPolicyConfig, HasherType},
rendezvous_hash::{AssignmentError, Hasher, Murmur3Hasher},
};
use crate::{registry::Registry, Configurable};
use async_trait::async_trait;
use chroma_error::ChromaError;
use std::fmt::Debug;
/*
===========================================
Interfaces
===... |
396806d866e31758b935841f966a9c96840af762d4862cc15ba46ac9e7d84a3c | Rust | 3,200 | 95 | use std::{collections::HashMap, path::PathBuf};
use super::{
types::{Record, RecordDataset},
util::get_or_populate_cached_dataset_file,
};
use anyhow::{anyhow, Result};
use async_compression::tokio::bufread::GzipDecoder;
use futures::{FutureExt, TryStreamExt};
use serde::Deserialize;
use tokio::{fs::File, io::... |
4e1e70208594f9a95719ee21b3dea151b31bff39d1f77a94547a4a8255380f46 | Rust | 3,217 | 105 | mod mocks;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use wal3::{Garbage, LogPosition, Manifest, Snapshot, SnapshotPointer};
use mocks::MockManifestPublisher;
use wal3::SnapshotCache;
struct MockSnapshotCache {
snapshots: Mutex<HashMap<String, Snapshot>>,
}
impl MockSnapshotCache {
fn new(... |
66bd4fea826c9631baecb5fa4fc2519cf528ff498e6eb17de29b8435ba70ce2b | Rust | 3,237 | 100 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use wal3::{
create_s3_factories, FragmentManagerFactory, LogPosition, LogReader, LogReaderOptions,
LogWriter, LogWriterOptions, ManifestManagerFactory, SnapshotOptions,
};
#[tokio::test]
async fn test_k8s_integration_80_copy() {
... |
55a7e7aa3d379470822a774748ef1911d1313ad486e24e79b008f3a4e8fd212c | Rust | 3,244 | 101 | //! `subagent_search` agent tool: delegates deep research to the external
//! "context-1" agent and returns its ranked documents as text.
//!
//! Wraps [`subagent_search_text`], which runs the deep-research stream to
//! completion and renders the ranked answer; the tool just carries the
//! per-request connection stat... |
aa24b15feff6a90e355adfac97263d876287ee33f2e013ebb2a6b7d8c023c10b | Rust | 3,245 | 117 | use std::ops::Sub;
use crate::arrow::types::ArrowWriteableValue;
#[derive(Clone, Copy, Debug, Default)]
pub struct DataRecordSizeTracker {
num_items: usize,
prefix_size: usize,
key_size: usize,
id_size: usize,
embedding_size: usize,
metadata_size: usize,
document_size: usize,
embedding... |
916ef690dc36081fc77ee2edf48e362bc1cbecfb4d9d91546f501e1c336c7565 | Rust | 3,279 | 99 | use crate::common;
use chroma_index::sparse::maxscore::PostingCursor;
use chroma_types::{SignedRoaringBitmap, SparsePostingBlock};
fn all_mask() -> SignedRoaringBitmap {
SignedRoaringBitmap::Exclude(Default::default())
}
#[test]
fn drain_essential_multi_block() {
let b1 = SparsePostingBlock::from_sorted_entri... |
70d5d14a7e2ef0584c9c0a9c8db6a4dfa677f5951c3addf1fc638a7f523ad4fb | Rust | 3,298 | 105 | use std::sync::Arc;
use arrow::{
array::{Array, AsArray, Float32Array, Float32Builder},
datatypes::{DataType, Field, Float32Type},
};
use crate::{
arrow::{
block::delta::{
single_column_size_tracker::SingleColumnSizeTracker,
single_column_storage::SingleColumnStorage, Block... |
90bada6746de7cbe72f915a35094822cbe878f2084f8a4d90ef6ed07eb69d99d | Rust | 3,300 | 119 | use chrono::Utc;
use s3heap::{HeapReader, HeapWriter, Limits};
use uuid::Uuid;
mod common;
use common::{setup_test_environment, verify_bucket_count, TestItemBuilder};
#[tokio::test]
async fn test_k8s_integration_02_basic_push() {
let prefix = "test_k8s_integration_02_basic_push";
let (storage, scheduler) = s... |
8dbc920c541418d4e136b309fb24d64586bfe96a358ddaddc34f49a5078e5e79 | Rust | 3,301 | 116 | use arrow::util::bit_util;
/// A simple size tracker for use internally in Arrow Deltas that
/// only have a single column value. More complex value types (such as
/// DataRecord) should use their own size tracking rather than this one.
/// Ideally we would have a more generic size tracker that could be used
/// for a... |
5db2b771fbdfd5ced5a5ebbcd727e7d9f6783ede83b3b5e7038ce4fb6af79292 | Rust | 3,332 | 106 | use crate::{
arrow::{
block::delta::{
single_column_size_tracker::SingleColumnSizeTracker,
single_column_storage::SingleColumnStorage, BlockStorage, UnorderedBlockDelta,
},
types::{ArrowReadableValue, ArrowWriteableKey, ArrowWriteableValue},
},
key::KeyWrapper... |
64daddd0121463e3cf4700c3345b364b276fe478056c70e4128832a1926bd515 | Rust | 3,352 | 86 | use chroma_error::ChromaError;
use chroma_types::{
chroma_proto::{scrub_log_request::LogToScrub, ScrubLogRequest, ScrubLogResponse},
CollectionUuid, DatabaseName, TopologyName,
};
use tonic::{Request, Response, Status};
use uuid::Uuid;
use wal3::{Limits, LogReaderOptions};
use crate::LogServer;
impl LogServer... |
3e64e94fd542edfa51fb17f5f36fa09fa8b44fb9761df8f620cd7374daee3fbb | Rust | 3,376 | 108 | 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, ManifestManagerFactory, SnapshotOptions,
StorageWrapper,
};
mod common;
use... |
527643dd9dd4011a531bef0774047903e7aed5ab823f0ae6b77e93a2a8b67afe | Rust | 3,377 | 87 | use std::ops::{BitAnd, BitOr};
use roaring::RoaringBitmap;
/// This enum helps to delay the evaluation of set minus in metadata filtering:
/// - `Include(rbm)` suggests the result contains the specified ids in `rbm`.
/// For example, `<k>: {$eq: <v>}` will result in a `Include(<record ids with k=v>)`.
/// - `Exclud... |
58d903fa0b4e0d27059ba825833bbff46af26086ecb4e09fd6344bdd6161092c | Rust | 3,379 | 92 | use chroma_types::Cmek;
use setsum::Setsum;
use crate::interfaces::{FragmentPointer, FragmentPublisher, ManifestManagerFactory};
use crate::{Error, Limits, LogPosition, LogReaderTrait, Manifest};
/// Copy a log from one prefix to another.
///
/// The `manifest_factory` is used to initialize the target manifest. The t... |
0b80af6881eaf32cb62a22b4bad6747cf5ea56520767f3e217012507e067c8b5 | Rust | 3,393 | 106 | use std::env;
use std::ffi::OsString;
use std::fs::{self, File};
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::process::ExitCode;
use foundation_api::trajectories::ReasoningTrajectoryFile;
/// Run the trajectory parser over explicit paths or the default tree.
fn main() -> ExitCode {
let paths: ... |
55e1933b98d217ee84249c98fdf4da292e6822fcd16935cd8d52358f508b26bc | Rust | 3,423 | 109 | use std::sync::Arc;
use chroma_storage::s3_client_for_test_with_new_bucket;
use uuid::Uuid;
use wal3::{
create_repl_factories, FragmentManagerFactory, LogReader, LogReaderOptions, LogWriter,
LogWriterOptions, Manifest, ManifestManagerFactory, ReplicatedManifestManagerFactory,
SnapshotOptions, StorageWrapp... |
809a18b454c4effd68dd99330a1e00a7043218e3cc967e3ddcc3f0ca708ba5ba | Rust | 3,424 | 127 | use serde::{Deserialize, Serialize};
use std::time::Duration;
use mdac::TokenBucket;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[allow(dead_code)]
pub struct WorkQueueConfig {
pub storage_path: String,
pub persistence: PersistenceConfig,
#[serde(default)]
pub get_work_rate_limit: Option<GetWorkR... |
2e9692f2d1f91a6c7602d454efe5ce7c751ad3822ccd05f974f43910ac7e0d23 | Rust | 3,441 | 85 | //! Building wiki page redirect links.
//!
//! `foundation-api` resolves only the tenant UUID from the caller's token, so a
//! page link is keyed by that UUID plus the page slug; the configured web
//! origin resolves it to the page. [`page_redirect_url`] builds the link.
use reqwest::Url;
/// Root-relative path of ... |
42d4c4757b6eda2b3745d7c9c6000bd17d605ce119c4675e469fa51785ab9be5 | Rust | 3,442 | 82 | //! Live end-to-end test against the real deep-research API. Ignored by default
//! (no network in CI); run explicitly with credentials.
use super::super::events::{parse_ranked_documents, AgentEvent};
use super::super::{subagent_search_data_stream, SubagentSearchCreds};
use futures::StreamExt;
/// Live end-to-end tes... |
c33477e24a557133e94c0bf1ba3b40809b9b192f713b58ff616f14d6ffc3ceaa | Rust | 3,456 | 82 | use crate::{ChromaError, ErrorCodes};
use thiserror::Error;
impl From<ErrorCodes> for tonic::Code {
fn from(err: ErrorCodes) -> tonic::Code {
match err {
ErrorCodes::Success => tonic::Code::Ok,
ErrorCodes::Cancelled => tonic::Code::Cancelled,
ErrorCodes::Unknown => tonic... |
8779ff00b89d54044a35f9f8da267a31c7552425eee08fb1de7a0c432635c0ae | Rust | 3,467 | 202 | use sea_query::Iden;
pub trait MetadataTable {
fn table_name() -> Self;
fn id_column() -> Self;
fn key_column() -> Self;
fn str_value_column() -> Self;
fn int_value_column() -> Self;
fn float_value_column() -> Self;
fn bool_value_column() -> Self;
}
/// The table definitions here should ma... |
6f3b4a56302cee2ef8403cdbe640e592f7aae56357f3d6110dc91c148a664819 | Rust | 3,507 | 106 | use crate::{
arrow::{
block::delta::{
single_column_size_tracker::SingleColumnSizeTracker,
single_column_storage::SingleColumnStorage, BlockStorage, UnorderedBlockDelta,
},
types::{ArrowReadableValue, ArrowWriteableKey, ArrowWriteableValue},
},
key::KeyWrapper... |
813962f0b203eedb3353500a9faced60619f88fd888110a118ac2e90659b115d | Rust | 3,550 | 97 | mod client;
mod commands;
mod config_store;
pub mod hnsw_config_repair;
pub mod hnsw_integrity_check;
mod terminal;
mod tui;
mod ui_utils;
mod utils;
use crate::commands::browse::{browse, BrowseArgs};
use crate::commands::copy::{copy, CopyArgs};
use crate::commands::db::{db_command, DbCommand};
use crate::commands::in... |
590e07a9a67c90e5d422786fb3f04b7da69c584efc6c1cb65a509f910e3deac7 | Rust | 3,570 | 135 | use clap::{Parser, Subcommand};
use worker::work_queue::work_queue_client::WorkQueueClient;
#[derive(Parser)]
#[command(name = "work-queue-cli")]
#[command(about = "CLI for interacting with the work queue service", long_about = None)]
struct Cli {
/// Work queue service endpoint
#[arg(short, long, default_valu... |
cfca81e1e87912059d510b5a0976c30540d0b1fbe17a9c750807928a41ea4a59 | Rust | 3,572 | 109 | //! Live end-to-end test of the loop driver against the real Anthropic Messages
//! API. Ignored by default; requires `ANTHROPIC_API_KEY` and network access.
//!
//! This exercises the seam the offline stubs cannot: a real model emitting
//! `tool_use` blocks, parsed into the trajectory, driven through
//! [`drive_agen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.