mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 02:40:43 +00:00
32 lines
804 B
TypeScript
32 lines
804 B
TypeScript
export type LlamaEmbedding = {
|
|
vector: Float32Array | number[];
|
|
};
|
|
|
|
export type LlamaEmbeddingContext = {
|
|
getEmbeddingFor: (text: string) => Promise<LlamaEmbedding>;
|
|
};
|
|
|
|
export type LlamaModel = {
|
|
createEmbeddingContext: (options?: {
|
|
contextSize?: number | "auto";
|
|
}) => Promise<LlamaEmbeddingContext>;
|
|
};
|
|
|
|
export type Llama = {
|
|
loadModel: (params: { modelPath: string }) => Promise<LlamaModel>;
|
|
};
|
|
|
|
export type NodeLlamaCppModule = {
|
|
LlamaLogLevel: {
|
|
error: number;
|
|
};
|
|
getLlama: (params: { logLevel: number }) => Promise<Llama>;
|
|
resolveModelFile: (modelPath: string, cacheDir?: string) => Promise<string>;
|
|
};
|
|
|
|
const NODE_LLAMA_CPP_MODULE = "node-llama-cpp";
|
|
|
|
export async function importNodeLlamaCpp() {
|
|
return import(NODE_LLAMA_CPP_MODULE) as Promise<NodeLlamaCppModule>;
|
|
}
|