Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;

/**
* OpenAI Reasoning Detail DTO (OpenRouter specific for Gemini).
Expand Down Expand Up @@ -90,4 +91,26 @@ public Integer getIndex() {
public void setIndex(Integer index) {
this.index = index;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof OpenAIReasoningDetail)) {
return false;
}
OpenAIReasoningDetail that = (OpenAIReasoningDetail) o;
return Objects.equals(this.id, that.id)
&& Objects.equals(this.type, that.type)
&& Objects.equals(this.data, that.data)
&& Objects.equals(this.text, that.text)
&& Objects.equals(this.format, that.format)
&& Objects.equals(this.index, that.index);
}

@Override
public int hashCode() {
return Objects.hash(this.id, this.type, this.data, this.text, this.format, this.index);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ public Source getSource() {
return source;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AudioBlock)) {
return false;
}
AudioBlock that = (AudioBlock) o;
return Objects.equals(this.source, that.source);
}

@Override
public int hashCode() {
return Objects.hash(this.source);
}

/**
* Creates a new builder for constructing AudioBlock instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ public String getData() {
return data;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Base64Source)) {
return false;
}
Base64Source that = (Base64Source) o;
return Objects.equals(this.mediaType, that.mediaType)
&& Objects.equals(this.data, that.data);
}

@Override
public int hashCode() {
return Objects.hash(this.mediaType, this.data);
}

/**
* Creates a new builder for constructing Base64Source instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ public Integer getMaxPixels() {
return maxPixels;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ImageBlock)) {
return false;
}
ImageBlock that = (ImageBlock) o;
return Objects.equals(this.source, that.source)
&& Objects.equals(this.minPixels, that.minPixels)
&& Objects.equals(this.maxPixels, that.maxPixels);
}

@Override
public int hashCode() {
return Objects.hash(this.source, this.minPixels, this.maxPixels);
}

/**
* Creates a new builder for constructing ImageBlock instances.
*
Expand Down
23 changes: 23 additions & 0 deletions agentscope-core/src/main/java/io/agentscope/core/message/Msg.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ private Msg(
this.timestamp = timestamp;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
} else if (!(o instanceof Msg)) {
return false;
} else {
Msg that = (Msg) o;
return Objects.equals(this.id, that.id)
&& Objects.equals(this.name, that.name)
&& this.role == that.role
&& Objects.equals(this.content, that.content)
&& Objects.equals(this.metadata, that.metadata)
&& Objects.equals(this.timestamp, that.timestamp);
}
}

@Override
public int hashCode() {
return Objects.hash(
this.id, this.name, this.role, this.content, this.metadata, this.timestamp);
}

/**
* Creates a new message builder with a randomly generated ID.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;

/**
* Represents plain text content in a message.
Expand Down Expand Up @@ -56,6 +57,23 @@ public String toString() {
return text;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
} else if (!(o instanceof TextBlock)) {
return false;
} else {
TextBlock that = (TextBlock) o;
return Objects.equals(this.text, that.text);
}
}

@Override
public int hashCode() {
return Objects.hash(this.text);
}

/**
* Creates a new builder for constructing TextBlock instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* Represents reasoning or thinking content in a message.
Expand Down Expand Up @@ -81,6 +82,24 @@ public Map<String, Object> getMetadata() {
return metadata;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ThinkingBlock)) {
return false;
}
ThinkingBlock that = (ThinkingBlock) o;
return Objects.equals(this.thinking, that.thinking)
&& Objects.equals(this.metadata, that.metadata);
}

@Override
public int hashCode() {
return Objects.hash(this.thinking, this.metadata);
}

/**
* Creates a new builder for constructing ThinkingBlock instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.beans.Transient;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
* Represents the result of a tool execution.
Expand Down Expand Up @@ -289,6 +290,26 @@ public ToolResultBlock withIdAndName(String id, String name) {
return new ToolResultBlock(id, name, this.output, this.metadata);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ToolResultBlock)) {
return false;
}
ToolResultBlock that = (ToolResultBlock) o;
return Objects.equals(this.id, that.id)
&& Objects.equals(this.name, that.name)
&& Objects.equals(this.output, that.output)
&& Objects.equals(this.metadata, that.metadata);
}

@Override
public int hashCode() {
return Objects.hash(this.id, this.name, this.output, this.metadata);
}

/**
* Creates a new builder for constructing ToolResultBlock instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* Represents a tool use request within a message.
Expand Down Expand Up @@ -144,6 +145,27 @@ public Map<String, Object> getMetadata() {
return metadata;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ToolUseBlock)) {
return false;
}
ToolUseBlock that = (ToolUseBlock) o;
return Objects.equals(this.id, that.id)
&& Objects.equals(this.name, that.name)
&& Objects.equals(this.input, that.input)
&& Objects.equals(this.content, that.content)
&& Objects.equals(this.metadata, that.metadata);
}

@Override
public int hashCode() {
return Objects.hash(this.id, this.name, this.input, this.content, this.metadata);
}

/**
* Creates a new builder for constructing a ToolUseBlock.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ public String getUrl() {
return url;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof URLSource)) {
return false;
}
URLSource that = (URLSource) o;
return Objects.equals(this.url, that.url);
}

@Override
public int hashCode() {
return Objects.hash(this.url);
}

/**
* Creates a new builder for constructing URLSource instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;

/**
* Represents video content in a message.
Expand Down Expand Up @@ -135,6 +136,34 @@ public Integer getTotalPixels() {
return totalPixels;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof VideoBlock)) {
return false;
}
VideoBlock that = (VideoBlock) o;
return Objects.equals(this.source, that.source)
&& Objects.equals(this.fps, that.fps)
&& Objects.equals(this.maxFrames, that.maxFrames)
&& Objects.equals(this.minPixels, that.minPixels)
&& Objects.equals(this.maxPixels, that.maxPixels)
&& Objects.equals(this.totalPixels, that.totalPixels);
}

@Override
public int hashCode() {
return Objects.hash(
this.source,
this.fps,
this.maxFrames,
this.minPixels,
this.maxPixels,
this.totalPixels);
}

/**
* Creates a new builder for constructing VideoBlock instances.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.agentscope.core.model;

import java.util.Objects;

/**
* Represents token usage information for chat completion responses.
*
Expand Down Expand Up @@ -76,6 +78,25 @@ public double getTime() {
return time;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ChatUsage)) {
return false;
}
ChatUsage that = (ChatUsage) o;
return this.inputTokens == that.inputTokens
&& this.outputTokens == that.outputTokens
&& Double.compare(this.time, that.time) == 0;
}

@Override
public int hashCode() {
return Objects.hash(this.inputTokens, this.outputTokens, this.time);
}

/**
* Creates a new builder for ChatUsage.
*
Expand Down
Loading
Loading