You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

polyfire-js

Package Overview
Dependencies
Maintainers
3
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polyfire-js

🔥 polyfire

0.2.60
latest
npmnpm
Version published
Weekly downloads
12
-91.37%
Maintainers
3
Weekly downloads
 
Created
Source

🔥 polyfire

Documentation | Discord | Dashboard

⚡ An all-in-one managed backend for AI apps. Build AI apps from the frontend, very fast. 🪶

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.

Demo Gif

🧰 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:

📚 Useful References

We're open source! Make a good PR to the JS SDK or the API and we'll merge it.

FAQs

Package last updated on 19 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts