org.bsc.langgraph4j.langchain4j.serializer.std.ToolExecutionResultMessageSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of langgraph4j-langchain4j Show documentation
Show all versions of langgraph4j-langchain4j Show documentation
Integration stuff for langchain4j
package org.bsc.langgraph4j.langchain4j.serializer.std;
import dev.langchain4j.data.message.ToolExecutionResultMessage;
import org.bsc.langgraph4j.serializer.Serializer;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
public class ToolExecutionResultMessageSerializer implements Serializer {
@Override
public void write(ToolExecutionResultMessage object, ObjectOutput out) throws IOException {
out.writeUTF( object.id() );
out.writeUTF( object.toolName() );
out.writeUTF( object.text() );
}
@Override
public ToolExecutionResultMessage read(ObjectInput in) throws IOException, ClassNotFoundException {
String id = in.readUTF();
String toolName = in.readUTF();
String text = in.readUTF();
return new ToolExecutionResultMessage( id, toolName, text );
}
}