pub trait UniversalSummarizer {
// Required method
fn summarize<'life0, 'async_trait>(
&'life0 self,
subject: Subject,
options: SummaryOptions,
) -> Pin<Box<dyn Future<Output = KagiResult<Summary>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn summarize_url<'life0, 'async_trait>(
&'life0 self,
url: Url,
options: SummaryOptions,
) -> Pin<Box<dyn Future<Output = KagiResult<Summary>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn summarize_text<'life0, 'async_trait>(
&'life0 self,
text: String,
options: SummaryOptions,
) -> Pin<Box<dyn Future<Output = KagiResult<Summary>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}
Expand description
The Universal Summarizer is an API using powerful LLMs to summarize content on the web, or your own documents, of any length.
Required Methods§
fn summarize<'life0, 'async_trait>(
&'life0 self,
subject: Subject,
options: SummaryOptions,
) -> Pin<Box<dyn Future<Output = KagiResult<Summary>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Provided Methods§
Sourcefn summarize_url<'life0, 'async_trait>(
&'life0 self,
url: Url,
options: SummaryOptions,
) -> Pin<Box<dyn Future<Output = KagiResult<Summary>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn summarize_url<'life0, 'async_trait>(
&'life0 self,
url: Url,
options: SummaryOptions,
) -> Pin<Box<dyn Future<Output = KagiResult<Summary>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Examples found in repository?
examples/simple-summary.rs (line 11)
4async fn main() {
5 let config = kagi_api::KagiConfig::with_api_key("api key goes here");
6 let client = kagi_api::KagiClient::new(config);
7 let options = SummaryOptions::default();
8
9 let some_url = url::Url::parse("https://en.wikipedia.org/wiki/A_Cyborg_Manifesto").unwrap();
10 let summary = client
11 .summarize_url(some_url, options)
12 .await
13 .expect("A valid Universal Summarizer result");
14
15 // FIXME: Cannot `.render()` without kagi-cli: Remove `Render` trait's coupling from `Args`.
16 serde_json::to_writer_pretty(std::io::stdout(), &summary).unwrap();
17}