espionox 0.1.42

A library for creating multi-agent workflows in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::error::EmbeddingResult;
use futures::Future;
use reqwest::{header::HeaderMap, Response};
use serde_json::Value;
use std::{fmt::Debug, pin::Pin};

pub type ProcessEmbeddingResponseReturn<'r> =
    Pin<Box<dyn Future<Output = EmbeddingResult<Vec<f32>>> + Send + Sync + 'r>>;
pub trait EmbeddingRequest: Debug + Sync + Send + 'static {
    fn headers(&self, api_key: &str) -> HeaderMap;
    fn model_str(&self) -> &str;
    fn url_str(&self) -> &str;
    fn as_json(&self, text: &str) -> EmbeddingResult<Value>;
    fn process_response<'r>(&'r self, response: Response) -> ProcessEmbeddingResponseReturn;
}