Skip to main content

ContentGenerator

Struct ContentGenerator 

Source
pub struct ContentGenerator { /* private fields */ }
Expand description

Content generator that combines an LLM provider with business context.

Implementations§

Source§

impl ContentGenerator

Source

pub fn new(provider: Box<dyn LlmProvider>, business: BusinessProfile) -> Self

Create a new content generator.

Source

pub fn business(&self) -> &BusinessProfile

Returns a reference to the business profile.

Source

pub async fn generate_reply( &self, tweet_text: &str, tweet_author: &str, mention_product: bool, ) -> Result<GenerationOutput, LlmError>

Generate a reply to a tweet.

Source

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.

Source

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.

Source

pub async fn generate_tweet( &self, topic: &str, ) -> Result<GenerationOutput, LlmError>

Generate a standalone educational tweet.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub async fn generate_hooks( &self, topic: &str, rag_context: Option<&str>, ) -> Result<HookGenerationOutput, LlmError>

Generate 5 differentiated hook options for the given topic.

Source

pub async fn generate_mined_angles( &self, topic: &str, neighbors: &[NeighborContent], selection_context: Option<&str>, ) -> Result<AngleMiningOutput, LlmError>

Generate evidence-backed content angles from neighbor notes.

Source

pub async fn extract_highlights( &self, rag_context: &str, ) -> Result<Vec<String>, LlmError>

Extract 3-5 concise, tweetable key highlights from provided context.

Used as an intermediate curation step before generating content from vault notes, letting the user review and select which insights to include.

Source

pub async fn generate_thread( &self, topic: &str, ) -> Result<ThreadGenerationOutput, LlmError>

Generate an educational thread of 5-8 tweets.

Source

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.

Source

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.

Source

pub async fn generate_thread_with_hook( &self, topic: &str, opening_hook: &str, structure: Option<ThreadStructure>, rag_context: Option<&str>, ) -> Result<ThreadGenerationOutput, LlmError>

Generate a thread that starts with a specific opening hook tweet.

The hook is used verbatim as the first tweet, and the LLM generates 4-7 additional tweets continuing from that opening.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more