Skip to main content

FluentC LangChain Tool

Official Python plugin for integrating the FluentC AI Translation API with LangChain. This package enables real-time and batch translation, source language detection, and job result polling — all through LangChain-compatible tools.


🚀 Features

  • ✅ Real-Time Translation (/translate)
  • ⏳ Batch Translation with Auto Polling (/translate + /results)
  • 🌍 Language Detection (/checklanguage)
  • 📡 Job Result Retrieval (/results)
  • 🔐 Secure API Key Authentication

📦 Installation

pip install fluentc-langchain-tool

🔐 Authentication

You'll need your FluentC API key (provided after signup and subscription):

tool = FluentCTranslationTool(api_key="your-fluentc-api-key")

🧠 Available Tools

Tool Class Purpose
FluentCTranslationTool Real-time or batch translation submit
FluentCLanguageDetectorTool Detect source language from input
FluentCTranslationStatusTool Check status of batch translation jobs
FluentCResultsTool Poll for batch job translation result (legacy)
FluentCBatchTranslationTool One-shot batch submit + polling

🛠 Real-Time Translation

from fluentc_langchain_tool import FluentCTranslationTool

tool = FluentCTranslationTool(api_key="your-api-key")
response = tool.run({
    "text": "Hello, world!",
    "target_language": "fr",
    "source_language": "en",
    "mode": "realtime"
})
print(response)  # "Bonjour, le monde !"

⏳ Batch Translation (Async with Auto Polling)

from fluentc_langchain_tool import FluentCBatchTranslationTool

tool = FluentCBatchTranslationTool(api_key="your-api-key")

result = tool.run({
    "text": "<html>Hello, batch world!</html>",
    "target_language": "de",
    "source_language": "en"
})

print(result)  # Final translated output after polling

✅ Polling automatically respects FluentC's estimated_wait_seconds to avoid overloading the API.


🌍 Language Detection

from fluentc_langchain_tool import FluentCLanguageDetectorTool

tool = FluentCLanguageDetectorTool(api_key="your-api-key")
response = tool.run({
    "text": "Hola, ¿cómo estás?"
})
print(response)  # Detected language: es (confidence: 0.99)

📡 Check Translation Status

from fluentc_langchain_tool import FluentCTranslationStatusTool

tool = FluentCTranslationStatusTool(api_key="your-api-key")
response = tool.run({
    "job_id": "your-job-id"
})
print(response)

🔗 LangChain Agent Integration

from langchain.agents import initialize_agent, Tool
from langchain.llms import OpenAI
from fluentc_langchain_tool import (
    FluentCTranslationTool,
    FluentCBatchTranslationTool,
    FluentCLanguageDetectorTool,
    FluentCTranslationStatusTool
)

api_key = "your-api-key"

agent = initialize_agent(
    tools=[
        Tool.from_function(FluentCTranslationTool(api_key)),
        Tool.from_function(FluentCBatchTranslationTool(api_key)),
        Tool.from_function(FluentCLanguageDetectorTool(api_key)),
        Tool.from_function(FluentCTranslationStatusTool(api_key))
    ],
    llm=OpenAI(temperature=0),
    agent="zero-shot-react-description"
)

agent.run("Translate 'Hello world' from English to German using FluentC.")

Metadata

Release files for fluentc-langchain-tool 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fluentc-langchain-tool 0.2.0
File Size Uploaded
fluentc_langchain_tool-0.2.0.tar.gz 7.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fluentc-langchain-tool 0.2.0
File Interpreter ABI Platform
fluentc_langchain_tool-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / fluentc_langchain_tool-0.2.0.tar.gz

Download URL fluentc_langchain_tool-0.2.0.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ad7ca3170ff0732cde34ccfea7cfeeb166bb696ef5c67aa7333f2364bc084c3c
BLAKE2b-256 checksum
How to use checksums
8af57428eced75cbdfffbb67e3f0102bbcdd1ef01a3538ab09185539e5e3af0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release files / fluentc_langchain_tool-0.2.0-py3-none-any.whl

Download URL fluentc_langchain_tool-0.2.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9664d03df98bff090f0b7fd8f46bfcd612a7b89d65fa4600a197d2f0bb1ecc8c
BLAKE2b-256 checksum
How to use checksums
01192dc927a7298f6196ad58d086a577566c10bb0489e293add1631547a25772
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.4

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page