Conversation
Signed-off-by: liuhy <liuhongyu@apache.org>
…icChatFormatter Signed-off-by: liuhy <liuhongyu@apache.org>
There was a problem hiding this comment.
Pull request overview
This PR replaces the Anthropic Java SDK with a custom HTTP client implementation using OkHttp. The change eliminates the external dependency on com.anthropic:anthropic-java and replaces it with internal DTO classes and a custom AnthropicClient.
Changes:
- Replaced Anthropic SDK with custom HTTP client (
AnthropicClient.java) - Introduced new DTO classes (
AnthropicRequest,AnthropicResponse,AnthropicMessage,AnthropicContent, etc.) - Updated all formatters and converters to work with DTOs instead of SDK types
- Updated comprehensive test suite to use new DTO-based approach
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
AnthropicClient.java |
New HTTP client for Anthropic API with sync and streaming support |
AnthropicChatModel.java |
Updated to use new client instead of SDK |
AnthropicRequest.java |
DTO for API requests |
AnthropicResponse.java |
DTO for API responses |
AnthropicMessage.java |
DTO for message structure |
AnthropicContent.java |
DTO for content blocks with helper methods |
AnthropicTool.java |
DTO for tool definitions |
AnthropicUsage.java |
DTO for usage statistics |
AnthropicStreamEvent.java |
DTO for streaming events |
AnthropicToolsHelper.java |
Updated to work with DTOs |
AnthropicResponseParser.java |
Updated to parse DTOs |
AnthropicMessageConverter.java |
Updated to convert to DTOs |
AnthropicMediaConverter.java |
Updated to return DTO ImageSource |
AnthropicChatFormatter.java |
Enhanced with multi-agent detection |
AnthropicMultiAgentFormatter.java |
Updated for DTOs with constructor improvements |
AnthropicBaseFormatter.java |
Updated to work with DTOs |
pom.xml |
Removed Anthropic SDK dependency |
| Test files | Updated to use DTOs and mocks instead of SDK classes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return metadata; | ||
| } | ||
|
|
||
| public void setMetadata(Map<String, Object> metadata) { |
There was a problem hiding this comment.
setMetadata exposes the internal representation stored in field metadata. The value may be modified through the variable metadata.
| this.stopSequences = stopSequences; | ||
| } | ||
|
|
||
| public Map<String, Object> getMetadata() { |
There was a problem hiding this comment.
getMetadata exposes the internal representation stored in field metadata. The value may be modified after this call to getMetadata.
agentscope-core/src/main/java/io/agentscope/core/formatter/anthropic/AnthropicToolsHelper.java
Outdated
Show resolved
Hide resolved
…ge formatting Signed-off-by: liuhy <liuhongyu@apache.org>
…hropic/AnthropicToolsHelper.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cRequest Signed-off-by: liuhy <liuhongyu@apache.org>
…AnthropicRequest" This reverts commit 4aa7870.
…scope-java into feat/replace_claude
…ti-agent conversation handling Signed-off-by: liuhy <liuhongyu@apache.org>
… tests Signed-off-by: liuhy <liuhongyu@apache.org>
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.6, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]Description
replace claude sdk
fix #97
[Please describe the background, purpose, changes made, and how to test this PR]
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)