Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript Examples wanted #122

Open
MRYingLEE opened this issue Jun 20, 2024 · 2 comments
Open

JavaScript Examples wanted #122

MRYingLEE opened this issue Jun 20, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@MRYingLEE
Copy link

One great feature of Pyodide is supporting JavaScript by a robust Javascript ⟺ Python foreign function interface.

But I only found few useful documents and examples on this topic, and they are all too simple.

Can you provide related examples? At least one on how to call Python functions in JavaScript.

Thank you in advance,

@MRYingLEE MRYingLEE added the documentation Improvements or additions to documentation label Jun 20, 2024
@jtpio
Copy link
Member

jtpio commented Jun 20, 2024

@MRYingLEE what would you like to achieve with the Python <-> JavaScript bindings that Pyodide provides?

It's also worth noting that the JupyterLite Pyodide kernel runs in a Web Worker, and does not direct have access to the main execution context of the page.

@MRYingLEE
Copy link
Author

I am looking for a way to call AI APIs, such as OpenAI API, from Pyodide. I understand there is a limit on networking in Pyodide. So instead of calling OpenAI PYTHON API directly, maybe an OpenAI JAVASCRIPT API based JavaScript function can be called in Pyodide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants