-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples in README are obsolete #118
Conversation
WalkthroughThis pull request refactors the message creation and sending process in the Changes
Sequence Diagram(s)sequenceDiagram
participant U as User/Application
participant C as AnthropicClient
participant M as Messages API
U->>C: Create CreateMessageParams with InputMessage objects
C->>M: Call MessagesPostAsync(messageParams)
M-->>C: Return message response
C-->>U: Return response
Possibly related PRs
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
README.md (2)
23-33
: Updated Message Construction and Sending
The updated snippet correctly demonstrates the use of the newCreateMessageParams
object and theMessages.MessagesPostAsync
API call, including the updated property naming (MaxTokens
). One minor point: the initializer for theMessages
collection uses square brackets ([ ... ]
), but standard C# collection initialization typically uses curly braces or explicit new array/list syntax. Please verify this syntax or consider updating it for clarity and correctness in a real code sample.
102-125
: Enhanced Tool Integration Workflow
This code segment cleanly demonstrates how tool integrations are now managed by:
- Building a
CreateMessageParams
object with the additional properties (System
,ToolChoice
, andTools
)- Sending the message and then dynamically adding the response (via
response.AsInputMessage()
)- Iterating over any tool uses to call the corresponding service function and appending the tool call result back into the message sequence.
For improved clarity, please consider adding inline comments that explain the purpose of each step (especially the re-invocation of
MessagesPostAsync
after processing tool responses). Also, confirm that the use of non-null assertions (Value2!
andtoolUse!
) is safe in this context or add proper null checks if necessary.
Thank you for your PR Yes, there is a problem here - I did not update because the generated code now contains |
Hi,
I tried to use this library this morning, and I struggled on the documentation.
It seems that the structure has changed since
CreateMessageAsync
method no longer exists.The only thing I didn't try is
AsTools()
since I'm not using it.Hope it helps
Summary by CodeRabbit