Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Feb 2, 2026

Summary

Modernizes the 01-making-queries.ipynb notebook to use Pinecone SDK v8 and OpenAI SDK v1.x, replacing deprecated API patterns with current best practices.

Changes

  • Dependencies: Updated from openai==0.27.7 and pinecone-client==3.1.0 to openai==1.86.0 and pinecone~=8.0
  • OpenAI SDK:
    • Replaced module-level functions (openai.Embedding.create(), openai.Completion.create()) with client-based pattern
    • Initialized OpenAI client and use openai_client.embeddings.create() and openai_client.chat.completions.create()
    • Migrated from text-davinci-003 completion model to gpt-3.5-turbo chat model
    • Updated response access from dict notation to attribute notation (res.data[0].embedding, res.choices[0].message.content)
    • Removed deprecated openai.Engine.list() authentication check
  • Code Quality: Applied ruff-style formatting for consistency with other modernized notebooks

Testing

  • Validated notebook JSON structure
  • Manual code review to ensure all API patterns follow v8/v1.x conventions
  • Changes follow patterns established in recently modernized notebooks (audio-search, semantic-search)

Related Issues

Resolves SDK-217

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it changes the GitHub Actions notebook conversion/execution path and upgrades notebook code to newer OpenAI/Pinecone SDK APIs, which could break CI runs or the tutorial if assumptions differ.

Overview
Modernizes 01-making-queries.ipynb to current SDKs by upgrading dependencies (openai v1.x, pinecone v8) and switching from legacy openai.* dict-based APIs to the OpenAI client with chat completions (gpt-3.5-turbo) and attribute-style responses.

Improves the GitHub Actions notebook runner (convert-notebook.py) to more safely extract only !pip/%pip lines into run.sh and to avoid emitting empty code cells after stripping notebook magics, reducing accidental execution of non-install code during setup.

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

- Update dependencies: openai==1.86.0, pinecone~=8.0
- Replace openai.Embedding.create() with openai_client.embeddings.create()
- Replace openai.Completion.create() with openai_client.chat.completions.create()
- Update to gpt-3.5-turbo chat model from text-davinci-003
- Remove deprecated openai.Engine.list() authentication check
- Initialize OpenAI client using new v1.x pattern
- Update response access from dict to attribute notation
- Apply ruff-style code formatting

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@jhamon jhamon added the agent-pr label Feb 2, 2026
@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 7 commits February 3, 2026 04:27
- Move all imports to first code cell following notebook guidelines
- Sort imports properly (stdlib first, then third-party)
- Remove unnecessary f-string prefix

Co-authored-by: Cursor <cursoragent@cursor.com>
The check-pinning script doesn't handle backslash line continuations properly,
treating the backslash as a package name. Put the pip install on one line instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- Move imports to first code cell with pip install per structure guidelines
- Fix test runner to extract imports from pip install cells instead of skipping them
- This resolves the conflict between structure check and test runner requirements

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

],
"execution_count": null,
"outputs": []
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty code cell accidentally committed

Low Severity

An empty code cell with just "" in the source was introduced between the install/import cell and the note about pip install formatting. This appears to be an accidental leftover that serves no educational purpose and clutters the notebook flow.

Fix in Cursor Fix in Web


for cell in nb.cells:
if cell.cell_type == "code":
# ensures the cell is not a pip command, avoid hitting words that contain "pip"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused PIP_COMMANDS list is dead code

Low Severity

The PIP_COMMANDS list is defined with an explanatory comment "pip commands we want to ignore" but is never referenced anywhere in the code. The old logic that used this list (if not any(cmd in cell.source for cmd in PIP_COMMANDS)) was removed, but the list definition was left behind as dead code that could mislead future maintainers.

Fix in Cursor Fix in Web

line.replace("!pip", "pip").replace("%pip", "pip")
for line in cell.source.split("\n")
if line.strip().startswith("!pip") or line.strip().startswith("%pip")
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-line pip commands broken by line extraction

High Severity

The new pip extraction logic only includes lines that start with !pip or %pip, which breaks multi-line pip commands using backslash continuation. Several notebooks in the repository use patterns like !pip install -qU \ followed by indented package names on subsequent lines. The continuation lines don't start with !pip, so they're excluded, resulting in incomplete pip commands that fail to install required packages.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants