mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-26 21:23:32 +00:00
Memory: add multimodal image and audio indexing (#43460)
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
This commit is contained in:
committed by
GitHub
parent
20d097ac2f
commit
d79ca52960
34
src/memory/embedding-inputs.ts
Normal file
34
src/memory/embedding-inputs.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user