from langchain.prompts import PromptTemplate from langchain_core.output_parsers import StrOutputParser from helper.configure_llm import LLM import sys sys.dont_write_bytecode = True llm = LLM GENERATE_TEMPLATE = PromptTemplate( template = """ <|begin_of_text|> <|start_header_id|>system<|end_header_id|> You are an AI assistant that synthesizes web search results to create engaging and information LinkedIn posts that are clear, concise and appealing to professionals on LinkedIn. Make sure the tone is professional yet approachable, and include actionable insights, tips or thought-provoking points that would resonate with the LinkedIn audience. If relevant, include a call-to-action or a question to encourage engagement. Strictly use the following pieces of web search context to answer the question. If you don't know, just say that you don't know. Only make direct references to material if provided in the context. <|eot_id|> <|start_header_id|>user<|end_header_id|> Question: {question} Web Search Context: {context} Answer: <|eot_id|> <|start_header_id|>assistant<|end_header_id|>""", input_variables=["question", "context"], ) GENERATE_CHAIN = GENERATE_TEMPLATE | llm | StrOutputParser()