LinkedIn-Post-Generator / template /transform_prompt.py
samagra44
initial commit
f154798
raw
history blame contribute delete
889 Bytes
from langchain.prompts import PromptTemplate
from langchain_core.output_parsers import JsonOutputParser
from helper.configure_llm import LLM
import sys
sys.dont_write_bytecode = True
llm = LLM
QUERY_PROMPT = PromptTemplate(
template = """
<|begin_of_text|>
<|start_header_id|>system<|end_header_id|>
You are a expert at crafting web search queries for research questions.
More often that not, a user will ask a basic question that they wish to learn more about; however, it might not be in the best format.
Reword their query to be the most effective web search string possible.
Return the JSON with a single key 'query' with no premable or explanation.
Question to transform: {question}
<|eot_id|>
<|start_header_id|>user<|end_header_id|>
""",
input_variables=["question"],
)
QUERY_CHAIN = QUERY_PROMPT | llm | JsonOutputParser()