Fix Python session.send docs examples#1312
Merged
Merged
Conversation
Update Python documentation examples to pass the prompt string positionally and use keyword arguments for mode, matching the current Python SDK API. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR corrects Python documentation examples to match the Python SDK’s CopilotSession.send(prompt: str, *, mode=...) API shape, avoiding cases where users copy examples that accidentally send a JSON object as the prompt and trigger CLI session.error failures (per #1127).
Changes:
- Update Python BYOK example to call
await session.send("...")instead of passing{ "prompt": ... }. - Update Python steering/queueing examples to use positional prompt strings and
mode="immediate"/mode="enqueue"keyword arguments. - Leave Node.js/TypeScript examples unchanged (object form is correct for that SDK).
Show a summary per file
| File | Description |
|---|---|
| docs/features/steering-and-queueing.md | Fix Python steering/queueing snippets to use session.send("...") with mode= keyword arg. |
| docs/auth/byok.md | Fix Python BYOK snippet to pass the prompt as a positional string to session.send(). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
Several Python docs examples showed the Node/TypeScript
session.send({ prompt: ... })shape even though the Python SDK expects the prompt as a positional string. Following those examples could send a JSON object as the prompt and surface a CLIsession.error.This updates the Python BYOK and steering/queueing examples to use
session.send("...")withmode=passed as a keyword argument where needed. TypeScript examples are left unchanged because the object form is correct for that SDK.Fixes #1127