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({
# import micropip
# await micropip.install("hypha-artifact>=0.0.14")
# Make sure you add "hypha-artifact" to your requirements
import asyncio
import os
import sys
from hypha_artifact import AsyncHyphaArtifact

Test Results Summary for Running Claude Code in WebContainers

✅ Working Tools:

  1. File System Operations - All working perfectly: - LS - Lists directories - Read - Reads files (including images, PDFs, notebooks) - Write - Creates new files - Edit - Modifies existing files
  • MultiEdit - Multiple edits in one operation
<!doctype html>
<html>
<head>
<title>Todo list</title>
<style>
body {
margin: 0;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: radial-gradient(circle at top left, #1e293b, #020617);
color: #e5e7eb;