LangChain 통합 기능
실시간 및 배치 번역
대용량 콘텐츠에 대해 즉시 번역 또는 일괄 처리를 선택하세요.
언어 감지
입력 콘텐츠의 언어를 자신감 점수와 함께 자동으로 감지합니다.
동적 언어 선택
API 키가 활성화된 언어로 채워진 드롭다운 메뉴.
포맷 지원
일반 텍스트와 HTML 콘텐츠를 모두 원활하게 처리하세요.
오류 처리
계속 실패 시 계속 진행하는 포괄적인 오류 처리 지원.
워크플로우 통합
어떤 N8N 자동화 워크플로우에도 원활하게 통합됩니다.
FluentC API 키 필요
FluentC LangChain 도구를 사용하려면 유효한 FluentC API 키와 활성 구독이 필요합니다. API 키는 140개 이상의 언어와 실시간 번역 기능에 대한 액세스를 제공합니다.
설치 & 설정
패키지 설치
FluentC LangChain 패키지를 설치하세요.
# Install via pip
Python 3.7 이상과 LangChain 프레임워크가 필요합니다.
pip install fluentc-langchain-tool
# Or with requirements.txt
echo "fluentc-langchain-tool" >> requirements.txt
pip install -r requirements.txt
인증 설정
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 에이전트
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 = """
Welcome
Hello, batch world!
This is a large document that needs translation.
It contains multiple paragraphs and HTML structure.
"""
# 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
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 키를 생성하고 플러그인을 설치한 후 다국어 자동화 워크플로우를 시작하세요.