Skip to content

Instantly share code, notes, and snippets.

View oeway's full-sized avatar

Wei Ouyang oeway

  • Science For Life Laboratory
  • Stockholm
View GitHub Profile
@oeway
oeway / openai_server.py
Created September 9, 2024 08:05
Create OpenAI Chat Server via Hypha
import asyncio
import random
from hypha_rpc.utils.serve import create_openai_chat_server
async def text_generator(request: dict):
max_tokens = request.get("max_tokens", 50)
words = [
"hello",
"world",
const serverUrl = "https://hypha.aicell.io"
const loginCallback = (context) => {
window.open(context.login_url);
};
async function startServer(serverUrl) {
// Log in and connect to the Hypha server
const token = await hyphaWebsocketClient.login({