公式のLangChain統合

FluentC LangChainツール

FluentC AI翻訳APIとLangChainを連携させる公式Pythonプラグイン。 LangChain対応ツールを使用して、リアルタイムおよびバッチ翻訳、言語検出、ジョブポーリングを有効にしてください。

LangChain統合機能

リアルタイムおよびバッチ翻訳

大量のコンテンツに対しては、即時翻訳と一括処理のどちらを選びますか。

言語検出

入力内容の言語を自動的に検出し、信頼度スコアを付与します。

動的言語選択

APIキーで有効になっている言語が表示されたドロップダウンメニュー。

フォーマットサポート

プレーンテキストとHTMLコンテンツの両方をシームレスに扱います。

エラー処理

継続して失敗時も処理を続行する包括的なエラー処理。

ワークフロー統合

どんなN8Nの自動化ワークフローにもシームレスに統合します。

FluentC APIキーが必要です

FluentC LangChainツールを使用するには、有効なサブスクリプションがある有効なFluentC APIキーが必要です。 APIキーは、140以上の言語とリアルタイム翻訳機能へのアクセスを提供します。

今すぐ登録

インストール 設定

パッケージのインストール

FluentC LangChainパッケージをインストールしてください。
# Install via pip
pip install fluentc-langchain-tool

# Or with requirements.txt
echo "fluentc-langchain-tool" >> requirements.txt
pip install -r requirements.txt
Python 3.7以上とLangChainフレームワークが必要です。

認証設定

FluentC APIキーを設定してください:

from fluentc_langchain_tool import
FluentCTranslationTool

# Initialize with API key
tool = FluentCTranslationTool( api_key="your-fluentc-api-key")

利用可能 LangChainツール

FluentC LangChainツールクラス

ツールクラス

目的

FluentCTranslationTool

リアルタイムまたはバッチ翻訳を送信

FluentCLanguageDetectorTool

入力からソース言語を検出してください

FluentCTranslationStatusTool

バッチ翻訳ジョブのステータスを確認してください

FluentCResultsTool

バッチジョブの翻訳結果の投票

FluentCBatchTranslationTool

ワンショットバッチ送信+ポーリング

使い方

  • リアルタイム翻訳
  • バッチ翻訳
  • ステータス確認
  • LangChainエージェント
FluentC LangChainツールを使用してリアルタイム翻訳を実行してください。
				
					from fluentc_langchain_tool import FluentCTranslationTool

# Initialize the translation tool
tool = FluentCTranslationTool(api_key="your-api-key")

# Perform real-time translation
response = tool.run({
    "text": "Hello, world!",
    "target_language": "fr",
    "source_language": "en",
    "mode": "realtime"
})

print(response)  # Output: "Bonjour, le monde !"

# Translation with auto-detection
response = tool.run({
    "text": "¿Cómo estás?",
    "target_language": "en",
    "mode": "realtime"
})

print(response)  # Output: "How are you?"
print("Detected source language:", response.get('detected_language', 'Unknown'))
				
			
大規模なコンテンツをバッチ翻訳と自動ポーリングで処理する
				
					from fluentc_langchain_tool import FluentCBatchTranslationTool

# Initialize batch translation tool
tool = FluentCBatchTranslationTool(api_key="your-api-key")

# Translate large HTML content
large_html = """
<html>
<head><title>Welcome</title></head>
<body data-rsssl=1>
    <h1>Hello, batch world!</h1>
    <p>This is a large document that needs translation.</p>
    <p>It contains multiple paragraphs and HTML structure.</p>
</body>
</html>
"""

# Submit and automatically poll for results
result = tool.run({
    "text": large_html,
    "target_language": "de",
    "source_language": "en"
})

print("Translated HTML:")
print(result)  # Final translated output after polling

# The tool automatically:
# 1. Submits the batch job
# 2. Polls for completion using estimated_wait_seconds
# 3. Returns the final translation result
				
			
バッチ翻訳ジョブのステータスを確認してください。
				
					from fluentc_langchain_tool import (
    FluentCTranslationTool, 
    FluentCTranslationStatusTool
)

# Initialize tools
translation_tool = FluentCTranslationTool(api_key="your-api-key")
status_tool = FluentCTranslationStatusTool(api_key="your-api-key")

# Submit a batch translation job
job_response = translation_tool.run({
    "text": "Large document for batch processing...",
    "target_language": "es",
    "mode": "batch"
})

job_id = job_response.get('job_id')
print(f"Batch job submitted: {job_id}")

# Check job status
status_response = status_tool.run({
    "job_id": job_id
})

print(f"Job status: {status_response}")

# Status responses include:
# - "processing": Job is still running
# - "complete": Translation finished
# - "failed": Job encountered an error
# - estimated_wait_seconds: Recommended polling interval
				
			
FluentCツールをLangChainエージェントと連携させて複雑なワークフローを実現する:
				
					from langchain.agents import initialize_agent, Tool
from langchain.llms import OpenAI
from fluentc_langchain_tool import (
    FluentCTranslationTool,
    FluentCBatchTranslationTool,
    FluentCLanguageDetectorTool,
    FluentCTranslationStatusTool
)

# Initialize FluentC tools
api_key = "your-fluentc-api-key"
translation_tool = FluentCTranslationTool(api_key)
batch_tool = FluentCBatchTranslationTool(api_key)
detector_tool = FluentCLanguageDetectorTool(api_key)
status_tool = FluentCTranslationStatusTool(api_key)

# Create LangChain agent with FluentC tools
agent = initialize_agent(
    tools=[
        Tool.from_function(
            func=translation_tool.run,
            name="FluentC_Translation",
            description="Translate text in real-time or batch mode"
        ),
        Tool.from_function(
            func=batch_tool.run,
            name="FluentC_Batch_Translation",
            description="Translate large content with auto-polling"
        ),
        Tool.from_function(
            func=detector_tool.run,
            name="FluentC_Language_Detection",
            description="Detect language of input text"
        ),
        Tool.from_function(
            func=status_tool.run,
            name="FluentC_Status_Check",
            description="Check batch translation job status"
        )
    ],
    llm=OpenAI(temperature=0),
    agent="zero-shot-react-description",
    verbose=True
)

# Example agent interactions
responses = [
    "Translate 'Hello world' from English to German using FluentC.",
    "Detect the language of 'Bonjour tout le monde' and translate it to Spanish.",
    "Translate this large HTML document to French using batch processing."
]

for query in responses:
    print(f"\nQuery: {query}")
    result = agent.run(query)
    print(f"Result: {result}")
				
			

N8Nのワークフローに翻訳を追加する準備はできましたか?

今日からFluentCのN8N統合を始めましょう。 APIキーを作成し、プラグインをインストールして、多言語自動化ワークフローの構築を始めましょう。