odtp-llm-translation

LLM powered component for text and json translation

https://github.com/caviri/odtp-llm-translation

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.0%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

LLM powered component for text and json translation

Basic Info
  • Host: GitHub
  • Owner: caviri
  • License: other
  • Language: Python
  • Default Branch: main
  • Size: 212 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

Name of the component

Add here your badges: Launch in your ODTP Compatible with ODTP v0.5.x

[!NOTE]
This repository makes use of submodules. Therefore, when cloning it you need to include them.

git clone --recurse-submodules https://github.com/odtp-org/odtp-llm-translation

This component make use of LLM to translate input text or json values. In order to run it you need to provide an LLM openai-compatible endpoint such as https://openrouter.ai. You can get this from a provider or deploy a local instance of llama.

Example of .env variables: ```bash

ODTP COMPONENT VARIABLES

INPUTFILE=input.txt OUTPUTFILE=output.txt MODELNAME=google/gemini-2.0-flash-exp:free LANGUAGE=Spanish ENPOINT=https://openrouter.ai/api/v1 APIKEY=sk-or-v1-0e7************************

ODTP ENV VARIABLES FOR API MODE

ODTPAPIMODE=FALSE ODTPGRADIOSHARE=FALSE

OTHER ENV VARIABLES (FALSE/TRUE)

TRANSFERINPUTTOOUTPUT=FALSE ODTPSAVESNAPSHOT=FALSE ODTPSAVEINRESULT=TRUE ODTPLOGSIN_DB=FALSE ```

Also you can use this component as a gradio application:

Table of Contents

Tools Information

No external tool used. The logic is in app.

How to add this component to your ODTP instance

In order to add this component to your ODTP CLI, you can use. If you want to use the component directly, please refer to the docker section.

bash odtp new odtp-component-entry \ --name odtp-llm-translation \ --component-version v0.0.1 \ --repository http://github.com/caviri/odtp-llm-translation \ --image TBD \

Data sheet

Parameters

TBD

| Parameter | Description | Type | Required | Default Value | Possible Values | Constraints | |----------------------------|-----------------------------------------------------|---------|----------|---------------|------------------------|-------------| | MODELNAME | Name of the LLM model to use | string | Yes | - | Model names supported | | | LANGUAGE | Target language for translation | string | Yes | - | Any language | | | ENDPOINT | OpenAI-compatible API endpoint | string | Yes | - | Valid URL | | | ODTPAPIMODE | Enable API mode | boolean | No | FALSE | TRUE, FALSE | | | ODTPGRADIOSHARE | Enable Gradio share | boolean | No | FALSE | TRUE, FALSE | | | TRANSFERINPUTTOOUTPUT | Copy input directly to output | boolean | No | FALSE | TRUE, FALSE | | | ODTPSAVESNAPSHOT | Save a snapshot of the process | boolean | No | FALSE | TRUE, FALSE | | | ODTPSAVEINRESULT | Save translation in result | boolean | No | TRUE | TRUE, FALSE | | | ODTPLOGSINDB | Store logs in database | boolean | No | FALSE | TRUE, FALSE | |

Secrets

| Secret Name | Description | Type | Required | Default Value | Constraints | Notes | |-------------|---------------------------------------------|--------|----------|---------------|-------------|-----------------------------| | API_KEY | API key for the OpenAI-compatible endpoint | string | Yes | - | Valid key | Do not share or commit this |

Input Files

| File/Folder | Description | File Type | Required | Format | Notes | |--------------------|----------------------------|-----------|----------|---------------|-------| | odtp-input/input.txt| Input text or JSON values | text/json | Yes | Plain/JSON | |

Output Files

| File/Folder | Description | File Type | Contents | Usage | |---------------------|----------------------------|-----------|--------------------|-------| | odtp-output/output.txt | Translated output text or JSON | text/json | Translated content | Main result |

Tutorial

How to run this component as docker

Build the dockerfile.

bash docker build -t odtp-llm-translation .

Run the following command. Mount the correct volumes for input/output/logs folders.

bash docker run -it --rm \ -v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input \ -v {PATH_TO_YOUR_OUTPUT_VOLUME}:/odtp/odtp-output \ -v {PATH_TO_YOUR_LOGS_VOLUME}:/odtp/odtp-logs \ --env-file .env odtp-llm-translation

On Windows:

powershell docker run -it --rm ` -v ${PWD}/odtp/odtp-input:/odtp/odtp-input ` -v ${PWD}/odtp/odtp-output:/odtp/odtp-output ` -v ${PWD}/odtp/odtp-logs:/odtp/odtp-logs ` --env-file .env odtp-llm-translation

Development Mode

To run the component in development mode, mount the app folder inside the container:

bash docker run -it --rm \ -v {PATH_TO_YOUR_INPUT_VOLUME}:/odtp/odtp-input \ -v {PATH_TO_YOUR_OUTPUT_VOLUME}:/odtp/odtp-output \ -v {PATH_TO_YOUR_LOGS_VOLUME}:/odtp/odtp-logs \ -v {PATH_TO_YOUR_APP_FOLDER}:/odtp/app \ --env-file .env odtp-llm-translation

Running in API Mode

To run the component in API mode and expose a port, use the following command:

bash docker run -it --rm \ -p 7860:7860 \ --env-file .env \ odtp-llm-translation

powershell docker run -it --rm ` -p 7860:7860 ` --env-file .env ` odtp-llm-translation

Credits and references

Carlos Vivar Rios

This component has been created using the odtp-component-template v0.5.0.

Owner

  • Name: Carlos Vivar Rios
  • Login: caviri
  • Kind: user
  • Location: Lausanne
  • Company: @SwissDataScienceCenter

Data Engineer at SDSC (EPFL) | Freelance Data Scientist

Citation (CITATION.cff)

# YAML 1.2
---
cff-version: "1.0.4"
message: "If you use this software, please cite it as below."
authors:
  - family-names: xxxx
    given-names: xxxx
    orcid: https://orcid.org/xxxx-xxxx-xxxx-xxxx
title: "My Research Software"
version: x.x.x
identifiers:
  - type: doi
    value: xxxx/xxxx.1234
date-released: xxxx-xx-xx
repository-code: "https://github.com/XXXXX/XXXX"
keywords:
  - xxxx
  - xxxx
license: xxxx

GitHub Events

Total
  • Watch event: 1
  • Public event: 1
  • Push event: 1
Last Year
  • Watch event: 1
  • Public event: 1
  • Push event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 3
  • Total Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 3
  • Committers: 1
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Carlos Vivar Rios c****s@g****m 3

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/multiplatform_docker_build.yml actions
  • actions/checkout v3 composite
  • docker/login-action v2 composite
  • docker/setup-buildx-action v2 composite
.github/workflows/multiplatform_docker_build_dockerhub.yml actions
  • actions/checkout v3 composite
  • docker/login-action v2 composite
  • docker/setup-buildx-action v2 composite
Dockerfile docker
  • ubuntu 22.04 build
requirements.txt pypi
  • gradio *
  • pydantic *
  • pydantic-ai *