Modern LangChain-compatible toolkit for FluentC AI Agent Translation API with real-time and batch translation support
Project description
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.")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluentc_langchain_tool-0.2.0.tar.gz.
File metadata
- Download URL: fluentc_langchain_tool-0.2.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad7ca3170ff0732cde34ccfea7cfeeb166bb696ef5c67aa7333f2364bc084c3c
|
|
| MD5 |
aa19e9d95725b41f3dbc70603fb6dfa1
|
|
| BLAKE2b-256 |
8af57428eced75cbdfffbb67e3f0102bbcdd1ef01a3538ab09185539e5e3af0e
|
File details
Details for the file fluentc_langchain_tool-0.2.0-py3-none-any.whl.
File metadata
- Download URL: fluentc_langchain_tool-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9664d03df98bff090f0b7fd8f46bfcd612a7b89d65fa4600a197d2f0bb1ecc8c
|
|
| MD5 |
02376c34058e526c881ea78576f88d72
|
|
| BLAKE2b-256 |
01192dc927a7298f6196ad58d086a577566c10bb0489e293add1631547a25772
|