asiansoul commited on
Commit
b97bbfa
โ€ข
1 Parent(s): 549b942

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -2
README.md CHANGED
@@ -243,18 +243,19 @@ def invoke_model(text, target_lang):
243
  if target_lang == 'ko':
244
  messages = [
245
  SystemMessage(content='๋ฌธ์„œ์˜ ํ•ต์‹ฌ ์š”์•ฝ์„ ์ƒ์„ธํ•˜๊ฒŒ ์ œ๊ณตํ•ด ์ฃผ์‹ค ์ „๋ฌธ๊ฐ€๋กœ์„œ, ๋‹ค์Œ ๋ฌธ์„œ๋ฅผ ์š”์•ฝํ•ด ์ฃผ์„ธ์š”.'),
246
- HumanMessage(content=f'๋‹ค์Œ ํ…์ŠคํŠธ์— ๋Œ€ํ•œ ์ „๋ฌธ์  ์š”์•ฝ์„ ์ œ๊ณตํ•ด ์ฃผ์„ธ์š”. ์š”์•ฝ์€ {target_lang}์–ด์˜ ์–ธ์–ด์  ๋‰˜์•™์Šค์— ๋งž๊ฒŒ ์ตœ๊ณ  ์ˆ˜์ค€์˜ ๋ช…ํ™•์„ฑ๊ณผ ์„ธ๋ถ€ ์‚ฌํ•ญ์„ ์ค€์ˆ˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:\n\nTEXT: {text}')
247
  ]
248
  else: # default to English if not Korean
249
  messages = [
250
  SystemMessage(content='As an adept summarizer, your expertise is required to condense the following document into its essential points in detail.'),
251
- HumanMessage(content=f'Kindly provide an expert summary of the text below, adhering to the highest standards of clarity and detail. Ensure the response is tailored to the linguistic nuances of {target_lang}:\n\nTEXT: {text}')
252
  ]
253
 
254
  response = llm.invoke(messages)
255
  if isinstance(response, AIMessage):
256
  cleaned_content = clean_output(response.content)
257
  content_lang = detect_language(cleaned_content)
 
258
  if content_lang != target_lang:
259
  return translate_text(cleaned_content, content_lang, target_lang)
260
  return cleaned_content
 
243
  if target_lang == 'ko':
244
  messages = [
245
  SystemMessage(content='๋ฌธ์„œ์˜ ํ•ต์‹ฌ ์š”์•ฝ์„ ์ƒ์„ธํ•˜๊ฒŒ ์ œ๊ณตํ•ด ์ฃผ์‹ค ์ „๋ฌธ๊ฐ€๋กœ์„œ, ๋‹ค์Œ ๋ฌธ์„œ๋ฅผ ์š”์•ฝํ•ด ์ฃผ์„ธ์š”.'),
246
+ HumanMessage(content=f'๋‹ค์Œ ํ…์ŠคํŠธ์— ๋Œ€ํ•œ ์ „๋ฌธ์  ์š”์•ฝ์„ ์ œ๊ณตํ•ด ์ฃผ์„ธ์š”. ์š”์•ฝ์€ ํ•œ๊ตญ์–ด์˜ ์–ธ์–ด์  ๋‰˜์•™์Šค์— ๋งž๊ฒŒ ์ตœ๊ณ  ์ˆ˜์ค€์˜ ๋ช…ํ™•์„ฑ๊ณผ ์„ธ๋ถ€ ์‚ฌํ•ญ์„ ์ค€์ˆ˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:\n\nTEXT: {text}')
247
  ]
248
  else: # default to English if not Korean
249
  messages = [
250
  SystemMessage(content='As an adept summarizer, your expertise is required to condense the following document into its essential points in detail.'),
251
+ HumanMessage(content=f'Kindly provide an expert summary of the text below, adhering to the highest standards of clarity and detail. Ensure the response is tailored to the linguistic nuances of english :\n\nTEXT: {text}')
252
  ]
253
 
254
  response = llm.invoke(messages)
255
  if isinstance(response, AIMessage):
256
  cleaned_content = clean_output(response.content)
257
  content_lang = detect_language(cleaned_content)
258
+ print(f"Current content language............: {content_lang}, Target language to be translated to: {target_lang}")
259
  if content_lang != target_lang:
260
  return translate_text(cleaned_content, content_lang, target_lang)
261
  return cleaned_content