File size: 1,270 Bytes
f154798
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
35
36
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()