pub struct ContentGenerator { /* private fields */ }Expand description
Content generator that combines an LLM provider with business context.
Implementations§
Source§impl ContentGenerator
impl ContentGenerator
Sourcepub fn new(provider: Box<dyn LlmProvider>, business: BusinessProfile) -> Self
pub fn new(provider: Box<dyn LlmProvider>, business: BusinessProfile) -> Self
Create a new content generator.
Sourcepub fn business(&self) -> &BusinessProfile
pub fn business(&self) -> &BusinessProfile
Returns a reference to the business profile.
Sourcepub async fn generate_reply(
&self,
tweet_text: &str,
tweet_author: &str,
mention_product: bool,
) -> Result<GenerationOutput, LlmError>
pub async fn generate_reply( &self, tweet_text: &str, tweet_author: &str, mention_product: bool, ) -> Result<GenerationOutput, LlmError>
Generate a reply to a tweet.
Sourcepub async fn generate_reply_with_archetype(
&self,
tweet_text: &str,
tweet_author: &str,
mention_product: bool,
archetype: Option<ReplyArchetype>,
) -> Result<GenerationOutput, LlmError>
pub async fn generate_reply_with_archetype( &self, tweet_text: &str, tweet_author: &str, mention_product: bool, archetype: Option<ReplyArchetype>, ) -> Result<GenerationOutput, LlmError>
Generate a reply using a specific archetype for varied output.
Sourcepub async fn generate_reply_with_context(
&self,
tweet_text: &str,
tweet_author: &str,
mention_product: bool,
archetype: Option<ReplyArchetype>,
rag_context: Option<&str>,
) -> Result<GenerationOutput, LlmError>
pub async fn generate_reply_with_context( &self, tweet_text: &str, tweet_author: &str, mention_product: bool, archetype: Option<ReplyArchetype>, rag_context: Option<&str>, ) -> Result<GenerationOutput, LlmError>
Generate a reply with optional RAG context injected into the prompt.
Sourcepub async fn generate_tweet(
&self,
topic: &str,
) -> Result<GenerationOutput, LlmError>
pub async fn generate_tweet( &self, topic: &str, ) -> Result<GenerationOutput, LlmError>
Generate a standalone educational tweet.
Sourcepub async fn generate_tweet_with_format(
&self,
topic: &str,
format: Option<TweetFormat>,
) -> Result<GenerationOutput, LlmError>
pub async fn generate_tweet_with_format( &self, topic: &str, format: Option<TweetFormat>, ) -> Result<GenerationOutput, LlmError>
Generate a tweet using a specific format for varied structure.
Sourcepub async fn generate_tweet_with_context(
&self,
topic: &str,
format: Option<TweetFormat>,
rag_context: Option<&str>,
) -> Result<GenerationOutput, LlmError>
pub async fn generate_tweet_with_context( &self, topic: &str, format: Option<TweetFormat>, rag_context: Option<&str>, ) -> Result<GenerationOutput, LlmError>
Generate a tweet with optional RAG context injected into the prompt.
Sourcepub async fn improve_draft(
&self,
draft: &str,
tone_cue: Option<&str>,
) -> Result<GenerationOutput, LlmError>
pub async fn improve_draft( &self, draft: &str, tone_cue: Option<&str>, ) -> Result<GenerationOutput, LlmError>
Rewrite/improve an existing draft tweet with an optional tone cue.
Sourcepub async fn improve_draft_with_context(
&self,
draft: &str,
tone_cue: Option<&str>,
rag_context: Option<&str>,
) -> Result<GenerationOutput, LlmError>
pub async fn improve_draft_with_context( &self, draft: &str, tone_cue: Option<&str>, rag_context: Option<&str>, ) -> Result<GenerationOutput, LlmError>
Rewrite/improve an existing draft tweet with optional RAG context injected into the system prompt.
Sourcepub async fn generate_thread(
&self,
topic: &str,
) -> Result<ThreadGenerationOutput, LlmError>
pub async fn generate_thread( &self, topic: &str, ) -> Result<ThreadGenerationOutput, LlmError>
Generate an educational thread of 5-8 tweets.
Sourcepub async fn generate_thread_with_structure(
&self,
topic: &str,
structure: Option<ThreadStructure>,
) -> Result<ThreadGenerationOutput, LlmError>
pub async fn generate_thread_with_structure( &self, topic: &str, structure: Option<ThreadStructure>, ) -> Result<ThreadGenerationOutput, LlmError>
Generate a thread using a specific structure for varied content.
Sourcepub async fn generate_thread_with_context(
&self,
topic: &str,
structure: Option<ThreadStructure>,
rag_context: Option<&str>,
) -> Result<ThreadGenerationOutput, LlmError>
pub async fn generate_thread_with_context( &self, topic: &str, structure: Option<ThreadStructure>, rag_context: Option<&str>, ) -> Result<ThreadGenerationOutput, LlmError>
Generate a thread with optional RAG context injected into the prompt.
Auto Trait Implementations§
impl Freeze for ContentGenerator
impl !RefUnwindSafe for ContentGenerator
impl Send for ContentGenerator
impl Sync for ContentGenerator
impl Unpin for ContentGenerator
impl UnsafeUnpin for ContentGenerator
impl !UnwindSafe for ContentGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more