ginipick commited on
Commit
fa889b1
ยท
verified ยท
1 Parent(s): 87e57ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -268,10 +268,9 @@ async def query_pdf(pdf_id: str, query: str) -> Dict[str, Any]:
268
 
269
  # ์‹œ์Šคํ…œ ํ”„๋กฌํ”„ํŠธ ์ค€๋น„
270
  system_prompt = """
271
- ๊ธฐ๋ณธ ์–ธ์–ด ์„ค์ •์€ English ์ด๋‹ค. ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ ์–ธ์–ด์— ๋”ฐ๋ผ(์˜์–ด, ํ•œ๊ตญ์–ด, ์ผ๋ณธ์–ด, ์ค‘๊ตญ์–ด ๋“ฑ) ์ž…๋ ฅ๋ฐ›์€ ์–ธ์–ด๋กœ ๋‹ต๋ณ€ํ•˜๋ผ.
272
- ๋‹น์‹ ์€ PDF ๋‚ด์šฉ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์งˆ๋ฌธ์— ๋‹ต๋ณ€ํ•˜๋Š” ๋„์šฐ๋ฏธ์ž…๋‹ˆ๋‹ค. ์ œ๊ณต๋œ PDF ์ปจํ…์ŠคํŠธ ์ •๋ณด๋งŒ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ต๋ณ€ํ•˜์„ธ์š”.
273
- ์ปจํ…์ŠคํŠธ์— ๊ด€๋ จ ์ •๋ณด๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ, '์ œ๊ณต๋œ PDF์—์„œ ํ•ด๋‹น ์ •๋ณด๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค'๋ผ๊ณ  ์†”์งํžˆ ๋‹ตํ•˜์„ธ์š”.
274
- ๋‹ต๋ณ€์€ ๋ช…ํ™•ํ•˜๊ณ  ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์ž‘์„ฑํ•˜๊ณ , ๊ด€๋ จ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ๋ฅผ ์ธ์šฉํ•˜์„ธ์š”. ๋ฐ˜๋“œ์‹œ ๊ณต์†ํ•œ ๋งํˆฌ๋กœ ์นœ์ ˆํ•˜๊ฒŒ ์‘๋‹ตํ•˜์„ธ์š”.
275
  """
276
 
277
  # gpt-4.1-mini ๋ชจ๋ธ ์‚ฌ์šฉ
@@ -283,7 +282,7 @@ async def query_pdf(pdf_id: str, query: str) -> Dict[str, Any]:
283
  model="gpt-4.1-mini",
284
  messages=[
285
  {"role": "system", "content": system_prompt},
286
- {"role": "user", "content": f"๋‹ค์Œ PDF ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์—ฌ ์งˆ๋ฌธ์— ๋‹ต๋ณ€ํ•ด์ฃผ์„ธ์š”.\n\nPDF ๋‚ด์šฉ:\n{all_text}\n\n์งˆ๋ฌธ: {query}"}
287
  ],
288
  temperature=0.7,
289
  max_tokens=2048,
@@ -353,7 +352,7 @@ async def summarize_pdf(pdf_id: str) -> Dict[str, Any]:
353
  response = openai_client.chat.completions.create(
354
  model="gpt-4.1-mini",
355
  messages=[
356
- {"role": "system", "content": "๋‹ค์Œ PDF ๋‚ด์šฉ์„ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์š”์•ฝํ•ด์ฃผ์„ธ์š”. ํ•ต์‹ฌ ์ฃผ์ œ์™€ ์ฃผ์š” ํฌ์ธํŠธ๋ฅผ ํฌํ•จํ•œ ์š”์•ฝ์„ 500์ž ์ด๋‚ด๋กœ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”."},
357
  {"role": "user", "content": f"PDF ๋‚ด์šฉ:\n{all_text}"}
358
  ],
359
  temperature=0.7,
 
268
 
269
  # ์‹œ์Šคํ…œ ํ”„๋กฌํ”„ํŠธ ์ค€๋น„
270
  system_prompt = """
271
+ The default language is set to English. However, please respond in the language used in the user's prompt (e.g., English, Korean, Japanese, Chinese, etc.).
272
+ You are an assistant that answers questions based solely on the provided PDF context. Please use only the information from the provided PDF content to respond. If relevant information is not available in the context, honestly reply with, "The requested information could not be found in the provided PDF."
273
+ Please ensure your responses are clear and concise, citing relevant page numbers. Always respond politely and courteously.
 
274
  """
275
 
276
  # gpt-4.1-mini ๋ชจ๋ธ ์‚ฌ์šฉ
 
282
  model="gpt-4.1-mini",
283
  messages=[
284
  {"role": "system", "content": system_prompt},
285
+ {"role": "user", "content": f"The default language is set to English.๋‹ค์Œ PDF ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์—ฌ ์งˆ๋ฌธ์— ๋‹ต๋ณ€ํ•ด์ฃผ์„ธ์š”.\n\nPDF ๋‚ด์šฉ:\n{all_text}\n\n์งˆ๋ฌธ: {query}"}
286
  ],
287
  temperature=0.7,
288
  max_tokens=2048,
 
352
  response = openai_client.chat.completions.create(
353
  model="gpt-4.1-mini",
354
  messages=[
355
+ {"role": "system", "content": "The default language is set to English. ๋‹ค์Œ PDF ๋‚ด์šฉ์„ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์š”์•ฝํ•ด์ฃผ์„ธ์š”. ํ•ต์‹ฌ ์ฃผ์ œ์™€ ์ฃผ์š” ํฌ์ธํŠธ๋ฅผ ํฌํ•จํ•œ ์š”์•ฝ์„ 500์ž ์ด๋‚ด๋กœ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”."},
356
  {"role": "user", "content": f"PDF ๋‚ด์šฉ:\n{all_text}"}
357
  ],
358
  temperature=0.7,