Skip to main content

An AI-powered chatbot that leverages multiple open-source models, including Groq, for advanced language processing and translation.

Project description

GenAI Translator

GenAI Translator is a state-of-the-art multilingual translation application designed to leverage advanced language models for high-quality translations. This project uses powerful AI models from Groq, Google, and OpenAI to deliver precise and contextually accurate translations.

Features

  • Multi-Model Support: Integrates with Groq, Google, and OpenAI language models.
  • Customizable Prompts: Uses configurable prompt templates for translation tasks.
  • User-Friendly Interface: Built with Gradio for easy interaction and visualization.
  • Logging & Monitoring: Comprehensive logging setup with file rotation for tracking and debugging.

Table of Contents

Installation

  1. Clone the Repository:

    git clone https://github.com/itsmohitkumar/GenAI-Translator.git
    cd GenAI-Translator
    
  2. Create a Virtual Environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use: venv\Scripts\activate
    
  3. Install Dependencies:

    pip install -r requirements.txt
    
  4. Set Up Environment Variables:

    Create a .env file in the root directory and add your API keys:

    GROQ_API_KEY=your_groq_api_key
    GOOGLE_API_KEY=your_google_api_key
    OPENAI_API_KEY=your_openai_api_key
    LANGCHAIN_API_KEY=your_langchain_api_key
    

Configuration

The configuration is managed in the config.py file. The default values can be adjusted based on your preferences.

Default Values:

  • Groq Model Name: llama3-70b-8192
  • Google Model Name: gemini-1.5-pro
  • OpenAI Model Name: gpt-3.5-turbo
  • Temperature: 0
  • Max Tokens: None
  • Timeout: None
  • Max Retries: 2
  • Default Input Language: English
  • Default Output Language: German

Usage

  1. Run the Application:

    python app.py
    
  2. Access the Gradio Interface:

    Open the link provided in the terminal output to access the translation interface.

  3. Using the TranslatorApp Package:

    You can use the translator-app package for programmatic access to the translation functionality. First, install the package:

    pip install translator-app==0.1
    

    Then, use the following code snippet to perform translations:

    from translator_app.config import Config
    from translator_app.translator import TranslatorApp
    
    # Initialize configuration
    config = Config()
    
    # Create a TranslatorApp instance with the configuration
    translator = TranslatorApp(config)
    
    # Perform a translation
    result = translator.perform_translations("Groq", "German", "Hello World")
    
    # Print the result
    print(result)
    

File Structure

GenAI-Translator/
│
├── src/
│   ├── __init__.py
│   ├── logger.py
│   ├── prompts.py
│
├── translator_app/
│   ├── __init__.py
│   ├── config.py
│   ├── api_client.py
│   ├── translator.py
│   └── gradio_interface.py
│
├── app.py
├── .env
├── requirements.txt
└── README.md
  • src/: Contains core modules including logging and prompt templates.
  • translator_app/: Contains configuration, API client, translation logic, and Gradio interface.
  • app.py: Entry point to run the application.
  • .env: Environment variables configuration file.
  • requirements.txt: List of dependencies for the project.
  • README.md: Project documentation.

API Documentation

  • APIClient: Handles API communication for different language models.
  • TranslatorApp: Manages translation logic and model interactions.
  • GradioInterface: Provides a web interface for user interaction.

Contributing

We welcome contributions to the GenAI Translator project! To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature/your-feature).
  5. Create a new Pull Request.

Please ensure your code adheres to the project's style guidelines and includes appropriate tests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or support, please contact:


Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genai_translator-0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file genai_translator-0.1-py3-none-any.whl.

File metadata

  • Download URL: genai_translator-0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.4

File hashes

Hashes for genai_translator-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e418bd4483b3fe306312b1495fd709f844d15fbfafd7742114782c59a38182e3
MD5 4815b7e5bd051488db7cd25720eccc00
BLAKE2b-256 4b7da8bccb7a45beed2a979402bcc232d0ad9c7d17d00503da6904f70a49d5df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page