Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
from typing import Protocol | |
class Callable(Protocol): | |
def __call__(self, *args, **kwargs): | |
... | |
class Params: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from fastapi.staticfiles import StaticFiles | |
class StaticNoCache(StaticFiles): | |
"""Disable caching of static files serverd""" | |
def is_not_modified(self, *args, **kwargs) -> bool: | |
return False | |
def file_response(self, *args, **kwargs): |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style>.tree { | |
position: relative; | |
} | |
/* Define variables used in tree-node */ | |
:root { | |
--indent: 1em; | |
--border-width: 2px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
FastAPI example web app for OAuth2 Authorization Code Flow. | |
Run with: | |
``` | |
uvicorn main:app --reload --log-config=log_conf.yaml | |
``` | |
""" | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple example of OpenAI Function Calling in ReAct Loop. | |
Functions are described in JSON with each parameter the function accepts described as a JSON Schema object. | |
More info: | |
- OpenAI Function Calling | |
- https://openai.com/blog/function-calling-and-other-api-updates | |
- https://platform.openai.com/docs/guides/gpt/function-calling | |
- https://platform.openai.com/docs/api-reference/chat/create#chat/create-functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import timedelta | |
import multiprocessing | |
import subprocess | |
import time | |
from IPython.display import clear_output | |
def nvidia_smi_call(): | |
""" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder