mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-01 12:16:46 +00:00
Merged via squash.
Prepared head SHA: dc9a5d5397
Co-authored-by: dutifulbob <261991368+dutifulbob@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
|
import type { SecretInput } from "../config/types.secrets.js";
|
|
|
|
export type EmbeddingInput =
|
|
| string
|
|
| {
|
|
text: string;
|
|
parts?: Array<
|
|
{ type: "text"; text: string } | { type: "inline-data"; mimeType: string; data: string }
|
|
>;
|
|
};
|
|
|
|
export type EmbeddingProviderCallOptions = {
|
|
signal?: AbortSignal;
|
|
inputType?: "query" | "document" | "semantic" | "classification" | "clustering";
|
|
};
|
|
|
|
export type EmbeddingProviderRuntime = {
|
|
id: string;
|
|
cacheKeyData?: Record<string, unknown>;
|
|
inlineQueryTimeoutMs?: number;
|
|
inlineBatchTimeoutMs?: number;
|
|
};
|
|
|
|
export type EmbeddingProvider = {
|
|
id: string;
|
|
model: string;
|
|
dimensions?: number;
|
|
maxInputTokens?: number;
|
|
embed: (input: EmbeddingInput, options?: EmbeddingProviderCallOptions) => Promise<number[]>;
|
|
embedBatch: (
|
|
inputs: EmbeddingInput[],
|
|
options?: EmbeddingProviderCallOptions,
|
|
) => Promise<number[][]>;
|
|
close?: () => Promise<void> | void;
|
|
};
|
|
|
|
export type EmbeddingProviderCreateOptions = {
|
|
config: OpenClawConfig;
|
|
agentDir?: string;
|
|
provider?: string;
|
|
remote?: {
|
|
baseUrl?: string;
|
|
apiKey?: SecretInput;
|
|
headers?: Record<string, string>;
|
|
};
|
|
model: string;
|
|
inputType?: string;
|
|
queryInputType?: string;
|
|
documentInputType?: string;
|
|
local?: {
|
|
modelPath?: string;
|
|
modelCacheDir?: string;
|
|
};
|
|
dimensions?: number;
|
|
taskType?: string;
|
|
};
|
|
|
|
export type EmbeddingProviderCreateResult = {
|
|
provider: EmbeddingProvider | null;
|
|
runtime?: EmbeddingProviderRuntime;
|
|
};
|
|
|
|
export type EmbeddingProviderAdapter = {
|
|
id: string;
|
|
defaultModel?: string;
|
|
transport?: "local" | "remote";
|
|
authProviderId?: string;
|
|
create: (options: EmbeddingProviderCreateOptions) => Promise<EmbeddingProviderCreateResult>;
|
|
formatSetupError?: (err: unknown) => string;
|
|
};
|
|
|
|
export type RegisteredEmbeddingProvider = {
|
|
adapter: EmbeddingProviderAdapter;
|
|
ownerPluginId?: string;
|
|
};
|