Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.

Metadata

Release files for azure-openai-tr 0.1.0a5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-openai-tr 0.1.0a5
File Size Uploaded
azure_openai_tr-0.1.0a5.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-openai-tr 0.1.0a5
File Interpreter ABI Platform
azure_openai_tr-0.1.0a5-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / azure_openai_tr-0.1.0a5.tar.gz

Download URL azure_openai_tr-0.1.0a5.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8f0865e9b71d678154f0088c3841a4a5fdd8fef12f7871d030dea13e365a95b0
BLAKE2b-256 checksum
How to use checksums
1df05d8a5255632a137732de537726022c8b8d69267fbb7193a85c9236e5691c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.10 Windows/10

Release files / azure_openai_tr-0.1.0a5-py3-none-any.whl

Download URL azure_openai_tr-0.1.0a5-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f413d73ad31ef40f1c085db02584c921244eb60168c8f5bfeb83fec6fa4f5cab
BLAKE2b-256 checksum
How to use checksums
27ab5e1f4202d0b2f6ca20dab021fb7da9691d5307bbd5969fbe76486aab0a88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.8.10 Windows/10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page