polyfire-js
v0.2.60
Published
<h1 align="center">🔥 polyfire</h1>
Downloads
28
Readme
Why use Polyfire?
- Just code from the frontend, no backend needed
- If you already have backend, less code to write
- Most backend services you'd need in a couple lines of code
We manage your AI backend so you don't have to.
🧰 Examples
We have several examples in our documentation. But here are two simple ones to get you started
React
import { useState, useEffect } from "react";
import { createRoot } from "react-dom/client";
import { TextGenerated, Login } from "polyfire-js/components";
function App() {
return (
<Login>
<h2>Here's a little auto-generated haiku for you:</h2>
<TextGenerated prompt="Generate a hello world haiku" />
</Login>
);
}
document.body.innerHTML = '<div id="app"></div>';
const root = createRoot(document.getElementById("app"));
root.render(
<PolyfireProvider project="your_project_id">
<App />
</PolyfireProvider>,
);
Don't forget to change the your_project_id by your project ID you will have got on https://beta.polyfire.com
Vanilla JS
<script src="https://github.com/polyfire-ai/polyfire-js/releases/download/0.2.7/polyfire-min-0.2.7.js"></script>
<script>
(async () => {
const polyfire = window.PolyfireClientBuilder({ project: "your_project_id" });
const isAuthenticated = await polyfire.auth.init();
if (!isAuthenticated) {
await polyfire.auth.login("github");
}
const helloWorld = await polyfire.models.generate("Write me a hello world haiku");
console.log(helloWorld);
})();
</script>
Don't forget to change the your_project_id by your project ID you will have got on https://beta.polyfire.com
🆕 Getting Started
To get an overview of Polyfire follow this Basic Usage tutorial.
✨ Starter Guides
We also made a couple of tutorials you can use to get started with Polyfire:
- How to make a clone of ChatGPT
- New Project & Rate Limits
- Adding stripe subscriptions
- Call Polyfire from React: The usePolyfire hooks lets you use Polyfire and handle authentification without having to deploy any backend
- Call Polyfire from other browser environments: The Polyfire Client Object allows you to use Polyfire and handle authentification without having to deploy any backend in any environment
📚 Useful References
- Generate Simple Text: Answer to simple requests as text
- Create Chatbots: Easily create chatbots
- Transcribe: Transcribe audio files to text
- Memory: Easily create a long-term memory and simplify the use of large amounts of information
- GenerateImage: Generate images with Dall-E
🔗 Links
- Website: polyfire.com
- Documentation: docs.polyfire.com
- Dashboard: beta.polyfire.com
- Discord: polyfire.com/discord
- Javascript SDK: github.com/polyfire-ai/polyfire-js
- Open Source API (your managed backend!): github.com/polyfire-ai/polyfire-api
We're open source! Make a good PR to the JS SDK or the API and we'll merge it.