-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
[ML] Make Streaming Results Writeable #122527
[ML] Make Streaming Results Writeable #122527
Conversation
Make streaming elements extend Writeable and create StreamInput constructors so we can publish elements across nodes using the transport layer. Additional notes: - Moved optional methods into the InferenceServiceResults interface and default them - StreamingUnifiedChatCompletionResults elements are now all records
Pinging @elastic/ml-core (Team:ML) |
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.
Should we backport this to 8.19?
@@ -27,18 +31,39 @@ public interface InferenceServiceResults extends NamedWriteable, ChunkedToXConte | |||
* | |||
* <p>For other results like SparseEmbeddingResults, this method can be a pass through to the transformToLegacyFormat.</p> | |||
*/ | |||
List<? extends InferenceResults> transformToCoordinationFormat(); | |||
default List<? extends InferenceResults> transformToCoordinationFormat() { |
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.
❤️
public boolean equals(Object o) { | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Results other = (Results) o; | ||
return dequeEquals(this.results, other.results()); |
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.
Ah was this why you were saying deque was a bad idea haha?
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.
Yeah, it took me a few minutes to realize most of the Deque implementations do not have an equals method =(
} | ||
|
||
public String getModel() { | ||
return model; | ||
private static boolean dequeEquals(Deque<?> thisDeque, Deque<?> otherDeque) { |
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.
Looks like we use this in a couple places, do you think it'd be worth moving it to a utility function?
} | ||
|
||
public Usage getUsage() { | ||
return usage; | ||
private static int dequeHashCode(Deque<?> deque) { |
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.
Same here maybe move to a utility function.
Make streaming elements extend Writeable and create StreamInput constructors so we can publish elements across nodes using the transport layer. Additional notes: - Moved optional methods into the InferenceServiceResults interface and default them - StreamingUnifiedChatCompletionResults elements are now all records
* [ML] Make Streaming Results Writeable (#122527) Make streaming elements extend Writeable and create StreamInput constructors so we can publish elements across nodes using the transport layer. Additional notes: - Moved optional methods into the InferenceServiceResults interface and default them - StreamingUnifiedChatCompletionResults elements are now all records * [CI] Auto commit changes from spotless --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Make streaming elements extend Writeable and create StreamInput constructors so we can publish elements across nodes using the transport layer.
Additional notes: