@langchain/openai 0.5.14 → 0.5.15
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/utils/tools.cjs +1 -17
- package/dist/utils/tools.js +1 -17
- package/package.json +1 -1
package/dist/utils/tools.cjs
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports._convertToOpenAITool = _convertToOpenAITool;
|
|
4
4
|
const function_calling_1 = require("@langchain/core/utils/function_calling");
|
|
5
|
-
const types_1 = require("@langchain/core/utils/types");
|
|
6
|
-
const zod_1 = require("openai/helpers/zod");
|
|
7
5
|
const openai_js_1 = require("./openai.cjs");
|
|
8
6
|
/**
|
|
9
7
|
* Formats a tool in either OpenAI format, or LangChain structured tool format
|
|
@@ -21,21 +19,7 @@ function _convertToOpenAITool(
|
|
|
21
19
|
tool, fields) {
|
|
22
20
|
let toolDef;
|
|
23
21
|
if ((0, function_calling_1.isLangChainTool)(tool)) {
|
|
24
|
-
|
|
25
|
-
// since their json schema standard is not always compatible with
|
|
26
|
-
// the schemas produced by zod. Ideally, we should be using the
|
|
27
|
-
// `zodFunction` util always, but that can only happen when OpenAI
|
|
28
|
-
// supports zod v4.
|
|
29
|
-
if ((0, types_1.isZodSchemaV3)(tool.schema)) {
|
|
30
|
-
toolDef = (0, zod_1.zodFunction)({
|
|
31
|
-
name: tool.name,
|
|
32
|
-
parameters: tool.schema,
|
|
33
|
-
description: tool.description,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
toolDef = (0, openai_js_1.formatToOpenAITool)(tool);
|
|
38
|
-
}
|
|
22
|
+
toolDef = (0, openai_js_1.formatToOpenAITool)(tool);
|
|
39
23
|
}
|
|
40
24
|
else {
|
|
41
25
|
toolDef = tool;
|
package/dist/utils/tools.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { isLangChainTool } from "@langchain/core/utils/function_calling";
|
|
2
|
-
import { isZodSchemaV3 } from "@langchain/core/utils/types";
|
|
3
|
-
import { zodFunction } from "openai/helpers/zod";
|
|
4
2
|
import { formatToOpenAITool } from "./openai.js";
|
|
5
3
|
/**
|
|
6
4
|
* Formats a tool in either OpenAI format, or LangChain structured tool format
|
|
@@ -18,21 +16,7 @@ export function _convertToOpenAITool(
|
|
|
18
16
|
tool, fields) {
|
|
19
17
|
let toolDef;
|
|
20
18
|
if (isLangChainTool(tool)) {
|
|
21
|
-
|
|
22
|
-
// since their json schema standard is not always compatible with
|
|
23
|
-
// the schemas produced by zod. Ideally, we should be using the
|
|
24
|
-
// `zodFunction` util always, but that can only happen when OpenAI
|
|
25
|
-
// supports zod v4.
|
|
26
|
-
if (isZodSchemaV3(tool.schema)) {
|
|
27
|
-
toolDef = zodFunction({
|
|
28
|
-
name: tool.name,
|
|
29
|
-
parameters: tool.schema,
|
|
30
|
-
description: tool.description,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
toolDef = formatToOpenAITool(tool);
|
|
35
|
-
}
|
|
19
|
+
toolDef = formatToOpenAITool(tool);
|
|
36
20
|
}
|
|
37
21
|
else {
|
|
38
22
|
toolDef = tool;
|