- Ensure you have these installed and accessible from the notebook pyngrok, nest_asyncio, fastapi, uvicorn and other libs you want
%pip install pyngrok nest_asyncio fastapi uvicorn loguru
- Create a FastAPI app
from fastapi import FastAPI
from openai_function_call import openai_function | |
import guidance | |
@openai_function | |
def get_weather(location: str, unit: str = 'fahrenheit', date: str = 'today'): | |
""" Get the current weather in a given location and date.""" | |
weather_info = { | |
'location': location, | |
'unit': unit, | |
'temperature': '60' if unit == 'fahrenheit' else '15', |
<script setup lang="ts"> | |
import { storeToRefs } from 'pinia'; | |
const notifyStore = useNotifyStore(); | |
const { notifications } = storeToRefs(notifyStore); | |
</script> | |
<template> | |
.... | |
<div class="toast toast-end toast-top"> | |
<div v-for="notification in notifications" :class="notification.type"> |
// ~/server/api/sse.ts | |
export default defineEventHandler(async (event) => { | |
if (!process.dev) return { disabled: true } | |
// Enable SSE endpoint | |
setHeader(event, 'cache-control', 'no-cache') | |
setHeader(event, 'connection', 'keep-alive') | |
setHeader(event, 'content-type', 'text/event-stream') | |
setResponseStatus(event, 200) |
# Reference: https://indominusbyte.github.io/fastapi-jwt-auth/usage/basic/ | |
from fastapi import FastAPI, Depends, Request, HTTPException | |
from fastapi.responses import JSONResponse | |
from fastapi_jwt_auth import AuthJWT | |
from fastapi_jwt_auth.exceptions import AuthJWTException | |
from pydantic import BaseModel | |
app = FastAPI() |
from fastapi import FastAPI | |
apiv1 = FastAPI() | |
@apiv1.get('/returnName') | |
def index(): | |
return {"Name": "Kaustubh demo"} | |
################# |
{ | |
// Disable telemetry | |
"telemetry.telemetryLevel": "off", | |
// Zen mode | |
"zenMode.fullScreen": false, | |
"zenMode.hideTabs": true, | |
"zenMode.centerLayout": false, | |
// Theming | |
"workbench.iconTheme": "city-lights-icons-vsc", | |
"editor.fontFamily": "Dank Mono", |