mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-17 21:10:54 +00:00
Merged via squash.
Prepared head SHA: a994c07190
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
35 lines
825 B
TypeScript
35 lines
825 B
TypeScript
export type EmbeddingInputTextPart = {
|
|
type: "text";
|
|
text: string;
|
|
};
|
|
|
|
export type EmbeddingInputInlineDataPart = {
|
|
type: "inline-data";
|
|
mimeType: string;
|
|
data: string;
|
|
};
|
|
|
|
export type EmbeddingInputPart = EmbeddingInputTextPart | EmbeddingInputInlineDataPart;
|
|
|
|
export type EmbeddingInput = {
|
|
text: string;
|
|
parts?: EmbeddingInputPart[];
|
|
};
|
|
|
|
export function buildTextEmbeddingInput(text: string): EmbeddingInput {
|
|
return { text };
|
|
}
|
|
|
|
export function isInlineDataEmbeddingInputPart(
|
|
part: EmbeddingInputPart,
|
|
): part is EmbeddingInputInlineDataPart {
|
|
return part.type === "inline-data";
|
|
}
|
|
|
|
export function hasNonTextEmbeddingParts(input: EmbeddingInput | undefined): boolean {
|
|
if (!input?.parts?.length) {
|
|
return false;
|
|
}
|
|
return input.parts.some((part) => isInlineDataEmbeddingInputPart(part));
|
|
}
|