Skip to main content

cortex_sdk/
lib.rs

1//! Blocking Rust HTTP client for CortexDB.
2//!
3//! `cortexdb-sdk` provides a synchronous, ergonomic client for the CortexDB
4//! beta HTTP API. All methods return strongly-typed responses or
5//! `serde_json::Value` for raw access.
6//!
7//! # Quickstart
8//!
9//! ```no_run
10//! use cortex_sdk::CortexDbClient;
11//!
12//! let client = CortexDbClient::new("http://127.0.0.1:8181");
13//! let health = client.health_response().unwrap();
14//! println!("Server version: {}", health.server_version);
15//! ```
16
17mod aql;
18mod aql_support;
19#[cfg(feature = "async")]
20mod async_client;
21mod client;
22mod context_pack;
23mod generated;
24mod grounded_answer;
25mod http;
26mod types;
27mod verification;
28
29pub use aql::{
30    Aql, AqlBuildError, AqlRetrievalMode, RememberBuilder, RetrieveContextBuilder,
31    VerifyFactBuilder,
32};
33#[cfg(feature = "async")]
34pub use async_client::AsyncCortexDbClient;
35pub use client::{CortexDbClient, SdkError, SdkResult};
36pub use context_pack::{
37    AnswerGroundingOptionsV1, AnswerGroundingReportV1, AnswerGroundingSpanV1,
38    ContextPackAccessDecisionV1, ContextPackAnomalyV1, ContextPackCellV1, ContextPackExplainV1,
39    ContextPackProvenanceV1, ContextPackSourceRefV1, ContextPackV1,
40    CONTEXT_PACK_V1_REQUIRED_FIELDS, CONTEXT_PACK_V1_SCHEMA_VERSION,
41};
42pub use grounded_answer::{GroundedAnswerRequest, GroundedAnswerResponse};
43pub use types::{
44    AnnEvaluationResponse, AnnNoFallbackDecision, AnnSearchReport, AnswerGroundingOptionsResponse,
45    AnswerGroundingReportResponse, AnswerGroundingSpanResponse, AqlCandidateCounts,
46    AqlCellResponse, AqlExecutionOperator, AqlExecutionTrace, AqlExplainFilter, AqlExplainResponse,
47    AqlLogicalPlan, AqlLogicalPlanNode, AqlResponse, CellLookupResponse, CellResponse,
48    ContextPackAnomalyResponse, ContextPackCellResponse, ContextPackResponse,
49    ContextSpanProvenanceResponse, DeleteJobResponse, ErrorCode, ErrorResponse, EvidenceResponse,
50    ExplainResponse, GuardResponse, HealthResponse, HnswNoFallbackProfileResponse, IngestResponse,
51    IngestionJobResponse, IngestionJobStatus, IngestionSkippedItem, IngestionSourceRefReport,
52    IngestionValidationIssue, IngestionValidationReport, NumericConflictResponse, PutCellResponse,
53    RememberResponse, ScoreComponentResponse, SearchAnswerGroundingReportResponse,
54    SearchAnswerGroundingSpanResponse, SearchExplainItem, SearchExplainResponse,
55    SearchExplainTermContribution, SearchResponse, SearchResult, SearchRoutingDecision,
56    SourceRefResponse, StatsResponse, ValidationResponse, VectorAlgorithm,
57    VerificationReportResponse, WriteBatchOperationRequest, WriteBatchRequest, WriteBatchResponse,
58};
59pub use verification::{
60    VerificationReportExt, VerifyConflict, VerifyEvidenceConflict, VerifyNumericConflict,
61    VerifyOutputFormat, VerifyRequest, VerifyResult,
62};
63
64#[cfg(test)]
65mod context_pack_tests;
66#[cfg(test)]
67mod grounded_answer_tests;
68#[cfg(test)]
69mod tests;
70#[cfg(test)]
71mod verification_tests;