# Pinecone tutorial: code and outputs

Run date: 2026-11-06. Everything ran in Docker. Nothing is installed on the host or in this repo. Account: Pinecone Starter (free).

Image: `Dockerfile`, `requirements.txt`, `pip-freeze.txt`. `pinecone` 10.3.0 (latest on PyPI on 2026-11-06), `requests` 2.34.2, Python 3.11.18 (`python:3.11-slim`, aarch64), Docker 24.0.6, image `kb-pinecone:10.3.0` 172 MB. API version of document indexes: `2026-07`.
`run.sh` runs a script in the image. It needs `DATA_DIR` (host folder with `chunks.jsonl`) and `PINECONE_ENV_FILE` (mode 600 file with one line `PINECONE_API_KEY=...`). The key reaches the container only through `--env-file`. `common.py` wraps stdout and stderr so the key and any index host (`...svc....pinecone.io`) print as `YOUR_API_KEY` and `INDEX_HOST`; no saved output contains either.

Scripts (each `X.py` has its output in `X.out`):
- `version_check.py` (`setup.out`, `pipgrep.out`), `create_index.py`, `load.py`, `query.py`, `filters.py`, `byo_vectors.py`.
- `namespaces.py layout` (`namespaces_layout.out`) and `namespaces.py tenants` (`namespaces_tenants.out`). `leftovers.py` / `leftovers.out`: the two namespaces (`root`, `integrations`) that survived the first delete in the layout run were deleted again. That output was copied verbatim from the terminal, the script was run as a one-off.
- `recrawl.py`, `limits_probe.py`, `legacy_probe.py`, `token_count.py` (first 96 chunks, three ways), `token_count_full.py` (all 304, two more ways), `cost.py` (formulas and measured ratios, nothing loaded).
- `build_chunks.py` (copied unchanged from the Chroma tutorial), `questions.json` (6 questions), `cleanup.sh`.

Run order: `docker build -t kb-pinecone:10.3.0 .`, then `./run.sh version_check.py`, `create_index.py`, `load.py`, `query.py`, `filters.py`, `byo_vectors.py`, `namespaces.py layout`, `namespaces.py tenants`, `recrawl.py`, `limits_probe.py`, `token_count.py`, `token_count_full.py`, `legacy_probe.py`, `cost.py`.

Input: `chunks.jsonl` is NOT included. 304 rows, 52 pages, sha256 7c62db9258ba7b33bc75bf3e0593b0a7ffc73d0b0fb11da68db0eb27ebe4e145 (verified before the run), the same file as the Chroma, Qdrant, LanceDB and Milvus tutorials. Pinecone embeds the `text`; the `embedding` column (nomic-embed-text, 768 dimensions) is used only by `byo_vectors.py`. Query vectors there come from Ollama at `host.docker.internal:11434` with the `search_query: ` prefix.

Sources read on 2026-11-06 (with `webcr`): docs.pinecone.io/guides/search/integrated-embedding, /guides/indexes/create-an-index (redirects under /guides/index-data/), /guides/cost/understand-cost, /reference/api/database-limits/rate-limits, /object-limits, /guides/data/delete-data, /guides/data/implement-multitenancy, /guides/data/manage-namespaces, /guides/indexes/processing-locations, /models/overview, /models/llama-text-embed-v2, pinecone.io/pricing, PyPI `pinecone`.

Notes on the outputs:
- Counts and token totals are from `usage.embed_total_tokens` and `describe_namespace`. Write units are not returned by the API and are not in any output; read units come back as whole numbers (1) per search, although the docs give a 0.25 minimum.
- `load.out` is the second clean load (the namespace was deleted first); an earlier load in the same session overwrote the same ids.
- `namespaces_layout.out` is the second run of that script (the first run read a stale count for the section namespaces and was changed to poll); both runs gave identical ranks.
- Starter usage for the whole session was a small part of the monthly allowance (the saved outputs add up to roughly 0.5M embedding tokens, plus earlier runs that were overwritten); the console usage page does not show embedding tokens, so the exact figure is not available there.
- `query.out` is the second run of `query.py` (it now also prints per-search latency, 121 to 560 ms); ranks and scores are identical to the first run.
- Screenshots `t*.png` are renderings of these outputs (some rows dropped). Console screenshots `c1` to `c4` are real browser captures with the account email, organization, key prefix and index host removed.

Clean up: `cleanup.sh` deletes `kb-docs`, `kb-docs-byo` and `kb-legacy` (if present). The two indexes were still alive when the article was finished, for the console screenshots.
