langchain 0.3.31 → 0.3.33
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.
|
@@ -149,9 +149,10 @@ function convertOpenAPISchemaToJSONSchema(schema, spec) {
|
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
if (schema.type === "array") {
|
|
152
|
+
const openAPIItems = spec.getSchema(schema.items) ?? {};
|
|
152
153
|
return {
|
|
153
154
|
type: "array",
|
|
154
|
-
items: convertOpenAPISchemaToJSONSchema(
|
|
155
|
+
items: convertOpenAPISchemaToJSONSchema(openAPIItems, spec),
|
|
155
156
|
minItems: schema.minItems,
|
|
156
157
|
maxItems: schema.maxItems,
|
|
157
158
|
};
|
|
@@ -144,9 +144,10 @@ export function convertOpenAPISchemaToJSONSchema(schema, spec) {
|
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
if (schema.type === "array") {
|
|
147
|
+
const openAPIItems = spec.getSchema(schema.items) ?? {};
|
|
147
148
|
return {
|
|
148
149
|
type: "array",
|
|
149
|
-
items: convertOpenAPISchemaToJSONSchema(
|
|
150
|
+
items: convertOpenAPISchemaToJSONSchema(openAPIItems, spec),
|
|
150
151
|
minItems: schema.minItems,
|
|
151
152
|
maxItems: schema.maxItems,
|
|
152
153
|
};
|
package/dist/hub/node.cjs
CHANGED
|
@@ -38,6 +38,27 @@ exports.pull = pull;
|
|
|
38
38
|
const base_js_1 = require("./base.cjs");
|
|
39
39
|
Object.defineProperty(exports, "push", { enumerable: true, get: function () { return base_js_1.basePush; } });
|
|
40
40
|
const index_js_1 = require("../load/index.cjs");
|
|
41
|
+
function _idEquals(a, b) {
|
|
42
|
+
if (!Array.isArray(a) || !Array.isArray(b)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
if (a.length !== b.length) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
for (let i = 0; i < a.length; i++) {
|
|
49
|
+
if (a[i] !== b[i]) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
function isRunnableBinding(a) {
|
|
56
|
+
const wellKnownIds = [
|
|
57
|
+
["langchain_core", "runnables", "RunnableBinding"],
|
|
58
|
+
["langchain", "schema", "runnable", "RunnableBinding"],
|
|
59
|
+
];
|
|
60
|
+
return wellKnownIds.some((id) => _idEquals(a, id));
|
|
61
|
+
}
|
|
41
62
|
/**
|
|
42
63
|
* Pull a prompt from the hub.
|
|
43
64
|
* @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.
|
|
@@ -52,8 +73,11 @@ async function pull(ownerRepoCommit, options) {
|
|
|
52
73
|
const promptObject = await (0, base_js_1.basePull)(ownerRepoCommit, options);
|
|
53
74
|
let modelClass;
|
|
54
75
|
if (options?.includeModel) {
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
const chatModelObject = isRunnableBinding(promptObject.manifest.kwargs?.last?.id)
|
|
77
|
+
? promptObject.manifest.kwargs?.last?.kwargs?.bound
|
|
78
|
+
: promptObject.manifest.kwargs?.last;
|
|
79
|
+
if (Array.isArray(chatModelObject?.id)) {
|
|
80
|
+
const modelName = chatModelObject?.id.at(-1);
|
|
57
81
|
if (modelName === "ChatOpenAI") {
|
|
58
82
|
modelClass = (await Promise.resolve().then(() => __importStar(require("@langchain/openai")))).ChatOpenAI;
|
|
59
83
|
}
|
package/dist/hub/node.js
CHANGED
|
@@ -2,6 +2,27 @@ import { basePush, basePull, generateModelImportMap, generateOptionalImportMap,
|
|
|
2
2
|
import { load } from "../load/index.js";
|
|
3
3
|
// TODO: Make this the default, add web entrypoint in next breaking release
|
|
4
4
|
export { basePush as push };
|
|
5
|
+
function _idEquals(a, b) {
|
|
6
|
+
if (!Array.isArray(a) || !Array.isArray(b)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (a.length !== b.length) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
for (let i = 0; i < a.length; i++) {
|
|
13
|
+
if (a[i] !== b[i]) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
function isRunnableBinding(a) {
|
|
20
|
+
const wellKnownIds = [
|
|
21
|
+
["langchain_core", "runnables", "RunnableBinding"],
|
|
22
|
+
["langchain", "schema", "runnable", "RunnableBinding"],
|
|
23
|
+
];
|
|
24
|
+
return wellKnownIds.some((id) => _idEquals(a, id));
|
|
25
|
+
}
|
|
5
26
|
/**
|
|
6
27
|
* Pull a prompt from the hub.
|
|
7
28
|
* @param ownerRepoCommit The name of the repo containing the prompt, as well as an optional commit hash separated by a slash.
|
|
@@ -16,8 +37,11 @@ export async function pull(ownerRepoCommit, options) {
|
|
|
16
37
|
const promptObject = await basePull(ownerRepoCommit, options);
|
|
17
38
|
let modelClass;
|
|
18
39
|
if (options?.includeModel) {
|
|
19
|
-
|
|
20
|
-
|
|
40
|
+
const chatModelObject = isRunnableBinding(promptObject.manifest.kwargs?.last?.id)
|
|
41
|
+
? promptObject.manifest.kwargs?.last?.kwargs?.bound
|
|
42
|
+
: promptObject.manifest.kwargs?.last;
|
|
43
|
+
if (Array.isArray(chatModelObject?.id)) {
|
|
44
|
+
const modelName = chatModelObject?.id.at(-1);
|
|
21
45
|
if (modelName === "ChatOpenAI") {
|
|
22
46
|
modelClass = (await import("@langchain/openai")).ChatOpenAI;
|
|
23
47
|
}
|