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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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