Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fastapi-poe

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastapi-poe

Create PoeAI server bot with JavaScript and Cloudflare Workers.

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

fastapi-poe

Create PoeAI server bot with JavaScript and Cloudflare Workers.

Bootstrap Project

pnpm dlx fastapi-poe@latest init <project-name>

Development

cd <project-name>
pnpm i
pnpm dev

Deployment

pnpm run deploy
echo <access-key> | pnpm wrangler secret put ACCESS_KEY

Basic Usage

import { Hono } from 'hono'
import { poe } from 'fastapi-poe'

const app = new Hono()

interface Env {
  ACCESS_KEY: string
}

const bot = poe({
  name: 'poe-bot-template',
  getSettings() {
    return {
      server_bot_dependencies: {
        'Claude-3.5-Sonnet': 1,
      },
    }
  },
  async *getResponse(req) {
    for await (const response of bot.streamRequest(req, 'Claude-3.5-Sonnet')) {
      yield {
        text: response.text,
      }
    }
  },
})

app.post('/', bot.handler)
app.get('/', async (c) => c.text('Hello Hono!'))

export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext) {
    bot.accessKey = env.ACCESS_KEY
    return app.fetch(request, env, ctx)
  },
}

FAQs

Package last updated on 21 Aug 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc