Code Monkey home page Code Monkey logo

pychatgpt-intl's Introduction

pyChatGPT-intl

Package Size Snyk CodeQL

Enhanced ChatGPT Wrapper for Internationalization - Python3

This NodeJS module acts as a wrapper for ChatGPT API and will help you to use ChatGPT in your own language. Logo

Installation

Install chatgpt-intl via pip : https://pypi.org/project/pyChatGPT-intl/

 pip install pyChatGPT-intl

Usage/Examples

First, you have to obtain your API key from OPENAI, then you can use it here.

from pyChatGPT-intl import PyChatGPTIntl

api_key = "sk-Z9bfKN34RT***********RtH4j0FCacAxD"
desired_lang ="si"

opts = {
                "model": "text-davinci-003",
                "temperature": 0.5,
                "max_tokens": 100,
                "top_p": 1,
                "frequency_penalty": 0,
                "presence_penalty": 0
            }

pyChatGPTIntl = PyChatGPTIntl(api_key, desired_lang, opts)
print(pyChatGPTIntl.generate_text("ශ්‍රී ලංකාව ගැන මට විස්තරයක් කියන්න"))

API

text - Type: string (The text to be translated)

api_key - Type: string (API Key obtained from OpenAI Developer Account)

opts - Type: object (OpenAI Language Model and hyperparameters)

desired_lang - Type: string ( Must be auto or one of the codes (not case-sensitive) contained in SUPPORTED_LANGUAGES.md.)

Features

  • Use ChatGPT API in your own language
  • Ability to customize the chatGPT model
  • Supports more than 50 languages

Limitations

  • Does not support for syntax and codes
  • Does not support larger text inputs

Language Support

Supported language codes contained in SUPPORTED_LANGUAGES.md

Demo

python3 chatGPT-intl.py

Sample App I created. Demo

Authors

Contributions

  • Issues and feature updates are welcome.

License

MIT

pychatgpt-intl's People

Contributors

asirihewage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

slnimantha

pychatgpt-intl's Issues

Pylint issues

************* Module languages
languages.py:119:0: C0305: Trailing newlines (trailing-newlines)
languages.py:117:0: C0116: Missing function or method docstring (missing-function-docstring)
languages.py:118:27: C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
************* Module pychatgptintl._main
pychatgptintl/_main.py:34:0: C0301: Line too long (101/100) (line-too-long)
pychatgptintl/_main.py:36:0: C0301: Line too long (110/100) (line-too-long)
pychatgptintl/_main.py:1:0: C0114: Missing module docstring (missing-module-docstring)
pychatgptintl/_main.py:4:0: E0401: Unable to import 'requests' (import-error)
pychatgptintl/_main.py:8:0: C0115: Missing class docstring (missing-class-docstring)
pychatgptintl/_main.py:30:4: C0116: Missing function or method docstring (missing-function-docstring)
pychatgptintl/_main.py:39:15: W0718: Catching too general exception Exception (broad-exception-caught)
pychatgptintl/_main.py:39:8: C0103: Variable name "er" doesn't conform to snake_case naming style (invalid-name)
pychatgptintl/_main.py:8:0: R0903: Too few public methods (1/2) (too-few-public-methods)
pychatgptintl/_main.py:4:0: C0411: third party import "import requests" should be placed before "from languages import is_supported" (wrong-import-order)
pychatgptintl/_main.py:5:0: C0411: standard import "import json" should be placed before "import requests" (wrong-import-order)
************* Module pychatgptintl.translator
pychatgptintl/translator.py:11:0: C0301: Line too long (115/100) (line-too-long)
pychatgptintl/translator.py:13:0: C0301: Line too long (114/100) (line-too-long)
pychatgptintl/translator.py:16:0: C0301: Line too long (113/100) (line-too-long)
pychatgptintl/translator.py:1:0: C0114: Missing module docstring (missing-module-docstring)
pychatgptintl/translator.py:1:0: E0401: Unable to import 'requests' (import-error)
pychatgptintl/translator.py:4:0: C0115: Missing class docstring (missing-class-docstring)
pychatgptintl/translator.py:27:16: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
pychatgptintl/translator.py:4:0: R0903: Too few public methods (1/2) (too-few-public-methods)
************* Module setup
setup.py:10:0: C0301: Line too long (117/100) (line-too-long)
setup.py:12:0: C0301: Line too long (118/100) (line-too-long)
setup.py:1:0: C0114: Missing module docstring (missing-module-docstring)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.