Integração Oficial do LangChain

Ferramenta FluentC LangChain

Plugin oficial do Python para integrar a API de Tradução FluentC AI com LangChain. Ative tradução em tempo real e em lote, detecção de idioma e consulta de tarefas por meio de ferramentas compatíveis com LangChain.

Recursos de Integração do LangChain

Tradução em tempo real e em lote

Escolha entre traduções instantâneas ou processamento em lote para grandes volumes de conteúdo.

Detecção de idioma

Detectar automaticamente o idioma do conteúdo de entrada com pontuação de confiança.

Seleção de Idioma Dinâmica

Menus suspensos preenchidos com os idiomas habilitados da sua chave de API.

Suporte de Formato

Manipule tanto conteúdo de texto simples quanto conteúdo HTML de forma transparente.

Tratamento de Erros

Tratamento de erros abrangente com suporte a continuar em caso de falha.

Integração de Fluxo de Trabalho

Integre-se perfeitamente em qualquer fluxo de trabalho de automação N8N.

Chave de API do FluentC Necessária

Para usar as ferramentas FluentC LangChain, você precisará de uma chave de API FluentC válida com uma assinatura ativa. Chaves de API oferecem acesso a mais de 140 idiomas e capacidades de tradução em tempo real.

Inscreva-se agora

Instalação & Configuração

Instalação de Pacote

Instale o pacote 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
Requer Python 3.7+ e o framework LangChain.

Configuração de Autenticação

Configure sua chave API do FluentC:

from fluentc_langchain_tool import
FluentCTranslationTool

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

Disponível Ferramentas LangChain

Classes de Ferramentas FluentC LangChain

Classe de Ferramenta

Propósito

FluentCTranslationTool

Envio de tradução em tempo real ou em lote

FluentCLanguageDetectorTool

Detectar o idioma de origem a partir da entrada

FluentCTranslationStatusTool

Verifique o status dos trabalhos de tradução em lote

FluentCResultsTool

Enquete sobre o resultado da tradução do lote de trabalho

FluentCBatchTranslationTool

Envio em lote de uma só vez + sondagem

Uso Exemplos

  • Tradução em Tempo Real
  • Tradução em lote
  • Verificação de status
  • Agente LangChain
Realize a tradução em tempo real usando a ferramenta 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'))
				
			
Lidar com conteúdo grande com tradução em lote e pesquisa automática:
				
					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
				
			
Verifique o status dos trabalhos de tradução em lote:
				
					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
				
			
Integrar as ferramentas FluentC com agentes LangChain para fluxos de trabalho complexos:
				
					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}")
				
			

Pronto para adicionar tradução aos seus fluxos de trabalho N8N?

Comece hoje mesmo a usar a integração do FluentC com o N8N. Crie sua chave de API, instale o plugin e comece a criar fluxos de automação multilíngues.