Skip to content

Instantly share code, notes, and snippets.

View KennyVaneetvelde's full-sized avatar

Kenny Vaneetvelde KennyVaneetvelde

View GitHub Profile
@KennyVaneetvelde
KennyVaneetvelde / memoization.py
Created September 15, 2024 14:29
Persistently caching pure functions with a custom memoization decorator
import functools
import sqlite3
from typing import Callable, Dict, TypeVar, ParamSpec, List
import pickle
from rich.console import Console
from rich.table import Table
from rich.prompt import Prompt
from rich import box
from tqdm import tqdm
@KennyVaneetvelde
KennyVaneetvelde / main.py
Created August 7, 2024 14:20
Atomic Agents + Streamlit Mermaid Diagram Assistant
import instructor
import openai
import streamlit as st
from pydantic import Field
from dataclasses import dataclass
import streamlit.components.v1 as components
from atomic_agents.agents.base_agent import BaseIOSchema, BaseAgent, BaseAgentConfig
from atomic_agents.lib.components.system_prompt_generator import SystemPromptGenerator
import os
import chromadb
from chromadb.utils import embedding_functions
from langchain.text_splitter import RecursiveCharacterTextSplitter
import hashlib
import logging
from rich.logging import RichHandler
from rich.progress import Progress, SpinnerColumn, TextColumn
from rich.console import Console
from rich.panel import Panel