■ PromptTemplate 클래스를 사용해 전문 저널리스트 역할로서 요약문 프롬프트를 만드는 방법을 보여준다.
▶ 예제 코드 (PY)
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 |
from langchain.prompts import PromptTemplate promptTemplateString = """You are a helpful expert journalist in extracting the main themes from a GIVEN DOCUMENTS below. Please provide a comprehensive summary of the GIVEN DOCUMENTS in numbered list format. The summary should cover all the key points and main ideas presented in the original text, while also condensing the information into a concise and easy-to-understand format. Please ensure that the summary includes relevant details and examples that support the main ideas, while avoiding any unnecessary information or repetition. The length of the summary should be appropriate for the length and complexity of the original text, providing a clear and accurate overview without omitting any important information. GIVEN DOCUMENTS : {docs} FORMAT : 1. main theme 1 2. main theme 2 3. main theme 3 ... CAUTION : - DO NOT list more than 5 main themes. Helpful Answer : """ promptTemplate = PromptTemplate.from_template(promptTemplateString) |
※ pip install langchain 명령을 실행했다.