Intégration officielle de LangChain

Outil FluentC LangChain

Plugin officiel Python pour l'intégration de l'API de traduction FluentC AI avec LangChain. Activer la traduction en temps réel et par lot, la détection de la langue et la surveillance des tâches via des outils compatibles avec LangChain.

Fonctionnalités d'intégration de LangChain

Traduction en temps réel et par lots

Choisissez entre des traductions instantanées ou un traitement par lots pour de grands volumes de contenu.

Détection de la langue

Détectez automatiquement la langue du contenu d'entrée avec un score de confiance.

Sélection dynamique de la langue

Menus déroulants remplis avec les langues activées de votre clé API.

Support de format

Gérez à la fois le contenu en texte brut et le contenu HTML de manière transparente.

Gestion des erreurs

Gestion complète des erreurs avec prise en charge de la continuation en cas d'échec.

Intégration du flux de travail

Intégrez sans effort dans n'importe quel flux de travail d'automatisation N8N.

Clé API FluentC requise

Pour utiliser les outils FluentC LangChain, vous aurez besoin d'une clé API FluentC valide avec un abonnement actif. Les clés API offrent un accès à plus de 140 langues et des capacités de traduction en temps réel.

Inscrivez-vous maintenant

Installation et Configuration

Installation du paquet

Installer le package 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
Nécessite Python 3.7+ et le framework LangChain.

Configuration d'authentification

Configurez votre clé API FluentC :

from fluentc_langchain_tool import
FluentCTranslationTool

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

Disponible Outils LangChain

Classes d'outils FluentC LangChain

Classe d'outil

Objectif

FluentCTranslationTool

Soumission de traduction en temps réel ou par lot

FluentCLanguageDetectorTool

Détecter la langue source à partir de l'entrée

FluentCTranslationStatusTool

Vérifier l'état des travaux de traduction par lot

FluentCResultsTool

Sondage sur le résultat de la traduction du traitement par lots

FluentCBatchTranslationTool

Soumission par lot en une seule fois + sondage

Utilisation Exemples

  • Traduction en temps réel
  • Traduction par lots
  • Vérification du statut
  • Agent LangChain
Effectuer une traduction en temps réel en utilisant l'outil 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'))
				
			
Gérer un contenu volumineux avec traduction par lots et sondage automatique :
				
					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
				
			
Vérifiez l'état des travaux de traduction par lot :
				
					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
				
			
Intégrez les outils FluentC avec les agents LangChain pour des flux de travail complexes :
				
					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}")
				
			

Prêt à ajouter une traduction à vos flux de travail N8N ?

Commencez dès aujourd'hui avec l'intégration N8N de FluentC. Créez votre clé API, installez le plugin et commencez à créer des flux de travail d'automatisation multilingues.