@elizaos/plugin-ollama 1.2.4 → 2.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.browser.js +429 -0
- package/dist/browser/index.browser.js.map +15 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.node.cjs +98 -0
- package/dist/cjs/index.node.cjs.map +10 -0
- package/dist/node/build.d.ts +2 -0
- package/dist/node/build.d.ts.map +1 -0
- package/dist/node/generated/specs/specs.d.ts +55 -0
- package/dist/node/generated/specs/specs.d.ts.map +1 -0
- package/dist/node/index.browser.d.ts +3 -0
- package/dist/node/index.browser.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.node.js +56 -0
- package/dist/node/index.node.js.map +10 -0
- package/dist/node/models/availability.d.ts +2 -0
- package/dist/node/models/availability.d.ts.map +1 -0
- package/dist/node/models/embedding.d.ts +3 -0
- package/dist/node/models/embedding.d.ts.map +1 -0
- package/dist/node/models/index.d.ts +5 -0
- package/dist/node/models/index.d.ts.map +1 -0
- package/dist/node/models/object.d.ts +4 -0
- package/dist/node/models/object.d.ts.map +1 -0
- package/dist/node/models/text.d.ts +4 -0
- package/dist/node/models/text.d.ts.map +1 -0
- package/dist/node/plugin.d.ts +3 -0
- package/dist/node/plugin.d.ts.map +1 -0
- package/dist/node/types/index.d.ts +47 -0
- package/dist/node/types/index.d.ts.map +1 -0
- package/dist/node/utils/config.d.ts +15 -0
- package/dist/node/utils/config.d.ts.map +1 -0
- package/dist/node/utils/index.d.ts +2 -0
- package/dist/node/utils/index.d.ts.map +1 -0
- package/package.json +49 -22
- package/LICENSE +0 -21
- package/README.md +0 -160
- package/dist/index.js +0 -356
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated canonical action/provider/evaluator docs for plugin-ollama.
|
|
3
|
+
* DO NOT EDIT - Generated from prompts/specs/**.
|
|
4
|
+
*/
|
|
5
|
+
export type ActionDoc = {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
similes?: readonly string[];
|
|
9
|
+
parameters?: readonly unknown[];
|
|
10
|
+
examples?: readonly (readonly unknown[])[];
|
|
11
|
+
};
|
|
12
|
+
export type ProviderDoc = {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
position?: number;
|
|
16
|
+
dynamic?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type EvaluatorDoc = {
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
similes?: readonly string[];
|
|
22
|
+
alwaysRun?: boolean;
|
|
23
|
+
examples?: readonly unknown[];
|
|
24
|
+
};
|
|
25
|
+
export declare const coreActionsSpec: {
|
|
26
|
+
readonly version: "1.0.0";
|
|
27
|
+
readonly actions: readonly [];
|
|
28
|
+
};
|
|
29
|
+
export declare const allActionsSpec: {
|
|
30
|
+
readonly version: "1.0.0";
|
|
31
|
+
readonly actions: readonly [];
|
|
32
|
+
};
|
|
33
|
+
export declare const coreProvidersSpec: {
|
|
34
|
+
readonly version: "1.0.0";
|
|
35
|
+
readonly providers: readonly [];
|
|
36
|
+
};
|
|
37
|
+
export declare const allProvidersSpec: {
|
|
38
|
+
readonly version: "1.0.0";
|
|
39
|
+
readonly providers: readonly [];
|
|
40
|
+
};
|
|
41
|
+
export declare const coreEvaluatorsSpec: {
|
|
42
|
+
readonly version: "1.0.0";
|
|
43
|
+
readonly evaluators: readonly [];
|
|
44
|
+
};
|
|
45
|
+
export declare const allEvaluatorsSpec: {
|
|
46
|
+
readonly version: "1.0.0";
|
|
47
|
+
readonly evaluators: readonly [];
|
|
48
|
+
};
|
|
49
|
+
export declare const coreActionDocs: readonly ActionDoc[];
|
|
50
|
+
export declare const allActionDocs: readonly ActionDoc[];
|
|
51
|
+
export declare const coreProviderDocs: readonly ProviderDoc[];
|
|
52
|
+
export declare const allProviderDocs: readonly ProviderDoc[];
|
|
53
|
+
export declare const coreEvaluatorDocs: readonly EvaluatorDoc[];
|
|
54
|
+
export declare const allEvaluatorDocs: readonly EvaluatorDoc[];
|
|
55
|
+
//# sourceMappingURL=specs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../../generated/specs/specs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,OAAO,EAAE,CAAC,EAAE,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AACX,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AACX,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,cAAc,EAAE,SAAS,SAAS,EAA4B,CAAC;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,SAAS,EAA2B,CAAC;AAC1E,eAAO,MAAM,gBAAgB,EAAE,SAAS,WAAW,EAAgC,CAAC;AACpF,eAAO,MAAM,eAAe,EAAE,SAAS,WAAW,EAA+B,CAAC;AAClF,eAAO,MAAM,iBAAiB,EAAE,SAAS,YAAY,EAAkC,CAAC;AACxF,eAAO,MAAM,gBAAgB,EAAE,SAAS,YAAY,EAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../index.browser.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AACjE,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// utils/config.ts
|
|
2
|
+
var DEFAULT_OLLAMA_URL = "http://localhost:11434";
|
|
3
|
+
var DEFAULT_SMALL_MODEL = "gemma3:latest";
|
|
4
|
+
var DEFAULT_LARGE_MODEL = "gemma3:latest";
|
|
5
|
+
var DEFAULT_EMBEDDING_MODEL = "nomic-embed-text:latest";
|
|
6
|
+
function getEnvValue(key) {
|
|
7
|
+
if (typeof process === "undefined" || !process.env) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const value = process.env[key];
|
|
11
|
+
return value === undefined ? undefined : String(value);
|
|
12
|
+
}
|
|
13
|
+
function getSetting(runtime, key, defaultValue) {
|
|
14
|
+
const value = runtime.getSetting(key);
|
|
15
|
+
if (value !== undefined && value !== null) {
|
|
16
|
+
return String(value);
|
|
17
|
+
}
|
|
18
|
+
return getEnvValue(key) ?? defaultValue;
|
|
19
|
+
}
|
|
20
|
+
function getBaseURL(runtime) {
|
|
21
|
+
const apiEndpoint = getSetting(runtime, "OLLAMA_API_ENDPOINT") || getSetting(runtime, "OLLAMA_API_URL") || DEFAULT_OLLAMA_URL;
|
|
22
|
+
if (!apiEndpoint.endsWith("/api")) {
|
|
23
|
+
return apiEndpoint.endsWith("/") ? `${apiEndpoint}api` : `${apiEndpoint}/api`;
|
|
24
|
+
}
|
|
25
|
+
return apiEndpoint;
|
|
26
|
+
}
|
|
27
|
+
function getApiBase(runtime) {
|
|
28
|
+
const baseURL = getBaseURL(runtime);
|
|
29
|
+
return baseURL.endsWith("/api") ? baseURL.slice(0, -4) : baseURL;
|
|
30
|
+
}
|
|
31
|
+
function getSmallModel(runtime) {
|
|
32
|
+
return getSetting(runtime, "OLLAMA_SMALL_MODEL") || getSetting(runtime, "SMALL_MODEL") || DEFAULT_SMALL_MODEL;
|
|
33
|
+
}
|
|
34
|
+
function getLargeModel(runtime) {
|
|
35
|
+
return getSetting(runtime, "OLLAMA_LARGE_MODEL") || getSetting(runtime, "LARGE_MODEL") || DEFAULT_LARGE_MODEL;
|
|
36
|
+
}
|
|
37
|
+
function getEmbeddingModel(runtime) {
|
|
38
|
+
return getSetting(runtime, "OLLAMA_EMBEDDING_MODEL") || DEFAULT_EMBEDDING_MODEL;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
ollamaPlugin,
|
|
42
|
+
getSmallModel,
|
|
43
|
+
getSetting,
|
|
44
|
+
getLargeModel,
|
|
45
|
+
getEmbeddingModel,
|
|
46
|
+
getBaseURL,
|
|
47
|
+
getApiBase,
|
|
48
|
+
ollamaPlugin2 as default,
|
|
49
|
+
DEFAULT_SMALL_MODEL,
|
|
50
|
+
DEFAULT_OLLAMA_URL,
|
|
51
|
+
DEFAULT_LARGE_MODEL,
|
|
52
|
+
DEFAULT_EMBEDDING_MODEL
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//# debugId=6582A0D5713070FA64756E2164756E21
|
|
56
|
+
//# sourceMappingURL=index.node.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../utils/config.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"type SettingsProvider = {\n getSetting: (key: string) => string | number | boolean | null;\n};\n\nexport const DEFAULT_OLLAMA_URL = \"http://localhost:11434\";\nexport const DEFAULT_SMALL_MODEL = \"gemma3:latest\";\nexport const DEFAULT_LARGE_MODEL = \"gemma3:latest\";\nexport const DEFAULT_EMBEDDING_MODEL = \"nomic-embed-text:latest\";\n\nfunction getEnvValue(key: string): string | undefined {\n if (typeof process === \"undefined\" || !process.env) {\n return undefined;\n }\n const value = process.env[key];\n return value === undefined ? undefined : String(value);\n}\n\nexport function getSetting(\n runtime: SettingsProvider,\n key: string,\n defaultValue?: string\n): string | undefined {\n const value = runtime.getSetting(key);\n if (value !== undefined && value !== null) {\n return String(value);\n }\n return getEnvValue(key) ?? defaultValue;\n}\n\nexport function getBaseURL(runtime: SettingsProvider): string {\n const apiEndpoint =\n getSetting(runtime, \"OLLAMA_API_ENDPOINT\") ||\n getSetting(runtime, \"OLLAMA_API_URL\") ||\n DEFAULT_OLLAMA_URL;\n\n if (!apiEndpoint.endsWith(\"/api\")) {\n return apiEndpoint.endsWith(\"/\") ? `${apiEndpoint}api` : `${apiEndpoint}/api`;\n }\n return apiEndpoint;\n}\n\nexport function getApiBase(runtime: SettingsProvider): string {\n const baseURL = getBaseURL(runtime);\n return baseURL.endsWith(\"/api\") ? baseURL.slice(0, -4) : baseURL;\n}\n\nexport function getSmallModel(runtime: SettingsProvider): string {\n return (\n getSetting(runtime, \"OLLAMA_SMALL_MODEL\") ||\n getSetting(runtime, \"SMALL_MODEL\") ||\n DEFAULT_SMALL_MODEL\n );\n}\n\nexport function getLargeModel(runtime: SettingsProvider): string {\n return (\n getSetting(runtime, \"OLLAMA_LARGE_MODEL\") ||\n getSetting(runtime, \"LARGE_MODEL\") ||\n DEFAULT_LARGE_MODEL\n );\n}\n\nexport function getEmbeddingModel(runtime: SettingsProvider): string {\n return getSetting(runtime, \"OLLAMA_EMBEDDING_MODEL\") || DEFAULT_EMBEDDING_MODEL;\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAIO,IAAM,qBAAqB;AAC3B,IAAM,sBAAsB;AAC5B,IAAM,sBAAsB;AAC5B,IAAM,0BAA0B;AAEvC,SAAS,WAAW,CAAC,KAAiC;AAAA,EACpD,IAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,KAAK;AAAA,IAClD;AAAA,EACF;AAAA,EACA,MAAM,QAAQ,QAAQ,IAAI;AAAA,EAC1B,OAAO,UAAU,YAAY,YAAY,OAAO,KAAK;AAAA;AAGhD,SAAS,UAAU,CACxB,SACA,KACA,cACoB;AAAA,EACpB,MAAM,QAAQ,QAAQ,WAAW,GAAG;AAAA,EACpC,IAAI,UAAU,aAAa,UAAU,MAAM;AAAA,IACzC,OAAO,OAAO,KAAK;AAAA,EACrB;AAAA,EACA,OAAO,YAAY,GAAG,KAAK;AAAA;AAGtB,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC5D,MAAM,cACJ,WAAW,SAAS,qBAAqB,KACzC,WAAW,SAAS,gBAAgB,KACpC;AAAA,EAEF,IAAI,CAAC,YAAY,SAAS,MAAM,GAAG;AAAA,IACjC,OAAO,YAAY,SAAS,GAAG,IAAI,GAAG,mBAAmB,GAAG;AAAA,EAC9D;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,UAAU,CAAC,SAAmC;AAAA,EAC5D,MAAM,UAAU,WAAW,OAAO;AAAA,EAClC,OAAO,QAAQ,SAAS,MAAM,IAAI,QAAQ,MAAM,GAAG,EAAE,IAAI;AAAA;AAGpD,SAAS,aAAa,CAAC,SAAmC;AAAA,EAC/D,OACE,WAAW,SAAS,oBAAoB,KACxC,WAAW,SAAS,aAAa,KACjC;AAAA;AAIG,SAAS,aAAa,CAAC,SAAmC;AAAA,EAC/D,OACE,WAAW,SAAS,oBAAoB,KACxC,WAAW,SAAS,aAAa,KACjC;AAAA;AAIG,SAAS,iBAAiB,CAAC,SAAmC;AAAA,EACnE,OAAO,WAAW,SAAS,wBAAwB,KAAK;AAAA;",
|
|
8
|
+
"debugId": "6582A0D5713070FA64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../../models/availability.ts"],"names":[],"mappings":"AAEA,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,EACxB,WAAW,CAAC,EAAE,OAAO,KAAK,GAAG,IAAI,GAChC,OAAO,CAAC,IAAI,CAAC,CAgCf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../models/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAQxE,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,GAC1C,OAAO,CAAC,MAAM,EAAE,CAAC,CA+CnB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ensureModelAvailable } from "./availability";
|
|
2
|
+
export { handleTextEmbedding } from "./embedding";
|
|
3
|
+
export { handleObjectLarge, handleObjectSmall } from "./object";
|
|
4
|
+
export { handleTextLarge, handleTextSmall } from "./text";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IAgentRuntime, ObjectGenerationParams } from "@elizaos/core";
|
|
2
|
+
export declare function handleObjectSmall(runtime: IAgentRuntime, params: ObjectGenerationParams): Promise<Record<string, string | number | boolean | null>>;
|
|
3
|
+
export declare function handleObjectLarge(runtime: IAgentRuntime, params: ObjectGenerationParams): Promise<Record<string, string | number | boolean | null>>;
|
|
4
|
+
//# sourceMappingURL=object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../../models/object.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AA6B3E,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAkB3D;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,CAkB3D"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GenerateTextParams, IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
export declare function handleTextSmall(runtime: IAgentRuntime, { prompt, stopSequences }: GenerateTextParams): Promise<string>;
|
|
3
|
+
export declare function handleTextLarge(runtime: IAgentRuntime, { prompt, stopSequences, maxTokens, temperature, frequencyPenalty, presencePenalty, }: GenerateTextParams): Promise<string>;
|
|
4
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../models/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAyCvE,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,EACtB,EAAE,MAAM,EAAE,aAAkB,EAAE,EAAE,kBAAkB,GACjD,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,aAAa,EACtB,EACE,MAAM,EACN,aAAkB,EAClB,SAAgB,EAChB,WAAiB,EACjB,gBAAsB,EACtB,eAAqB,GACtB,EAAE,kBAAkB,GACpB,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,MAAM,EAEP,MAAM,eAAe,CAAC;AAsBvB,eAAO,MAAM,YAAY,EAAE,MA+K1B,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface OllamaConfig {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
smallModel: string;
|
|
4
|
+
largeModel: string;
|
|
5
|
+
embeddingModel: string;
|
|
6
|
+
timeoutMs: number;
|
|
7
|
+
}
|
|
8
|
+
export interface TextGenerationParams {
|
|
9
|
+
prompt: string;
|
|
10
|
+
system?: string;
|
|
11
|
+
temperature?: number;
|
|
12
|
+
maxTokens?: number;
|
|
13
|
+
frequencyPenalty?: number;
|
|
14
|
+
presencePenalty?: number;
|
|
15
|
+
stopSequences?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface TextGenerationResponse {
|
|
18
|
+
text: string;
|
|
19
|
+
model: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ObjectGenerationParams {
|
|
22
|
+
prompt: string;
|
|
23
|
+
system?: string;
|
|
24
|
+
temperature?: number;
|
|
25
|
+
schema?: Record<string, string | number | boolean | null>;
|
|
26
|
+
maxTokens?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ObjectGenerationResponse {
|
|
29
|
+
object: Record<string, string | number | boolean | null>;
|
|
30
|
+
model: string;
|
|
31
|
+
}
|
|
32
|
+
export interface EmbeddingParams {
|
|
33
|
+
text: string;
|
|
34
|
+
}
|
|
35
|
+
export interface EmbeddingResponse {
|
|
36
|
+
embedding: number[];
|
|
37
|
+
model: string;
|
|
38
|
+
}
|
|
39
|
+
export interface OllamaModelInfo {
|
|
40
|
+
name: string;
|
|
41
|
+
size: number;
|
|
42
|
+
modified_at: string;
|
|
43
|
+
}
|
|
44
|
+
export interface OllamaTagsResponse {
|
|
45
|
+
models: OllamaModelInfo[];
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;IAC1D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type SettingsProvider = {
|
|
2
|
+
getSetting: (key: string) => string | number | boolean | null;
|
|
3
|
+
};
|
|
4
|
+
export declare const DEFAULT_OLLAMA_URL = "http://localhost:11434";
|
|
5
|
+
export declare const DEFAULT_SMALL_MODEL = "gemma3:latest";
|
|
6
|
+
export declare const DEFAULT_LARGE_MODEL = "gemma3:latest";
|
|
7
|
+
export declare const DEFAULT_EMBEDDING_MODEL = "nomic-embed-text:latest";
|
|
8
|
+
export declare function getSetting(runtime: SettingsProvider, key: string, defaultValue?: string): string | undefined;
|
|
9
|
+
export declare function getBaseURL(runtime: SettingsProvider): string;
|
|
10
|
+
export declare function getApiBase(runtime: SettingsProvider): string;
|
|
11
|
+
export declare function getSmallModel(runtime: SettingsProvider): string;
|
|
12
|
+
export declare function getLargeModel(runtime: SettingsProvider): string;
|
|
13
|
+
export declare function getEmbeddingModel(runtime: SettingsProvider): string;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../utils/config.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CAC/D,CAAC;AAEF,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,uBAAuB,4BAA4B,CAAC;AAUjE,wBAAgB,UAAU,CACxB,OAAO,EAAE,gBAAgB,EACzB,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAU5D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAG5D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAM/D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAM/D;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-ollama",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/node/index.node.js",
|
|
6
|
+
"module": "dist/node/index.node.js",
|
|
7
|
+
"types": "dist/node/index.d.ts",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/elizaos-plugins/plugin-ollama.git"
|
|
@@ -12,32 +12,53 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
"./package.json": "./package.json",
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
15
|
+
"types": "./dist/node/index.d.ts",
|
|
16
|
+
"browser": {
|
|
17
|
+
"types": "./dist/browser/index.d.ts",
|
|
18
|
+
"import": "./dist/browser/index.browser.js",
|
|
19
|
+
"default": "./dist/browser/index.browser.js"
|
|
20
|
+
},
|
|
21
|
+
"node": {
|
|
22
|
+
"types": "./dist/node/index.d.ts",
|
|
23
|
+
"import": "./dist/node/index.node.js",
|
|
24
|
+
"default": "./dist/node/index.node.js"
|
|
25
|
+
},
|
|
26
|
+
"bun": {
|
|
27
|
+
"types": "./dist/node/index.d.ts",
|
|
28
|
+
"default": "./dist/node/index.node.js"
|
|
29
|
+
},
|
|
30
|
+
"require": "./dist/cjs/index.node.cjs",
|
|
31
|
+
"default": "./dist/node/index.node.js"
|
|
19
32
|
}
|
|
20
33
|
},
|
|
21
34
|
"files": [
|
|
22
35
|
"dist"
|
|
23
36
|
],
|
|
37
|
+
"sideEffects": false,
|
|
24
38
|
"dependencies": {
|
|
25
39
|
"@ai-sdk/ui-utils": "^1.2.8",
|
|
26
|
-
"@elizaos/core": "
|
|
40
|
+
"@elizaos/core": "2.0.0-alpha.3",
|
|
27
41
|
"ai": "^4.3.9",
|
|
28
42
|
"js-tiktoken": "^1.0.18",
|
|
29
|
-
"ollama-ai-provider": "^1.2.0"
|
|
30
|
-
|
|
43
|
+
"ollama-ai-provider": "^1.2.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@biomejs/biome": "^2.3.11",
|
|
47
|
+
"@types/node": "^25.0.3",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
31
49
|
},
|
|
32
50
|
"scripts": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"lint": "prettier --write ./src",
|
|
51
|
+
"dev": "bun run build.ts --watch",
|
|
52
|
+
"lint": "bunx @biomejs/biome check --write --unsafe .",
|
|
36
53
|
"clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
|
|
37
|
-
"format": "
|
|
38
|
-
"format:check": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
54
|
+
"format": "bunx @biomejs/biome format --write .",
|
|
55
|
+
"format:check": "bunx @biomejs/biome format .",
|
|
56
|
+
"typecheck": "tsc --noEmit --noCheck -p tsconfig.json",
|
|
57
|
+
"test": "vitest run __tests__/ --passWithNoTests",
|
|
58
|
+
"test:unit": "vitest run __tests__/",
|
|
59
|
+
"lint:check": "bunx @biomejs/biome check .",
|
|
60
|
+
"build": "bun run build.ts",
|
|
61
|
+
"build:ts": "bun run build.ts"
|
|
41
62
|
},
|
|
42
63
|
"publishConfig": {
|
|
43
64
|
"access": "public"
|
|
@@ -96,9 +117,15 @@
|
|
|
96
117
|
}
|
|
97
118
|
},
|
|
98
119
|
"gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
120
|
+
"milady": {
|
|
121
|
+
"platforms": [
|
|
122
|
+
"browser",
|
|
123
|
+
"node"
|
|
124
|
+
],
|
|
125
|
+
"runtime": "both",
|
|
126
|
+
"platformDetails": {
|
|
127
|
+
"browser": "Browser-compatible build available via exports.browser",
|
|
128
|
+
"node": "Node.js build available via exports.node"
|
|
129
|
+
}
|
|
103
130
|
}
|
|
104
131
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Shaw Walters and elizaOS Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
# Ollama Plugin
|
|
2
|
-
|
|
3
|
-
This plugin provides integration with [Ollama](https://ollama.com/)'s local models through the ElizaOS platform. It allows you to leverage locally running LLMs for text generation, embeddings, and object generation.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
Ollama enables running large language models locally on your machine. This plugin connects ElizaOS with your local Ollama installation, giving your characters access to powerful language models running on your own hardware.
|
|
8
|
-
|
|
9
|
-
## Requirements
|
|
10
|
-
|
|
11
|
-
- [Ollama](https://ollama.com/) installed and running on your system
|
|
12
|
-
- ElizaOS platform
|
|
13
|
-
- At least one Ollama model pulled and available (e.g., `llama3`, `gemma3:latest`)
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
1. Install this plugin in your ElizaOS project:
|
|
18
|
-
```bash
|
|
19
|
-
bun add @elizaos-plugins/plugin-ollama
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
2. Make sure Ollama is running:
|
|
23
|
-
```bash
|
|
24
|
-
ollama serve
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
Add the plugin to your character configuration:
|
|
30
|
-
|
|
31
|
-
```json
|
|
32
|
-
"plugins": ["@elizaos-plugins/plugin-ollama"]
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Configuration
|
|
36
|
-
|
|
37
|
-
The plugin requires these environment variables (can be set in .env file or character settings):
|
|
38
|
-
|
|
39
|
-
```json
|
|
40
|
-
"settings": {
|
|
41
|
-
"OLLAMA_API_ENDPOINT": "http://localhost:11434/api",
|
|
42
|
-
"OLLAMA_SMALL_MODEL": "gemma3:latest",
|
|
43
|
-
"OLLAMA_MEDIUM_MODEL": "gemma3:latest",
|
|
44
|
-
"OLLAMA_LARGE_MODEL": "gemma3:latest",
|
|
45
|
-
"OLLAMA_EMBEDDING_MODEL": "nomic-embed-text:latest"
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Or in `.env` file:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
OLLAMA_API_ENDPOINT=http://localhost:11434/api
|
|
53
|
-
OLLAMA_SMALL_MODEL=gemma3:latest
|
|
54
|
-
OLLAMA_MEDIUM_MODEL=gemma3:latest
|
|
55
|
-
OLLAMA_LARGE_MODEL=gemma3:latest
|
|
56
|
-
OLLAMA_EMBEDDING_MODEL=nomic-embed-text:latest
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Configuration Options
|
|
60
|
-
|
|
61
|
-
- `OLLAMA_API_ENDPOINT`: Ollama API endpoint (default: http://localhost:11434/api)
|
|
62
|
-
- `OLLAMA_SMALL_MODEL`: Model for simpler tasks (default: gemma3:latest)
|
|
63
|
-
- `OLLAMA_MEDIUM_MODEL`: Medium-complexity model (default: gemma3:latest)
|
|
64
|
-
- `OLLAMA_LARGE_MODEL`: Model for complex tasks (default: gemma3:latest)
|
|
65
|
-
- `OLLAMA_EMBEDDING_MODEL`: Model for text embeddings (default: nomic-embed-text:latest)
|
|
66
|
-
|
|
67
|
-
The plugin provides these model classes:
|
|
68
|
-
|
|
69
|
-
- `TEXT_SMALL`: Optimized for fast responses with simpler prompts
|
|
70
|
-
- `TEXT_LARGE`: For complex tasks requiring deeper reasoning
|
|
71
|
-
- `TEXT_EMBEDDING`: Text embedding model
|
|
72
|
-
- `OBJECT_SMALL`: JSON object generation with simpler models
|
|
73
|
-
- `OBJECT_LARGE`: JSON object generation with more complex models
|
|
74
|
-
|
|
75
|
-
## API Reference
|
|
76
|
-
|
|
77
|
-
For detailed information about the Ollama API used by this plugin, refer to the [official Ollama API documentation](https://github.com/ollama/ollama/blob/main/docs/api.md).
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
## Features
|
|
82
|
-
|
|
83
|
-
### Text Generation (Small Model)
|
|
84
|
-
|
|
85
|
-
Generate text using smaller, faster models optimized for quick responses:
|
|
86
|
-
|
|
87
|
-
```js
|
|
88
|
-
const text = await runtime.useModel(ModelType.TEXT_SMALL, {
|
|
89
|
-
prompt: 'What is the nature of reality?',
|
|
90
|
-
stopSequences: [], // optional
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### Text Generation (Large Model)
|
|
95
|
-
|
|
96
|
-
Generate comprehensive text responses using more powerful models for complex tasks:
|
|
97
|
-
|
|
98
|
-
```js
|
|
99
|
-
const text = await runtime.useModel(ModelType.TEXT_LARGE, {
|
|
100
|
-
prompt: 'Write a detailed explanation of quantum physics',
|
|
101
|
-
stopSequences: [], // optional
|
|
102
|
-
maxTokens: 8192, // optional (default: 8192)
|
|
103
|
-
temperature: 0.7, // optional (default: 0.7)
|
|
104
|
-
frequencyPenalty: 0.7, // optional (default: 0.7)
|
|
105
|
-
presencePenalty: 0.7, // optional (default: 0.7)
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Text Embeddings
|
|
110
|
-
|
|
111
|
-
Generate vector embeddings for text, which can be used for semantic search or other vector operations:
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, {
|
|
115
|
-
text: 'Text to embed',
|
|
116
|
-
});
|
|
117
|
-
// or
|
|
118
|
-
const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, 'Text to embed');
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Object Generation (Small Model)
|
|
122
|
-
|
|
123
|
-
Generate structured JSON objects using faster models:
|
|
124
|
-
|
|
125
|
-
```js
|
|
126
|
-
const object = await runtime.useModel(ModelType.OBJECT_SMALL, {
|
|
127
|
-
prompt: 'Generate a JSON object representing a user profile',
|
|
128
|
-
temperature: 0.7, // optional
|
|
129
|
-
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Object Generation (Large Model)
|
|
133
|
-
|
|
134
|
-
Generate complex, detailed JSON objects using more powerful models:
|
|
135
|
-
|
|
136
|
-
```js
|
|
137
|
-
const object = await runtime.useModel(ModelType.OBJECT_LARGE, {
|
|
138
|
-
prompt: 'Generate a detailed JSON object representing a restaurant',
|
|
139
|
-
temperature: 0.7, // optional
|
|
140
|
-
});
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Troubleshooting
|
|
144
|
-
|
|
145
|
-
### Connection Issues
|
|
146
|
-
|
|
147
|
-
- Ensure Ollama is running by testing the `OLLAMA_API_ENDPOINT`
|
|
148
|
-
- Verify the `OLLAMA_API_ENDPOINT` points to the correct host and port
|
|
149
|
-
- Check firewall settings if connecting to a remote Ollama instance
|
|
150
|
-
|
|
151
|
-
### Model Availability
|
|
152
|
-
|
|
153
|
-
- The plugin will attempt to download models automatically if they're not found
|
|
154
|
-
- You can pre-download models using `ollama pull modelname`
|
|
155
|
-
- Check model availability with `ollama list`
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
## License
|
|
159
|
-
|
|
160
|
-
See LICENSE file for details.
|