DOC-1892: Fix Semantic Kernel notebook for semantic-kernel 1.x - #50
Closed
snova-gilvanm wants to merge 1 commit into
Closed
DOC-1892: Fix Semantic Kernel notebook for semantic-kernel 1.x#50snova-gilvanm wants to merge 1 commit into
snova-gilvanm wants to merge 1 commit into
Conversation
The notebook was committed without ever having been run end to end: cells 2-4 carried execution counts while the imports cell and `await main()` had none. It fails on the first line of `main()`. Blocking fixes: - Drop the `service_id` argument from `ChatCompletionAgent`. It was removed in semantic-kernel 1.0, which raises TypeError. The agent takes a configured `kernel` instead. `OpenAIChatCompletion` still accepts it. - Set `metadata.kernelspec` to `python3` instead of `semantic_kernel_venv`, a machine-local kernel name that raises NoSuchKernel for everyone else. Correctness: - Restore the `"not approved"` guard in ApprovalTerminationStrategy. Without it, a reviewer reply of "this is not approved" terminated the chat as if it had passed. Guard against a None `content` while here. - Subclass TerminationStrategy rather than DefaultTerminationStrategy, to match the upstream sample. Dependencies: - Declare `python-dotenv`, which the notebook imports but nothing declared; it resolved only transitively via semantic-kernel -> pydantic-settings. - Bound `semantic-kernel>=1.44,<2`. On Python 3.9 pip silently backsolves to 0.9.6b1, which fails with an unrelated-looking ImportError from pydantic. Housekeeping: - Fix the malformed logo anchor (stray backslash, crossed <a>/<picture> nesting), the dead upstream link, and a typo. - Remove the unused `asyncio` import and `sys.path` append; clear stale execution counts. Verified with a fresh Python 3.11 venv built from requirements.txt: nbconvert --execute exits 0 with no error cells and both agents respond. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
snova-varunkrishna
approved these changes
Aug 25, 2026
Collaborator
Author
|
Closing this cross-repo PR. Reopening from a branch on the official repo now that I have admin access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Semantic Kernel example notebook does not run. It fails on the first line of
main()with:This is the
sambanova/integrationshalf of DOC-1892. The docs half is sambanova/docs#984.The notebook appears to have been committed without ever completing a run — cells 2-4 carried execution counts 3/4/5 while the imports cell and
await main()had none and no outputs.Blocking fixes
1.
service_idremoved fromChatCompletionAgentRemoved in semantic-kernel 1.0; the agent takes a configured
kernelinstead. Matches the current upstream sample,step06_chat_completion_agent_group_chat.py.OpenAIChatCompletionstill acceptsservice_id, so_create_kernel_with_chat_completionis unchanged.2.
metadata.kernelspecwassemantic_kernel_venvA machine-local kernel name. Anyone else opening the notebook gets:
Now
python3, which anyipykernelinstall provides.Correctness
"not approved"guard inApprovalTerminationStrategy. The check was"approved" in history[-1].content.lower(), so a reviewer replying "this is not approved" terminated the chat as if it had passed. Also guards aNonecontent.TerminationStrategyrather thanDefaultTerminationStrategy, matching upstream.Dependencies
python-dotenv. The notebook doesfrom dotenv import load_dotenv, but nothing declared it — it resolved only transitively viasemantic-kernel→pydantic-settings.semantic-kernel>=1.44,<2. On Python 3.9, pip does not error; it backsolves to0.9.6b1(2024) which fails withImportError: cannot import name 'Url' from 'pydantic.networks'— a traceback that names pydantic and never mentions the Python version. The floor turns that silent downgrade into a resolver error.Housekeeping
<a href="..."\>and crossed<a>/<picture>nesting.step3_chat.py→ 404) and alevaragingtypo.asyncioimport andsys.path.append('../../'); cleared stale execution counts and outputs.Verification
Fresh Python 3.11 venv built only from the updated
requirements.txt, thennbconvert --executewith no override flags:Notes for reviewers
AgentGroupChatis deprecated upstream in favour ofGroupChatOrchestration. Migrating the sample is a larger change and out of scope here.agentops_venv,autogen_venv,instructor_venv,venv,haystack_test,langgraph_env,base_env,petro_test_2). Worth a sweep in a separate ticket.🤖 Generated with Claude Code