Skip to content

docs: sync README tutorial snippets to Pinecone SDK v8#26

Merged
jhamon merged 1 commit into
mainfrom
docs/sync-readme-to-sdk-v8
Jul 9, 2026
Merged

docs: sync README tutorial snippets to Pinecone SDK v8#26
jhamon merged 1 commit into
mainfrom
docs/sync-readme-to-sdk-v8

Conversation

@jhamon

@jhamon jhamon commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Why

The README is the tutorial for this example, but its code snippets had drifted from the working source and now taught patterns that do not run against the SDK v8 this repo ships. A customer copy-pasting from the README would hit errors. This PR is docs-only — it syncs the snippets to the actual code in server/.

What changed

  • indexImages — replaced the v2-era listIndexes().indexOf({ name }) check and the createIndex call with no serverless spec. Now matches server/indexImages.ts: indexes?.some(...) plus spec: { serverless: { region, cloud } }, with cloud/region read from the environment (defaulting to aws/us-east-1).
  • Dependency list — was pointing at @pinecone-database/pineconetran (a typo that 404s on npm) and @xenova/transformers. Corrected to @pinecone-database/pinecone and @huggingface/transformers (Transformers.js), matching package.json.
  • Embedder — snippet now shows the idempotent ready() / initPromise lazy loader and the DenseRecord return type, with a note on why ready() exists (load the ~600MB weights once across all entry points).
  • embedAndUpsert — now receives the index from its caller (shared by indexImages and upsertImages).
  • queryImages — shows the lazy getIndex() pattern and the path-confinement guard, with a short note on why the client-supplied path is validated.
  • Prose fixes — corrected the endpoint list (/uploadImages, added /getImages) and the incorrect claim that indexImages runs at server start (it fires on the UI "Index" button).

Testing

Docs-only; no code changed. Snippets were transcribed directly from the current server/ source.

🤖 Generated with Claude Code

The README's code snippets had drifted from the working source and taught
patterns that no longer run against the SDK v8 this repo ships:

- indexImages used the v2-era `listIndexes().indexOf({name})` check and a
  `createIndex` call with no `spec: { serverless }` — replaced with the real
  `indexes?.some(...)` check and serverless spec (cloud/region from env).
- Dependency list pointed at `@pinecone-database/pineconetran` (typo, 404)
  and `@xenova/transformers`; corrected to `@pinecone-database/pinecone` and
  `@huggingface/transformers` (Transformers.js).
- Embedder snippet now shows the idempotent `ready()`/`initPromise` lazy
  load and the `DenseRecord` return type.
- embedAndUpsert now receives the `index` from its caller.
- query snippet shows the lazy `getIndex()` and the path-confinement guard.
- Fixed endpoint list (`/uploadImages`, added `/getImages`) and the claim
  that indexImages runs at server start (it fires on the UI Index button).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jhamon jhamon merged commit 57b563e into main Jul 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant