Skip to main content

patches for promplate-core for running in pyodide runtime

Project description

promplate-pyodide

Run your promplate project in the browser with pyodide!

Usage

If you just want to use its templating staff:

from micropip import install  # in pyodide runtime
await install("promplate-pyodide")

from promplate_pyodide import *
patch_promplate()

If you also want to use its OpenAI LLM, you should register the openai module because it is not compatible with pyodide. Note that you can register it as the JavaScript OpenAI SDK because its API is similar to the Python SDK.

patch_promplate(True)

This will patch ensure method to return a JavaScript array instead of a Python list. And it will remove sync APIs of promplate.llm.openai because the JavaScript OpenAI SDK is async-only.

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

promplate_pyodide-0.0.1.1.dev1.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

promplate_pyodide-0.0.1.1.dev1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file promplate_pyodide-0.0.1.1.dev1.tar.gz.

File metadata

File hashes

Hashes for promplate_pyodide-0.0.1.1.dev1.tar.gz
Algorithm Hash digest
SHA256 ea0f5902bd8667b7443f165581197edf6041453132ee248757596baf32bef28f
MD5 c9e990ec39f0d7501a19d2c7abafaebd
BLAKE2b-256 eb64c291963beae8c7de37e4bfa32d4f92e61e547dc1041d5c39473079e5283f

See more details on using hashes here.

File details

Details for the file promplate_pyodide-0.0.1.1.dev1-py3-none-any.whl.

File metadata

File hashes

Hashes for promplate_pyodide-0.0.1.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 2dbfe43b76ebee50c2e4fede1f65051a019745bd56548dee0c012416c2fef956
MD5 601ee6fe4f4b9ac0466cb076310b87b5
BLAKE2b-256 d0309fa1903291f1d4208e6778a912552473f9721db4cccfdfda58d70425cef8

See more details on using hashes here.

Supported by

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