File size: 729 Bytes
8bc7dc5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain

def x_retweet_commenting_gen(tweet, tone_of_voice, llm):
    
    x_retweet_comment_prompt = f"I'm planning to retweet the following tweet:\n“{tweet}”\nConstruct 5 varied comments I could append to this retweet. tone should be {tone_of_voice}"
    x_retweet_comment_promptTemp = PromptTemplate(
    input_variables=["text_input"],
    template="You are Specilaized Twitter Copywriter\n{text_input}\n\nRetweet Comment:")
    x_retweet_comment_extraction_chain = LLMChain(llm=llm, prompt=x_retweet_comment_promptTemp)
    x_retweet_comment = x_retweet_comment_extraction_chain.run(x_retweet_comment_prompt)
    
    return x_retweet_comment