@langchain/openai 0.1.2 → 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.
@@ -532,6 +532,7 @@ class ChatOpenAI extends chat_models_1.BaseChatModel {
532
532
  ...(options?.stream_options !== undefined
533
533
  ? { stream_options: options.stream_options }
534
534
  : {}),
535
+ parallel_tool_calls: options?.parallel_tool_calls,
535
536
  ...this.modelKwargs,
536
537
  };
537
538
  return params;
@@ -27,9 +27,22 @@ export interface ChatOpenAICallOptions extends OpenAICallOptions, BaseFunctionCa
27
27
  type: "json_object";
28
28
  };
29
29
  seed?: number;
30
+ /**
31
+ * Additional options to pass to streamed completions.
32
+ */
30
33
  stream_options?: {
34
+ /**
35
+ * Whether or not to include token usage in the stream.
36
+ * If set to `true`, this will include an additional
37
+ * chunk at the end of the stream with the token usage.
38
+ */
31
39
  include_usage: boolean;
32
40
  };
41
+ /**
42
+ * Whether or not to restrict the ability to
43
+ * call multiple tools in one response.
44
+ */
45
+ parallel_tool_calls?: boolean;
33
46
  }
34
47
  /**
35
48
  * Wrapper around OpenAI large language models that use the Chat endpoint.
@@ -528,6 +528,7 @@ export class ChatOpenAI extends BaseChatModel {
528
528
  ...(options?.stream_options !== undefined
529
529
  ? { stream_options: options.stream_options }
530
530
  : {}),
531
+ parallel_tool_calls: options?.parallel_tool_calls,
531
532
  ...this.modelKwargs,
532
533
  };
533
534
  return params;
package/dist/legacy.cjs CHANGED
@@ -227,7 +227,9 @@ class OpenAIChat extends llms_1.LLM {
227
227
  value: void 0
228
228
  });
229
229
  this.openAIApiKey =
230
- fields?.openAIApiKey ?? (0, env_1.getEnvironmentVariable)("OPENAI_API_KEY");
230
+ fields?.apiKey ??
231
+ fields?.openAIApiKey ??
232
+ (0, env_1.getEnvironmentVariable)("OPENAI_API_KEY");
231
233
  this.azureOpenAIApiKey =
232
234
  fields?.azureOpenAIApiKey ??
233
235
  (0, env_1.getEnvironmentVariable)("AZURE_OPENAI_API_KEY");
package/dist/legacy.js CHANGED
@@ -224,7 +224,9 @@ export class OpenAIChat extends LLM {
224
224
  value: void 0
225
225
  });
226
226
  this.openAIApiKey =
227
- fields?.openAIApiKey ?? getEnvironmentVariable("OPENAI_API_KEY");
227
+ fields?.apiKey ??
228
+ fields?.openAIApiKey ??
229
+ getEnvironmentVariable("OPENAI_API_KEY");
228
230
  this.azureOpenAIApiKey =
229
231
  fields?.azureOpenAIApiKey ??
230
232
  getEnvironmentVariable("AZURE_OPENAI_API_KEY");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/openai",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@langchain/core": ">=0.2.5 <0.3.0",
39
39
  "js-tiktoken": "^1.0.12",
40
- "openai": "^4.41.1",
40
+ "openai": "^4.49.1",
41
41
  "zod": "^3.22.4",
42
42
  "zod-to-json-schema": "^3.22.3"
43
43
  },
@@ -45,7 +45,7 @@
45
45
  "@azure/identity": "^4.2.0",
46
46
  "@jest/globals": "^29.5.0",
47
47
  "@langchain/scripts": "~0.0.14",
48
- "@langchain/standard-tests": "workspace:*",
48
+ "@langchain/standard-tests": "0.0.0",
49
49
  "@swc/core": "^1.3.90",
50
50
  "@swc/jest": "^0.2.29",
51
51
  "dpdm": "^3.12.0",
@@ -61,6 +61,7 @@
61
61
  "prettier": "^2.8.3",
62
62
  "release-it": "^15.10.1",
63
63
  "rimraf": "^5.0.1",
64
+ "ts-jest": "^29.1.0",
64
65
  "typescript": "~5.1.6"
65
66
  },
66
67
  "publishConfig": {