This file contains hidden or 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 time import sleep | |
from prefect import flow | |
@flow | |
def sleepy(n: int = 3600): | |
sleep(n) |
This file contains hidden or 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
# /// script | |
# dependencies = ["prefect"] | |
# /// | |
import webbrowser | |
from dataclasses import dataclass, field | |
from datetime import datetime | |
from pathlib import Path | |
from typing import Any |
This file contains hidden or 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 prefect import task | |
def some_fn(x: int, y: str) -> int: | |
return x + len(y) | |
some_task = task(some_fn) | |
print(some_task(x=1, y="hello")) |
This file contains hidden or 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 typing import Annotated | |
from pydantic import Field | |
from pydantic_ai import Agent | |
# the Field description is respected by the LLM as it produces a list[HistoricEvent] | |
HistoricEvent = Annotated[str, Field(description="what, where, when, how, why - very concise")] | |
historic_event_brainstormer = Agent[None, list[HistoricEvent]]( | |
"openai:gpt-4o", |
This file contains hidden or 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
# /// script | |
# dependencies = ["marvin@git+https://github.com/PrefectHQ/marvin.git@marvin-3"] | |
# /// | |
from typing import Annotated, Any, TypedDict | |
from pydantic import ConfigDict, Field, create_model | |
from pydantic_core import to_json | |
import marvin |
This file contains hidden or 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
# /// script | |
# dependencies = ["httpx", "pydantic-settings"] | |
# /// | |
from pathlib import Path | |
from typing import Any | |
import httpx | |
from pydantic import Field | |
from pydantic_settings import BaseSettings, SettingsConfigDict |
This file contains hidden or 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> | |
<body style="margin:0;overflow:hidden;background:#000;"> | |
<canvas id="c"></canvas> | |
<div style="position:fixed;top:1em;right:1em;background:rgba(0,0,0,0.85);color:#fff;padding:1.5em;border-radius:8px;min-width:200px;box-shadow:0 2px 10px rgba(0,0,0,0.5);"> | |
<h3 style="margin:0 0 1em 0;font-family:system-ui;font-weight:400;">Particle Controls</h3> | |
<label style="display:block;margin-bottom:0.5em;font-family:system-ui;">Count: <span id="v" style="color:#8FBC8F;"></span></label> | |
<input id="count" type="range" min="10" max="2000" value="500" step="10" style="width:100%;margin-bottom:1em;"> | |
<label style="display:block;margin-bottom:0.5em;font-family:system-ui;">Attraction: <span id="fv" style="color:#87CEEB;"></span></label> | |
<input id="force" type="range" min="-10000" max="10000" value="0" step="10" style="width:100%;"> | |
</div> |
This file contains hidden or 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
# echo OPENAI_API_KEY=$OPENAI_API_KEY > .env | |
# uv run --with marvin --with fastmcp fastmcp install mcp_server.py -f .env | |
# open -a Claude | |
import marvin | |
from fastmcp import FastMCP | |
server = FastMCP("Fruit server", dependencies=["marvin"]) | |
@server.tool() | |
def generate_fruit(n: int, color: str) -> list[str]: |
This file contains hidden or 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
import httpx | |
from atproto import Client, models | |
from pydantic_settings import BaseSettings, SettingsConfigDict | |
class Settings(BaseSettings): | |
"""set the following in your .env file | |
BSKY_USERNAME=your_username | |
BSKY_PASSWORD=your_password | |
""" |
This file contains hidden or 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 pydantic import BaseModel | |
from prefect import flow | |
class MyModel(BaseModel): | |
my_int: int = 3 | |
my_string: str = "foo" | |
NewerOlder