aurora-tr
Translate via aurora and variants, openai, azure openai, etc.
Quick Setup
From command line
pip install aurora-tr
docker run -d --name aurora -p 8080:8080 ghcr.io/aurora-develop/aurora:latest
python code
from aurora_tr import aurora_tr
res = aurora_tr("test me", url="http:/127.0.0.1:8080/v1")
print(res)
# output: {'translation': '测试我', 'notes': ''}
Detailed Instructions
Install
pip install aurora-tr
Use
url for aurora REST API
First off, acquire a url (OPENAI_BASE_URL in python-openai) for the aurora REST API for aurora-tr to use, for example, search the net, beg your friends, or deploy your own aurora, etc.
N.B.: aurora is a service in the wild similar or compatible to openai (more commonly known as chatgpt).
To deplay your own aurora locolly or on a remote machine, refer to
https://github.com/aurora-develop/aurora
For example (the easieast way if you can access docker):
docker run -d --name aurora -p 8080:8080 ghcr.io/aurora-develop/aurora:latest
The OPENAI_BASE_URL in this case will be http://localhost:8080/v1 or http://external_ip_or_domainname:8080/v1
python code
Default base_url, api_key and model of
aurora_tr take the value of OPENAI_BASE_URL, OPENAI_API_KEY and
OPENAI_MODEL from the file .env-aurora.
base_url, api_key and model can also be set directly in aurora_tr, e.g.,
res = aurora_tr(
'....',
url_base="https://uu.ci/v1",
api_key=...,
model-"gpt-4-turbo-preview",
selector="uuci"
)
Hence, if you have deployed your own aurora API:
from aurora_tr import aurora_tr
res = aurora_tr("test me", url="http:/127.0.0.1:8080/v1")
print(res)
# output: {'translation': '测试我', 'notes': ''}
Other examples:
from aurora_tr import aurora_tr
# default aurora, source language: English, target language: Chinese
res = aurora_tr("Test me.")
print(res)
{'translation': '测试我。', 'notes': 'Translated from English to Chinese.'}
# target language: English
res = aurora_tr("试试我", to_lang="English")
{'translation': 'Try me', 'notes': ''}
# select aurora
res = aurora_tr("Testen mich bitte")
{'translation': '请测试我', 'notes': 'Translated from English to Chinese'}
# select uuci
import dotenv
api_key = dotenv.dotenv_values(".env").get("OPENAI_API_KEY_UUCI")
# or api_key = "......"
res = aurora_tr("Test me.", selector="uuci", api_key=api_key)
{'translation': '测试我。'}
Brief docs
aurora_tr(
text: str,
from_lang: Optional[str] = 'English',
to_lang: str = 'Chinese',
selector: str = 'aurora',
base_url: str = '',
api_key: str = '',
model: str = '',
temperature: Optional[float] = None,
)
Docstring:
Translate viaa auroa and uu.ci.
Args
----
text: string to transalte
from_lang: source language
to_lang: target language
selector: prodiver selector
base_url:
api_key: token
model: model name, anything for aurora
temperature (str): 0.2-0.4 for translation, might just left out
Returns
-------
dict/json: {"translation": "...", notes: "..."}
Metadata
Release files for aurora-tr 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aurora_tr-0.1.1.tar.gz | 22.1 kB | Without provenance | Details for aurora_tr-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aurora_tr-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for aurora_tr-0.1.1-py3-none-any.whl |
Total release size: 27.5 kB
Release files / aurora_tr-0.1.1.tar.gz
| Download URL | aurora_tr-0.1.1.tar.gz |
|---|---|
| Size | 22.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c9036ac0a6e9a8f970fe474cb17b389787d637e3e3c9063365608466305e437
|
|
BLAKE2b-256 checksum How to use checksums |
762c806dacb24d7fb7a813da68e2c22b4c4e197adf2358ef319254d95d793de3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Release files / aurora_tr-0.1.1-py3-none-any.whl
| Download URL | aurora_tr-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce800a7b21992d569154f8602d116c89c24175af3a78366bbf85a0dfc90aa449
|
|
BLAKE2b-256 checksum How to use checksums |
83af8960e94904d6295542ef91e33278de4bf6a2b6ce2c0433eb056d7eca1de7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Security for aurora-tr 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.