Update README.md
Browse files
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'๋ค์ ํ
์คํธ์ ๋ํ ์ ๋ฌธ์ ์์ฝ์ ์ ๊ณตํด ์ฃผ์ธ์. ์์ฝ์
|
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
|
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
|