#[async_trait::async_trait]
pub trait LanguageService: std::fmt::Debug + Send + Sync {
async fn analyze_sentiment(
&self,
req: crate::model::AnalyzeSentimentRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::AnalyzeSentimentResponse>>;
async fn analyze_entities(
&self,
req: crate::model::AnalyzeEntitiesRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::AnalyzeEntitiesResponse>>;
async fn classify_text(
&self,
req: crate::model::ClassifyTextRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::ClassifyTextResponse>>;
async fn moderate_text(
&self,
req: crate::model::ModerateTextRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::ModerateTextResponse>>;
async fn annotate_text(
&self,
req: crate::model::AnnotateTextRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::AnnotateTextResponse>>;
}
#[async_trait::async_trait]
impl<T: super::LanguageService> LanguageService for T {
async fn analyze_sentiment(
&self,
req: crate::model::AnalyzeSentimentRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::AnalyzeSentimentResponse>> {
T::analyze_sentiment(self, req, options).await
}
async fn analyze_entities(
&self,
req: crate::model::AnalyzeEntitiesRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::AnalyzeEntitiesResponse>> {
T::analyze_entities(self, req, options).await
}
async fn classify_text(
&self,
req: crate::model::ClassifyTextRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::ClassifyTextResponse>> {
T::classify_text(self, req, options).await
}
async fn moderate_text(
&self,
req: crate::model::ModerateTextRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::ModerateTextResponse>> {
T::moderate_text(self, req, options).await
}
async fn annotate_text(
&self,
req: crate::model::AnnotateTextRequest,
options: crate::RequestOptions,
) -> crate::Result<crate::Response<crate::model::AnnotateTextResponse>> {
T::annotate_text(self, req, options).await
}
}