Skip to content

Fix documentation anomalies: incorrect API signatures, missing SDK links, wrong streaming patterns#598

Merged
baijumeswani merged 2 commits intomainfrom
copilot/study-language-bindings-functionality
Apr 6, 2026
Merged

Fix documentation anomalies: incorrect API signatures, missing SDK links, wrong streaming patterns#598
baijumeswani merged 2 commits intomainfrom
copilot/study-language-bindings-functionality

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 6, 2026

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

…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>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
foundry-local Ready Ready Preview, Comment Apr 6, 2026 4:31pm

Request Review

Copilot AI requested a review from baijumeswani April 6, 2026 07:27
@baijumeswani baijumeswani marked this pull request as ready for review April 6, 2026 16:29
Copilot AI review requested due to automatic review settings April 6, 2026 16:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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, internal SelectedVariant; Rust IModel trait) 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.

@baijumeswani baijumeswani enabled auto-merge (squash) April 6, 2026 17:18
@baijumeswani baijumeswani merged commit 7ad2ef0 into main Apr 6, 2026
42 checks passed
@baijumeswani baijumeswani deleted the copilot/study-language-bindings-functionality branch April 6, 2026 17:42
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants