各翻訳クライアントで supported_languages を YAML から translation_lang に移行・参照するよう修正、プロンプトYAMLの重複した supported_languages ブロックを削除、LMStudio のデフォルト URL を /v1 に変更、mainloop に LMStudio/Ollama のモデル関連エンドポイントと run_mapping を追加、Controller 内の Ollama 表記のtypo(Lollama→Ollama)を修正してメソッド名・ログ文を更新、各クライアントで translation_languages のフォールバック import を追加
This commit is contained in:
@@ -2,47 +2,6 @@ system_prompt: |
|
||||
You are a helpful translation assistant.
|
||||
Supported languages:
|
||||
{supported_languages}
|
||||
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
|
||||
supported_languages: |
|
||||
Arabic
|
||||
Bengali
|
||||
Bulgarian
|
||||
Simplified Chinese
|
||||
Traditional Chinese
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
English
|
||||
Estonian
|
||||
Finnish
|
||||
French
|
||||
German
|
||||
Greek
|
||||
Hebrew
|
||||
Hindi
|
||||
Hungarian
|
||||
Indonesian
|
||||
Italian
|
||||
Japanese
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Norwegian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Russian
|
||||
Serbian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Swahili
|
||||
Swedish
|
||||
Thai
|
||||
Turkish
|
||||
Ukrainian
|
||||
Vietnamese
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
@@ -2,47 +2,6 @@ system_prompt: |
|
||||
You are a helpful translation assistant.
|
||||
Supported languages:
|
||||
{supported_languages}
|
||||
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
|
||||
supported_languages: |
|
||||
Arabic
|
||||
Bengali
|
||||
Bulgarian
|
||||
Simplified Chinese
|
||||
Traditional Chinese
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
English
|
||||
Estonian
|
||||
Finnish
|
||||
French
|
||||
German
|
||||
Greek
|
||||
Hebrew
|
||||
Hindi
|
||||
Hungarian
|
||||
Indonesian
|
||||
Italian
|
||||
Japanese
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Norwegian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Russian
|
||||
Serbian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Swahili
|
||||
Swedish
|
||||
Thai
|
||||
Turkish
|
||||
Ukrainian
|
||||
Vietnamese
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
@@ -2,47 +2,6 @@ system_prompt: |
|
||||
You are a helpful translation assistant.
|
||||
Supported languages:
|
||||
{supported_languages}
|
||||
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
|
||||
supported_languages: |
|
||||
Arabic
|
||||
Bengali
|
||||
Bulgarian
|
||||
Simplified Chinese
|
||||
Traditional Chinese
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
English
|
||||
Estonian
|
||||
Finnish
|
||||
French
|
||||
German
|
||||
Greek
|
||||
Hebrew
|
||||
Hindi
|
||||
Hungarian
|
||||
Indonesian
|
||||
Italian
|
||||
Japanese
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Norwegian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Russian
|
||||
Serbian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Swahili
|
||||
Swedish
|
||||
Thai
|
||||
Turkish
|
||||
Ukrainian
|
||||
Vietnamese
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
@@ -4,46 +4,4 @@ system_prompt: |
|
||||
{supported_languages}
|
||||
|
||||
Translate the user provided text from {input_lang} to {output_lang}.
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
|
||||
supported_languages: |
|
||||
Arabic
|
||||
Bengali
|
||||
Bulgarian
|
||||
Catalan
|
||||
Chinese Simplified
|
||||
Chinese Traditional
|
||||
Croatian
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
English
|
||||
Estonian
|
||||
Finnish
|
||||
French
|
||||
German
|
||||
Greek
|
||||
Hebrew
|
||||
Hindi
|
||||
Hungarian
|
||||
Indonesian
|
||||
Italian
|
||||
Japanese
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Norwegian
|
||||
Polish
|
||||
Portuguese
|
||||
Romanian
|
||||
Russian
|
||||
Serbian
|
||||
Slovak
|
||||
Slovenian
|
||||
Spanish
|
||||
Swahili
|
||||
Swedish
|
||||
Thai
|
||||
Turkish
|
||||
Ukrainian
|
||||
Vietnamese
|
||||
Return ONLY the translated text. Do not add quotes or extra commentary.
|
||||
@@ -2,38 +2,6 @@ system_prompt: |
|
||||
You are a translation assistant that uses the `plamo-translate` tool.
|
||||
Translate the following text.Supported languages include:
|
||||
{supported_languages}
|
||||
|
||||
Translate the following text from {input_lang} to {output_lang}.
|
||||
output only the translated text without any additional commentary.
|
||||
|
||||
supported_languages: |
|
||||
English
|
||||
Japanese
|
||||
Korean
|
||||
French
|
||||
German
|
||||
Spanish
|
||||
Portuguese
|
||||
Russian
|
||||
Italian
|
||||
Dutch
|
||||
Polish
|
||||
Turkish
|
||||
Arabic
|
||||
Hindi
|
||||
Thai
|
||||
Vietnamese
|
||||
Indonesian
|
||||
Malay
|
||||
Filipino
|
||||
Swedish
|
||||
Finnish
|
||||
Danish
|
||||
Norwegian
|
||||
Romanian
|
||||
Czech
|
||||
Hungarian
|
||||
Greek
|
||||
Hebrew
|
||||
Simplified Chinese
|
||||
Traditional Chinese
|
||||
Translate the following text from {input_lang} to {output_lang}.
|
||||
output only the translated text without any additional commentary.
|
||||
@@ -3,12 +3,14 @@ from google import genai
|
||||
from langchain_google_genai import ChatGoogleGenerativeAI
|
||||
|
||||
try:
|
||||
from .translation_languages import translation_lang
|
||||
from .translation_utils import loadPromptConfig
|
||||
except Exception:
|
||||
import sys
|
||||
from os import path as os_path
|
||||
print(os_path.dirname(os_path.dirname(os_path.dirname(os_path.abspath(__file__)))))
|
||||
sys.path.append(os_path.dirname(os_path.dirname(os_path.dirname(os_path.abspath(__file__)))))
|
||||
from translation_languages import translation_lang
|
||||
from translation_utils import loadPromptConfig
|
||||
|
||||
logger = logging.getLogger("langchain_google_genai")
|
||||
@@ -56,7 +58,7 @@ class GeminiClient:
|
||||
|
||||
# プロンプト設定をYAMLファイルから読み込む
|
||||
prompt_config = loadPromptConfig(root_path, "translation_gemini.yml")
|
||||
self.supported_languages = prompt_config["supported_languages"]
|
||||
self.supported_languages = list(translation_lang["Gemini_API"]["source"].keys())
|
||||
self.prompt_template = prompt_config["system_prompt"]
|
||||
|
||||
self.gemini_llm = None
|
||||
|
||||
@@ -3,11 +3,13 @@ from langchain_openai import ChatOpenAI
|
||||
from pydantic import SecretStr
|
||||
|
||||
try:
|
||||
from .translation_languages import translation_lang
|
||||
from .translation_utils import loadPromptConfig
|
||||
except Exception:
|
||||
import sys
|
||||
from os import path as os_path
|
||||
sys.path.append(os_path.dirname(os_path.dirname(os_path.dirname(os_path.abspath(__file__)))))
|
||||
from translation_languages import translation_lang
|
||||
from translation_utils import loadPromptConfig
|
||||
|
||||
def _authentication_check(api_key: str, base_url: str | None = None) -> bool:
|
||||
@@ -43,7 +45,7 @@ class LMStudioClient:
|
||||
self.base_url = base_url # None の場合は公式エンドポイント
|
||||
|
||||
prompt_config = loadPromptConfig(root_path, "translation_lmstudio.yml")
|
||||
self.supported_languages = prompt_config["supported_languages"]
|
||||
self.supported_languages = list(translation_lang["LMStudio"]["source"].keys())
|
||||
self.prompt_template = prompt_config["system_prompt"]
|
||||
|
||||
self.openai_llm = None
|
||||
|
||||
@@ -2,11 +2,13 @@ import requests
|
||||
from langchain_ollama import ChatOllama
|
||||
|
||||
try:
|
||||
from .translation_languages import translation_lang
|
||||
from .translation_utils import loadPromptConfig
|
||||
except Exception:
|
||||
import sys
|
||||
from os import path as os_path
|
||||
sys.path.append(os_path.dirname(os_path.dirname(os_path.dirname(os_path.abspath(__file__)))))
|
||||
from translation_languages import translation_lang
|
||||
from translation_utils import loadPromptConfig
|
||||
|
||||
def _authentication_check(base_url: str | None = None) -> bool:
|
||||
@@ -43,7 +45,7 @@ class OllamaClient:
|
||||
self.base_url = "http://localhost:11434"
|
||||
|
||||
prompt_config = loadPromptConfig(root_path, "translation_ollama.yml")
|
||||
self.supported_languages = prompt_config["supported_languages"]
|
||||
self.supported_languages = list(translation_lang["Ollama"]["source"].keys())
|
||||
self.prompt_template = prompt_config["system_prompt"]
|
||||
|
||||
self.openai_llm = None
|
||||
|
||||
@@ -3,11 +3,13 @@ from langchain_openai import ChatOpenAI
|
||||
from pydantic import SecretStr
|
||||
|
||||
try:
|
||||
from .translation_languages import translation_lang
|
||||
from .translation_utils import loadPromptConfig
|
||||
except Exception:
|
||||
import sys
|
||||
from os import path as os_path
|
||||
sys.path.append(os_path.dirname(os_path.dirname(os_path.dirname(os_path.abspath(__file__)))))
|
||||
from translation_languages import translation_lang
|
||||
from translation_utils import loadPromptConfig
|
||||
|
||||
def _authentication_check(api_key: str, base_url: str | None = None) -> bool:
|
||||
@@ -67,7 +69,7 @@ class OpenAIClient:
|
||||
self.base_url = base_url # None の場合は公式エンドポイント
|
||||
|
||||
prompt_config = loadPromptConfig(root_path, "translation_openai.yml")
|
||||
self.supported_languages = prompt_config["supported_languages"]
|
||||
self.supported_languages = list(translation_lang["OpenAI_API"]["source"].keys())
|
||||
self.prompt_template = prompt_config["system_prompt"]
|
||||
|
||||
self.openai_llm = None
|
||||
|
||||
@@ -3,11 +3,13 @@ from langchain_openai import ChatOpenAI
|
||||
from pydantic import SecretStr
|
||||
|
||||
try:
|
||||
from .translation_languages import translation_lang
|
||||
from .translation_utils import loadPromptConfig
|
||||
except Exception:
|
||||
import sys
|
||||
from os import path as os_path
|
||||
sys.path.append(os_path.dirname(os_path.dirname(os_path.dirname(os_path.abspath(__file__)))))
|
||||
from translation_languages import translation_lang
|
||||
from translation_utils import loadPromptConfig
|
||||
|
||||
BASE_URL = "https://api.platform.preferredai.jp/v1"
|
||||
@@ -42,7 +44,7 @@ class PlamoClient:
|
||||
self.model = None
|
||||
|
||||
prompt_config = loadPromptConfig(root_path, "translation_plamo.yml")
|
||||
self.supported_languages = prompt_config["supported_languages"]
|
||||
self.supported_languages = list(translation_lang["Plamo_API"]["source"].keys())
|
||||
self.prompt_template = prompt_config["system_prompt"]
|
||||
|
||||
self.plamo_llm = None
|
||||
|
||||
Reference in New Issue
Block a user