@langchain/openai 1.6.1 → 1.6.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.
Files changed (183) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/azure/chat_models/common.d.cts +1 -2
  3. package/dist/azure/chat_models/common.d.cts.map +1 -1
  4. package/dist/azure/chat_models/common.d.ts +1 -2
  5. package/dist/azure/chat_models/common.d.ts.map +1 -1
  6. package/dist/azure/chat_models/completions.d.cts +1 -2
  7. package/dist/azure/chat_models/completions.d.cts.map +1 -1
  8. package/dist/azure/chat_models/completions.d.ts +1 -2
  9. package/dist/azure/chat_models/completions.d.ts.map +1 -1
  10. package/dist/azure/chat_models/index.cjs +5 -0
  11. package/dist/azure/chat_models/index.cjs.map +1 -1
  12. package/dist/azure/chat_models/index.d.cts +3 -2
  13. package/dist/azure/chat_models/index.d.cts.map +1 -1
  14. package/dist/azure/chat_models/index.d.ts +3 -2
  15. package/dist/azure/chat_models/index.d.ts.map +1 -1
  16. package/dist/azure/chat_models/index.js +5 -0
  17. package/dist/azure/chat_models/index.js.map +1 -1
  18. package/dist/azure/chat_models/responses.cjs +5 -0
  19. package/dist/azure/chat_models/responses.cjs.map +1 -1
  20. package/dist/azure/chat_models/responses.d.cts +3 -2
  21. package/dist/azure/chat_models/responses.d.cts.map +1 -1
  22. package/dist/azure/chat_models/responses.d.ts +3 -2
  23. package/dist/azure/chat_models/responses.d.ts.map +1 -1
  24. package/dist/azure/chat_models/responses.js +5 -0
  25. package/dist/azure/chat_models/responses.js.map +1 -1
  26. package/dist/azure/embeddings.d.cts +1 -2
  27. package/dist/azure/embeddings.d.cts.map +1 -1
  28. package/dist/azure/embeddings.d.ts +1 -2
  29. package/dist/azure/embeddings.d.ts.map +1 -1
  30. package/dist/azure/llms.d.cts +1 -2
  31. package/dist/azure/llms.d.cts.map +1 -1
  32. package/dist/azure/llms.d.ts.map +1 -1
  33. package/dist/chat_models/base.cjs +1 -1
  34. package/dist/chat_models/base.d.cts +4 -4
  35. package/dist/chat_models/base.d.cts.map +1 -1
  36. package/dist/chat_models/base.d.ts +4 -4
  37. package/dist/chat_models/base.d.ts.map +1 -1
  38. package/dist/chat_models/base.js +1 -1
  39. package/dist/chat_models/completions.cjs +2 -2
  40. package/dist/chat_models/completions.cjs.map +1 -1
  41. package/dist/chat_models/completions.d.cts +2 -3
  42. package/dist/chat_models/completions.d.cts.map +1 -1
  43. package/dist/chat_models/completions.d.ts +2 -3
  44. package/dist/chat_models/completions.d.ts.map +1 -1
  45. package/dist/chat_models/completions.js +2 -2
  46. package/dist/chat_models/completions.js.map +1 -1
  47. package/dist/chat_models/index.cjs +2 -2
  48. package/dist/chat_models/index.cjs.map +1 -1
  49. package/dist/chat_models/index.d.cts +4 -4
  50. package/dist/chat_models/index.d.cts.map +1 -1
  51. package/dist/chat_models/index.d.ts +4 -4
  52. package/dist/chat_models/index.d.ts.map +1 -1
  53. package/dist/chat_models/index.js +2 -2
  54. package/dist/chat_models/index.js.map +1 -1
  55. package/dist/chat_models/profiles.cjs +350 -193
  56. package/dist/chat_models/profiles.cjs.map +1 -1
  57. package/dist/chat_models/profiles.js +350 -193
  58. package/dist/chat_models/profiles.js.map +1 -1
  59. package/dist/chat_models/responses.cjs +2 -2
  60. package/dist/chat_models/responses.cjs.map +1 -1
  61. package/dist/chat_models/responses.d.cts +3 -4
  62. package/dist/chat_models/responses.d.cts.map +1 -1
  63. package/dist/chat_models/responses.d.ts +3 -4
  64. package/dist/chat_models/responses.d.ts.map +1 -1
  65. package/dist/chat_models/responses.js +2 -2
  66. package/dist/chat_models/responses.js.map +1 -1
  67. package/dist/converters/completions.cjs +4 -1
  68. package/dist/converters/completions.cjs.map +1 -1
  69. package/dist/converters/completions.d.cts +6 -7
  70. package/dist/converters/completions.d.cts.map +1 -1
  71. package/dist/converters/completions.d.ts +6 -7
  72. package/dist/converters/completions.d.ts.map +1 -1
  73. package/dist/converters/completions.js +5 -2
  74. package/dist/converters/completions.js.map +1 -1
  75. package/dist/converters/responses.cjs +41 -11
  76. package/dist/converters/responses.cjs.map +1 -1
  77. package/dist/converters/responses.d.cts +11 -12
  78. package/dist/converters/responses.d.cts.map +1 -1
  79. package/dist/converters/responses.d.ts +11 -12
  80. package/dist/converters/responses.d.ts.map +1 -1
  81. package/dist/converters/responses.js +42 -12
  82. package/dist/converters/responses.js.map +1 -1
  83. package/dist/embeddings.d.cts +3 -4
  84. package/dist/embeddings.d.cts.map +1 -1
  85. package/dist/embeddings.d.ts +3 -4
  86. package/dist/embeddings.d.ts.map +1 -1
  87. package/dist/llms.cjs +1 -1
  88. package/dist/llms.d.cts.map +1 -1
  89. package/dist/llms.d.ts.map +1 -1
  90. package/dist/llms.js +1 -1
  91. package/dist/tools/applyPatch.d.cts +8 -9
  92. package/dist/tools/applyPatch.d.cts.map +1 -1
  93. package/dist/tools/applyPatch.d.ts +8 -9
  94. package/dist/tools/applyPatch.d.ts.map +1 -1
  95. package/dist/tools/codeInterpreter.d.cts +5 -6
  96. package/dist/tools/codeInterpreter.d.cts.map +1 -1
  97. package/dist/tools/codeInterpreter.d.ts +5 -6
  98. package/dist/tools/codeInterpreter.d.ts.map +1 -1
  99. package/dist/tools/computerUse.d.cts +17 -18
  100. package/dist/tools/computerUse.d.cts.map +1 -1
  101. package/dist/tools/computerUse.d.ts +17 -18
  102. package/dist/tools/computerUse.d.ts.map +1 -1
  103. package/dist/tools/custom.d.cts +2 -3
  104. package/dist/tools/custom.d.cts.map +1 -1
  105. package/dist/tools/custom.d.ts +2 -3
  106. package/dist/tools/custom.d.ts.map +1 -1
  107. package/dist/tools/dalle.d.cts +3 -4
  108. package/dist/tools/dalle.d.cts.map +1 -1
  109. package/dist/tools/dalle.d.ts +3 -4
  110. package/dist/tools/dalle.d.ts.map +1 -1
  111. package/dist/tools/fileSearch.d.cts +9 -10
  112. package/dist/tools/fileSearch.d.cts.map +1 -1
  113. package/dist/tools/fileSearch.d.ts +9 -10
  114. package/dist/tools/fileSearch.d.ts.map +1 -1
  115. package/dist/tools/imageGeneration.d.cts +4 -5
  116. package/dist/tools/imageGeneration.d.cts.map +1 -1
  117. package/dist/tools/imageGeneration.d.ts +4 -5
  118. package/dist/tools/imageGeneration.d.ts.map +1 -1
  119. package/dist/tools/index.d.cts +2 -2
  120. package/dist/tools/index.d.cts.map +1 -1
  121. package/dist/tools/index.d.ts +2 -2
  122. package/dist/tools/index.d.ts.map +1 -1
  123. package/dist/tools/localShell.d.cts +5 -6
  124. package/dist/tools/localShell.d.cts.map +1 -1
  125. package/dist/tools/localShell.d.ts +5 -6
  126. package/dist/tools/localShell.d.ts.map +1 -1
  127. package/dist/tools/mcp.d.cts +8 -9
  128. package/dist/tools/mcp.d.cts.map +1 -1
  129. package/dist/tools/mcp.d.ts +8 -9
  130. package/dist/tools/mcp.d.ts.map +1 -1
  131. package/dist/tools/shell.d.cts +8 -9
  132. package/dist/tools/shell.d.cts.map +1 -1
  133. package/dist/tools/shell.d.ts +8 -9
  134. package/dist/tools/shell.d.ts.map +1 -1
  135. package/dist/tools/toolSearch.d.cts +3 -4
  136. package/dist/tools/toolSearch.d.cts.map +1 -1
  137. package/dist/tools/toolSearch.d.ts +3 -4
  138. package/dist/tools/toolSearch.d.ts.map +1 -1
  139. package/dist/tools/webSearch.d.cts +5 -6
  140. package/dist/tools/webSearch.d.cts.map +1 -1
  141. package/dist/tools/webSearch.d.ts +5 -6
  142. package/dist/tools/webSearch.d.ts.map +1 -1
  143. package/dist/types.d.cts +16 -16
  144. package/dist/types.d.cts.map +1 -1
  145. package/dist/types.d.ts +16 -16
  146. package/dist/types.d.ts.map +1 -1
  147. package/dist/utils/azure.d.cts +7 -8
  148. package/dist/utils/azure.d.cts.map +1 -1
  149. package/dist/utils/azure.d.ts +7 -8
  150. package/dist/utils/azure.d.ts.map +1 -1
  151. package/dist/utils/client.d.cts +1 -2
  152. package/dist/utils/client.d.cts.map +1 -1
  153. package/dist/utils/client.d.ts +1 -2
  154. package/dist/utils/client.d.ts.map +1 -1
  155. package/dist/utils/misc.cjs +26 -0
  156. package/dist/utils/misc.cjs.map +1 -1
  157. package/dist/utils/misc.d.cts +1 -2
  158. package/dist/utils/misc.d.cts.map +1 -1
  159. package/dist/utils/misc.d.ts +1 -2
  160. package/dist/utils/misc.d.ts.map +1 -1
  161. package/dist/utils/misc.js +26 -2
  162. package/dist/utils/misc.js.map +1 -1
  163. package/dist/utils/profile.cjs +27 -0
  164. package/dist/utils/profile.cjs.map +1 -0
  165. package/dist/utils/profile.js +27 -0
  166. package/dist/utils/profile.js.map +1 -0
  167. package/dist/utils/prompts.d.cts +1 -2
  168. package/dist/utils/prompts.d.cts.map +1 -1
  169. package/dist/utils/prompts.d.ts +1 -2
  170. package/dist/utils/prompts.d.ts.map +1 -1
  171. package/dist/utils/responses_stream_events.d.cts +2 -3
  172. package/dist/utils/responses_stream_events.d.cts.map +1 -1
  173. package/dist/utils/responses_stream_events.d.ts +2 -3
  174. package/dist/utils/responses_stream_events.d.ts.map +1 -1
  175. package/dist/utils/tools.d.cts +4 -5
  176. package/dist/utils/tools.d.cts.map +1 -1
  177. package/dist/utils/tools.d.ts +4 -5
  178. package/dist/utils/tools.d.ts.map +1 -1
  179. package/package.json +8 -8
  180. package/dist/utils/file_mime_types.cjs +0 -15
  181. package/dist/utils/file_mime_types.cjs.map +0 -1
  182. package/dist/utils/file_mime_types.js +0 -15
  183. package/dist/utils/file_mime_types.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","names":[],"sources":["../../src/tools/shell.ts"],"mappings":";;;;;;;;KAQY,cACV,OAAa,UAAU,8BAA8B;cAG1C,mBAAiB,EAAA;;;;GAY5B,EAAA,KAAA;;;;;KAMU,qBACV,OAAa,UAAU;;;;KAKb,mBAAmB;;;;;UAMd;;;;;EAKf,QAAQ;;;;;EAKR;;;;;UAMe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCf,UAAU,QAAQ,gBAAgB,cAAc,QAAQ;;;;;KAM9C,YAAY,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqI/B,MAAM,SAAS,eAyBT,6BACX,mBACP"}
