use std::collections::HashMap;
use std::sync::Arc;
use futures::future::BoxFuture;
pub(crate) type BoxError = Box<dyn std::error::Error + Send + Sync>;
pub(crate) type Completer = Arc<
dyn Fn(CompletionRequest) -> BoxFuture<'static, Result<Vec<String>, BoxError>> + Send + Sync,
>;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum CompletionTarget {
Prompt(String),
Resource(String),
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct CompletionRequest {
pub target: CompletionTarget,
pub argument: String,
pub value: String,
pub context: HashMap<String, String>,
}
impl CompletionRequest {
pub fn new(
target: CompletionTarget,
argument: impl Into<String>,
value: impl Into<String>,
context: HashMap<String, String>,
) -> Self {
Self {
target,
argument: argument.into(),
value: value.into(),
context,
}
}
}