liboxen 0.53.0

Oxen is a fast data version control system, built with machine learning training data in mind. Designed to handle terabytes of data with ease, using a workflow similar to git. Version both structured and unstructured data of any modality: text, images, video, audio, CSV, Parquet, JSONL, model checkpoints, and more. liboxen is the embeddable core library behind the oxen CLI and server, which power fine tuning and inference pipelines for multimodal LLMs, image models, and video models on Oxen.ai.
use std::path::PathBuf;

use crate::error::OxenError;

use super::PaginateOpts;

#[derive(Clone, Debug)]
pub struct EmbeddingQueryOpts {
    pub path: PathBuf,  // path to the data frame
    pub column: String, // embedding column to query
    pub query: String,  // key=value
    pub name: String,   // name of the similarity column
    pub pagination: PaginateOpts,
}

impl EmbeddingQueryOpts {
    pub fn parse_query(&self) -> Result<(String, String), OxenError> {
        let parts: Vec<&str> = self.query.split('=').collect();
        if parts.len() != 2 {
            return Err(OxenError::basic_str(
                "Query must be in the format key=value",
            ));
        }
        Ok((parts[0].trim().to_string(), parts[1].trim().to_string()))
    }
}