@a2alite/sdk
Version:
A Modular SDK (Server & Client) for Agent to Agent (A2A) protocol, with easy task lifecycle management
38 lines (37 loc) • 831 B
JavaScript
/**
* Creates a text part with the given content and metadata
*/
function createTextPart(text, metadata) {
return {
kind: "text",
text,
...(metadata && { metadata }),
};
}
/**
* Creates a file part with the given file data and metadata
*/
function createFilePart(file, metadata) {
return {
kind: "file",
file,
...(metadata && { metadata }),
};
}
function isFileWithBytes(file) {
return "bytes" in file;
}
function isFileWithUri(file) {
return "uri" in file;
}
/**
* Creates a data part with the given data and metadata
*/
function createDataPart(data, metadata) {
return {
kind: "data",
data,
...(metadata && { metadata }),
};
}
export { createTextPart, createFilePart, isFileWithBytes, isFileWithUri, createDataPart, };