-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(learn): modernize 01-making-queries.ipynb to SDK v8 #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- 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>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
- 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>
There was a problem hiding this 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": [] | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| for cell in nb.cells: | ||
| if cell.cell_type == "code": | ||
| # ensures the cell is not a pip command, avoid hitting words that contain "pip" |
There was a problem hiding this comment.
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.
| line.replace("!pip", "pip").replace("%pip", "pip") | ||
| for line in cell.source.split("\n") | ||
| if line.strip().startswith("!pip") or line.strip().startswith("%pip") | ||
| ] |
There was a problem hiding this comment.
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.


Summary
Modernizes the
01-making-queries.ipynbnotebook to use Pinecone SDK v8 and OpenAI SDK v1.x, replacing deprecated API patterns with current best practices.Changes
openai==0.27.7andpinecone-client==3.1.0toopenai==1.86.0andpinecone~=8.0openai.Embedding.create(),openai.Completion.create()) with client-based patternOpenAIclient and useopenai_client.embeddings.create()andopenai_client.chat.completions.create()text-davinci-003completion model togpt-3.5-turbochat modelres.data[0].embedding,res.choices[0].message.content)openai.Engine.list()authentication checkTesting
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.ipynbto current SDKs by upgrading dependencies (openaiv1.x,pineconev8) and switching from legacyopenai.*dict-based APIs to theOpenAIclient 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/%piplines intorun.shand 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.