gemma / generator /prompt_builder_v1.py
dasomaru's picture
Upload folder using huggingface_hub
2c5f455 verified
raw
history blame contribute delete
539 Bytes
def build_prompt(query: str, context_docs: list) -> str:
"""
์‚ฌ์šฉ์ž ์งˆ๋ฌธ๊ณผ ๊ฒ€์ƒ‰๋œ ๋ฌธ์„œ๋“ค์„ ์กฐํ•ฉํ•ด LLM ์ž…๋ ฅ์šฉ ํ”„๋กฌํ”„ํŠธ๋ฅผ ๋งŒ๋“ ๋‹ค.
"""
context_text = "\n".join([f"- {doc}" for doc in context_docs])
prompt = f"""๋‹น์‹ ์€ ๊ณต์ธ์ค‘๊ฐœ์‚ฌ ์‹œํ—˜ ๋ฌธ์ œ ์ถœ์ œ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค.
๋‹ค์Œ์€ ๊ธฐ์ถœ ๋ฌธ์ œ ๋ฐ ๊ด€๋ จ ๋ฒ•๋ น ์ •๋ณด์ž…๋‹ˆ๋‹ค:
{context_text}
์ด ์ •๋ณด๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์‚ฌ์šฉ์ž์˜ ์š”์ฒญ์— ๋‹ต๋ณ€ํ•ด ์ฃผ์„ธ์š”.
[์งˆ๋ฌธ]
{query}
[๋‹ต๋ณ€]
"""
return prompt