repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/core_eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.555235 | """
Functions for evaluating the CORE metric, as described in the DCLM paper.
https://arxiv.org/abs/2406.11794
TODOs:
- All tasks ~match except for squad. We get 31% reference is 37%. Figure out why.
"""
import random
from jinja2 import Template
import torch
import torch.distributed as dist
# -----------------------... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | dev/gen_synthetic_data.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.572185 | """
Synthetic data generation for teaching nanochat about its identity and capabilities.
This script uses the OpenRouter API to generate diverse multi-turn conversations
between a user and nanochat. The conversations are saved to a .jsonl file for use
in supervised finetuning (SFT) via the CustomJSON task.
Key design... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | dev/repackage_data_reference.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.591145 | """
Repackage a given dataset into simple parquet shards:
- each shard is ~100MB in size (after zstd compression)
- parquets are written with row group size of 1000
- shuffle the dataset
This will be uploaded to HuggingFace for hosting.
The big deal is that our DataLoader will be able to stream
the data and cache it ... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/common.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.592354 | """
Common utilities for nanochat.
"""
import os
import re
import logging
import urllib.request
import torch
import torch.distributed as dist
from filelock import FileLock
# The dtype used for compute (matmuls, activations). Master weights stay fp32 for optimizer precision.
# Linear layers cast their weights to this ... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/execution.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.600671 | """
Sandboxed execution utilities for running Python code that comes out of an LLM.
Adapted from OpenAI HumanEval code:
https://github.com/openai/human-eval/blob/master/human_eval/execution.py
What is covered:
- Each execution runs in its own process (can be killed if it hangs or crashes)
- Execution is limited by a t... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/dataset.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.608908 | """
The base/pretraining dataset is a set of parquet files.
This file contains utilities for:
- iterating over the parquet files and yielding documents from it
- download the files on demand if they are not on disk
For details of how the dataset was prepared, see `repackage_data_reference.py`.
"""
import os
import ar... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/checkpoint_manager.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.617289 | """
Utilities for saving and loading model/optim/state checkpoints.
"""
import os
import re
import glob
import json
import logging
import torch
from nanochat.common import get_base_dir
from nanochat.gpt import GPT, GPTConfig
from nanochat.tokenizer import get_tokenizer
from nanochat.common import setup_default_logging... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/engine.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:06.633540 | """
Engine for efficient inference of our models.
Everything works around token sequences:
- The user can send token sequences to the engine
- The engine returns the next token
Notes:
- The engine knows nothing about tokenization, it's purely token id sequences.
The whole thing is made as efficient as possible.
"""
... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/flash_attention.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.684078 | """
Unified Flash Attention interface with automatic FA3/SDPA switching.
Exports `flash_attn` module that matches the FA3 API exactly, but falls back
to PyTorch SDPA on non-Hopper GPUs (including Blackwell), MPS, and CPU.
Usage (drop-in replacement for FA3):
from nanochat.flash_attention import flash_attn
# ... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/fp8.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.726386 | """Minimal FP8 training for nanochat — tensorwise dynamic scaling only.
Drop-in replacement for torchao's Float8Linear (~2000 lines) with ~150 lines.
We only need the "tensorwise" recipe (one scalar scale per tensor), not the full
generality of torchao (rowwise scaling, FSDP float8 all-gather, DTensor, tensor
subclass... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/loss_eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.733665 | """
A number of functions that help with evaluating a base model.
"""
import math
import torch
import torch.distributed as dist
@torch.no_grad()
def evaluate_bpb(model, batches, steps, token_bytes):
"""
Instead of the naive 'mean loss', this function returns the bits per byte (bpb),
which is a tokenization... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/gpt.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.742379 | """
GPT model (rewrite, a lot simpler)
Notable features:
- rotary embeddings (and no positional embeddings)
- QK norm
- untied weights for token embedding and lm_head
- relu^2 activation in MLP
- norm after token embedding
- no learnable params in rmsnorm
- no bias in linear layers
- Group-Query Attention (GQA) support... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/report.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.796214 | """
Utilities for generating training report cards. More messy code than usual, will fix.
"""
import os
import re
import shutil
import subprocess
import socket
import datetime
import platform
import psutil
import torch
def run_command(cmd):
"""Run a shell command and return output, or None if it fails."""
try... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/base_eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.809149 | """
Unified evaluation script for base models.
Supports three evaluation modes (comma-separated):
--eval core : CORE metric (accuracy on ICL tasks)
--eval bpb : Bits per byte on train/val splits
--eval sample : Generate samples from the model
Default is all three: --eval core,bpb,sample
Examples:
... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/optim.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.817842 | """
A nice and efficient mixed AdamW/Muon Combined Optimizer.
Usually the embeddings and scalars go into AdamW, and the matrix parameters go into Muon.
Two versions are provided (MuonAdamW, DistMuonAdamW), for single GPU and distributed.
Addapted from: https://github.com/KellerJordan/modded-nanogpt
Further contributio... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | nanochat/tokenizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.837739 | """
BPE Tokenizer in the style of GPT-4.
Two implementations are available:
1) HuggingFace Tokenizer that can do both training and inference but is really confusing
2) Our own RustBPE Tokenizer for training and tiktoken for efficient inference
"""
import os
import copy
from functools import lru_cache
SPECIAL_TOKENS ... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/chat_cli.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.862270 | """
New and upgraded chat mode because a lot of the code has changed since the last one.
Intended to be run single GPU only atm:
python -m scripts.chat_cli
"""
import argparse
import torch
from nanochat.common import compute_init, autodetect_device_type
from nanochat.engine import Engine
from nanochat.checkpoint_manag... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/base_train.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:07.873625 | """
Train model. From root directory of the project, run as:
python -m scripts.base_train
or distributed as:
torchrun --nproc_per_node=8 -m scripts.base_train
If you are only on CPU/Macbook, you'll want to train a much much smaller LLM. Example:
python -m scripts.base_train --depth=4 --max-seq-len=512 --device-batc... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/chat_eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.270030 | """
Evaluate the Chat model.
All the generic code lives here, and all the evaluation-specific
code lives in nanochat directory and is imported from here.
Example runs:
python -m scripts.chat_eval -a ARC-Easy
torchrun --nproc_per_node=8 -m scripts.chat_eval -- -a ARC-Easy
"""
import argparse
from functools import part... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/chat_web.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.311564 | #!/usr/bin/env python3
"""
Unified web chat server - serves both UI and API from a single FastAPI instance.
Uses data parallelism to distribute requests across multiple GPUs. Each GPU loads
a full copy of the model, and incoming requests are distributed to available workers.
Launch examples:
- single available GPU (... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/chat_rl.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.312121 | """
Reinforcement learning on GSM8K via "GRPO".
I put GRPO in quotes because we actually end up with something a lot
simpler and more similar to just REINFORCE:
1) Delete trust region, so there is no KL regularization to a reference model
2) We are on policy, so there's no need for PPO ratio+clip.
3) We use DAPO styl... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/chat_sft.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.337832 | """
Supervised fine-tuning (SFT) the model.
Run as:
python -m scripts.chat_sft
Or torchrun for training:
torchrun --standalone --nproc_per_node=8 -m scripts.chat_sft -- --device-batch-size=16
"""
import gc
import argparse
import os
os.environ["PYTORCH_ALLOC_CONF"] = "expandable_segments:True"
import time
import wan... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/tok_eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.383048 | """
Evaluate compression ratio of the tokenizer.
"""
from nanochat.tokenizer import get_tokenizer, RustBPETokenizer
from nanochat.dataset import parquets_iter_batched
# Random text I got from a random website this morning
news_text = r"""
(Washington, D.C., July 9, 2025)- Yesterday, Mexico’s National Service of Agro-... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | scripts/tok_train.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.399734 | """
Train a tokenizer using our own BPE Tokenizer library.
In the style of GPT-4 tokenizer.
"""
import os
import time
import argparse
import torch
from nanochat.tokenizer import RustBPETokenizer
from nanochat.common import get_base_dir
from nanochat.dataset import parquets_iter_batched
# ------------------------------... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/gsm8k.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.415760 | """
GSM8K evaluation.
https://huggingface.co/datasets/openai/gsm8k
Example problem instance:
Question:
Weng earns $12 an hour for babysitting. Yesterday, she just did 50 minutes of babysitting. How much did she earn?
Answer:
Weng earns 12/60 = $<<12/60=0.2>>0.2 per minute.
Working 50 minutes, she earned 0.2 x 50 = $<... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/customjson.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.417151 | """
CustomJSON task for loading conversations from JSONL files.
Each line in the JSONL file should be a JSON array of messages.
"""
import os
import json
from tasks.common import Task
class CustomJSON(Task):
"""
Load conversations from a JSONL file.
Each line should be a JSON array of message objects with... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/arc.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.428985 | """
The ARC dataset from Allen AI.
https://huggingface.co/datasets/allenai/ai2_arc
"""
from datasets import load_dataset
from tasks.common import Task, render_mc
class ARC(Task):
def __init__(self, subset, split, **kwargs):
super().__init__(**kwargs)
assert subset in ["ARC-Easy", "ARC-Challenge"]... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/common.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.441597 | """
Base class for all Tasks.
A Task is basically a dataset of conversations, together with some
metadata and often also evaluation criteria.
Example tasks: MMLU, ARC-Easy, ARC-Challenge, GSM8K, HumanEval, SmolTalk.
"""
import random
class Task:
"""
Base class of a Task. Allows for lightweight slicing of the ... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/humaneval.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.809999 | """
Evaluate the Chat model on HumanEval dataset.
Btw this dataset is a misnomer and has nothing to do with humans.
It is a coding benchmark.
"""
import re
from datasets import load_dataset
from nanochat.execution import execute_code
from tasks.common import Task
def extract_imports(prompt):
"""Extract import sta... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/mmlu.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.834902 | """
The MMLU dataset.
https://huggingface.co/datasets/cais/mmlu
"""
from datasets import load_dataset
from tasks.common import Task, render_mc
class MMLU(Task):
letters = ('A', 'B', 'C', 'D')
groups = ('abstract_algebra', 'anatomy', 'astronomy', 'business_ethics', 'clinical_knowledge', 'college_biology', 'co... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/spellingbee.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.876376 | """
Task intended to make nanochat better in spelling and counting, for example:
"How many r are in strawberry?" -> 3
An interesting part of this task is that we will get the assistant to
solve the problem using a combination of manual counting and Python.
This is a good problem solving "instinct" to mix into the mod... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tasks/smoltalk.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.890726 | """
SmolTalk by HuggingFace. Good "general" conversational dataset.
https://huggingface.co/datasets/HuggingFaceTB/smol-smoltalk
We use the "smol" version, which is more appropriate for smaller models.
"""
from datasets import load_dataset
from tasks.common import Task
class SmolTalk(Task):
""" smol-smoltalk datas... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tests/test_attention_fallback.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.953363 | """
Test Flash Attention unified interface - verify FA3 and SDPA produce identical results.
Run: python -m pytest tests/test_attention_fallback.py -v -s
Note on test structure:
Tests are split into two classes due to dtype/device constraints:
1. TestFA3VsSDPA: Comparison tests that run both FA3 and SDPA on t... |
karpathy/nanochat | https://github.com/karpathy/nanochat | null | null | null | null | 52,868 | null | null | mit | null | null | null | null | null | null | null | tests/test_engine.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:08.988095 | """
Test Engine class. Example run:
python -m pytest tests/test_engine.py -v
"""
import torch
from nanochat.engine import KVCache, Engine
from dataclasses import dataclass
# -----------------------------------------------------------------------------
# Mock classes for testing Engine without loading a real model
... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/backends/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.663309 | """Storage backend contract for MemPalace (RFC 001).
This module defines the surface every storage backend must implement:
* ``BaseCollection`` — the per-collection read/write interface, kwargs-only.
* ``BaseBackend`` — the per-palace factory, addressed by ``PalaceRef``.
* ``QueryResult`` / ``GetResult`` — typed resu... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/backends/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.675472 | """Storage backend implementations for MemPalace (RFC 001).
Public surface:
* :class:`BaseCollection` — per-collection read/write contract.
* :class:`BaseBackend` — per-palace factory contract.
* :class:`PalaceRef` — value object identifying a palace for a backend.
* :class:`QueryResult` / :class:`GetResult` — typed ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | examples/convo_import.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.683832 | #!/usr/bin/env python3
"""Example: import Claude Code / ChatGPT conversations."""
print("Import Claude Code sessions:")
print(" mempalace mine ~/claude-sessions/ --mode convos --wing my_project")
print()
print("Import ChatGPT exports:")
print(" mempalace mine ~/chatgpt-exports/ --mode convos")
print()
print("Use gen... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | benchmarks/locomo_bench.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.685294 | #!/usr/bin/env python3
"""
MemPal × LoCoMo Benchmark
===========================
Evaluates MemPal's retrieval against the LoCoMo benchmark.
10 conversations, ~200 QA pairs across 5 categories.
For each conversation:
1. Ingest all sessions into a fresh MemPal palace
2. For each QA pair, query the palace
3. Score retri... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.688623 | """MemPalace — Give your AI a memory. No API key required."""
import logging
from .version import __version__ # noqa: E402
# chromadb telemetry: posthog capture() was broken in 0.6.x causing noisy stderr
# warnings ("capture() takes 1 positional argument but 3 were given"). In 1.x the
# posthog client is a no-op st... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | benchmarks/mine_bench.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.696097 | """Mining throughput benchmark: per-chunk vs batched upsert, CPU vs GPU.
Compares the legacy per-chunk ``add_drawer`` loop against the batched
``collection.upsert`` path introduced in the "batched upsert + GPU" PR.
Runs both paths on an identical seeded synthetic corpus, reports
wall-clock time + drawers/sec, and prin... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | examples/basic_mining.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.699789 | #!/usr/bin/env python3
"""Example: mine a project folder into the palace."""
import sys
project_dir = sys.argv[1] if len(sys.argv) > 1 else "~/projects/my_app"
print("Step 1: Initialize rooms from folder structure")
print(f" mempalace init {project_dir}")
print("\nStep 2: Mine everything")
print(f" mempalace mine {... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | benchmarks/convomem_bench.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.729319 | #!/usr/bin/env python3
"""
MemPal × ConvoMem Benchmark
==============================
Evaluates MemPal's retrieval against the ConvoMem benchmark.
75,336 QA pairs across 6 evidence categories.
For each evidence item:
1. Ingest all conversations into a fresh MemPal palace (one drawer per message)
2. Query with the que... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | benchmarks/membench_bench.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:11.730605 | #!/usr/bin/env python3
"""
MemPal × MemBench Benchmark
============================
MemBench (ACL 2025): https://aclanthology.org/2025.findings-acl.989/
Data: https://github.com/import-myself/Membench
MemBench tests memory across multi-turn conversations in multiple categories:
- highlevel: inferences requiring agg... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/closet_llm.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.290159 | """
closet_llm.py — Generate closets via a user-configured LLM for richer indexing.
The regex-based closet extraction catches action verbs, headers, and proper
nouns — but misses implicit topics, foreign-language content, and contextual
references. An LLM reads everything and produces better closets.
This module is *... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/corpus_origin.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.328794 | """
corpus_origin.py — Detect whether a corpus is an AI-dialogue record and,
if so, what platform and what persona names the user has assigned to the
agent.
This is the first question any downstream Pass 2 classification needs
answered. Without it, a drawer like "my three sons" in a Claude Code
dialogue corpus can't b... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/cli.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.330421 | #!/usr/bin/env python3
"""
MemPalace — Give your AI a memory. No API key required.
Two ways to ingest:
Projects: mempalace mine ~/projects/my_app (code, docs, notes)
Conversations: mempalace mine <convo-dir> --mode convos (Claude Code, Claude.ai, ChatGPT, Slack exports)
Same palace. Same search.... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/backends/chroma.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.331449 | """ChromaDB-backed MemPalace storage backend (RFC 001 reference implementation)."""
import datetime as _dt
import logging
import os
import sqlite3
from pathlib import Path
from typing import Any, Optional
import chromadb
from chromadb.errors import NotFoundError as _ChromaNotFoundError
from .base import (
BaseBa... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/config.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.337937 | """
MemPalace configuration system.
Priority: env vars > config file (~/.mempalace/config.json) > defaults
"""
import json
import os
import re
from pathlib import Path
# ── Input validation ──────────────────────────────────────────────────────────
# Shared sanitizers for wing/room/entity names. Prevents path trave... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/convo_scanner.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.356894 | """
convo_scanner.py — Parse Claude Code conversation directories into ProjectInfo.
Claude Code stores sessions under ``~/.claude/projects/<slug>/<id>.jsonl``,
where the ``<slug>`` is the original CWD with ``/`` replaced by ``-``. That
encoding is lossy: we can't tell whether ``foo-bar`` in a slug is the
literal proje... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/convo_miner.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.358352 | #!/usr/bin/env python3
"""
convo_miner.py — Mine conversations into the palace.
Ingests chat exports (Claude Code, ChatGPT, Slack, plain text transcripts).
Normalizes format, chunks by exchange pair (Q+A = one unit), files to palace.
Same palace as project mining. Different ingest strategy.
"""
import os
import sys
... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/backends/registry.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.377243 | """Backend registry + entry-point discovery (RFC 001 §3).
Third-party backends ship as installable packages that declare a
``mempalace.backends`` entry point::
# pyproject.toml of mempalace-postgres
[project.entry-points."mempalace.backends"]
postgres = "mempalace_postgres:PostgresBackend"
MemPalace disc... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/dialect.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.378412 | #!/usr/bin/env python3
"""
AAAK Dialect -- Structured Symbolic Summary Format
====================================================
A lossy summarization format that extracts entities, topics, key sentences,
emotions, and flags from plain text into a compact structured representation.
Any LLM reads it natively — no dec... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/dedup.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.402085 | """
dedup.py — Detect and remove near-duplicate drawers
====================================================
When the same files are mined multiple times, near-identical drawers
accumulate. This module finds drawers from the same source_file that
are too similar (cosine distance < threshold), keeps the longest/richest... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/diary_ingest.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.871267 | """
diary_ingest.py — Ingest daily summary files into the palace.
Architecture:
- ONE drawer per (wing, day) — full verbatim content, upserted as the day grows.
- Closets pack topics up to CLOSET_CHAR_LIMIT, never split mid-topic.
- A re-ingest fully purges the prior day's closets before rebuilding so a
shorter day ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/embedding.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.934425 | """Embedding function factory with hardware acceleration.
Returns a ChromaDB-compatible embedding function bound to a user-selected
ONNX Runtime execution provider. The same ``all-MiniLM-L6-v2`` model and
384-dim vectors ChromaDB ships by default are reused, so switching device
does not invalidate existing palaces.
S... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/exporter.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.940481 | """
exporter.py — Export the palace as a browsable folder of markdown files.
Produces:
output_dir/
index.md — table of contents
wing_name/
room_name.md — one file per room, drawers as sections
Streams drawers in paginated batches so memory usage stays bounded
regardless of palace s... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/entity_detector.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.961199 | #!/usr/bin/env python3
"""
entity_detector.py — Auto-detect people and projects from file content.
Uses ``from __future__ import annotations`` so PEP 604 union syntax
(``dict | None``) works on the Python 3.9 baseline.
Two-pass approach:
Pass 1: scan files, extract entity candidates with signal counts
Pass 2: sco... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/i18n/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:12.998089 | """i18n — Language dictionaries for MemPalace.
Usage:
from mempalace.i18n import load_lang, t
load_lang("fr") # load French
print(t("cli.mine_start", path="/docs")) # "Extraction de /docs..."
print(t("terms.wing")) # "aile"
print(t("aaak.instruction")) # AAAK compression instruction... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/general_extractor.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.000359 | #!/usr/bin/env python3
"""
general_extractor.py — Extract 5 types of memories from text.
Types:
1. DECISIONS — "we went with X because Y", choices made
2. PREFERENCES — "always use X", "never do Y", "I prefer Z"
3. MILESTONES — breakthroughs, things that finally worked
4. PROBLEMS — what broke, what ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/instructions_cli.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.001266 | """
Instruction text output for MemPalace CLI commands.
Each instruction lives as a .md file in the instructions/ directory
inside the package. The CLI reads and prints the file content.
"""
import sys
from pathlib import Path
INSTRUCTIONS_DIR = Path(__file__).parent / "instructions"
AVAILABLE = ["init", "search", ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/fact_checker.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.003810 | """
fact_checker.py — Verify text against known facts in the palace.
Checks AI responses, diary entries, and new content against the entity
registry and knowledge graph for three classes of issue:
* similar_name — text mentions a name that's one/two edits
away from *another* reg... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/entity_registry.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.015070 | #!/usr/bin/env python3
"""
entity_registry.py — Persistent personal entity registry for MemPalace.
Knows the difference between Riley (a person) and ever (an adverb).
Built from three sources, in priority order:
1. Onboarding — what the user explicitly told us
2. Learned — what we inferred from session history wit... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/hooks_cli.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.046280 | """
Hook logic for MemPalace — Python implementation of session-start, stop, and precompact hooks.
Reads JSON from stdin, outputs JSON to stdout.
Supported hooks: session-start, stop, precompact
Supported harnesses: claude-code, codex (extensible to cursor, gemini, etc.)
"""
import json
import os
import re
import sub... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/palace.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.936052 | """
palace.py — Shared palace operations.
Consolidates collection access patterns used by both miners and the MCP server.
"""
import contextlib
import hashlib
import os
import re
from .backends.chroma import ChromaBackend
SKIP_DIRS = {
".git",
"node_modules",
"__pycache__",
".venv",
"venv",
... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/onboarding.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:13.958905 | #!/usr/bin/env python3
"""
onboarding.py — MemPalace first-run setup.
Asks the user:
1. How they're using MemPalace (work / personal / combo)
2. Who the people in their life are (names, nicknames, relationships)
3. What their projects are
4. What they want their wings called
Seeds the entity_registry with con... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/knowledge_graph.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:14.048183 | """
knowledge_graph.py — Temporal Entity-Relationship Graph for MemPalace
=====================================================================
Real knowledge graph with:
- Entity nodes (people, projects, tools, concepts)
- Typed relationship edges (daughter_of, does, loves, works_on, etc.)
- Temporal validity (... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/palace_graph.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:14.522774 | """
palace_graph.py — Graph traversal layer for MemPalace
======================================================
Builds a navigable graph from the palace structure:
- Nodes = rooms (named ideas)
- Edges = shared rooms across wings (tunnels)
- Edge types = halls (the corridors)
Enables queries like:
"Start at ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/query_sanitizer.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:14.851576 | """
query_sanitizer.py — Mitigate system prompt contamination in search queries.
Problem: AI agents sometimes prepend system prompts (2000+ chars) to search queries.
Embedding models represent the concatenated string as a single vector where the
system prompt overwhelms the actual question (typically 10-50 chars), cau... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/normalize.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:14.852653 | #!/usr/bin/env python3
"""
normalize.py — Convert any chat export format to MemPalace transcript format.
Supported:
- Plain text with > markers (pass through)
- Claude.ai JSON export
- ChatGPT conversations.json
- Claude Code JSONL (with tool_use/tool_result block capture)
- OpenAI Codex CLI JSONL
... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/miner.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:14.853984 | #!/usr/bin/env python3
"""
miner.py — Files everything into the palace.
Reads mempalace.yaml from the project directory to know the wing + rooms.
Routes each file to the right room based on content.
Stores verbatim chunks as drawers. No summaries. Ever.
"""
import os
import sys
import shlex
import hashlib
import fnma... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/layers.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.306870 | #!/usr/bin/env python3
"""
layers.py — 4-Layer Memory Stack for mempalace
===================================================
Load only what you need, when you need it.
Layer 0: Identity (~100 tokens) — Always loaded. "Who am I?"
Layer 1: Essential Story (~500-800) — Always loaded. Top moments fr... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/project_scanner.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.438353 | """
project_scanner.py — Detect projects and people from real signal.
For a codebase with build manifests or git history, this beats regex-based
entity detection by a wide margin: the project's own name is already written
down in package.json / pyproject.toml / Cargo.toml / go.mod, and the people
who worked on it are ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/llm_client.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.489362 | """
llm_client.py — Minimal provider abstraction for LLM-assisted entity refinement.
Three providers cover the useful space:
- ``ollama`` (default): local models via http://localhost:11434. Works fully
offline. Honors MemPalace's "zero-API required" principle.
- ``openai-compat``: any OpenAI-compatible ``/v1/chat/c... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/migrate.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.513962 | #!/usr/bin/env python3
"""
mempalace migrate — Recover a palace created with a different ChromaDB version.
Reads documents and metadata directly from the palace's SQLite database
(bypassing ChromaDB's API, which fails on version-mismatched palaces),
then re-imports everything into a fresh palace using the currently in... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/repair.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.550336 | """
repair.py — Scan, prune corrupt entries, and rebuild HNSW index
================================================================
When ChromaDB's HNSW index accumulates duplicate entries (from repeated
add() calls with the same ID), link_lists.bin can grow unbounded —
terabytes on large palaces — eventually causing... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/llm_refine.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.555121 | """
llm_refine.py — Optional LLM refinement of regex-detected entities.
Takes the candidate set produced by phase-1 detection (manifests, git
authors, regex on prose) and asks an LLM to reclassify each candidate as
PERSON / PROJECT / TOPIC / COMMON_WORD / AMBIGUOUS.
Design constraints:
- Opt-in. Default init path nev... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/sources/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.923504 | """Source adapter subsystem (RFC 002).
Public surface:
* :class:`BaseSourceAdapter` — per-source read-side contract.
* Typed records: :class:`SourceRef`, :class:`SourceItemMetadata`,
:class:`DrawerRecord`, :class:`RouteHint`, :class:`SourceSummary`,
:class:`AdapterSchema`, :class:`FieldSpec`.
* Error classes: :cl... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/room_detector_local.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:15.924283 | #!/usr/bin/env python3
"""
room_detector_local.py — Local setup, no API required.
Two ways to define rooms without calling any AI:
1. Auto-detect from folder structure (zero config)
2. Define manually in mempalace.yaml
No internet. No API key. Your files stay on your machine.
"""
import logging
import os
import ... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/mcp_server.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:16.328140 | #!/usr/bin/env python3
"""
MemPalace MCP Server — read/write palace access for Claude Code
================================================================
Install: claude mcp add mempalace -- mempalace-mcp [--palace /path/to/palace]
Tools (read):
mempalace_status — total drawers, wing/room breakdown
memp... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/searcher.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:16.329402 | #!/usr/bin/env python3
"""
searcher.py — Find anything. Exact words.
Hybrid search: BM25 keyword matching + vector semantic similarity. The
drawer query is the floor — always runs — and closet hits add a rank-based
boost when they agree. Closets are a ranking *signal*, never a gate, so
weak closets (regex extraction o... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/sources/base.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:16.852398 | """Source adapter contract for MemPalace (RFC 002).
Mirrors what ``mempalace/backends/base.py`` does for the write side: it defines
the read-side surface every source adapter must implement. A source adapter
extracts content from a specific origin (filesystem, git, Slack, Cursor …) and
yields typed records (``SourceIt... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/sources/context.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:21.069787 | """``PalaceContext`` facade passed to source adapters (RFC 002 §9).
Bundles the palace-side surface an adapter needs during :meth:`ingest`:
drawer collection, closet collection, knowledge graph, palace config, and
progress hooks. Adapters receive a ``PalaceContext`` instance and MUST NOT
import ``mempalace.palace`` di... |
MemPalace/mempalace | https://github.com/MemPalace/mempalace | null | null | null | null | 50,957 | null | null | mit | null | null | null | null | null | null | null | mempalace/sources/registry.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:21.118824 | """Source adapter registry + entry-point discovery (RFC 002 §3).
Third-party adapters ship as installable packages that declare a
``mempalace.sources`` entry point::
# pyproject.toml of mempalace-source-cursor
[project.entry-points."mempalace.sources"]
cursor = "mempalace_source_cursor:CursorAdapter"
Mem... |
charlax/professional-programming | https://github.com/charlax/professional-programming | null | null | null | null | 50,780 | null | null | mit | null | null | null | null | null | null | null | antipatterns/sqlalchemy-examples/exists.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:23.450013 | from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine("sqlite:///:memory:", echo=True)
Session = sessionmaker(bind=engine)
Base = declarative_base()
class Toaster(Base... |
charlax/professional-programming | https://github.com/charlax/professional-programming | null | null | null | null | 50,780 | null | null | mit | null | null | null | null | null | null | null | antipatterns/python-examples/reraise_exceptions_good.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:23.450714 | from collections import namedtuple
Bread = namedtuple("Bread", "color")
class ToastException(Exception):
pass
def toast(bread):
try:
put_in_toaster(bread)
except:
print("Got exception while trying to toast")
raise
def put_in_toaster(bread):
brad.color = "light_brown" # No... |
charlax/professional-programming | https://github.com/charlax/professional-programming | null | null | null | null | 50,780 | null | null | mit | null | null | null | null | null | null | null | antipatterns/python-examples/reraise_exceptions_bad.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:23.451532 | from collections import namedtuple
Bread = namedtuple("Bread", "color")
class ToastException(Exception):
pass
def toast(bread):
try:
put_in_toaster(bread)
except:
raise ToastException("Could not toast bread")
def put_in_toaster(bread):
brad.color = "light_brown" # Note the typo
... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/core/constants.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.202206 | """Constants for file handling utilities."""
from datetime import timedelta
from typing import Final, Literal
DEFAULT_MAX_FILE_SIZE_BYTES: Final[Literal[524_288_000]] = 524_288_000
MAGIC_BUFFER_SIZE: Final[Literal[2048]] = 2048
UPLOAD_MAX_RETRIES: Final[Literal[3]] = 3
UPLOAD_RETRY_DELAY_BASE: Final[Literal[2]] = 2... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/cache/metrics.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.204413 | """Performance metrics and structured logging for file operations."""
from __future__ import annotations
from collections.abc import Generator
from contextlib import contextmanager
from dataclasses import dataclass, field
from datetime import datetime, timezone
import logging
import time
from typing import Any
logg... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/core/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.207234 | """Core file types and sources."""
from crewai_files.core.constants import (
BACKOFF_BASE_DELAY,
BACKOFF_JITTER_FACTOR,
BACKOFF_MAX_DELAY,
DEFAULT_MAX_CACHE_ENTRIES,
DEFAULT_MAX_FILE_SIZE_BYTES,
DEFAULT_TTL_SECONDS,
DEFAULT_UPLOAD_CHUNK_SIZE,
FILES_API_MAX_SIZE,
GEMINI_FILE_TTL,
... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.211189 | """File handling utilities for crewAI tasks."""
from crewai_files.cache.cleanup import (
cleanup_expired_files,
cleanup_provider_files,
cleanup_uploaded_files,
)
from crewai_files.cache.upload_cache import (
CachedUpload,
UploadCache,
get_upload_cache,
reset_upload_cache,
)
from crewai_file... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/core/resolved.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.212564 | """Resolved file types representing different delivery methods for file content."""
from abc import ABC
from dataclasses import dataclass
from datetime import datetime
@dataclass(frozen=True)
class ResolvedFile(ABC):
"""Base class for resolved file representations.
A ResolvedFile represents the final form o... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | conftest.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.219207 | """Pytest configuration for crewAI workspace."""
import base64
from collections.abc import Generator
import gzip
import os
from pathlib import Path
import tempfile
from typing import Any
from dotenv import load_dotenv
import pytest
from vcr.request import Request # type: ignore[import-untyped]
try:
import vcr.... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/core/sources.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.220635 | """Base file class for handling file inputs in tasks."""
from __future__ import annotations
from collections.abc import AsyncIterator, Iterator
import inspect
import mimetypes
from pathlib import Path
from typing import Annotated, Any, BinaryIO, Protocol, cast, runtime_checkable
import aiofiles
from pydantic import ... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/cache/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.236641 | """Upload caching and cleanup."""
from crewai_files.cache.cleanup import cleanup_uploaded_files
from crewai_files.cache.metrics import FileOperationMetrics, measure_operation
from crewai_files.cache.upload_cache import UploadCache, get_upload_cache
__all__ = [
"FileOperationMetrics",
"UploadCache",
"clea... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/cache/upload_cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.266254 | """Cache for tracking uploaded files using aiocache."""
from __future__ import annotations
import asyncio
import atexit
import builtins
from collections.abc import Iterator
from dataclasses import dataclass
from datetime import datetime, timezone
import hashlib
import logging
from typing import TYPE_CHECKING, Any
fr... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/cache/cleanup.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:26.329311 | """Cleanup utilities for uploaded files."""
from __future__ import annotations
import asyncio
import logging
from typing import TYPE_CHECKING
from crewai_files.cache.upload_cache import CachedUpload, UploadCache
from crewai_files.uploaders import get_uploader
from crewai_files.uploaders.factory import ProviderType
... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/processing/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:27.096921 | """File processing module for multimodal content handling.
This module provides validation, transformation, and processing utilities
for files used in multimodal LLM interactions.
"""
from crewai_files.processing.constraints import (
ANTHROPIC_CONSTRAINTS,
BEDROCK_CONSTRAINTS,
GEMINI_CONSTRAINTS,
OPEN... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/formatting/openai.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:27.098626 | """OpenAI content block formatter."""
from __future__ import annotations
import base64
from typing import Any
from crewai_files.core.resolved import (
FileReference,
InlineBase64,
InlineBytes,
ResolvedFileType,
UrlReference,
)
class OpenAIResponsesFormatter:
"""Formats resolved files into O... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/formatting/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:27.099939 | """High-level formatting API for multimodal content."""
from crewai_files.formatting.api import (
aformat_multimodal_content,
format_multimodal_content,
)
from crewai_files.formatting.openai import OpenAIResponsesFormatter
__all__ = [
"OpenAIResponsesFormatter",
"aformat_multimodal_content",
"for... |
crewAIInc/crewAI | https://github.com/crewAIInc/crewAI | null | null | null | null | 50,544 | null | null | mit | null | null | null | null | null | null | null | lib/crewai-files/src/crewai_files/formatting/anthropic.py | null | null | null | null | null | null | Python | 2026-05-04T02:19:27.101405 | """Anthropic content block formatter."""
from __future__ import annotations
import base64
from typing import Any
from crewai_files.core.resolved import (
FileReference,
InlineBase64,
InlineBytes,
ResolvedFileType,
UrlReference,
)
from crewai_files.core.types import FileInput
class AnthropicForm... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.