Spaces:
Build error
Build error
use std::fmt::Debug; | |
use schemars::JsonSchema; | |
use serde; | |
use serde::Serialize; | |
pub fn get_git_commit_id() -> Option<String> { | |
option_env!("GIT_COMMIT_ID") | |
.map(ToString::to_string) | |
.filter(|s| !s.trim().is_empty()) | |
} | |
pub struct VersionInfo { | |
pub title: String, | |
pub version: String, | |
pub commit: Option<String>, | |
} | |
impl Default for VersionInfo { | |
fn default() -> Self { | |
VersionInfo { | |
title: "qdrant - vector search engine".to_string(), | |
version: env!("CARGO_PKG_VERSION").to_string(), | |
commit: get_git_commit_id(), | |
} | |
} | |
} | |
pub enum ApiStatus { | |
Ok, | |
Error(String), | |
Accepted, | |
} | |
pub struct ApiResponse<D> { | |
pub result: Option<D>, | |
pub status: ApiStatus, | |
pub time: f64, | |
pub usage: Option<HardwareUsage>, | |
} | |
/// Usage of the hardware resources, spent to process the request | |
pub struct HardwareUsage { | |
pub cpu: usize, | |
} | |
pub struct CollectionDescription { | |
pub name: String, | |
} | |
fn example_collectios_response() -> CollectionsResponse { | |
CollectionsResponse { | |
collections: vec![ | |
CollectionDescription { | |
name: "arivx-title".to_string(), | |
}, | |
CollectionDescription { | |
name: "arivx-abstract".to_string(), | |
}, | |
CollectionDescription { | |
name: "medium-title".to_string(), | |
}, | |
CollectionDescription { | |
name: "medium-text".to_string(), | |
}, | |
], | |
} | |
} | |
pub struct CollectionsResponse { | |
pub collections: Vec<CollectionDescription>, | |
} | |