Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Jan 29, 2026

Summary

Updates learn/generation/openai/fine-tuning/gpt-3.5-agent-training/00-fine-tuning.ipynb and the chains.py helper to use Pinecone Python SDK v8 instead of pinecone-client.

What this accomplishes

  • Notebook and helper work with the current Pinecone SDK (serverless index creation, Pinecone(api_key), pc.Index(name=...)).
  • API key handling uses the standard pattern: PINECONE_API_KEY env or getpass fallback.
  • VectorDBChain uses region/cloud (serverless) instead of legacy environment.

Audience / use case

Developers following the GPT-3.5 fine-tuning + retrieval example who need to run it with the current Pinecone SDK.

Prerequisites

  • pinecone>=5.0.0 (replaces pinecone-client)
  • OpenAI and LangChain dependencies as in the notebook

Key changes

  • Notebook: pinecone-client==2.2.2pinecone>=5.0.0; VectorDBChain instantiation uses pinecone_api_key, region, cloud with getpass fallback for API key.
  • chains.py: Pinecone(api_key), ServerlessSpec, create_index(name=..., dimension=1536, metric=..., spec=spec), pc.Index(name=...); query response handling compatible with v8.

Linear


Note

Medium Risk
Medium risk because it changes the Pinecone integration and index creation semantics (serverless ServerlessSpec, metadata shape, and region/env handling), which could break the notebook if assumptions don’t match the user’s Pinecone setup.

Overview
Modernizes the gpt-3.5-agent-training fine-tuning notebook to run with current dependencies, including switching from pinecone-client to pinecone==8.0.0, adding a short intro/prerequisites section, and prompting for PINECONE_API_KEY (env or getpass) while defaulting the Pinecone region.

Updates chains.py to use the Pinecone SDK v8 API (Pinecone(api_key), serverless index creation via ServerlessSpec, explicit embedding dimension), and aligns stored/queryable metadata to use the text field so retrieval works with the updated query response shape.

Written by Cursor Bugbot for commit 5823593. This will update automatically on new commits. Configure here.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

jhamon and others added 11 commits January 29, 2026 09:59
…DK v8

- Replace pinecone-client with pinecone>=7.0.0 in notebook
- Update chains.py: Pinecone(api_key=...), ServerlessSpec, create_index with dimension/spec
- Add intro markdown, prerequisites, Colab/nbviewer badges
- Use getpass fallback for Pinecone API key per review template
- Align metadata key in build_index with query (text)
- Clear notebook outputs for valid nbformat

Linear: SDK-174
- Split first notebook cell: download chains.py then imports (fix E402)
- Sort imports in notebook and chains.py (fix I001)
- Use 'is not None' instead of '!= None' (fix E711)
- Move imports into first code cell per notebook guidelines
- Add noqa: E402 for imports after chains.py download (required order)
- chains.py: use environment param for ServerlessSpec region instead of hardcoding
- 00-fine-tuning.ipynb: run pip install before imports so Colab runs correctly
Merge pip install, chains.py download, and all imports into the first
code cell to satisfy check-structure (imports in first code cell).
Pin requests==2.32.3 for reproducibility.
Addresses Bugbot: pip install must run first so packages are available
before importing on a fresh Colab environment.

Co-authored-by: Cursor <[email protected]>
The run-notebook converter puts cells containing !pip entirely in run.sh
and excludes them from the Python script. The first cell mixed pip install
with imports and chains.py download, so the script never got the imports.
Split into two cells: pip only, then imports and chains download.

Co-authored-by: Cursor <[email protected]>
@jhamon jhamon force-pushed the jhamon/sdk-174-modernize-sdk-00-fine-tuningipynb branch from eb5ddfd to 5823593 Compare January 29, 2026 16:54
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.

2 participants