Document the exported message.Message.String and message.Message.Usage accessors - #719
Conversation
There was a problem hiding this comment.
Pull request overview
Adds GoDoc comments for the remaining exported Message accessors so the message package’s public API surface is fully documented in go doc/IDE hovers.
Changes:
- Documented
(*Message).String()as thefmt.Stringerimplementation (delegating toContents.Text). - Documented
(*Message).Usage()as the aggregated usage accessor (delegating toContents.Usage).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // String implements fmt.Stringer, returning the concatenated text of all | ||
| // TextContent in the message (delegating to Contents.Text). |
There was a problem hiding this comment.
Good catch — fixed in 732e4b7: rather than weaken the new String() doc, I corrected the stale Contents.Text godoc, which claimed "first text content" while the implementation actually concatenates all TextContent. Both public docs now consistently describe the concatenation semantics.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Add godoc to the exported String and Usage methods, matching their documented neighbors NewText and Clone. String satisfies fmt.Stringer; both delegate to the already-documented Contents.Text and Contents.Usage helpers, so the comments make the Message-level API self-describing in go doc.
732e4b7 to
6a0274b
Compare
|
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
What
Add godoc comments to the exported
Message.StringandMessage.Usageaccessors inmessage/message.go, which were the only undocumented exported methods onMessage(their neighborsNewTextandCloneare already documented).Why
Message.Stringimplementsfmt.Stringer, andMessage.Usageexposes aggregated token usage — both are part of the public surface that shows up ingo docand IDE hovers. Leaving them blank makes the type read as partially documented. Both simply delegate to the already-documentedContents.TextandContents.Usagehelpers, so the comments state that delegation explicitly.This mirrors the .NET / Python SDKs, where the equivalent message text (
ChatMessage.Text/.text) and usage accessors are documented API members; adding the comments keeps the Go port aligned with that cross-SDK expectation.Tests
Docs-only change. Verified with
go build ./...,go vet ./message/..., andgo test ./message/...(all green), and confirmed the new comments render viago doc ./message Message.Stringandgo doc ./message Message.Usage.