@kernl-sdk/ai 0.4.6 → 0.4.7
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/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { mistral as _mistral } from "@ai-sdk/mistral";
|
|
2
|
+
import { AISDKLanguageModel } from "../language-model.js";
|
|
3
|
+
/**
|
|
4
|
+
* Mistral model IDs (derived from @ai-sdk/mistral).
|
|
5
|
+
*/
|
|
6
|
+
export type MistralModelId = Parameters<typeof _mistral>[0];
|
|
7
|
+
/**
|
|
8
|
+
* Options for creating a custom Mistral provider.
|
|
9
|
+
*/
|
|
10
|
+
export interface MistralProviderOptions {
|
|
11
|
+
/** API key for authentication */
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
/** Custom base URL */
|
|
14
|
+
baseURL?: string;
|
|
15
|
+
/** Custom headers */
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a custom Mistral provider with explicit credentials.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const mistral = createMistral({ apiKey: "..." });
|
|
24
|
+
* const model = mistral("mistral-large-latest");
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function createMistral(options?: MistralProviderOptions): (modelId: MistralModelId) => AISDKLanguageModel;
|
|
28
|
+
/**
|
|
29
|
+
* Create a kernl-compatible Mistral language model.
|
|
30
|
+
* Uses MISTRAL_API_KEY environment variable.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { mistral } from '@kernl-sdk/ai/mistral';
|
|
35
|
+
*
|
|
36
|
+
* const model = mistral('mistral-large-latest');
|
|
37
|
+
* const response = await model.generate([...], {});
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function mistral(modelId: MistralModelId): AISDKLanguageModel;
|
|
41
|
+
//# sourceMappingURL=mistral.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mistral.d.ts","sourceRoot":"","sources":["../../src/providers/mistral.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,QAAQ,EAEpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,sBAA2B,IAOxD,SAAS,cAAc,wBAChC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,sBAG9C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { mistral as _mistral, createMistral as _createMistral, } from "@ai-sdk/mistral";
|
|
2
|
+
import { registerEmbeddingProvider } from "@kernl-sdk/retrieval";
|
|
3
|
+
import { AISDKLanguageModel } from "../language-model.js";
|
|
4
|
+
import { AISDKEmbeddingModel } from "../embedding-model.js";
|
|
5
|
+
/**
|
|
6
|
+
* Create a custom Mistral provider with explicit credentials.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const mistral = createMistral({ apiKey: "..." });
|
|
11
|
+
* const model = mistral("mistral-large-latest");
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export function createMistral(options = {}) {
|
|
15
|
+
const provider = _createMistral({
|
|
16
|
+
apiKey: options.apiKey,
|
|
17
|
+
baseURL: options.baseURL,
|
|
18
|
+
headers: options.headers,
|
|
19
|
+
});
|
|
20
|
+
return (modelId) => new AISDKLanguageModel(provider(modelId));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a kernl-compatible Mistral language model.
|
|
24
|
+
* Uses MISTRAL_API_KEY environment variable.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { mistral } from '@kernl-sdk/ai/mistral';
|
|
29
|
+
*
|
|
30
|
+
* const model = mistral('mistral-large-latest');
|
|
31
|
+
* const response = await model.generate([...], {});
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function mistral(modelId) {
|
|
35
|
+
const model = _mistral(modelId);
|
|
36
|
+
return new AISDKLanguageModel(model);
|
|
37
|
+
}
|
|
38
|
+
// Auto-register Mistral embedding provider
|
|
39
|
+
registerEmbeddingProvider("mistral", (id) => new AISDKEmbeddingModel(_mistral.embedding(id)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernl-sdk/ai",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Vercel AI SDK adapter for kernl",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kernl",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"./google": {
|
|
41
41
|
"types": "./dist/providers/google.d.ts",
|
|
42
42
|
"import": "./dist/providers/google.js"
|
|
43
|
+
},
|
|
44
|
+
"./mistral": {
|
|
45
|
+
"types": "./dist/providers/mistral.d.ts",
|
|
46
|
+
"import": "./dist/providers/mistral.js"
|
|
43
47
|
}
|
|
44
48
|
},
|
|
45
49
|
"peerDependencies": {
|
|
@@ -54,11 +58,15 @@
|
|
|
54
58
|
},
|
|
55
59
|
"@ai-sdk/google": {
|
|
56
60
|
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@ai-sdk/mistral": {
|
|
63
|
+
"optional": true
|
|
57
64
|
}
|
|
58
65
|
},
|
|
59
66
|
"devDependencies": {
|
|
60
67
|
"@ai-sdk/anthropic": "^3.0.14",
|
|
61
68
|
"@ai-sdk/google": "^3.0.9",
|
|
69
|
+
"@ai-sdk/mistral": "^3.0.7",
|
|
62
70
|
"@ai-sdk/openai": "^3.0.11",
|
|
63
71
|
"@ai-sdk/provider": "^3.0.3",
|
|
64
72
|
"@types/node": "^24.10.0",
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mistral as _mistral,
|
|
3
|
+
createMistral as _createMistral,
|
|
4
|
+
} from "@ai-sdk/mistral";
|
|
5
|
+
import { registerEmbeddingProvider } from "@kernl-sdk/retrieval";
|
|
6
|
+
|
|
7
|
+
import { AISDKLanguageModel } from "../language-model";
|
|
8
|
+
import { AISDKEmbeddingModel } from "../embedding-model";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Mistral model IDs (derived from @ai-sdk/mistral).
|
|
12
|
+
*/
|
|
13
|
+
export type MistralModelId = Parameters<typeof _mistral>[0];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Options for creating a custom Mistral provider.
|
|
17
|
+
*/
|
|
18
|
+
export interface MistralProviderOptions {
|
|
19
|
+
/** API key for authentication */
|
|
20
|
+
apiKey?: string;
|
|
21
|
+
/** Custom base URL */
|
|
22
|
+
baseURL?: string;
|
|
23
|
+
/** Custom headers */
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Create a custom Mistral provider with explicit credentials.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const mistral = createMistral({ apiKey: "..." });
|
|
33
|
+
* const model = mistral("mistral-large-latest");
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export function createMistral(options: MistralProviderOptions = {}) {
|
|
37
|
+
const provider = _createMistral({
|
|
38
|
+
apiKey: options.apiKey,
|
|
39
|
+
baseURL: options.baseURL,
|
|
40
|
+
headers: options.headers,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return (modelId: MistralModelId) => new AISDKLanguageModel(provider(modelId));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Create a kernl-compatible Mistral language model.
|
|
48
|
+
* Uses MISTRAL_API_KEY environment variable.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { mistral } from '@kernl-sdk/ai/mistral';
|
|
53
|
+
*
|
|
54
|
+
* const model = mistral('mistral-large-latest');
|
|
55
|
+
* const response = await model.generate([...], {});
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export function mistral(modelId: MistralModelId) {
|
|
59
|
+
const model = _mistral(modelId);
|
|
60
|
+
return new AISDKLanguageModel(model);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Auto-register Mistral embedding provider
|
|
64
|
+
registerEmbeddingProvider(
|
|
65
|
+
"mistral",
|
|
66
|
+
(id) => new AISDKEmbeddingModel(_mistral.embedding(id)),
|
|
67
|
+
);
|