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.dev0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for promplate_pyodide-0.0.1.1.dev0.tar.gz
Algorithm Hash digest
SHA256 779e0202347f54f0e99cb5e20a99e4c7aa4bd456c826b2424718293ef44fed6d
MD5 b7524782fb9d5bce784d6ba3b95856e3
BLAKE2b-256 76f2173d211a0c2edee4c8a20aeb31d7ae601eae6e6094e392fff41ba23d1ea4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for promplate_pyodide-0.0.1.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 3518c6380aa4aea1f7fa3562c726236b464600c5b5c73d76f3cedd2731c04577
MD5 78aa47995dede7768979f3c711951906
BLAKE2b-256 44d09825c888ed4e4c2daa918d707363613f760cdc4e30c5a8fe91ddac7bf551

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