优化Gemini提示词

pull/168/head
John Smith 8 months ago
parent 8c3d62d08d
commit 0d7f847dc8

@ -164,7 +164,7 @@ class AppConfig:
translator_config['proxy'] = section['proxy']
translator_config['api_key'] = section['api_key']
translator_config['model_code'] = section['model_code']
translator_config['prompt'] = section['prompt']
translator_config['prompt'] = section['prompt'].replace('\n', ' ').replace('\\n', '\n')
translator_config['temperature'] = section.getfloat('temperature')
else:
raise ValueError(f'Invalid translator type: {type_}')

@ -170,19 +170,23 @@ api_key =
# 模型代码
model_code = models/gemini-1.0-pro
# 提示词
prompt = As an advanced translation software, your role is to provide accurate translations
that respect the original content's meaning and tone. If the input text includes brackets,
ensure that these are retained in the translation. Aim to deliver the translated text in a
polite and gentle tone, as per the preferences of the audience.\n\nBelow are some examples
to guide you:\n\nExamples:\nInput1:\n来拉(莱拉) 设置一下吧\nOutput1:\nライラちゃん、設定してみましょうか。
\n\nInput2:\n我来拉一下各位进队伍\nOutput2:\n皆さんをチームに入れさせていただきます。\n\nInput3:\n死了w\n
Output3:\n死んじゃったわw\n\nInput4:\n每天来宝这里打个卡\nOutput4:\n毎日、ここに来て宝さんにチェックインしま
\n\n\nPlease keep in mind that accurate translation is not just about linguistic conversion;
it is about conveying the same sentiment and meaning as the original input. Pay special
attention to internet vernaculars and colloquial expressions to maintain the nuances of the
source language.\n\nNow, proceed with the translation of the following Chinese comment text
into Japanese, ensuring accuracy and preservation of the original message:\nInput:\n
{{original_text}}\nOutput ONLY:\n
prompt = As an advanced translation software, your role is to provide accurate translations that respect
the original content's meaning and tone.
Ensure that texts between brackets "[]" are kept untranslated.
Aim to deliver the translated text in a polite and gentle tone, as per the preferences of the audience.\n\n
Below are some examples to guide you:\n\n
Input1:\n来拉(莱拉)设置一下吧\nOutput1:\nライラちゃん、設定してみましょうか\n\n
Input2:\n我来拉一下各位进队伍\nOutput2:\n皆さんをチームに入れさせていただきます\n\n
Input3:\n死了w\nOutput3:\n死んじゃったわw\n\n
Input4:\n每天来宝这里打个卡[比心]\nOutput4:\n毎日、ここに来て宝さんにチェックインしま[比心]\n\n
\n
Please keep in mind that accurate translation is not just about linguistic conversion;
it is about conveying the same sentiment and meaning as the original input.
Pay special attention to internet vernaculars and colloquial expressions to maintain the nuances of the
source language.\n\n
Now, proceed with the translation of the following Chinese comment text into Japanese, ensuring accuracy
and preservation of the original message:\n
Input:\n{{original_text}}\nOutput ONLY:\n
# 温度,用于控制令牌选择的随机性,较低的温度适合需要更具确定性或不够开放的回答的提示,而较高的温度可以产生更加多样化或更具创意的结果
temperature = 0.4

@ -688,7 +688,7 @@ class GeminiTranslate(TranslateProvider):
self._proxy = proxy or None
self._api_key = api_key
self._url = f'https://generativelanguage.googleapis.com/v1beta/{model_code}:generateContent'
self._prompt = prompt.replace('\n', ' ').replace('\\n', '\n')
self._prompt = prompt
self._body = {
'contents': [
{

Loading…
Cancel
Save