-
Notifications
You must be signed in to change notification settings - Fork 1
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
OpenAI API proxy with Wasi preview 2 and the WebAssembly Component Model #11
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
petersalomonsen
force-pushed
the
wasip2
branch
from
October 11, 2024 19:48
db00387
to
2f7ce72
Compare
petersalomonsen
changed the title
Wasip2
OpenAI API proxy with Wasi preview 2 and the WebAssembly Component Model
Oct 11, 2024
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
petersalomonsen
force-pushed
the
wasip2
branch
from
November 30, 2024 19:51
cf63ab2
to
4068b95
Compare
petersalomonsen
added a commit
to petersalomonsen/quickjs-rust-near
that referenced
this pull request
Dec 12, 2024
petersalomonsen
added a commit
to petersalomonsen/quickjs-rust-near
that referenced
this pull request
Dec 14, 2024
- copied code from petersalomonsen/near-openai#11, which adds a [spin](https://github.com/fermyon/spin) app with a proxy to the OpenAI API, using the Fungible Token contract to cover usage cost - hash `conversation_id` when calling the smart contract from the proxy to ensure that the smart contract does not reveal the conversation id that the AI proxy accepts - added a test for the [aiconversation.js](https://github.com/petersalomonsen/quickjs-rust-near/blob/master/examples/fungibletoken/e2e/aiconversation.js) script that also shows the full process of starting a conversation and to get the refund when done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request contains another variant of implementing an OpenAI API proxy. It is written in Rust compiling to WASI 0.2.0 and packaged according to the WebAssembly Component Model. This provides a serverless and highly scalable proxy
For tracking spending, and initiating a conversation, the proxy is connecting to a NEAR Fungible Token contract which can be found here: petersalomonsen/quickjs-rust-near#21
TODO
Demo
See a demo video of the application here
https://youtu.be/-R_zok--L_A?si=AkBl4IBjk6dbXDiw