Skip to main content

Translate via Azure Openai

Project description

azure-openai-tr

pytestpythonCode style: blackLicense: MITPyPI version

Translate via Azure Openai

Install it

pip install azure-openai-tr
# pip install git+https://github.com/ffreemt/azure-openai-tr
# poetry add git+https://github.com/ffreemt/azure-openai-tr
# git clone https://github.com/ffreemt/azure-openai-tr && cd azure-openai-tr

Use it

Copy .env.example to .env and edit .env accordingly

# .env, e.g.
OPENAI_API_BASE = https://dattw.openai.azure.com
OPENAI_API_KEY = ...
DEPLOYMENT_NAME = chat

or set those environ variables from the command line.

from azure_openai_tr import azure_openai_tr

print(azure_openai_tr("test this and that")
# '测试这个和那个。'

print(azure_openai_tr("Hey ya", temperature=.2))
# 嘿,你好

print(azure_openai_tr("Hey ya", temperature=.8))
# 嗨啊

print(azure_openai_tr("Hey ya", temperature=.8))
# 嘿 ya

print(azure_openai_tr("test this and that", to_lang='German', temperature=.8))
# Teste dies und jenes.

print(azure_openai_tr("test this and that", to_lang='German', temperature=.8))
# Teste dies und das.

print(azure_openai_tr("test this and that", to_lang='German', temperature=.1))
# Teste dies und das.

print(azure_openai_tr("test this and that", to_lang='中文', temperature=.8, template='翻成 {to_lang}, 列出3个版本\n {text}'))
# 1. 测试这个和那个
# 2. 检验这个和那个
# 3. 试验这个和那个

Check source code for more details.

Project details


Download files

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

Source Distribution

azure_openai_tr-0.1.0a4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

azure_openai_tr-0.1.0a4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file azure_openai_tr-0.1.0a4.tar.gz.

File metadata

  • Download URL: azure_openai_tr-0.1.0a4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.10 Windows/10

File hashes

Hashes for azure_openai_tr-0.1.0a4.tar.gz
Algorithm Hash digest
SHA256 d078b4ec3ba5cda7d5cf7f73ca5af8c9a8be2e93395cd57ce565c96d4a939ff7
MD5 5c717174be9e9e23b5c9db6bb4f4a12b
BLAKE2b-256 83045c5f5f93b7b852456dc9345dbd186a5a16d12b894c973227c32e0f901dd1

See more details on using hashes here.

File details

Details for the file azure_openai_tr-0.1.0a4-py3-none-any.whl.

File metadata

  • Download URL: azure_openai_tr-0.1.0a4-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.10 Windows/10

File hashes

Hashes for azure_openai_tr-0.1.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 b103e3aeca33396306973c4dfb3b59ed1cd47750bb1e6a7a0c05f1827b4e61e9
MD5 f102e18bd6fb5f0c9e0ebfa84e761fc6
BLAKE2b-256 294a98b11c3b93ee4756af1d82fafc05835d5fbde5867084eabfa30c0844d194

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