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.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
Maintainers
0
Weekly downloads
 
Created
Source

fastapi-poe

Create PoeAI server bot with JavaScript and Cloudflare Workers.

Bootstrap Project

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

Development

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

const app = new Hono()

interface Env {
  API_KEY: string
}

export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext) {
    const bot = poe({
      name: 'custom-bot-name',
      key: env.API_KEY,
      getSettings() {
        return {
          server_bot_dependencies: {
            'Claude-3.5-Sonnet': 10,
          },
          allow_attachments: false,
          suggested_replies: true,
          enable_markdown: true,
        }
      },
      async *getResponse(req) {
        // Stream request to PoeAI server
        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!'))
    return app.fetch(request, env, ctx)
  },
}

FAQs

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