pub struct CortexDbClient { /* private fields */ }Expand description
Blocking HTTP client for the CortexDB API.
Create with CortexDbClient::new and chain configuration:
use cortex_sdk::CortexDbClient;
let client = CortexDbClient::new("http://127.0.0.1:8181")
.with_token("secret")
.with_tenant("tenant:alpha");Implementations§
Source§impl CortexDbClient
impl CortexDbClient
pub fn health(&self) -> SdkResult<Value>
pub fn health_response(&self) -> SdkResult<HealthResponse>
pub fn stats(&self) -> SdkResult<Value>
pub fn stats_response(&self) -> SdkResult<StatsResponse>
pub fn validate(&self) -> SdkResult<Value>
pub fn validate_response(&self) -> SdkResult<ValidationResponse>
pub fn put_cell(&self, cell_id: u64, payload: &str) -> SdkResult<Value>
pub fn put_cell_response( &self, cell_id: u64, payload: &str, ) -> SdkResult<PutCellResponse>
pub fn write_batch(&self, request: &WriteBatchRequest) -> SdkResult<Value>
pub fn write_batch_response( &self, request: &WriteBatchRequest, ) -> SdkResult<WriteBatchResponse>
pub fn get_cell(&self, cell_id: u64) -> SdkResult<Value>
pub fn get_cell_response(&self, cell_id: u64) -> SdkResult<CellLookupResponse>
pub fn tombstone_cell(&self, cell_id: u64) -> SdkResult<Value>
pub fn flush(&self) -> SdkResult<Value>
pub fn compact(&self) -> SdkResult<Value>
Source§impl CortexDbClient
impl CortexDbClient
pub fn ingest_text( &self, scope: &str, source: &str, text: &str, ) -> SdkResult<Value>
pub fn ingest_text_response( &self, scope: &str, source: &str, text: &str, ) -> SdkResult<IngestResponse>
pub fn ingest_json( &self, scope: &str, source: &str, document: &str, ) -> SdkResult<Value>
pub fn ingest_json_response( &self, scope: &str, source: &str, document: &str, ) -> SdkResult<IngestResponse>
pub fn ingest_csv( &self, scope: &str, source: &str, document: &str, ) -> SdkResult<Value>
pub fn ingest_csv_response( &self, scope: &str, source: &str, document: &str, ) -> SdkResult<IngestResponse>
pub fn ingestion_job(&self, job_id: u64) -> SdkResult<Value>
pub fn ingestion_job_response( &self, job_id: u64, ) -> SdkResult<IngestionJobResponse>
pub fn delete_ingestion_job(&self, job_id: u64) -> SdkResult<DeleteJobResponse>
pub fn retry_ingestion_job( &self, job_id: u64, ) -> SdkResult<IngestionJobResponse>
Source§impl CortexDbClient
impl CortexDbClient
pub fn aql(&self, scope: &str, statement: &str) -> SdkResult<Value>
pub fn aql_response( &self, scope: &str, statement: &str, ) -> SdkResult<AqlResponse>
pub fn context(&self, scope: &str, statement: &str) -> SdkResult<Value>
pub fn context_response( &self, scope: &str, statement: &str, ) -> SdkResult<ContextPackResponse>
pub fn context_prompt(&self, scope: &str, statement: &str) -> SdkResult<String>
pub fn context_markdown( &self, scope: &str, statement: &str, ) -> SdkResult<String>
pub fn verify(&self, scope: &str, statement: &str) -> SdkResult<Value>
pub fn verify_response( &self, scope: &str, statement: &str, ) -> SdkResult<VerificationReportResponse>
pub fn verify_request_response( &self, request: &VerifyRequest, ) -> SdkResult<VerificationReportResponse>
pub fn verify_request_export( &self, request: &VerifyRequest, ) -> SdkResult<String>
pub fn answer_with_grounded_context( &self, request: GroundedAnswerRequest, answerer: impl FnOnce(&ContextPackResponse) -> SdkResult<String>, ) -> SdkResult<GroundedAnswerResponse>
pub fn remember(&self, scope: &str, statement: &str) -> SdkResult<Value>
pub fn remember_response( &self, scope: &str, statement: &str, ) -> SdkResult<RememberResponse>
Source§impl CortexDbClient
impl CortexDbClient
pub fn search_keyword( &self, scope: &str, query: &str, limit: usize, ) -> SdkResult<Value>
pub fn search_keyword_response( &self, scope: &str, query: &str, limit: usize, ) -> SdkResult<SearchResponse>
pub fn search_auto( &self, scope: &str, query: &str, vector: Option<&str>, limit: usize, ) -> SdkResult<Value>
pub fn search_auto_response( &self, scope: &str, query: &str, vector: Option<&str>, limit: usize, ) -> SdkResult<SearchResponse>
pub fn search_explain( &self, scope: &str, query: &str, mode: &str, vector: Option<&str>, limit: usize, ) -> SdkResult<Value>
pub fn search_explain_response( &self, scope: &str, query: &str, mode: &str, vector: Option<&str>, limit: usize, ) -> SdkResult<SearchExplainResponse>
pub fn search_vector( &self, scope: &str, vector: &[i16], algorithm: VectorAlgorithm, limit: usize, ) -> SdkResult<Value>
pub fn search_vector_response( &self, scope: &str, vector: &[i16], algorithm: VectorAlgorithm, limit: usize, ) -> SdkResult<SearchResponse>
pub fn evaluate_ann( &self, scope: &str, vector: &[i16], limit: usize, ) -> SdkResult<Value>
pub fn evaluate_ann_response( &self, scope: &str, vector: &[i16], limit: usize, ) -> SdkResult<AnnEvaluationResponse>
Source§impl CortexDbClient
impl CortexDbClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
Create a client with the default 10-second timeout.
Sourcepub fn with_timeout(base_url: impl Into<String>, timeout: Duration) -> Self
pub fn with_timeout(base_url: impl Into<String>, timeout: Duration) -> Self
Create a client with a custom timeout.
Sourcepub fn with_token(self, token: impl Into<String>) -> Self
pub fn with_token(self, token: impl Into<String>) -> Self
Set the Bearer token for authenticated requests.
Sourcepub fn with_tenant(self, tenant: impl Into<String>) -> Self
pub fn with_tenant(self, tenant: impl Into<String>) -> Self
Set the tenant ID for per-tenant database routing.
Sourcepub fn with_retries(self, max_retries: u32, retry_delay: Duration) -> Self
pub fn with_retries(self, max_retries: u32, retry_delay: Duration) -> Self
Set retry behaviour for idempotent requests.
Trait Implementations§
Source§impl Clone for CortexDbClient
impl Clone for CortexDbClient
Source§fn clone(&self) -> CortexDbClient
fn clone(&self) -> CortexDbClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for CortexDbClient
impl !UnwindSafe for CortexDbClient
impl Freeze for CortexDbClient
impl Send for CortexDbClient
impl Sync for CortexDbClient
impl Unpin for CortexDbClient
impl UnsafeUnpin for CortexDbClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more