Fix documentation anomalies: incorrect API signatures, missing SDK links, wrong streaming patterns#598
Merged
baijumeswani merged 2 commits intomainfrom Apr 6, 2026
Conversation
…nks, wrong streaming patterns - Root README.md: Fix C# `await model.Unload()` → `await model.UnloadAsync()`, add required CancellationToken parameter to streaming example - C# SDK README: Replace non-existent `ChatMessage.FromUser()`/`FromSystem()` with constructor syntax, fix streaming `Delta` → `Message` (Betalgo uses ChatCompletionCreateResponse for both), fix `SelectedVariant` (internal) → `Info` - JS SDK README: Fix streaming `chunk.choices?.[0]?.message?.content` → `chunk.choices?.[0]?.delta?.content` (2 occurrences) - Python SDK README: Fix streaming callback pattern → generator pattern to match actual `complete_streaming_chat()` signature - Rust SDK README: Fix `IModel trait` → concrete `Model` type (no trait exists), add missing `Internal` error variant, fix license claim (MIT → MS license) - docs/README.md: Add missing Python and Rust SDK reference links Agent-Logs-Url: https://github.com/microsoft/Foundry-Local/sessions/2d97ddf3-ea01-4052-9158-a76f862f8096 Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Copilot created this pull request from a session on behalf of
baijumeswani
April 6, 2026 07:27
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR corrects SDK documentation examples and reference text to match the actual implemented APIs across C#, JavaScript, Python, and Rust, plus adds missing SDK links in the docs index.
Changes:
- Fix incorrect/obsolete API signatures and usage patterns (C# unload + streaming signature; Python generator-based streaming; JS streaming chunk access).
- Remove references to non-existent types/properties (C#
ChatMessage.From*,Delta, internalSelectedVariant; RustIModeltrait) and add the missing Rust error variant. - Correct licensing text in Rust README and add Python/Rust SDK links to
docs/README.md.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Updates C# quickstart snippet to use UnloadAsync() and the correct streaming signature including CancellationToken. |
sdk/cs/README.md |
Fixes C# examples to use valid ChatMessage construction, correct streaming chunk access (Message.Content), and avoids internal properties. |
sdk/js/README.md |
Fixes JS streaming examples to read delta.content from streaming chunks. |
sdk/python/README.md |
Updates Python streaming docs to the supported generator iteration pattern. |
sdk/rust/README.md |
Removes incorrect IModel trait mention, adds missing Internal { reason } error variant, and corrects license text. |
docs/README.md |
Adds missing Python and Rust SDK reference links. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
prathikr
approved these changes
Apr 6, 2026
baijumeswani
added a commit
that referenced
this pull request
Apr 8, 2026
…nks, wrong streaming patterns (#598) ## Summary Systematic audit of all SDK documentation against actual source code revealed **10 documentation anomalies** across 6 files. All fixes are documentation-only — no source code changes. ## Changes by File ### Root `README.md` | Fix | Before | After | |-----|--------|-------| | C# unload method name | `await model.Unload()` | `await model.UnloadAsync()` | | C# streaming missing parameter | `CompleteChatStreamingAsync(messages)` | `CompleteChatStreamingAsync(messages, CancellationToken.None)` | ### `sdk/cs/README.md` | Fix | Before | After | |-----|--------|-------| | Non-existent factory methods (3 occurrences) | `ChatMessage.FromUser("...")` / `ChatMessage.FromSystem("...")` | `new ChatMessage { Role = "user", Content = "..." }` | | Streaming property doesn't exist | `chunk.Choices?[0]?.Delta?.Content` | `chunk.Choices?[0]?.Message?.Content` | | Internal property used in public example | `m.SelectedVariant.Info.DisplayName` | `m.Info.DisplayName` | ### `sdk/js/README.md` | Fix | Before | After | |-----|--------|-------| | Streaming chunk access (2 occurrences) | `chunk.choices?.[0]?.message?.content` | `chunk.choices?.[0]?.delta?.content` | ### `sdk/python/README.md` | Fix | Before | After | |-----|--------|-------| | Streaming pattern | Callback: `client.complete_streaming_chat(messages, on_chunk)` | Generator: `for chunk in client.complete_streaming_chat(messages):` | ### `sdk/rust/README.md` | Fix | Before | After | |-----|--------|-------| | Non-existent trait | "All models implement the `IModel` trait" | "All models are represented by the `Model` type" | | Missing error variant | 8 variants listed | 9 variants (added `Internal { reason }`) | | Wrong license | "MIT" | "Microsoft Software License Terms" | ### `docs/README.md` | Fix | Before | After | |-----|--------|-------| | Missing SDK references | Only C# and JS listed | Added Python and Rust SDK links | ## Verification Method Each fix was verified by reading the actual source code: - C# `ChatMessage` constructor syntax confirmed in `ChatCompletionsTests.cs` - C# streaming `Message.Content` (not `Delta`) confirmed in `ChatClient.cs` — both streaming and non-streaming return `ChatCompletionCreateResponse` - JS streaming `delta.content` confirmed in `chatClient.ts` JSDoc - Python generator return confirmed in `chat_client.py:263-290` - Rust `Model` struct confirmed in `lib.rs:16`; no trait exists - Rust error variants confirmed in `error.rs:4-33` - LICENSE file confirmed as Microsoft Software License Terms Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com> Co-authored-by: Baiju Meswani <baijumeswani@gmail.com>
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
Systematic audit of all SDK documentation against actual source code revealed 10 documentation anomalies across 6 files. All fixes are documentation-only — no source code changes.
Changes by File
Root
README.mdawait model.Unload()await model.UnloadAsync()CompleteChatStreamingAsync(messages)CompleteChatStreamingAsync(messages, CancellationToken.None)sdk/cs/README.mdChatMessage.FromUser("...")/ChatMessage.FromSystem("...")new ChatMessage { Role = "user", Content = "..." }chunk.Choices?[0]?.Delta?.Contentchunk.Choices?[0]?.Message?.Contentm.SelectedVariant.Info.DisplayNamem.Info.DisplayNamesdk/js/README.mdchunk.choices?.[0]?.message?.contentchunk.choices?.[0]?.delta?.contentsdk/python/README.mdclient.complete_streaming_chat(messages, on_chunk)for chunk in client.complete_streaming_chat(messages):sdk/rust/README.mdIModeltrait"Modeltype"Internal { reason })docs/README.mdVerification Method
Each fix was verified by reading the actual source code:
ChatMessageconstructor syntax confirmed inChatCompletionsTests.csMessage.Content(notDelta) confirmed inChatClient.cs— both streaming and non-streaming returnChatCompletionCreateResponsedelta.contentconfirmed inchatClient.tsJSDocchat_client.py:263-290Modelstruct confirmed inlib.rs:16; no trait existserror.rs:4-33