la-machina-engine 0.7.1 → 0.7.2
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/README.md +264 -23
- package/dist/index.cjs +8 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1873,6 +1873,10 @@ function toAISdkTools(tools) {
|
|
|
1873
1873
|
}
|
|
1874
1874
|
|
|
1875
1875
|
// src/model/aiSdkAdapter.ts
|
|
1876
|
+
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
1877
|
+
import { createOpenAI } from "@ai-sdk/openai";
|
|
1878
|
+
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
1879
|
+
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
1876
1880
|
var AISdkAdapter = class {
|
|
1877
1881
|
options;
|
|
1878
1882
|
model = null;
|
|
@@ -1933,23 +1937,18 @@ var AISdkAdapter = class {
|
|
|
1933
1937
|
async getModel() {
|
|
1934
1938
|
if (this.model !== null) return this.model;
|
|
1935
1939
|
const { provider, modelId, apiKey, baseURL } = this.options;
|
|
1936
|
-
let mod;
|
|
1937
1940
|
switch (provider) {
|
|
1938
1941
|
case "anthropic":
|
|
1939
|
-
|
|
1940
|
-
this.model = mod.createAnthropic({ apiKey })(modelId);
|
|
1942
|
+
this.model = createAnthropic({ apiKey })(modelId);
|
|
1941
1943
|
break;
|
|
1942
1944
|
case "openai":
|
|
1943
|
-
|
|
1944
|
-
this.model = mod.createOpenAI({ apiKey, ...baseURL ? { baseURL } : {} })(modelId);
|
|
1945
|
+
this.model = createOpenAI({ apiKey, ...baseURL ? { baseURL } : {} })(modelId);
|
|
1945
1946
|
break;
|
|
1946
1947
|
case "google":
|
|
1947
|
-
|
|
1948
|
-
this.model = mod.createGoogleGenerativeAI({ apiKey })(modelId);
|
|
1948
|
+
this.model = createGoogleGenerativeAI({ apiKey })(modelId);
|
|
1949
1949
|
break;
|
|
1950
1950
|
case "openai-compatible":
|
|
1951
|
-
|
|
1952
|
-
this.model = mod.createOpenAICompatible({ name: "custom", apiKey, baseURL: baseURL ?? "" })(
|
|
1951
|
+
this.model = createOpenAICompatible({ name: "custom", apiKey, baseURL: baseURL ?? "" })(
|
|
1953
1952
|
modelId
|
|
1954
1953
|
);
|
|
1955
1954
|
break;
|
|
@@ -1971,13 +1970,6 @@ function mapFinishReason(reason) {
|
|
|
1971
1970
|
return "end_turn";
|
|
1972
1971
|
}
|
|
1973
1972
|
}
|
|
1974
|
-
async function importOrThrow(pkg, provider) {
|
|
1975
|
-
try {
|
|
1976
|
-
return await import(pkg);
|
|
1977
|
-
} catch {
|
|
1978
|
-
throw new Error(`Provider "${provider}" requires "${pkg}". Install: npm i ${pkg}`);
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
1973
|
|
|
1982
1974
|
// src/model/factory.ts
|
|
1983
1975
|
function createModelAdapter(config, options = {}) {
|