1
+ {"version":3,"file":"shell.d.ts","names":["OpenAIClient"],"sources":["../../src/tools/shell.ts"],"mappings":";;;;;;;;YAQY,cACVA,OAAa,UAAU,8BAA8B;qBAG1C,mBAAiB,EAAA;;;;GAY5B,EAAA,KAAA;;;;;YAMU,qBACVA,OAAa,UAAU;;;;YAKb,mBAAmB;;;;;iBAMd;;;;;EAKf,QAAQ;;;;;EAKR;;;;;iBAMe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCf,UAAU,QAAQ,gBAAgB,cAAc,QAAQ;;;;;YAM9C,YAAYA,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqI/B,MAAM,SAAS,eAyBT,6BACX,mBACP"}
@@ -1,7 +1,7 @@
1
1
  import { OpenAI } from "openai";
2
2
  import { ServerTool } from "@langchain/core/tools";
3
3
  //#region src/tools/toolSearch.d.ts
4
- interface ToolSearchOptions {
4
+ export interface ToolSearchOptions {
5
5
  /**
6
6
  * Whether tool search is executed by the server or by the client.
7
7
  * - `"server"` (default): OpenAI's servers handle the search internally.
@@ -17,7 +17,7 @@ interface ToolSearchOptions {
17
17
  */
18
18
  parameters?: unknown;
19
19
  }
20
- type ToolSearchTool = OpenAI.Responses.ToolSearchTool;
20
+ export type ToolSearchTool = OpenAI.Responses.ToolSearchTool;
21
21
  /**
22
22
  * Creates a tool search tool that enables OpenAI models to dynamically discover
23
23
  * and load tools on-demand from a large pool, rather than requiring all tool
@@ -72,7 +72,6 @@ type ToolSearchTool = OpenAI.Responses.ToolSearchTool;
72
72
  * });
73
73
  * ```
74
74
  */
75
- declare function toolSearch(options?: ToolSearchOptions): ServerTool;
75
+ export declare function toolSearch(options?: ToolSearchOptions): ServerTool;
76
76
  //#endregion
77
- export { ToolSearchOptions, ToolSearchTool, toolSearch };
78
77
  //# sourceMappingURL=toolSearch.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolSearch.d.cts","names":[],"sources":["../../src/tools/toolSearch.ts"],"mappings":";;;UAGiB;;;;;;EAMf;;;;EAIA;;;;EAIA;;KAGU,iBAAiB,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwDpC,WAAW,UAAU,oBAAoB"}
1
+ {"version":3,"file":"toolSearch.d.cts","names":["OpenAIClient"],"sources":["../../src/tools/toolSearch.ts"],"mappings":";;;iBAGiB;;;;;;EAMf;;;;EAIA;;;;EAIA;;YAGU,iBAAiBA,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDpC,WAAW,UAAU,oBAAoB"}
@@ -1,7 +1,7 @@
1
1
  import { OpenAI } from "openai";
2
2
  import { ServerTool } from "@langchain/core/tools";
3
3
  //#region src/tools/toolSearch.d.ts
4
- interface ToolSearchOptions {
4
+ export interface ToolSearchOptions {
5
5
  /**
6
6
  * Whether tool search is executed by the server or by the client.
7
7
  * - `"server"` (default): OpenAI's servers handle the search internally.
@@ -17,7 +17,7 @@ interface ToolSearchOptions {
17
17
  */
18
18
  parameters?: unknown;
19
19
  }
20
- type ToolSearchTool = OpenAI.Responses.ToolSearchTool;
20
+ export type ToolSearchTool = OpenAI.Responses.ToolSearchTool;
21
21
  /**
22
22
  * Creates a tool search tool that enables OpenAI models to dynamically discover
23
23
  * and load tools on-demand from a large pool, rather than requiring all tool
@@ -72,7 +72,6 @@ type ToolSearchTool = OpenAI.Responses.ToolSearchTool;
72
72
  * });
73
73
  * ```
74
74
  */
75
- declare function toolSearch(options?: ToolSearchOptions): ServerTool;
75
+ export declare function toolSearch(options?: ToolSearchOptions): ServerTool;
76
76
  //#endregion
77
- export { ToolSearchOptions, ToolSearchTool, toolSearch };
78
77
  //# sourceMappingURL=toolSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolSearch.d.ts","names":[],"sources":["../../src/tools/toolSearch.ts"],"mappings":";;;UAGiB;;;;;;EAMf;;;;EAIA;;;;EAIA;;KAGU,iBAAiB,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwDpC,WAAW,UAAU,oBAAoB"}
1
+ {"version":3,"file":"toolSearch.d.ts","names":["OpenAIClient"],"sources":["../../src/tools/toolSearch.ts"],"mappings":";;;iBAGiB;;;;;;EAMf;;;;EAIA;;;;EAIA;;YAGU,iBAAiBA,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwDpC,WAAW,UAAU,oBAAoB"}
@@ -4,7 +4,7 @@ import { ServerTool } from "@langchain/core/tools";
4
4
  /**
5
5
  * User location configuration for geographic search refinement.
6
6
  */
7
- interface WebSearchUserLocation {
7
+ export interface WebSearchUserLocation {
8
8
  /**
9
9
  * The type of location. Currently only "approximate" is supported.
10
10
  */
@@ -31,7 +31,7 @@ interface WebSearchUserLocation {
31
31
  /**
32
32
  * Domain filtering configuration for web search.
33
33
  */
34
- interface WebSearchFilters {
34
+ export interface WebSearchFilters {
35
35
  /**
36
36
  * Allow-list of up to 100 domains to limit search results.
37
37
  * Omit the HTTP/HTTPS prefix (e.g., "openai.com" instead of "https://openai.com/").
@@ -42,7 +42,7 @@ interface WebSearchFilters {
42
42
  /**
43
43
  * Options for the OpenAI web search tool.
44
44
  */
45
- interface WebSearchOptions {
45
+ export interface WebSearchOptions {
46
46
  /**
47
47
  * Domain filtering configuration.
48
48
  * Limit results to a specific set of up to 100 domains.
@@ -62,7 +62,7 @@ interface WebSearchOptions {
62
62
  /**
63
63
  * OpenAI web search tool type for the Responses API.
64
64
  */
65
- type WebSearchTool = OpenAI.Responses.WebSearchTool;
65
+ export type WebSearchTool = OpenAI.Responses.WebSearchTool;
66
66
  /**
67
67
  * Creates a web search tool that allows OpenAI models to search the web
68
68
  * for up-to-date information before generating a response.
@@ -122,7 +122,6 @@ type WebSearchTool = OpenAI.Responses.WebSearchTool;
122
122
  * });
123
123
  * ```
124
124
  */
125
- declare function webSearch(options?: WebSearchOptions): ServerTool;
125
+ export declare function webSearch(options?: WebSearchOptions): ServerTool;
126
126
  //#endregion
127
- export { WebSearchFilters, WebSearchOptions, WebSearchTool, WebSearchUserLocation, webSearch };
128
127
  //# sourceMappingURL=webSearch.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webSearch.d.cts","names":[],"sources":["../../src/tools/webSearch.ts"],"mappings":";;;;;;UAMiB;;;;EAIf;;;;;EAKA;;;;EAIA;;;;EAIA;;;;;EAKA;;;;;UAMe;;;;;;EAMf;;;;;UAMe;;;;;EAKf,UAAU;;;;;EAKV,eAAe;;;;;EAKf;;;;;KAMU,gBAAgB,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DnC,UAAU,UAAU,mBAAmB"}
1
+ {"version":3,"file":"webSearch.d.cts","names":["OpenAIClient"],"sources":["../../src/tools/webSearch.ts"],"mappings":";;;;;;iBAMiB;;;;EAIf;;;;;EAKA;;;;EAIA;;;;EAIA;;;;;EAKA;;;;;iBAMe;;;;;;EAMf;;;;;iBAMe;;;;;EAKf,UAAU;;;;;EAKV,eAAe;;;;;EAKf;;;;;YAMU,gBAAgBA,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6DnC,UAAU,UAAU,mBAAmB"}
@@ -4,7 +4,7 @@ import { ServerTool } from "@langchain/core/tools";
4
4
  /**
5
5
  * User location configuration for geographic search refinement.
6
6
  */
7
- interface WebSearchUserLocation {
7
+ export interface WebSearchUserLocation {
8
8
  /**
9
9
  * The type of location. Currently only "approximate" is supported.
10
10
  */
@@ -31,7 +31,7 @@ interface WebSearchUserLocation {
31
31
  /**
32
32
  * Domain filtering configuration for web search.
33
33
  */
34
- interface WebSearchFilters {
34
+ export interface WebSearchFilters {
35
35
  /**
36
36
  * Allow-list of up to 100 domains to limit search results.
37
37
  * Omit the HTTP/HTTPS prefix (e.g., "openai.com" instead of "https://openai.com/").
@@ -42,7 +42,7 @@ interface WebSearchFilters {
42
42
  /**
43
43
  * Options for the OpenAI web search tool.
44
44
  */
45
- interface WebSearchOptions {
45
+ export interface WebSearchOptions {
46
46
  /**
47
47
  * Domain filtering configuration.
48
48
  * Limit results to a specific set of up to 100 domains.
@@ -62,7 +62,7 @@ interface WebSearchOptions {
62
62
  /**
63
63
  * OpenAI web search tool type for the Responses API.
64
64
  */
65
- type WebSearchTool = OpenAI.Responses.WebSearchTool;
65
+ export type WebSearchTool = OpenAI.Responses.WebSearchTool;
66
66
  /**
67
67
  * Creates a web search tool that allows OpenAI models to search the web
68
68
  * for up-to-date information before generating a response.
@@ -122,7 +122,6 @@ type WebSearchTool = OpenAI.Responses.WebSearchTool;
122
122
  * });
123
123
  * ```
124
124
  */
125
- declare function webSearch(options?: WebSearchOptions): ServerTool;
125
+ export declare function webSearch(options?: WebSearchOptions): ServerTool;
126
126
  //#endregion
127
- export { WebSearchFilters, WebSearchOptions, WebSearchTool, WebSearchUserLocation, webSearch };
128
127
  //# sourceMappingURL=webSearch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webSearch.d.ts","names":[],"sources":["../../src/tools/webSearch.ts"],"mappings":";;;;;;UAMiB;;;;EAIf;;;;;EAKA;;;;EAIA;;;;EAIA;;;;;EAKA;;;;;UAMe;;;;;;EAMf;;;;;UAMe;;;;;EAKf,UAAU;;;;;EAKV,eAAe;;;;;EAKf;;;;;KAMU,gBAAgB,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6DnC,UAAU,UAAU,mBAAmB"}
1
+ {"version":3,"file":"webSearch.d.ts","names":["OpenAIClient"],"sources":["../../src/tools/webSearch.ts"],"mappings":";;;;;;iBAMiB;;;;EAIf;;;;;EAKA;;;;EAIA;;;;EAIA;;;;;EAKA;;;;;iBAMe;;;;;;EAMf;;;;;iBAMe;;;;;EAKf,UAAU;;;;;EAKV,eAAe;;;;;EAKf;;;;;YAMU,gBAAgBA,OAAa,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6DnC,UAAU,UAAU,mBAAmB"}
package/dist/types.d.cts CHANGED
@@ -7,12 +7,12 @@ import { TiktokenModel } from "js-tiktoken/lite";
7
7
  /**
8
8
  * @see https://platform.openai.com/docs/models
9
9
  */
10
- type OpenAIChatModelId = OpenAI.ChatModel | (string & NonNullable<unknown>);
11
- type OpenAIVerbosityParam = "low" | "medium" | "high" | null;
12
- type OpenAICacheRetentionParam = "in_memory" | "in-memory" | "24h" | null;
13
- type OpenAIPromptCacheOptions = OpenAI.Responses.ResponseCreateParams["prompt_cache_options"];
14
- type OpenAIApiKey = ClientOptions["apiKey"];
15
- declare interface OpenAIBaseInput {
10
+ export type OpenAIChatModelId = OpenAI.ChatModel | (string & NonNullable<unknown>);
11
+ export type OpenAIVerbosityParam = "low" | "medium" | "high" | null;
12
+ export type OpenAICacheRetentionParam = "in_memory" | "in-memory" | "24h" | null;
13
+ export type OpenAIPromptCacheOptions = OpenAI.Responses.ResponseCreateParams["prompt_cache_options"];
14
+ export type OpenAIApiKey = ClientOptions["apiKey"];
15
+ export declare interface OpenAIBaseInput {
16
16
  /** Sampling temperature to use */
17
17
  temperature: number;
18
18
  /**
@@ -85,8 +85,8 @@ declare interface OpenAIBaseInput {
85
85
  */
86
86
  verbosity?: OpenAIVerbosityParam;
87
87
  }
88
- type OpenAICoreRequestOptions = OpenAI.RequestOptions;
89
- interface OpenAICallOptions extends BaseLanguageModelCallOptions {
88
+ export type OpenAICoreRequestOptions = OpenAI.RequestOptions;
89
+ export interface OpenAICallOptions extends BaseLanguageModelCallOptions {
90
90
  /**
91
91
  * Additional options to pass to the underlying axios request.
92
92
  */
@@ -95,13 +95,13 @@ interface OpenAICallOptions extends BaseLanguageModelCallOptions {
95
95
  /**
96
96
  * Input to OpenAI class.
97
97
  */
98
- declare interface OpenAIInput extends OpenAIBaseInput {
98
+ export declare interface OpenAIInput extends OpenAIBaseInput {
99
99
  /** Generates `bestOf` completions server side and returns the "best" */
100
100
  bestOf?: number;
101
101
  /** Batch size to use when passing multiple documents to generate */
102
102
  batchSize: number;
103
103
  }
104
- interface OpenAIChatInput extends OpenAIBaseInput {
104
+ export interface OpenAIChatInput extends OpenAIBaseInput {
105
105
  /**
106
106
  * Whether to return log probabilities of the output tokens or not.
107
107
  * If true, returns the log probabilities of each output token returned in the content of message.
@@ -177,7 +177,7 @@ interface OpenAIChatInput extends OpenAIBaseInput {
177
177
  */
178
178
  promptCacheOptions?: OpenAIPromptCacheOptions;
179
179
  }
180
- interface AzureOpenAIInput {
180
+ export interface AzureOpenAIInput {
181
181
  /**
182
182
  * API version to use when making requests to Azure OpenAI.
183
183
  */
@@ -235,7 +235,7 @@ interface AzureOpenAIInput {
235
235
  */
236
236
  azureADTokenProvider?: () => Promise<string>;
237
237
  }
238
- interface AzureOpenAIChatInput extends OpenAIChatInput, AzureOpenAIInput {
238
+ export interface AzureOpenAIChatInput extends OpenAIChatInput, AzureOpenAIInput {
239
239
  openAIApiVersion?: string;
240
240
  openAIBasePath?: string;
241
241
  deploymentName?: string;
@@ -252,7 +252,7 @@ type ChatOpenAIResponseFormatJSONSchema = Omit<ResponseFormatJSONSchema, "json_s
252
252
  /**
253
253
  * The summary of a model's reasoning step.
254
254
  */
255
- type ChatOpenAIReasoningSummary = Omit<OpenAI.Responses.ResponseReasoningItem, "summary"> & {
255
+ export type ChatOpenAIReasoningSummary = Omit<OpenAI.Responses.ResponseReasoningItem, "summary"> & {
256
256
  /**
257
257
  * The summary of the reasoning step. The index field will be populated if the response was
258
258
  * streamed. This allows LangChain to recompose the reasoning summary output correctly when the
@@ -262,8 +262,8 @@ type ChatOpenAIReasoningSummary = Omit<OpenAI.Responses.ResponseReasoningItem, "
262
262
  index?: number;
263
263
  }>;
264
264
  };
265
- type ChatOpenAIResponseFormat = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatTextGrammar | ResponseFormatTextPython | ChatOpenAIResponseFormatJSONSchema;
266
- type ResponseFormatConfiguration = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatJSONSchema;
265
+ export type ChatOpenAIResponseFormat = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatTextGrammar | ResponseFormatTextPython | ChatOpenAIResponseFormatJSONSchema;
266
+ export type ResponseFormatConfiguration = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatJSONSchema;
267
267
  //#endregion
268
- export { AzureOpenAIChatInput, AzureOpenAIInput, ChatOpenAIReasoningSummary, ChatOpenAIResponseFormat, OpenAIApiKey, OpenAIBaseInput, OpenAICacheRetentionParam, OpenAICallOptions, OpenAIChatInput, OpenAIChatModelId, OpenAICoreRequestOptions, OpenAIInput, OpenAIPromptCacheOptions, OpenAIVerbosityParam, ResponseFormatConfiguration, type TiktokenModel };
268
+ export type { TiktokenModel };
269
269
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;KAoBY,oBACR,OAAa,sBACH;KAEF;KAEA;KAKA,2BACV,OAAa,UAAU;KAEb,eAAe;kBAEF;;EAEvB;;;;;EAMA;;;;;;EAOA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,YAAY;;EAGZ;;EAGA;;;;;EAMA;;;;;;EAOA;;EAGA,OAAO;;;;;EAOP,cAAc;;;;;EAMd;;EAEA;;;;EAKA;;;;;;EAOA,eAAe;;;;;EAKf,SAAS;;;;EAKT,YAAY;;KAGF,2BAA2B,OAAa;UAEnC,0BAA0B;;;;EAIzC,UAAU;;;;;kBAMa,oBAAoB;;EAE3C;;EAGA;;UAGe,wBAAwB;;;;;EAKvC;;;;;EAMA;;EAGA,iBAAiB,OAAa,KAAK;;;;;EAMnC;;;;;EAMA;;;;;;;;;;;;;EAcA,aAAa,MAAM,OAAa,KAAK;;;;;;EAOrC,QAAQ,OAAa,KAAK;;;;;;;EAQ1B,YAAY,OAAa;;;;;;;EAQzB;;;;;EAMA,eAAe,OAAa,UAAU;;;;;;EAOtC;;;;EAKA,uBAAuB;;;;EAKvB,qBAAqB;;UAGN;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;EASA;;;;;;;;;EAUA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,6BAA6B;;UAGd,6BACP,iBAAiB;EACzB;EACA;EACA;;KAGG,qCAAqC,KACxC;EAGA,aAAa,KAAK;;;;;IAMhB,QAAQ,sBAAsB;;;;;;KAOtB,6BAA6B,KACvC,OAAa,UAAU;;;;;;EAQvB,SAAS,MACP,OAAa,UAAU,sBAAsB;IAAY;;;KAIjD,2BACR,qBACA,2BACA,4BACA,2BACA;KAEQ,8BACR,qBACA,2BACA"}
1
+ {"version":3,"file":"types.d.cts","names":["OpenAIClient"],"sources":["../src/types.ts"],"mappings":";;;;;;;;;YAoBY,oBACRA,OAAa,sBACH;YAEF;YAEA;YAKA,2BACVA,OAAa,UAAU;YAEb,eAAe;yBAEF;;EAEvB;;;;;EAMA;;;;;;EAOA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,YAAY;;EAGZ;;EAGA;;;;;EAMA;;;;;;EAOA;;EAGA,OAAO;;;;;EAOP,cAAc;;;;;EAMd;;EAEA;;;;EAKA;;;;;;EAOA,eAAe;;;;;EAKf,SAAS;;;;EAKT,YAAY;;YAGF,2BAA2BA,OAAa;iBAEnC,0BAA0B;;;;EAIzC,UAAU;;;;;yBAMa,oBAAoB;;EAE3C;;EAGA;;iBAGe,wBAAwB;;;;;EAKvC;;;;;EAMA;;EAGA,iBAAiBA,OAAa,KAAK;;;;;EAMnC;;;;;EAMA;;;;;;;;;;;;;EAcA,aAAa,MAAMA,OAAa,KAAK;;;;;;EAOrC,QAAQA,OAAa,KAAK;;;;;;;EAQ1B,YAAYA,OAAa;;;;;;;EAQzB;;;;;EAMA,eAAeA,OAAa,UAAU;;;;;;EAOtC;;;;EAKA,uBAAuB;;;;EAKvB,qBAAqB;;iBAGN;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;EASA;;;;;;;;;EAUA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,6BAA6B;;iBAGd,6BACP,iBAAiB;EACzB;EACA;EACA;;KAGG,qCAAqC,KACxC;EAGA,aAAa,KAAK;;;;;IAMhB,QAAQ,sBAAsB;;;;;;YAOtB,6BAA6B,KACvCA,OAAa,UAAU;;;;;;EAQvB,SAAS,MACPA,OAAa,UAAU,sBAAsB;IAAY;;;YAIjD,2BACR,qBACA,2BACA,4BACA,2BACA;YAEQ,8BACR,qBACA,2BACA"}
package/dist/types.d.ts CHANGED
@@ -7,12 +7,12 @@ import { TiktokenModel } from "js-tiktoken/lite";
7
7
  /**
8
8
  * @see https://platform.openai.com/docs/models
9
9
  */
10
- type OpenAIChatModelId = OpenAI.ChatModel | (string & NonNullable<unknown>);
11
- type OpenAIVerbosityParam = "low" | "medium" | "high" | null;
12
- type OpenAICacheRetentionParam = "in_memory" | "in-memory" | "24h" | null;
13
- type OpenAIPromptCacheOptions = OpenAI.Responses.ResponseCreateParams["prompt_cache_options"];
14
- type OpenAIApiKey = ClientOptions["apiKey"];
15
- declare interface OpenAIBaseInput {
10
+ export type OpenAIChatModelId = OpenAI.ChatModel | (string & NonNullable<unknown>);
11
+ export type OpenAIVerbosityParam = "low" | "medium" | "high" | null;
12
+ export type OpenAICacheRetentionParam = "in_memory" | "in-memory" | "24h" | null;
13
+ export type OpenAIPromptCacheOptions = OpenAI.Responses.ResponseCreateParams["prompt_cache_options"];
14
+ export type OpenAIApiKey = ClientOptions["apiKey"];
15
+ export declare interface OpenAIBaseInput {
16
16
  /** Sampling temperature to use */
17
17
  temperature: number;
18
18
  /**
@@ -85,8 +85,8 @@ declare interface OpenAIBaseInput {
85
85
  */
86
86
  verbosity?: OpenAIVerbosityParam;
87
87
  }
88
- type OpenAICoreRequestOptions = OpenAI.RequestOptions;
89
- interface OpenAICallOptions extends BaseLanguageModelCallOptions {
88
+ export type OpenAICoreRequestOptions = OpenAI.RequestOptions;
89
+ export interface OpenAICallOptions extends BaseLanguageModelCallOptions {
90
90
  /**
91
91
  * Additional options to pass to the underlying axios request.
92
92
  */
@@ -95,13 +95,13 @@ interface OpenAICallOptions extends BaseLanguageModelCallOptions {
95
95
  /**
96
96
  * Input to OpenAI class.
97
97
  */
98
- declare interface OpenAIInput extends OpenAIBaseInput {
98
+ export declare interface OpenAIInput extends OpenAIBaseInput {
99
99
  /** Generates `bestOf` completions server side and returns the "best" */
100
100
  bestOf?: number;
101
101
  /** Batch size to use when passing multiple documents to generate */
102
102
  batchSize: number;
103
103
  }
104
- interface OpenAIChatInput extends OpenAIBaseInput {
104
+ export interface OpenAIChatInput extends OpenAIBaseInput {
105
105
  /**
106
106
  * Whether to return log probabilities of the output tokens or not.
107
107
  * If true, returns the log probabilities of each output token returned in the content of message.
@@ -177,7 +177,7 @@ interface OpenAIChatInput extends OpenAIBaseInput {
177
177
  */
178
178
  promptCacheOptions?: OpenAIPromptCacheOptions;
179
179
  }
180
- interface AzureOpenAIInput {
180
+ export interface AzureOpenAIInput {
181
181
  /**
182
182
  * API version to use when making requests to Azure OpenAI.
183
183
  */
@@ -235,7 +235,7 @@ interface AzureOpenAIInput {
235
235
  */
236
236
  azureADTokenProvider?: () => Promise<string>;
237
237
  }
238
- interface AzureOpenAIChatInput extends OpenAIChatInput, AzureOpenAIInput {
238
+ export interface AzureOpenAIChatInput extends OpenAIChatInput, AzureOpenAIInput {
239
239
  openAIApiVersion?: string;
240
240
  openAIBasePath?: string;
241
241
  deploymentName?: string;
@@ -252,7 +252,7 @@ type ChatOpenAIResponseFormatJSONSchema = Omit<ResponseFormatJSONSchema, "json_s
252
252
  /**
253
253
  * The summary of a model's reasoning step.
254
254
  */
255
- type ChatOpenAIReasoningSummary = Omit<OpenAI.Responses.ResponseReasoningItem, "summary"> & {
255
+ export type ChatOpenAIReasoningSummary = Omit<OpenAI.Responses.ResponseReasoningItem, "summary"> & {
256
256
  /**
257
257
  * The summary of the reasoning step. The index field will be populated if the response was
258
258
  * streamed. This allows LangChain to recompose the reasoning summary output correctly when the
@@ -262,8 +262,8 @@ type ChatOpenAIReasoningSummary = Omit<OpenAI.Responses.ResponseReasoningItem, "
262
262
  index?: number;
263
263
  }>;
264
264
  };
265
- type ChatOpenAIResponseFormat = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatTextGrammar | ResponseFormatTextPython | ChatOpenAIResponseFormatJSONSchema;
266
- type ResponseFormatConfiguration = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatJSONSchema;
265
+ export type ChatOpenAIResponseFormat = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatTextGrammar | ResponseFormatTextPython | ChatOpenAIResponseFormatJSONSchema;
266
+ export type ResponseFormatConfiguration = ResponseFormatText | ResponseFormatJSONObject | ResponseFormatJSONSchema;
267
267
  //#endregion
268
- export { AzureOpenAIChatInput, AzureOpenAIInput, ChatOpenAIReasoningSummary, ChatOpenAIResponseFormat, OpenAIApiKey, OpenAIBaseInput, OpenAICacheRetentionParam, OpenAICallOptions, OpenAIChatInput, OpenAIChatModelId, OpenAICoreRequestOptions, OpenAIInput, OpenAIPromptCacheOptions, OpenAIVerbosityParam, ResponseFormatConfiguration, type TiktokenModel };
268
+ export type { TiktokenModel };
269
269
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;KAoBY,oBACR,OAAa,sBACH;KAEF;KAEA;KAKA,2BACV,OAAa,UAAU;KAEb,eAAe;kBAEF;;EAEvB;;;;;EAMA;;;;;;EAOA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,YAAY;;EAGZ;;EAGA;;;;;EAMA;;;;;;EAOA;;EAGA,OAAO;;;;;EAOP,cAAc;;;;;EAMd;;EAEA;;;;EAKA;;;;;;EAOA,eAAe;;;;;EAKf,SAAS;;;;EAKT,YAAY;;KAGF,2BAA2B,OAAa;UAEnC,0BAA0B;;;;EAIzC,UAAU;;;;;kBAMa,oBAAoB;;EAE3C;;EAGA;;UAGe,wBAAwB;;;;;EAKvC;;;;;EAMA;;EAGA,iBAAiB,OAAa,KAAK;;;;;EAMnC;;;;;EAMA;;;;;;;;;;;;;EAcA,aAAa,MAAM,OAAa,KAAK;;;;;;EAOrC,QAAQ,OAAa,KAAK;;;;;;;EAQ1B,YAAY,OAAa;;;;;;;EAQzB;;;;;EAMA,eAAe,OAAa,UAAU;;;;;;EAOtC;;;;EAKA,uBAAuB;;;;EAKvB,qBAAqB;;UAGN;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;EASA;;;;;;;;;EAUA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,6BAA6B;;UAGd,6BACP,iBAAiB;EACzB;EACA;EACA;;KAGG,qCAAqC,KACxC;EAGA,aAAa,KAAK;;;;;IAMhB,QAAQ,sBAAsB;;;;;;KAOtB,6BAA6B,KACvC,OAAa,UAAU;;;;;;EAQvB,SAAS,MACP,OAAa,UAAU,sBAAsB;IAAY;;;KAIjD,2BACR,qBACA,2BACA,4BACA,2BACA;KAEQ,8BACR,qBACA,2BACA"}
1
+ {"version":3,"file":"types.d.ts","names":["OpenAIClient"],"sources":["../src/types.ts"],"mappings":";;;;;;;;;YAoBY,oBACRA,OAAa,sBACH;YAEF;YAEA;YAKA,2BACVA,OAAa,UAAU;YAEb,eAAe;yBAEF;;EAEvB;;;;;EAMA;;;;;;EAOA;;EAGA;;EAGA;;EAGA;;EAGA;;EAGA,YAAY;;EAGZ;;EAGA;;;;;EAMA;;;;;;EAOA;;EAGA,OAAO;;;;;EAOP,cAAc;;;;;EAMd;;EAEA;;;;EAKA;;;;;;EAOA,eAAe;;;;;EAKf,SAAS;;;;EAKT,YAAY;;YAGF,2BAA2BA,OAAa;iBAEnC,0BAA0B;;;;EAIzC,UAAU;;;;;yBAMa,oBAAoB;;EAE3C;;EAGA;;iBAGe,wBAAwB;;;;;EAKvC;;;;;EAMA;;EAGA,iBAAiBA,OAAa,KAAK;;;;;EAMnC;;;;;EAMA;;;;;;;;;;;;;EAcA,aAAa,MAAMA,OAAa,KAAK;;;;;;EAOrC,QAAQA,OAAa,KAAK;;;;;;;EAQ1B,YAAYA,OAAa;;;;;;;EAQzB;;;;;EAMA,eAAeA,OAAa,UAAU;;;;;;EAOtC;;;;EAKA,uBAAuB;;;;EAKvB,qBAAqB;;iBAGN;;;;EAIf;;;;EAKA;;;;;;;EAQA;;;;;;;EAQA;;;;;;;;EASA;;;;;;;;;EAUA;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,6BAA6B;;iBAGd,6BACP,iBAAiB;EACzB;EACA;EACA;;KAGG,qCAAqC,KACxC;EAGA,aAAa,KAAK;;;;;IAMhB,QAAQ,sBAAsB;;;;;;YAOtB,6BAA6B,KACvCA,OAAa,UAAU;;;;;;EAQvB,SAAS,MACPA,OAAa,UAAU,sBAAsB;IAAY;;;YAIjD,2BACR,qBACA,2BACA,4BACA,2BACA;YAEQ,8BACR,qBACA,2BACA"}
@@ -1,5 +1,5 @@
1
1
  //#region src/utils/azure.d.ts
2
- interface OpenAIEndpointConfig {
2
+ export interface OpenAIEndpointConfig {
3
3
  azureOpenAIApiDeploymentName?: string;
4
4
  azureOpenAIApiInstanceName?: string;
5
5
  azureOpenAIApiKey?: string;
@@ -32,13 +32,13 @@ interface OpenAIEndpointConfig {
32
32
  *
33
33
  * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.
34
34
  */
35
- declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;
35
+ export declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;
36
36
  type HeaderValue = string | undefined | null;
37
- type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | {
37
+ export type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | {
38
38
  values: Headers;
39
39
  [key: string]: unknown;
40
40
  };
41
- declare function isHeaders(headers: unknown): headers is Headers;
41
+ export declare function isHeaders(headers: unknown): headers is Headers;
42
42
  /**
43
43
  * Normalizes various header formats into a consistent Record format.
44
44
  *
@@ -68,9 +68,8 @@ declare function isHeaders(headers: unknown): headers is Headers;
68
68
  * const normalized3 = normalizeHeaders(headers3);
69
69
  * ```
70
70
  */
71
- declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
72
- declare function getFormattedEnv(): string;
73
- declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;
71
+ export declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
72
+ export declare function getFormattedEnv(): string;
73
+ export declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;
74
74
  //#endregion
75
- export { HeadersLike, OpenAIEndpointConfig, getEndpoint, getFormattedEnv, getHeadersWithUserAgent, isHeaders, normalizeHeaders };
76
75
  //# sourceMappingURL=azure.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.d.cts","names":[],"sources":["../../src/utils/azure.ts"],"mappings":";UAGiB;EACf;EACA;EACA;EACA,6BAA6B;EAC7B;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,YAAY,QAAQ;KA2C/B;KACO,cACR,mBACS,kBACT,eAAe,uBAAuB;EAIpC,QAAQ;GAAU;;iBAER,UAAU,mBAAmB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCxC,iBACd,SAAS,cACR,eAAe,uBAAuB;iBAgCzB;iBAUA,wBACd,SAAS,aACT,mBACA,mBACC"}
1
+ {"version":3,"file":"azure.d.cts","names":[],"sources":["../../src/utils/azure.ts"],"mappings":";iBAGiB;EACf;EACA;EACA;EACA,6BAA6B;EAC7B;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2Bc,YAAY,QAAQ;KA2C/B;YACO,cACR,mBACS,kBACT,eAAe,uBAAuB;EAIpC,QAAQ;GAAU;;wBAER,UAAU,mBAAmB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsCxC,iBACd,SAAS,cACR,eAAe,uBAAuB;wBAgCzB;wBAUA,wBACd,SAAS,aACT,mBACA,mBACC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/utils/azure.d.ts
2
- interface OpenAIEndpointConfig {
2
+ export interface OpenAIEndpointConfig {
3
3
  azureOpenAIApiDeploymentName?: string;
4
4
  azureOpenAIApiInstanceName?: string;
5
5
  azureOpenAIApiKey?: string;
@@ -32,13 +32,13 @@ interface OpenAIEndpointConfig {
32
32
  *
33
33
  * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.
34
34
  */
35
- declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;
35
+ export declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;
36
36
  type HeaderValue = string | undefined | null;
37
- type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | {
37
+ export type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null | {
38
38
  values: Headers;
39
39
  [key: string]: unknown;
40
40
  };
41
- declare function isHeaders(headers: unknown): headers is Headers;
41
+ export declare function isHeaders(headers: unknown): headers is Headers;
42
42
  /**
43
43
  * Normalizes various header formats into a consistent Record format.
44
44
  *
@@ -68,9 +68,8 @@ declare function isHeaders(headers: unknown): headers is Headers;
68
68
  * const normalized3 = normalizeHeaders(headers3);
69
69
  * ```
70
70
  */
71
- declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
72
- declare function getFormattedEnv(): string;
73
- declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;
71
+ export declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
72
+ export declare function getFormattedEnv(): string;
73
+ export declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;
74
74
  //#endregion
75
- export { HeadersLike, OpenAIEndpointConfig, getEndpoint, getFormattedEnv, getHeadersWithUserAgent, isHeaders, normalizeHeaders };
76
75
  //# sourceMappingURL=azure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.d.ts","names":[],"sources":["../../src/utils/azure.ts"],"mappings":";UAGiB;EACf;EACA;EACA;EACA,6BAA6B;EAC7B;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Bc,YAAY,QAAQ;KA2C/B;KACO,cACR,mBACS,kBACT,eAAe,uBAAuB;EAIpC,QAAQ;GAAU;;iBAER,UAAU,mBAAmB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCxC,iBACd,SAAS,cACR,eAAe,uBAAuB;iBAgCzB;iBAUA,wBACd,SAAS,aACT,mBACA,mBACC"}
1
+ {"version":3,"file":"azure.d.ts","names":[],"sources":["../../src/utils/azure.ts"],"mappings":";iBAGiB;EACf;EACA;EACA;EACA,6BAA6B;EAC7B;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2Bc,YAAY,QAAQ;KA2C/B;YACO,cACR,mBACS,kBACT,eAAe,uBAAuB;EAIpC,QAAQ;GAAU;;wBAER,UAAU,mBAAmB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsCxC,iBACd,SAAS,cACR,eAAe,uBAAuB;wBAgCzB;wBAUA,wBACd,SAAS,aACT,mBACA,mBACC"}
@@ -1,5 +1,4 @@
1
1
  //#region src/utils/client.d.ts
2
- declare function wrapOpenAIClientError(e: unknown): any;
2
+ export declare function wrapOpenAIClientError(e: unknown): any;
3
3
  //#endregion
4
- export { wrapOpenAIClientError };
5
4
  //# sourceMappingURL=client.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.cts","names":[],"sources":["../../src/utils/client.ts"],"mappings":";iBAqBgB,sBAAsB"}
1
+ {"version":3,"file":"client.d.cts","names":[],"sources":["../../src/utils/client.ts"],"mappings":";wBAqBgB,sBAAsB"}
@@ -1,5 +1,4 @@
1
1
  //#region src/utils/client.d.ts
2
- declare function wrapOpenAIClientError(e: unknown): any;
2
+ export declare function wrapOpenAIClientError(e: unknown): any;
3
3
  //#endregion
4
- export { wrapOpenAIClientError };
5
4
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/utils/client.ts"],"mappings":";iBAqBgB,sBAAsB"}
1
+ {"version":3,"file":"client.d.ts","names":[],"sources":["../../src/utils/client.ts"],"mappings":";wBAqBgB,sBAAsB"}
@@ -1,6 +1,30 @@
1
1
  let _langchain_core_messages = require("@langchain/core/messages");
2
2
  //#region src/utils/misc.ts
3
3
  const iife = (fn) => fn();
4
+ /**
5
+ * Returns the provider payload a content block carries: the `value` of a
6
+ * `non_standard` wrapper, or the block itself.
7
+ */
8
+ function unwrapNonStandard(block) {
9
+ if (block.type === "non_standard" && typeof block.value === "object" && block.value !== null) return block.value;
10
+ return block;
11
+ }
12
+ const ADDITIONAL_TOOLS_PLACEMENT_ERROR = "`additional_tools` must be carried on a `SystemMessage`. OpenAI restricts the input item to `role: \"developer\"`, so it cannot be sent on any other message.";
13
+ const ADDITIONAL_TOOLS_TRANSPORT_ERROR = "`additional_tools` requires the Responses API and cannot be sent via Chat Completions. Set `useResponsesApi: true`.";
14
+ /**
15
+ * Throws if `message` carries an `additional_tools` block, in either spelling,
16
+ * that cannot reach the wire.
17
+ *
18
+ * OpenAI takes `additional_tools` only as a Responses API input item with
19
+ * `role: "developer"`, so only a `SystemMessage` sent via the Responses API
20
+ * can carry it. Assistant messages are exempt: their content is replayed model
21
+ * output, not an instruction from the caller.
22
+ */
23
+ function assertAdditionalToolsPlacement(message, api) {
24
+ if (_langchain_core_messages.AIMessage.isInstance(message) || !Array.isArray(message.content) || !message.content.some((block) => unwrapNonStandard(block).type === "additional_tools")) return;
25
+ if (!_langchain_core_messages.SystemMessage.isInstance(message)) throw new Error(ADDITIONAL_TOOLS_PLACEMENT_ERROR);
26
+ if (api === "chat/completions") throw new Error(ADDITIONAL_TOOLS_TRANSPORT_ERROR);
27
+ }
4
28
  function normalizePromptCacheRetention(retention) {
5
29
  return retention === "in-memory" ? "in_memory" : retention;
6
30
  }
@@ -74,6 +98,7 @@ function _modelPrefersResponsesAPI(model) {
74
98
  exports.LC_AUTOGENERATED_FILENAME = LC_AUTOGENERATED_FILENAME;
75
99
  exports._modelPrefersResponsesAPI = _modelPrefersResponsesAPI;
76
100
  exports.applyPromptCacheBreakpoint = applyPromptCacheBreakpoint;
101
+ exports.assertAdditionalToolsPlacement = assertAdditionalToolsPlacement;
77
102
  exports.extractGenericMessageCustomRole = extractGenericMessageCustomRole;
78
103
  exports.getFilenameFromMetadata = getFilenameFromMetadata;
79
104
  exports.getRequiredFilenameFromMetadata = getRequiredFilenameFromMetadata;
@@ -83,5 +108,6 @@ exports.isReasoningModel = isReasoningModel;
83
108
  exports.liftExtrasPromptCacheBreakpoint = liftExtrasPromptCacheBreakpoint;
84
109
  exports.messageToOpenAIRole = messageToOpenAIRole;
85
110
  exports.normalizePromptCacheRetention = normalizePromptCacheRetention;
111
+ exports.unwrapNonStandard = unwrapNonStandard;
86
112
 
87
113
  //# sourceMappingURL=misc.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.cjs","names":["ChatMessage"],"sources":["../../src/utils/misc.ts"],"sourcesContent":["import type { OpenAI as OpenAIClient } from \"openai\";\nimport type { OpenAICacheRetentionParam } from \"../types.js\";\nimport {\n BaseMessage,\n ChatMessage,\n ContentBlock,\n Data,\n} from \"@langchain/core/messages\";\n\nexport const iife = <T>(fn: () => T) => fn();\n\nexport function normalizePromptCacheRetention(\n retention: OpenAICacheRetentionParam | undefined\n): Exclude<OpenAICacheRetentionParam, \"in-memory\"> | undefined {\n return retention === \"in-memory\" ? \"in_memory\" : retention;\n}\n\nexport function applyPromptCacheBreakpoint<T extends object>(\n source: Record<string, unknown>,\n target: T\n): T {\n if (\"prompt_cache_breakpoint\" in source) {\n return {\n ...target,\n prompt_cache_breakpoint: source.prompt_cache_breakpoint,\n };\n }\n if (hasExtrasPromptCacheBreakpoint(source)) {\n return {\n ...target,\n prompt_cache_breakpoint: source.extras.prompt_cache_breakpoint,\n };\n }\n return target;\n}\n\nexport function hasExtrasPromptCacheBreakpoint(\n block: Record<string, unknown>\n): block is { extras: { prompt_cache_breakpoint: unknown } } {\n const { extras } = block;\n return (\n typeof extras === \"object\" &&\n extras !== null &&\n \"prompt_cache_breakpoint\" in extras\n );\n}\n\nexport function liftExtrasPromptCacheBreakpoint<T extends object>(block: T): T {\n const source = block as Record<string, unknown>;\n if (!hasExtrasPromptCacheBreakpoint(source)) {\n return block;\n }\n const { extras: _extras, ...rest } = source;\n return applyPromptCacheBreakpoint(source, rest) as T;\n}\n\nexport function isReasoningModel(model?: string) {\n if (!model) return false;\n if (/^o\\d/.test(model ?? \"\")) return true;\n if (model.startsWith(\"gpt-5\") && !model.startsWith(\"gpt-5-chat\")) return true;\n if (model.startsWith(\"gpt-6\") && !model.startsWith(\"gpt-6-chat\")) return true;\n return false;\n}\n\nexport function extractGenericMessageCustomRole(message: ChatMessage) {\n if (\n message.role !== \"system\" &&\n message.role !== \"developer\" &&\n message.role !== \"assistant\" &&\n message.role !== \"user\" &&\n message.role !== \"function\" &&\n message.role !== \"tool\"\n ) {\n console.warn(`Unknown message role: ${message.role}`);\n }\n\n return message.role as OpenAIClient.ChatCompletionRole;\n}\n\nexport function getFilenameFromMetadata(\n block:\n | ContentBlock.Multimodal.File\n | ContentBlock.Multimodal.Video\n | Data.StandardFileBlock\n): string | undefined {\n return (block.metadata?.filename ??\n block.metadata?.name ??\n block.metadata?.title) as string;\n}\n\nexport const LC_AUTOGENERATED_FILENAME = \"LC_AUTOGENERATED\";\n\nexport function getRequiredFilenameFromMetadata(\n block:\n | ContentBlock.Multimodal.File\n | ContentBlock.Multimodal.Video\n | Data.StandardFileBlock\n): string {\n const filename = (block.metadata?.filename ??\n block.metadata?.name ??\n block.metadata?.title) as string;\n\n if (!filename) {\n console.warn(\n \"OpenAI may require a filename for file uploads. Specify a filename \" +\n \"in the content block metadata, e.g.: { type: 'file', mimeType: \" +\n \"'...', data: '...', metadata: { filename: 'my-file.pdf' } }. \" +\n \"Using placeholder filename 'LC_AUTOGENERATED'.\"\n );\n return LC_AUTOGENERATED_FILENAME;\n }\n\n return filename;\n}\nexport function messageToOpenAIRole(\n message: BaseMessage\n): OpenAIClient.ChatCompletionRole {\n const type = message._getType();\n switch (type) {\n case \"system\":\n return \"system\";\n case \"ai\":\n return \"assistant\";\n case \"human\":\n return \"user\";\n case \"function\":\n return \"function\";\n case \"tool\":\n return \"tool\";\n case \"generic\": {\n if (!ChatMessage.isInstance(message))\n throw new Error(\"Invalid generic chat message\");\n return extractGenericMessageCustomRole(message);\n }\n default:\n throw new Error(`Unknown message type: ${type}`);\n }\n}\n\nexport function _modelPrefersResponsesAPI(model: string): boolean {\n if (model.includes(\"gpt-5.2-pro\")) return true;\n if (model.includes(\"gpt-5.4-pro\")) return true;\n if (model.includes(\"gpt-5.5-pro\")) return true;\n if (model.includes(\"gpt-5.6\")) return true;\n // Codex models are Responses API only\n if (model.includes(\"codex\")) return true;\n return false;\n}\n"],"mappings":";;AASA,MAAa,QAAW,OAAgB,GAAG;AAE3C,SAAgB,8BACd,WAC6D;CAC7D,OAAO,cAAc,cAAc,cAAc;AACnD;AAEA,SAAgB,2BACd,QACA,QACG;CACH,IAAI,6BAA6B,QAC/B,OAAO;EACL,GAAG;EACH,yBAAyB,OAAO;CAClC;CAEF,IAAI,+BAA+B,MAAM,GACvC,OAAO;EACL,GAAG;EACH,yBAAyB,OAAO,OAAO;CACzC;CAEF,OAAO;AACT;AAEA,SAAgB,+BACd,OAC2D;CAC3D,MAAM,EAAE,WAAW;CACnB,OACE,OAAO,WAAW,YAClB,WAAW,QACX,6BAA6B;AAEjC;AAEA,SAAgB,gCAAkD,OAAa;CAC7E,MAAM,SAAS;CACf,IAAI,CAAC,+BAA+B,MAAM,GACxC,OAAO;CAET,MAAM,EAAE,QAAQ,SAAS,GAAG,SAAS;CACrC,OAAO,2BAA2B,QAAQ,IAAI;AAChD;AAEA,SAAgB,iBAAiB,OAAgB;CAC/C,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,OAAO,KAAK,SAAS,EAAE,GAAG,OAAO;CACrC,IAAI,MAAM,WAAW,OAAO,KAAK,CAAC,MAAM,WAAW,YAAY,GAAG,OAAO;CACzE,IAAI,MAAM,WAAW,OAAO,KAAK,CAAC,MAAM,WAAW,YAAY,GAAG,OAAO;CACzE,OAAO;AACT;AAEA,SAAgB,gCAAgC,SAAsB;CACpE,IACE,QAAQ,SAAS,YACjB,QAAQ,SAAS,eACjB,QAAQ,SAAS,eACjB,QAAQ,SAAS,UACjB,QAAQ,SAAS,cACjB,QAAQ,SAAS,QAEjB,QAAQ,KAAK,yBAAyB,QAAQ,MAAM;CAGtD,OAAO,QAAQ;AACjB;AAEA,SAAgB,wBACd,OAIoB;CACpB,OAAQ,MAAM,UAAU,YACtB,MAAM,UAAU,QAChB,MAAM,UAAU;AACpB;AAEA,MAAa,4BAA4B;AAEzC,SAAgB,gCACd,OAIQ;CACR,MAAM,WAAY,MAAM,UAAU,YAChC,MAAM,UAAU,QAChB,MAAM,UAAU;CAElB,IAAI,CAAC,UAAU;EACb,QAAQ,KACN,+OAIF;EACA,OAAO;CACT;CAEA,OAAO;AACT;AACA,SAAgB,oBACd,SACiC;CACjC,MAAM,OAAO,QAAQ,SAAS;CAC9B,QAAQ,MAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,MACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,KAAK;GACH,IAAI,CAACA,yBAAAA,YAAY,WAAW,OAAO,GACjC,MAAM,IAAI,MAAM,8BAA8B;GAChD,OAAO,gCAAgC,OAAO;EAEhD,SACE,MAAM,IAAI,MAAM,yBAAyB,MAAM;CACnD;AACF;AAEA,SAAgB,0BAA0B,OAAwB;CAChE,IAAI,MAAM,SAAS,aAAa,GAAG,OAAO;CAC1C,IAAI,MAAM,SAAS,aAAa,GAAG,OAAO;CAC1C,IAAI,MAAM,SAAS,aAAa,GAAG,OAAO;CAC1C,IAAI,MAAM,SAAS,SAAS,GAAG,OAAO;CAEtC,IAAI,MAAM,SAAS,OAAO,GAAG,OAAO;CACpC,OAAO;AACT"}
1
+ {"version":3,"file":"misc.cjs","names":["AIMessage","SystemMessage","ChatMessage"],"sources":["../../src/utils/misc.ts"],"sourcesContent":["import type { OpenAI as OpenAIClient } from \"openai\";\nimport type { OpenAICacheRetentionParam } from \"../types.js\";\nimport {\n AIMessage,\n BaseMessage,\n ChatMessage,\n ContentBlock,\n Data,\n SystemMessage,\n} from \"@langchain/core/messages\";\n\nexport const iife = <T>(fn: () => T) => fn();\n\n/**\n * Returns the provider payload a content block carries: the `value` of a\n * `non_standard` wrapper, or the block itself.\n */\nexport function unwrapNonStandard(block: ContentBlock): ContentBlock {\n if (\n block.type === \"non_standard\" &&\n typeof block.value === \"object\" &&\n block.value !== null\n ) {\n return block.value as ContentBlock;\n }\n return block;\n}\n\nconst ADDITIONAL_TOOLS_PLACEMENT_ERROR =\n \"`additional_tools` must be carried on a `SystemMessage`. OpenAI restricts \" +\n 'the input item to `role: \"developer\"`, so it cannot be sent on any other ' +\n \"message.\";\n\nconst ADDITIONAL_TOOLS_TRANSPORT_ERROR =\n \"`additional_tools` requires the Responses API and cannot be sent via Chat \" +\n \"Completions. Set `useResponsesApi: true`.\";\n\n/**\n * Throws if `message` carries an `additional_tools` block, in either spelling,\n * that cannot reach the wire.\n *\n * OpenAI takes `additional_tools` only as a Responses API input item with\n * `role: \"developer\"`, so only a `SystemMessage` sent via the Responses API\n * can carry it. Assistant messages are exempt: their content is replayed model\n * output, not an instruction from the caller.\n */\nexport function assertAdditionalToolsPlacement(\n message: BaseMessage,\n api: \"responses\" | \"chat/completions\"\n): void {\n if (\n AIMessage.isInstance(message) ||\n !Array.isArray(message.content) ||\n !message.content.some(\n (block) => unwrapNonStandard(block).type === \"additional_tools\"\n )\n ) {\n return;\n }\n if (!SystemMessage.isInstance(message)) {\n throw new Error(ADDITIONAL_TOOLS_PLACEMENT_ERROR);\n }\n if (api === \"chat/completions\") {\n throw new Error(ADDITIONAL_TOOLS_TRANSPORT_ERROR);\n }\n}\n\nexport function normalizePromptCacheRetention(\n retention: OpenAICacheRetentionParam | undefined\n): Exclude<OpenAICacheRetentionParam, \"in-memory\"> | undefined {\n return retention === \"in-memory\" ? \"in_memory\" : retention;\n}\n\nexport function applyPromptCacheBreakpoint<T extends object>(\n source: Record<string, unknown>,\n target: T\n): T {\n if (\"prompt_cache_breakpoint\" in source) {\n return {\n ...target,\n prompt_cache_breakpoint: source.prompt_cache_breakpoint,\n };\n }\n if (hasExtrasPromptCacheBreakpoint(source)) {\n return {\n ...target,\n prompt_cache_breakpoint: source.extras.prompt_cache_breakpoint,\n };\n }\n return target;\n}\n\nexport function hasExtrasPromptCacheBreakpoint(\n block: Record<string, unknown>\n): block is { extras: { prompt_cache_breakpoint: unknown } } {\n const { extras } = block;\n return (\n typeof extras === \"object\" &&\n extras !== null &&\n \"prompt_cache_breakpoint\" in extras\n );\n}\n\nexport function liftExtrasPromptCacheBreakpoint<T extends object>(block: T): T {\n const source = block as Record<string, unknown>;\n if (!hasExtrasPromptCacheBreakpoint(source)) {\n return block;\n }\n const { extras: _extras, ...rest } = source;\n return applyPromptCacheBreakpoint(source, rest) as T;\n}\n\nexport function isReasoningModel(model?: string) {\n if (!model) return false;\n if (/^o\\d/.test(model ?? \"\")) return true;\n if (model.startsWith(\"gpt-5\") && !model.startsWith(\"gpt-5-chat\")) return true;\n if (model.startsWith(\"gpt-6\") && !model.startsWith(\"gpt-6-chat\")) return true;\n return false;\n}\n\nexport function extractGenericMessageCustomRole(message: ChatMessage) {\n if (\n message.role !== \"system\" &&\n message.role !== \"developer\" &&\n message.role !== \"assistant\" &&\n message.role !== \"user\" &&\n message.role !== \"function\" &&\n message.role !== \"tool\"\n ) {\n console.warn(`Unknown message role: ${message.role}`);\n }\n\n return message.role as OpenAIClient.ChatCompletionRole;\n}\n\nexport function getFilenameFromMetadata(\n block:\n | ContentBlock.Multimodal.File\n | ContentBlock.Multimodal.Video\n | Data.StandardFileBlock\n): string | undefined {\n return (block.metadata?.filename ??\n block.metadata?.name ??\n block.metadata?.title) as string;\n}\n\nexport const LC_AUTOGENERATED_FILENAME = \"LC_AUTOGENERATED\";\n\nexport function getRequiredFilenameFromMetadata(\n block:\n | ContentBlock.Multimodal.File\n | ContentBlock.Multimodal.Video\n | Data.StandardFileBlock\n): string {\n const filename = (block.metadata?.filename ??\n block.metadata?.name ??\n block.metadata?.title) as string;\n\n if (!filename) {\n console.warn(\n \"OpenAI may require a filename for file uploads. Specify a filename \" +\n \"in the content block metadata, e.g.: { type: 'file', mimeType: \" +\n \"'...', data: '...', metadata: { filename: 'my-file.pdf' } }. \" +\n \"Using placeholder filename 'LC_AUTOGENERATED'.\"\n );\n return LC_AUTOGENERATED_FILENAME;\n }\n\n return filename;\n}\nexport function messageToOpenAIRole(\n message: BaseMessage\n): OpenAIClient.ChatCompletionRole {\n const type = message._getType();\n switch (type) {\n case \"system\":\n return \"system\";\n case \"ai\":\n return \"assistant\";\n case \"human\":\n return \"user\";\n case \"function\":\n return \"function\";\n case \"tool\":\n return \"tool\";\n case \"generic\": {\n if (!ChatMessage.isInstance(message))\n throw new Error(\"Invalid generic chat message\");\n return extractGenericMessageCustomRole(message);\n }\n default:\n throw new Error(`Unknown message type: ${type}`);\n }\n}\n\nexport function _modelPrefersResponsesAPI(model: string): boolean {\n if (model.includes(\"gpt-5.2-pro\")) return true;\n if (model.includes(\"gpt-5.4-pro\")) return true;\n if (model.includes(\"gpt-5.5-pro\")) return true;\n if (model.includes(\"gpt-5.6\")) return true;\n // Codex models are Responses API only\n if (model.includes(\"codex\")) return true;\n return false;\n}\n"],"mappings":";;AAWA,MAAa,QAAW,OAAgB,GAAG;;;;;AAM3C,SAAgB,kBAAkB,OAAmC;CACnE,IACE,MAAM,SAAS,kBACf,OAAO,MAAM,UAAU,YACvB,MAAM,UAAU,MAEhB,OAAO,MAAM;CAEf,OAAO;AACT;AAEA,MAAM,mCACJ;AAIF,MAAM,mCACJ;;;;;;;;;;AAYF,SAAgB,+BACd,SACA,KACM;CACN,IACEA,yBAAAA,UAAU,WAAW,OAAO,KAC5B,CAAC,MAAM,QAAQ,QAAQ,OAAO,KAC9B,CAAC,QAAQ,QAAQ,MACd,UAAU,kBAAkB,KAAK,CAAC,CAAC,SAAS,kBAC/C,GAEA;CAEF,IAAI,CAACC,yBAAAA,cAAc,WAAW,OAAO,GACnC,MAAM,IAAI,MAAM,gCAAgC;CAElD,IAAI,QAAQ,oBACV,MAAM,IAAI,MAAM,gCAAgC;AAEpD;AAEA,SAAgB,8BACd,WAC6D;CAC7D,OAAO,cAAc,cAAc,cAAc;AACnD;AAEA,SAAgB,2BACd,QACA,QACG;CACH,IAAI,6BAA6B,QAC/B,OAAO;EACL,GAAG;EACH,yBAAyB,OAAO;CAClC;CAEF,IAAI,+BAA+B,MAAM,GACvC,OAAO;EACL,GAAG;EACH,yBAAyB,OAAO,OAAO;CACzC;CAEF,OAAO;AACT;AAEA,SAAgB,+BACd,OAC2D;CAC3D,MAAM,EAAE,WAAW;CACnB,OACE,OAAO,WAAW,YAClB,WAAW,QACX,6BAA6B;AAEjC;AAEA,SAAgB,gCAAkD,OAAa;CAC7E,MAAM,SAAS;CACf,IAAI,CAAC,+BAA+B,MAAM,GACxC,OAAO;CAET,MAAM,EAAE,QAAQ,SAAS,GAAG,SAAS;CACrC,OAAO,2BAA2B,QAAQ,IAAI;AAChD;AAEA,SAAgB,iBAAiB,OAAgB;CAC/C,IAAI,CAAC,OAAO,OAAO;CACnB,IAAI,OAAO,KAAK,SAAS,EAAE,GAAG,OAAO;CACrC,IAAI,MAAM,WAAW,OAAO,KAAK,CAAC,MAAM,WAAW,YAAY,GAAG,OAAO;CACzE,IAAI,MAAM,WAAW,OAAO,KAAK,CAAC,MAAM,WAAW,YAAY,GAAG,OAAO;CACzE,OAAO;AACT;AAEA,SAAgB,gCAAgC,SAAsB;CACpE,IACE,QAAQ,SAAS,YACjB,QAAQ,SAAS,eACjB,QAAQ,SAAS,eACjB,QAAQ,SAAS,UACjB,QAAQ,SAAS,cACjB,QAAQ,SAAS,QAEjB,QAAQ,KAAK,yBAAyB,QAAQ,MAAM;CAGtD,OAAO,QAAQ;AACjB;AAEA,SAAgB,wBACd,OAIoB;CACpB,OAAQ,MAAM,UAAU,YACtB,MAAM,UAAU,QAChB,MAAM,UAAU;AACpB;AAEA,MAAa,4BAA4B;AAEzC,SAAgB,gCACd,OAIQ;CACR,MAAM,WAAY,MAAM,UAAU,YAChC,MAAM,UAAU,QAChB,MAAM,UAAU;CAElB,IAAI,CAAC,UAAU;EACb,QAAQ,KACN,+OAIF;EACA,OAAO;CACT;CAEA,OAAO;AACT;AACA,SAAgB,oBACd,SACiC;CACjC,MAAM,OAAO,QAAQ,SAAS;CAC9B,QAAQ,MAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,MACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,KAAK;GACH,IAAI,CAACC,yBAAAA,YAAY,WAAW,OAAO,GACjC,MAAM,IAAI,MAAM,8BAA8B;GAChD,OAAO,gCAAgC,OAAO;EAEhD,SACE,MAAM,IAAI,MAAM,yBAAyB,MAAM;CACnD;AACF;AAEA,SAAgB,0BAA0B,OAAwB;CAChE,IAAI,MAAM,SAAS,aAAa,GAAG,OAAO;CAC1C,IAAI,MAAM,SAAS,aAAa,GAAG,OAAO;CAC1C,IAAI,MAAM,SAAS,aAAa,GAAG,OAAO;CAC1C,IAAI,MAAM,SAAS,SAAS,GAAG,OAAO;CAEtC,IAAI,MAAM,SAAS,OAAO,GAAG,OAAO;CACpC,OAAO;AACT"}
@@ -2,7 +2,6 @@ import "../types.cjs";
2
2
  import { OpenAI } from "openai";
3
3
  import { BaseMessage, ContentBlock } from "@langchain/core/messages";
4
4
  //#region src/utils/misc.d.ts
5
- declare function messageToOpenAIRole(message: BaseMessage): OpenAI.ChatCompletionRole;
5
+ export declare function messageToOpenAIRole(message: BaseMessage): OpenAI.ChatCompletionRole;
6
6
  //#endregion
7
- export { messageToOpenAIRole };
8
7
  //# sourceMappingURL=misc.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.cts","names":[],"sources":["../../src/utils/misc.ts"],"mappings":";;;;iBAkHgB,oBACd,SAAS,cACR,OAAa"}
1
+ {"version":3,"file":"misc.d.cts","names":["OpenAIClient"],"sources":["../../src/utils/misc.ts"],"mappings":";;;;wBA0KgB,oBACd,SAAS,cACRA,OAAa"}
@@ -2,7 +2,6 @@ import "../types.js";
2
2
  import { OpenAI } from "openai";
3
3
  import { BaseMessage, ChatMessage, ContentBlock } from "@langchain/core/messages";
4
4
  //#region src/utils/misc.d.ts
5
- declare function messageToOpenAIRole(message: BaseMessage): OpenAI.ChatCompletionRole;
5
+ export declare function messageToOpenAIRole(message: BaseMessage): OpenAI.ChatCompletionRole;
6
6
  //#endregion
7
- export { messageToOpenAIRole };
8
7
  //# sourceMappingURL=misc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","names":[],"sources":["../../src/utils/misc.ts"],"mappings":";;;;iBAkHgB,oBACd,SAAS,cACR,OAAa"}
1
+ {"version":3,"file":"misc.d.ts","names":["OpenAIClient"],"sources":["../../src/utils/misc.ts"],"mappings":";;;;wBA0KgB,oBACd,SAAS,cACRA,OAAa"}
@@ -1,6 +1,30 @@
1
- import { ChatMessage } from "@langchain/core/messages";
1
+ import { AIMessage, ChatMessage, SystemMessage } from "@langchain/core/messages";
2
2
  //#region src/utils/misc.ts
3
3
  const iife$1 = (fn) => fn();
4
+ /**
5
+ * Returns the provider payload a content block carries: the `value` of a
6
+ * `non_standard` wrapper, or the block itself.
7
+ */
8
+ function unwrapNonStandard(block) {
9
+ if (block.type === "non_standard" && typeof block.value === "object" && block.value !== null) return block.value;
10
+ return block;
11
+ }
12
+ const ADDITIONAL_TOOLS_PLACEMENT_ERROR = "`additional_tools` must be carried on a `SystemMessage`. OpenAI restricts the input item to `role: \"developer\"`, so it cannot be sent on any other message.";
13
+ const ADDITIONAL_TOOLS_TRANSPORT_ERROR = "`additional_tools` requires the Responses API and cannot be sent via Chat Completions. Set `useResponsesApi: true`.";
14
+ /**
15
+ * Throws if `message` carries an `additional_tools` block, in either spelling,
16
+ * that cannot reach the wire.
17
+ *
18
+ * OpenAI takes `additional_tools` only as a Responses API input item with
19
+ * `role: "developer"`, so only a `SystemMessage` sent via the Responses API
20
+ * can carry it. Assistant messages are exempt: their content is replayed model
21
+ * output, not an instruction from the caller.
22
+ */
23
+ function assertAdditionalToolsPlacement(message, api) {
24
+ if (AIMessage.isInstance(message) || !Array.isArray(message.content) || !message.content.some((block) => unwrapNonStandard(block).type === "additional_tools")) return;
25
+ if (!SystemMessage.isInstance(message)) throw new Error(ADDITIONAL_TOOLS_PLACEMENT_ERROR);
26
+ if (api === "chat/completions") throw new Error(ADDITIONAL_TOOLS_TRANSPORT_ERROR);
27
+ }
4
28
  function normalizePromptCacheRetention(retention) {
5
29
  return retention === "in-memory" ? "in_memory" : retention;
6
30
  }
@@ -71,6 +95,6 @@ function _modelPrefersResponsesAPI(model) {
71
95
  return false;
72
96
  }
73
97
  //#endregion
74
- export { LC_AUTOGENERATED_FILENAME, _modelPrefersResponsesAPI, applyPromptCacheBreakpoint, extractGenericMessageCustomRole, getFilenameFromMetadata, getRequiredFilenameFromMetadata, hasExtrasPromptCacheBreakpoint, iife$1 as iife, isReasoningModel, liftExtrasPromptCacheBreakpoint, messageToOpenAIRole, normalizePromptCacheRetention };
98
+ export { LC_AUTOGENERATED_FILENAME, _modelPrefersResponsesAPI, applyPromptCacheBreakpoint, assertAdditionalToolsPlacement, extractGenericMessageCustomRole, getFilenameFromMetadata, getRequiredFilenameFromMetadata, hasExtrasPromptCacheBreakpoint, iife$1 as iife, isReasoningModel, liftExtrasPromptCacheBreakpoint, messageToOpenAIRole, normalizePromptCacheRetention, unwrapNonStandard };
75
99
 
76
100
  //# sourceMappingURL=misc.js.map