wiizm commited on
Commit
fa20d20
ยท
verified ยท
1 Parent(s): 0e8e2dd

Upload app\prompts\parent_chunk.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app//prompts//parent_chunk.py +54 -0
app//prompts//parent_chunk.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Parent Chunk ๋ถ„์„ ํ”„๋กฌํ”„ํŠธ
3
+ """
4
+
5
+ from typing import Optional
6
+
7
+
8
+ def get_parent_chunk_analysis_prompt(
9
+ content: str,
10
+ max_length: int = 8000
11
+ ) -> str:
12
+ """
13
+ Parent Chunk ๋ถ„์„์„ ์œ„ํ•œ ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ
14
+
15
+ Args:
16
+ content: ๋ถ„์„ํ•  ์ „์ฒด ํ…์ŠคํŠธ
17
+ max_length: ํ”„๋กฌํ”„ํŠธ์— ํฌํ•จํ•  ์ตœ๋Œ€ ํ…์ŠคํŠธ ๊ธธ์ด
18
+
19
+ Returns:
20
+ ํ”„๋กฌํ”„ํŠธ ๋ฌธ์ž์—ด
21
+ """
22
+ content_preview = content[:max_length]
23
+ is_truncated = len(content) > max_length
24
+
25
+ truncation_note = "\n(์ฐธ๊ณ : ํ…์ŠคํŠธ๊ฐ€ ๊ธธ์–ด ์ผ๋ถ€๋งŒ ์‚ฌ์šฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.)" if is_truncated else ""
26
+
27
+ prompt = f"""๋‹ค์Œ ์›น์†Œ์„ค ํ…์ŠคํŠธ๋ฅผ ๋ถ„์„ํ•˜์—ฌ ์„ธ๊ณ„๊ด€, ์บ๋ฆญํ„ฐ, ์Šคํ† ๋ฆฌ, ์—ํ”ผ์†Œ๋“œ, ๊ธฐํƒ€ ์ •๋ณด๋ฅผ ์ถ”์ถœํ•˜์„ธ์š”.
28
+
29
+ ํ…์ŠคํŠธ:
30
+ {content_preview}{truncation_note}
31
+
32
+ ๋‹ค์Œ ํ˜•์‹์œผ๋กœ ์‘๋‹ตํ•˜์„ธ์š”:
33
+
34
+ ## ์„ธ๊ณ„๊ด€
35
+ [์„ธ๊ณ„๊ด€์— ๋Œ€ํ•œ ์ƒ์„ธ ์„ค๋ช…]
36
+
37
+ ## ์บ๋ฆญํ„ฐ
38
+ [์ฃผ์š” ์บ๋ฆญํ„ฐ๋“ค์˜ ํŠน์ง•๊ณผ ๋ฐฐ๊ฒฝ]
39
+
40
+ ## ์Šคํ† ๋ฆฌ
41
+ [์ฃผ์š” ์Šคํ† ๋ฆฌ ๋ผ์ธ๊ณผ ์ „๊ฐœ]
42
+
43
+ ## ์—ํ”ผ์†Œ๋“œ
44
+ [์ฃผ์š” ์—ํ”ผ์†Œ๋“œ์™€ ์‚ฌ๊ฑด๋“ค]
45
+
46
+ ## ๊ธฐํƒ€
47
+ [๊ธฐํƒ€ ์ค‘์š”ํ•œ ์ •๋ณด]
48
+
49
+ ๊ฐ ์„น์…˜์€ ์ƒ์„ธํ•˜๊ณ  ๊ตฌ์กฐํ™”๋œ ํ˜•ํƒœ๋กœ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”."""
50
+
51
+ return prompt
52
+
53
+
54
+