polymathy 0.2.0

Turn search results into answers - a web service that fetches, chunks, and returns semantic content from search queries
Documentation
//! Search functionality for processing queries and retrieving results.
//!
//! This module handles:
//! - Processing search queries through SearxNG integration
//! - Retrieving search results from external services
//! - Managing search result data structures

use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use apistos::ApiComponent;
use schemars::JsonSchema;

/// Represents a search query.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ApiComponent)]
pub struct SearchQuery {
    /// The search query string
    pub q: String,
}

/// Represents the configuration for content processing.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ApiComponent)]
pub struct Config {
    /// The type of chunking to perform
    pub chunking_type: String,
    /// The size of chunks
    pub chunking_size: usize,
    /// The embedding model to use
    pub embedding_model: String,
}

/// Represents the processed content of a URL.
#[derive(Debug, Serialize, Deserialize, JsonSchema, ApiComponent)]
pub struct ProcessedContent {
    /// The URL of the processed content
    pub url: String,
    /// Configuration used for processing
    pub config: Config,
    /// The chunks of content
    pub chunks: HashMap<usize, String>,
    /// The embeddings for each chunk
    pub embeddings: HashMap<usize, Vec<f32>>,
    /// Any error that occurred during processing
    pub error: Option<String>,
}