Spaces:
Sleeping
Sleeping
File size: 1,234 Bytes
2c20470 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
from langchain.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
def post_from_content(model , content):
template=""" As a professional LinkedIn post creator tool, your task is to craft a compelling post based on the content provided. Adhere to the following guidelines:
1. Post length should not exceed 3000 characters.
2. Select a fitting title, employ professional formatting, incorporate stickers, emojis, relevant hashtags, links (if applicable in the content), and references.
3. Additionally, if the content includes code snippets, ensure to present them appropriately within the post.
Execute these steps thoughtfully to create an engaging and polished LinkedIn post.
Content: {content}\n\n
Output should only be generated LinkedIn post so that I can quickly copy it and put on my LinkedIn page without doing any modifications.
"""
prompt = ChatPromptTemplate.from_template(template)
chain = prompt | model | StrOutputParser()
generated_post=chain.invoke({"content":content})
return generated_post |