@easbot/ollama-sdk 0.1.1 → 0.1.3
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/index.cjs +7 -7
- package/dist/index.d.cts +28 -3
- package/dist/index.d.ts +28 -3
- package/dist/index.mjs +7 -7
- package/package.json +17 -19
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { LanguageModelV2, LanguageModelV2CallOptions } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV2, EmbeddingModelV2, LanguageModelV2CallOptions } from '@ai-sdk/provider';
|
|
2
2
|
|
|
3
3
|
type OllamaModelId = string;
|
|
4
4
|
interface OllamaConfig {
|
|
5
5
|
baseURL?: string;
|
|
6
6
|
fetch?: typeof fetch;
|
|
7
7
|
headers?: Record<string, string>;
|
|
8
|
+
logPath?: string;
|
|
9
|
+
logLevel?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
8
10
|
}
|
|
9
11
|
interface OllamaProviderOptions {
|
|
10
12
|
temperature?: number;
|
|
@@ -21,6 +23,7 @@ interface OllamaProvider {
|
|
|
21
23
|
(modelId: OllamaModelId): LanguageModelV2;
|
|
22
24
|
languageModel(modelId: OllamaModelId): LanguageModelV2;
|
|
23
25
|
chat(modelId: OllamaModelId): LanguageModelV2;
|
|
26
|
+
textEmbeddingModel(modelId: OllamaModelId): EmbeddingModelV2<string>;
|
|
24
27
|
}
|
|
25
28
|
declare function createOllama(config?: OllamaConfig): OllamaProvider;
|
|
26
29
|
|
|
@@ -36,6 +39,28 @@ declare class OllamaLanguageModel implements LanguageModelV2 {
|
|
|
36
39
|
doStream(options: LanguageModelV2CallOptions): ReturnType<LanguageModelV2['doStream']>;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
declare class OllamaEmbeddingModel implements EmbeddingModelV2<string> {
|
|
43
|
+
readonly specificationVersion: "v2";
|
|
44
|
+
readonly provider = "ollama";
|
|
45
|
+
readonly modelId: string;
|
|
46
|
+
readonly maxEmbeddingsPerCall: undefined;
|
|
47
|
+
readonly supportsParallelCalls = true;
|
|
48
|
+
private readonly baseURL;
|
|
49
|
+
constructor(modelId: string, config?: OllamaConfig);
|
|
50
|
+
doEmbed(options: {
|
|
51
|
+
values: string[];
|
|
52
|
+
abortSignal?: AbortSignal;
|
|
53
|
+
headers?: Record<string, string | undefined>;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
embeddings: number[][];
|
|
56
|
+
usage?: {
|
|
57
|
+
tokens: number;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
private generateSingleEmbedding;
|
|
61
|
+
private estimateTokens;
|
|
62
|
+
}
|
|
63
|
+
|
|
39
64
|
declare const VERSION = "0.1.0";
|
|
40
65
|
|
|
41
66
|
declare class OllamaError extends Error {
|
|
@@ -61,7 +86,7 @@ declare class TimeoutError extends OllamaError {
|
|
|
61
86
|
}
|
|
62
87
|
|
|
63
88
|
declare const OLLAMA_DEFAULT_OPTIONS: {
|
|
64
|
-
readonly numCtx:
|
|
89
|
+
readonly numCtx: 262144;
|
|
65
90
|
readonly temperature: 0.7;
|
|
66
91
|
readonly topK: 40;
|
|
67
92
|
readonly topP: 0.9;
|
|
@@ -70,4 +95,4 @@ declare const OLLAMA_DEFAULT_OPTIONS: {
|
|
|
70
95
|
};
|
|
71
96
|
declare const OLLAMA_SPECIFIC_PARAMS: readonly ["numCtx", "repeatPenalty", "numPredict"];
|
|
72
97
|
|
|
73
|
-
export { ConnectionError, ModelNotFoundError, OLLAMA_DEFAULT_OPTIONS, OLLAMA_SPECIFIC_PARAMS, type OllamaConfig, OllamaError, OllamaLanguageModel, type OllamaModelId, type OllamaProvider, type OllamaProviderOptions, TimeoutError, VERSION, ValidationError, createOllama };
|
|
98
|
+
export { ConnectionError, ModelNotFoundError, OLLAMA_DEFAULT_OPTIONS, OLLAMA_SPECIFIC_PARAMS, type OllamaConfig, OllamaEmbeddingModel, OllamaError, OllamaLanguageModel, type OllamaModelId, type OllamaProvider, type OllamaProviderOptions, TimeoutError, VERSION, ValidationError, createOllama };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { LanguageModelV2, LanguageModelV2CallOptions } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV2, EmbeddingModelV2, LanguageModelV2CallOptions } from '@ai-sdk/provider';
|
|
2
2
|
|
|
3
3
|
type OllamaModelId = string;
|
|
4
4
|
interface OllamaConfig {
|
|
5
5
|
baseURL?: string;
|
|
6
6
|
fetch?: typeof fetch;
|
|
7
7
|
headers?: Record<string, string>;
|
|
8
|
+
logPath?: string;
|
|
9
|
+
logLevel?: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
|
|
8
10
|
}
|
|
9
11
|
interface OllamaProviderOptions {
|
|
10
12
|
temperature?: number;
|
|
@@ -21,6 +23,7 @@ interface OllamaProvider {
|
|
|
21
23
|
(modelId: OllamaModelId): LanguageModelV2;
|
|
22
24
|
languageModel(modelId: OllamaModelId): LanguageModelV2;
|
|
23
25
|
chat(modelId: OllamaModelId): LanguageModelV2;
|
|
26
|
+
textEmbeddingModel(modelId: OllamaModelId): EmbeddingModelV2<string>;
|
|
24
27
|
}
|
|
25
28
|
declare function createOllama(config?: OllamaConfig): OllamaProvider;
|
|
26
29
|
|
|
@@ -36,6 +39,28 @@ declare class OllamaLanguageModel implements LanguageModelV2 {
|
|
|
36
39
|
doStream(options: LanguageModelV2CallOptions): ReturnType<LanguageModelV2['doStream']>;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
declare class OllamaEmbeddingModel implements EmbeddingModelV2<string> {
|
|
43
|
+
readonly specificationVersion: "v2";
|
|
44
|
+
readonly provider = "ollama";
|
|
45
|
+
readonly modelId: string;
|
|
46
|
+
readonly maxEmbeddingsPerCall: undefined;
|
|
47
|
+
readonly supportsParallelCalls = true;
|
|
48
|
+
private readonly baseURL;
|
|
49
|
+
constructor(modelId: string, config?: OllamaConfig);
|
|
50
|
+
doEmbed(options: {
|
|
51
|
+
values: string[];
|
|
52
|
+
abortSignal?: AbortSignal;
|
|
53
|
+
headers?: Record<string, string | undefined>;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
embeddings: number[][];
|
|
56
|
+
usage?: {
|
|
57
|
+
tokens: number;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
private generateSingleEmbedding;
|
|
61
|
+
private estimateTokens;
|
|
62
|
+
}
|
|
63
|
+
|
|
39
64
|
declare const VERSION = "0.1.0";
|
|
40
65
|
|
|
41
66
|
declare class OllamaError extends Error {
|
|
@@ -61,7 +86,7 @@ declare class TimeoutError extends OllamaError {
|
|
|
61
86
|
}
|
|
62
87
|
|
|
63
88
|
declare const OLLAMA_DEFAULT_OPTIONS: {
|
|
64
|
-
readonly numCtx:
|
|
89
|
+
readonly numCtx: 262144;
|
|
65
90
|
readonly temperature: 0.7;
|
|
66
91
|
readonly topK: 40;
|
|
67
92
|
readonly topP: 0.9;
|
|
@@ -70,4 +95,4 @@ declare const OLLAMA_DEFAULT_OPTIONS: {
|
|
|
70
95
|
};
|
|
71
96
|
declare const OLLAMA_SPECIFIC_PARAMS: readonly ["numCtx", "repeatPenalty", "numPredict"];
|
|
72
97
|
|
|
73
|
-
export { ConnectionError, ModelNotFoundError, OLLAMA_DEFAULT_OPTIONS, OLLAMA_SPECIFIC_PARAMS, type OllamaConfig, OllamaError, OllamaLanguageModel, type OllamaModelId, type OllamaProvider, type OllamaProviderOptions, TimeoutError, VERSION, ValidationError, createOllama };
|
|
98
|
+
export { ConnectionError, ModelNotFoundError, OLLAMA_DEFAULT_OPTIONS, OLLAMA_SPECIFIC_PARAMS, type OllamaConfig, OllamaEmbeddingModel, OllamaError, OllamaLanguageModel, type OllamaModelId, type OllamaProvider, type OllamaProviderOptions, TimeoutError, VERSION, ValidationError, createOllama };
|