@langchain/openai 1.1.0 → 1.1.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.
Files changed (91) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/azure/chat_models/common.cjs +4 -9
  3. package/dist/azure/chat_models/common.cjs.map +1 -1
  4. package/dist/azure/chat_models/common.js +6 -11
  5. package/dist/azure/chat_models/common.js.map +1 -1
  6. package/dist/azure/chat_models/completions.d.cts +1 -1
  7. package/dist/azure/chat_models/index.cjs +1 -1
  8. package/dist/azure/chat_models/index.d.cts +2 -2
  9. package/dist/azure/chat_models/index.js +1 -1
  10. package/dist/azure/chat_models/responses.cjs +1 -1
  11. package/dist/azure/chat_models/responses.d.cts +1 -1
  12. package/dist/azure/chat_models/responses.js +1 -1
  13. package/dist/azure/embeddings.cjs +5 -8
  14. package/dist/azure/embeddings.cjs.map +1 -1
  15. package/dist/azure/embeddings.js +5 -8
  16. package/dist/azure/embeddings.js.map +1 -1
  17. package/dist/azure/llms.cjs +4 -7
  18. package/dist/azure/llms.cjs.map +1 -1
  19. package/dist/azure/llms.js +5 -8
  20. package/dist/azure/llms.js.map +1 -1
  21. package/dist/chat_models/base.cjs +26 -4
  22. package/dist/chat_models/base.cjs.map +1 -1
  23. package/dist/chat_models/base.d.cts +22 -3
  24. package/dist/chat_models/base.d.cts.map +1 -1
  25. package/dist/chat_models/base.d.ts +25 -6
  26. package/dist/chat_models/base.d.ts.map +1 -1
  27. package/dist/chat_models/base.js +27 -5
  28. package/dist/chat_models/base.js.map +1 -1
  29. package/dist/chat_models/completions.cjs +2 -2
  30. package/dist/chat_models/completions.d.cts +1 -1
  31. package/dist/chat_models/completions.js +2 -2
  32. package/dist/chat_models/index.cjs +1 -1
  33. package/dist/chat_models/index.d.cts +3 -3
  34. package/dist/chat_models/index.d.ts +4 -4
  35. package/dist/chat_models/index.js +1 -1
  36. package/dist/chat_models/profiles.cjs +567 -0
  37. package/dist/chat_models/profiles.cjs.map +1 -0
  38. package/dist/chat_models/profiles.js +566 -0
  39. package/dist/chat_models/profiles.js.map +1 -0
  40. package/dist/chat_models/responses.cjs +1 -1
  41. package/dist/chat_models/responses.d.cts +1 -1
  42. package/dist/chat_models/responses.js +1 -1
  43. package/dist/converters/completions.cjs +3 -1
  44. package/dist/converters/completions.d.cts +319 -0
  45. package/dist/converters/completions.d.cts.map +1 -0
  46. package/dist/converters/completions.d.ts +319 -0
  47. package/dist/converters/completions.d.ts.map +1 -0
  48. package/dist/converters/completions.js +2 -2
  49. package/dist/converters/index.cjs +2 -0
  50. package/dist/converters/index.js +2 -0
  51. package/dist/converters/responses.cjs +5 -2
  52. package/dist/converters/responses.d.cts +310 -0
  53. package/dist/converters/responses.d.cts.map +1 -0
  54. package/dist/converters/responses.d.ts +310 -0
  55. package/dist/converters/responses.d.ts.map +1 -0
  56. package/dist/converters/responses.js +3 -3
  57. package/dist/embeddings.cjs +3 -1
  58. package/dist/embeddings.cjs.map +1 -1
  59. package/dist/embeddings.d.cts +4 -2
  60. package/dist/embeddings.d.cts.map +1 -1
  61. package/dist/embeddings.d.ts +4 -2
  62. package/dist/embeddings.d.ts.map +1 -1
  63. package/dist/embeddings.js +3 -1
  64. package/dist/embeddings.js.map +1 -1
  65. package/dist/index.cjs +26 -9
  66. package/dist/index.d.cts +6 -4
  67. package/dist/index.d.ts +6 -4
  68. package/dist/index.js +8 -5
  69. package/dist/llms.cjs +3 -2
  70. package/dist/llms.cjs.map +1 -1
  71. package/dist/llms.d.cts +4 -4
  72. package/dist/llms.d.cts.map +1 -1
  73. package/dist/llms.d.ts +3 -3
  74. package/dist/llms.d.ts.map +1 -1
  75. package/dist/llms.js +3 -2
  76. package/dist/llms.js.map +1 -1
  77. package/dist/types.d.cts +7 -7
  78. package/dist/types.d.cts.map +1 -1
  79. package/dist/types.d.ts +7 -7
  80. package/dist/types.d.ts.map +1 -1
  81. package/dist/utils/azure.cjs +18 -0
  82. package/dist/utils/azure.cjs.map +1 -1
  83. package/dist/utils/azure.d.cts +5 -1
  84. package/dist/utils/azure.d.cts.map +1 -1
  85. package/dist/utils/azure.d.ts +5 -1
  86. package/dist/utils/azure.d.ts.map +1 -1
  87. package/dist/utils/azure.js +16 -1
  88. package/dist/utils/azure.js.map +1 -1
  89. package/dist/utils/tools.cjs +1 -1
  90. package/dist/utils/tools.js +1 -1
  91. package/package.json +9 -6
@@ -1,4 +1,6 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
2
  const require_misc = require('./misc.cjs');
3
+ const __langchain_core_utils_env = require_rolldown_runtime.__toESM(require("@langchain/core/utils/env"));
2
4
 
3
5
  //#region src/utils/azure.ts
4
6
  /**
@@ -81,9 +83,25 @@ function normalizeHeaders(headers) {
81
83
  });
82
84
  return Object.fromEntries(output.entries());
83
85
  }
86
+ function getFormattedEnv() {
87
+ let env = (0, __langchain_core_utils_env.getEnv)();
88
+ if (env === "node" || env === "deno") env = `(${env}/${process.version}; ${process.platform}; ${process.arch})`;
89
+ return env;
90
+ }
91
+ function getHeadersWithUserAgent(headers, isAzure = false, version = "1.0.0") {
92
+ const normalizedHeaders = normalizeHeaders(headers);
93
+ const env = getFormattedEnv();
94
+ const library = `langchainjs${isAzure ? "-azure" : ""}-openai`;
95
+ return {
96
+ ...normalizedHeaders,
97
+ "User-Agent": normalizedHeaders["User-Agent"] ? `${library}/${version} (${env})${normalizedHeaders["User-Agent"]}` : `${library}/${version} (${env})`
98
+ };
99
+ }
84
100
 
85
101
  //#endregion
86
102
  exports.getEndpoint = getEndpoint;
103
+ exports.getFormattedEnv = getFormattedEnv;
104
+ exports.getHeadersWithUserAgent = getHeadersWithUserAgent;
87
105
  exports.isHeaders = isHeaders;
88
106
  exports.normalizeHeaders = normalizeHeaders;
89
107
  //# sourceMappingURL=azure.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.cjs","names":["config: OpenAIEndpointConfig","headers: unknown","headers: HeadersLike","iife","entries: [string, string][]"],"sources":["../../src/utils/azure.ts"],"sourcesContent":["import { iife } from \"./misc.js\";\n\nexport interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport function getEndpoint(config: OpenAIEndpointConfig) {\n const {\n azureOpenAIApiDeploymentName,\n azureOpenAIApiInstanceName,\n azureOpenAIApiKey,\n azureOpenAIBasePath,\n baseURL,\n azureADTokenProvider,\n azureOpenAIEndpoint,\n } = config;\n\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIBasePath &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`;\n }\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIEndpoint &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n if (azureOpenAIApiKey || azureADTokenProvider) {\n if (!azureOpenAIApiInstanceName) {\n throw new Error(\n \"azureOpenAIApiInstanceName is required when using azureOpenAIApiKey\"\n );\n }\n if (!azureOpenAIApiDeploymentName) {\n throw new Error(\n \"azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey\"\n );\n }\n return `https://${azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n return baseURL;\n}\n\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike =\n | Headers\n | readonly HeaderValue[][]\n | Record<string, HeaderValue | readonly HeaderValue[]>\n | undefined\n | null\n // NullableHeaders\n | { values: Headers; [key: string]: unknown };\n\nexport function isHeaders(headers: unknown): headers is Headers {\n return (\n typeof Headers !== \"undefined\" &&\n headers !== null &&\n typeof headers === \"object\" &&\n Object.prototype.toString.call(headers) === \"[object Headers]\"\n );\n}\n\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport function normalizeHeaders(\n headers: HeadersLike\n): Record<string, HeaderValue | readonly HeaderValue[]> {\n const output = iife(() => {\n // If headers is a Headers instance\n if (isHeaders(headers)) {\n return headers;\n }\n // If headers is an array of [key, value] pairs\n else if (Array.isArray(headers)) {\n return new Headers(headers);\n }\n // If headers is a NullableHeaders-like object (has 'values' property that is a Headers)\n else if (\n typeof headers === \"object\" &&\n headers !== null &&\n \"values\" in headers &&\n isHeaders(headers.values)\n ) {\n return headers.values;\n }\n // If headers is a plain object\n else if (typeof headers === \"object\" && headers !== null) {\n const entries: [string, string][] = Object.entries(headers)\n .filter(([, v]) => typeof v === \"string\")\n .map(([k, v]) => [k, v as string]);\n return new Headers(entries);\n }\n return new Headers();\n });\n\n return Object.fromEntries(output.entries());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,YAAYA,QAA8B;CACxD,MAAM,EACJ,8BACA,4BACA,mBACA,qBACA,SACA,sBACA,qBACD,GAAG;AAEJ,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,CAAC,EAAE,8BAA8B;AAEjE,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,oBAAoB,EAAE,8BAA8B;AAGpF,KAAI,qBAAqB,sBAAsB;AAC7C,MAAI,CAAC,2BACH,OAAM,IAAI,MACR;AAGJ,MAAI,CAAC,6BACH,OAAM,IAAI,MACR;AAGJ,SAAO,CAAC,QAAQ,EAAE,2BAA2B,qCAAqC,EAAE,8BAA8B;CACnH;AAED,QAAO;AACR;AAYD,SAAgB,UAAUC,SAAsC;AAC9D,QACE,OAAO,YAAY,eACnB,YAAY,QACZ,OAAO,YAAY,YACnB,OAAO,UAAU,SAAS,KAAK,QAAQ,KAAK;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,SAAgB,iBACdC,SACsD;CACtD,MAAM,SAASC,kBAAK,MAAM;AAExB,MAAI,UAAU,QAAQ,CACpB,QAAO;WAGA,MAAM,QAAQ,QAAQ,CAC7B,QAAO,IAAI,QAAQ;WAInB,OAAO,YAAY,YACnB,YAAY,QACZ,YAAY,WACZ,UAAU,QAAQ,OAAO,CAEzB,QAAO,QAAQ;WAGR,OAAO,YAAY,YAAY,YAAY,MAAM;GACxD,MAAMC,UAA8B,OAAO,QAAQ,QAAQ,CACxD,OAAO,CAAC,GAAG,EAAE,KAAK,OAAO,MAAM,SAAS,CACxC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAY,EAAC;AACpC,UAAO,IAAI,QAAQ;EACpB;AACD,SAAO,IAAI;CACZ,EAAC;AAEF,QAAO,OAAO,YAAY,OAAO,SAAS,CAAC;AAC5C"}
1
+ {"version":3,"file":"azure.cjs","names":["config: OpenAIEndpointConfig","headers: unknown","headers: HeadersLike","iife","entries: [string, string][]"],"sources":["../../src/utils/azure.ts"],"sourcesContent":["import { getEnv } from \"@langchain/core/utils/env\";\nimport { iife } from \"./misc.js\";\n\nexport interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport function getEndpoint(config: OpenAIEndpointConfig) {\n const {\n azureOpenAIApiDeploymentName,\n azureOpenAIApiInstanceName,\n azureOpenAIApiKey,\n azureOpenAIBasePath,\n baseURL,\n azureADTokenProvider,\n azureOpenAIEndpoint,\n } = config;\n\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIBasePath &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`;\n }\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIEndpoint &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n if (azureOpenAIApiKey || azureADTokenProvider) {\n if (!azureOpenAIApiInstanceName) {\n throw new Error(\n \"azureOpenAIApiInstanceName is required when using azureOpenAIApiKey\"\n );\n }\n if (!azureOpenAIApiDeploymentName) {\n throw new Error(\n \"azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey\"\n );\n }\n return `https://${azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n return baseURL;\n}\n\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike =\n | Headers\n | readonly HeaderValue[][]\n | Record<string, HeaderValue | readonly HeaderValue[]>\n | undefined\n | null\n // NullableHeaders\n | { values: Headers; [key: string]: unknown };\n\nexport function isHeaders(headers: unknown): headers is Headers {\n return (\n typeof Headers !== \"undefined\" &&\n headers !== null &&\n typeof headers === \"object\" &&\n Object.prototype.toString.call(headers) === \"[object Headers]\"\n );\n}\n\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport function normalizeHeaders(\n headers: HeadersLike\n): Record<string, HeaderValue | readonly HeaderValue[]> {\n const output = iife(() => {\n // If headers is a Headers instance\n if (isHeaders(headers)) {\n return headers;\n }\n // If headers is an array of [key, value] pairs\n else if (Array.isArray(headers)) {\n return new Headers(headers);\n }\n // If headers is a NullableHeaders-like object (has 'values' property that is a Headers)\n else if (\n typeof headers === \"object\" &&\n headers !== null &&\n \"values\" in headers &&\n isHeaders(headers.values)\n ) {\n return headers.values;\n }\n // If headers is a plain object\n else if (typeof headers === \"object\" && headers !== null) {\n const entries: [string, string][] = Object.entries(headers)\n .filter(([, v]) => typeof v === \"string\")\n .map(([k, v]) => [k, v as string]);\n return new Headers(entries);\n }\n return new Headers();\n });\n\n return Object.fromEntries(output.entries());\n}\n\nexport function getFormattedEnv() {\n let env = getEnv();\n if (env === \"node\" || env === \"deno\") {\n env = `(${env}/${process.version}; ${process.platform}; ${process.arch})`;\n }\n return env;\n}\n\n// Note: ideally version would be imported from package.json, but there's\n// currently no good way to do that for all supported environments (Node, Deno, Browser).\nexport function getHeadersWithUserAgent(\n headers: HeadersLike,\n isAzure = false,\n version = \"1.0.0\"\n): Record<string, string> {\n const normalizedHeaders = normalizeHeaders(headers);\n const env = getFormattedEnv();\n const library = `langchainjs${isAzure ? \"-azure\" : \"\"}-openai`;\n return {\n ...normalizedHeaders,\n \"User-Agent\": normalizedHeaders[\"User-Agent\"]\n ? `${library}/${version} (${env})${normalizedHeaders[\"User-Agent\"]}`\n : `${library}/${version} (${env})`,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,YAAYA,QAA8B;CACxD,MAAM,EACJ,8BACA,4BACA,mBACA,qBACA,SACA,sBACA,qBACD,GAAG;AAEJ,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,CAAC,EAAE,8BAA8B;AAEjE,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,oBAAoB,EAAE,8BAA8B;AAGpF,KAAI,qBAAqB,sBAAsB;AAC7C,MAAI,CAAC,2BACH,OAAM,IAAI,MACR;AAGJ,MAAI,CAAC,6BACH,OAAM,IAAI,MACR;AAGJ,SAAO,CAAC,QAAQ,EAAE,2BAA2B,qCAAqC,EAAE,8BAA8B;CACnH;AAED,QAAO;AACR;AAYD,SAAgB,UAAUC,SAAsC;AAC9D,QACE,OAAO,YAAY,eACnB,YAAY,QACZ,OAAO,YAAY,YACnB,OAAO,UAAU,SAAS,KAAK,QAAQ,KAAK;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,SAAgB,iBACdC,SACsD;CACtD,MAAM,SAASC,kBAAK,MAAM;AAExB,MAAI,UAAU,QAAQ,CACpB,QAAO;WAGA,MAAM,QAAQ,QAAQ,CAC7B,QAAO,IAAI,QAAQ;WAInB,OAAO,YAAY,YACnB,YAAY,QACZ,YAAY,WACZ,UAAU,QAAQ,OAAO,CAEzB,QAAO,QAAQ;WAGR,OAAO,YAAY,YAAY,YAAY,MAAM;GACxD,MAAMC,UAA8B,OAAO,QAAQ,QAAQ,CACxD,OAAO,CAAC,GAAG,EAAE,KAAK,OAAO,MAAM,SAAS,CACxC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAY,EAAC;AACpC,UAAO,IAAI,QAAQ;EACpB;AACD,SAAO,IAAI;CACZ,EAAC;AAEF,QAAO,OAAO,YAAY,OAAO,SAAS,CAAC;AAC5C;AAED,SAAgB,kBAAkB;CAChC,IAAI,8CAAc;AAClB,KAAI,QAAQ,UAAU,QAAQ,QAC5B,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,QAAQ,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,QAAQ,KAAK,CAAC,CAAC;AAE3E,QAAO;AACR;AAID,SAAgB,wBACdF,SACA,UAAU,OACV,UAAU,SACc;CACxB,MAAM,oBAAoB,iBAAiB,QAAQ;CACnD,MAAM,MAAM,iBAAiB;CAC7B,MAAM,UAAU,CAAC,WAAW,EAAE,UAAU,WAAW,GAAG,OAAO,CAAC;AAC9D,QAAO;EACL,GAAG;EACH,cAAc,kBAAkB,gBAC5B,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,kBAAkB,eAAe,GAClE,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;CACrC;AACF"}
@@ -71,6 +71,10 @@ declare function isHeaders(headers: unknown): headers is Headers;
71
71
  * ```
72
72
  */
73
73
  declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
74
+ declare function getFormattedEnv(): string;
75
+ // Note: ideally version would be imported from package.json, but there's
76
+ // currently no good way to do that for all supported environments (Node, Deno, Browser).
77
+ declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;
74
78
  //#endregion
75
- export { HeadersLike, OpenAIEndpointConfig, getEndpoint, isHeaders, normalizeHeaders };
79
+ export { HeadersLike, OpenAIEndpointConfig, getEndpoint, getFormattedEnv, getHeadersWithUserAgent, isHeaders, normalizeHeaders };
76
80
  //# sourceMappingURL=azure.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.d.cts","names":["OpenAIEndpointConfig","Promise","getEndpoint","HeaderValue","HeadersLike","Headers","Record","isHeaders","normalizeHeaders"],"sources":["../../src/utils/azure.d.ts"],"sourcesContent":["export interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null\n// NullableHeaders\n | {\n values: Headers;\n [key: string]: unknown;\n};\nexport declare function isHeaders(headers: unknown): headers is Headers;\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;\nexport {};\n"],"mappings":";UAAiBA,oBAAAA;EAAAA,4BAAoB,CAAA,EAAA,MAIJC;EA6BTC,0BAAoBF,CAAAA,EAAAA,MAAAA;EACvCG,iBAAW,CAAA,EAAA,MAAA;EACJC,oBAAW,CAAA,EAAA,GAAA,GA/BUH,OA+BV,CAAA,MAAA,CAAA;EAAA,mBAAA,CAAA,EAAA,MAAA;EAAA,OAAGI,CAAAA,EAAAA,MAAAA,GAAAA,IAAAA;EAAO,mBAAYF,CAAAA,EAAAA,MAAAA;;;;;AAG1B;AAGnB;AA8BA;;;;;;AAAsE;;;;;;;;;;;;;iBAtC9CD,WAAAA,SAAoBF;KACvCG,WAAAA;KACOC,WAAAA,GAAcC,mBAAmBF,kBAAkBG,eAAeH,uBAAuBA;;;UAGzFE;;;iBAGYE,SAAAA,+BAAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BxCG,gBAAAA,UAA0BJ,cAAcE,eAAeH,uBAAuBA"}
1
+ {"version":3,"file":"azure.d.cts","names":["OpenAIEndpointConfig","Promise","getEndpoint","HeaderValue","HeadersLike","Headers","Record","isHeaders","normalizeHeaders","getFormattedEnv","getHeadersWithUserAgent"],"sources":["../../src/utils/azure.d.ts"],"sourcesContent":["export interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null\n// NullableHeaders\n | {\n values: Headers;\n [key: string]: unknown;\n};\nexport declare function isHeaders(headers: unknown): headers is Headers;\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;\nexport declare function getFormattedEnv(): string;\n// Note: ideally version would be imported from package.json, but there's\n// currently no good way to do that for all supported environments (Node, Deno, Browser).\nexport declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;\nexport {};\n"],"mappings":";UAAiBA,oBAAAA;EAAAA,4BAAoB,CAAA,EAAA,MAIJC;EA6BTC,0BAAoBF,CAAAA,EAAAA,MAAAA;EACvCG,iBAAW,CAAA,EAAA,MAAA;EACJC,oBAAW,CAAA,EAAA,GAAA,GA/BUH,OA+BV,CAAA,MAAA,CAAA;EAAA,mBAAA,CAAA,EAAA,MAAA;EAAA,OAAGI,CAAAA,EAAAA,MAAAA,GAAAA,IAAAA;EAAO,mBAAYF,CAAAA,EAAAA,MAAAA;;;;;AAG1B;AAGnB;AA8BA;;;;;;AAAsE;AACtE;AAGA;;;;AAAkH;;;;;;;iBA1C1FD,WAAAA,SAAoBF;KACvCG,WAAAA;KACOC,WAAAA,GAAcC,mBAAmBF,kBAAkBG,eAAeH,uBAAuBA;;;UAGzFE;;;iBAGYE,SAAAA,+BAAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BxCG,gBAAAA,UAA0BJ,cAAcE,eAAeH,uBAAuBA;iBAC9EM,eAAAA,CAAAA;;;iBAGAC,uBAAAA,UAAiCN,mDAAmDE"}
@@ -71,6 +71,10 @@ declare function isHeaders(headers: unknown): headers is Headers;
71
71
  * ```
72
72
  */
73
73
  declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;
74
+ declare function getFormattedEnv(): string;
75
+ // Note: ideally version would be imported from package.json, but there's
76
+ // currently no good way to do that for all supported environments (Node, Deno, Browser).
77
+ declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;
74
78
  //#endregion
75
- export { HeadersLike, OpenAIEndpointConfig, getEndpoint, isHeaders, normalizeHeaders };
79
+ export { HeadersLike, OpenAIEndpointConfig, getEndpoint, getFormattedEnv, getHeadersWithUserAgent, isHeaders, normalizeHeaders };
76
80
  //# sourceMappingURL=azure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.d.ts","names":["OpenAIEndpointConfig","Promise","getEndpoint","HeaderValue","HeadersLike","Headers","Record","isHeaders","normalizeHeaders"],"sources":["../../src/utils/azure.d.ts"],"sourcesContent":["export interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null\n// NullableHeaders\n | {\n values: Headers;\n [key: string]: unknown;\n};\nexport declare function isHeaders(headers: unknown): headers is Headers;\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;\nexport {};\n"],"mappings":";UAAiBA,oBAAAA;EAAAA,4BAAoB,CAAA,EAAA,MAIJC;EA6BTC,0BAAoBF,CAAAA,EAAAA,MAAAA;EACvCG,iBAAW,CAAA,EAAA,MAAA;EACJC,oBAAW,CAAA,EAAA,GAAA,GA/BUH,OA+BV,CAAA,MAAA,CAAA;EAAA,mBAAA,CAAA,EAAA,MAAA;EAAA,OAAGI,CAAAA,EAAAA,MAAAA,GAAAA,IAAAA;EAAO,mBAAYF,CAAAA,EAAAA,MAAAA;;;;;AAG1B;AAGnB;AA8BA;;;;;;AAAsE;;;;;;;;;;;;;iBAtC9CD,WAAAA,SAAoBF;KACvCG,WAAAA;KACOC,WAAAA,GAAcC,mBAAmBF,kBAAkBG,eAAeH,uBAAuBA;;;UAGzFE;;;iBAGYE,SAAAA,+BAAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BxCG,gBAAAA,UAA0BJ,cAAcE,eAAeH,uBAAuBA"}
1
+ {"version":3,"file":"azure.d.ts","names":["OpenAIEndpointConfig","Promise","getEndpoint","HeaderValue","HeadersLike","Headers","Record","isHeaders","normalizeHeaders","getFormattedEnv","getHeadersWithUserAgent"],"sources":["../../src/utils/azure.d.ts"],"sourcesContent":["export interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport declare function getEndpoint(config: OpenAIEndpointConfig): string | null | undefined;\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike = Headers | readonly HeaderValue[][] | Record<string, HeaderValue | readonly HeaderValue[]> | undefined | null\n// NullableHeaders\n | {\n values: Headers;\n [key: string]: unknown;\n};\nexport declare function isHeaders(headers: unknown): headers is Headers;\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport declare function normalizeHeaders(headers: HeadersLike): Record<string, HeaderValue | readonly HeaderValue[]>;\nexport declare function getFormattedEnv(): string;\n// Note: ideally version would be imported from package.json, but there's\n// currently no good way to do that for all supported environments (Node, Deno, Browser).\nexport declare function getHeadersWithUserAgent(headers: HeadersLike, isAzure?: boolean, version?: string): Record<string, string>;\nexport {};\n"],"mappings":";UAAiBA,oBAAAA;EAAAA,4BAAoB,CAAA,EAAA,MAIJC;EA6BTC,0BAAoBF,CAAAA,EAAAA,MAAAA;EACvCG,iBAAW,CAAA,EAAA,MAAA;EACJC,oBAAW,CAAA,EAAA,GAAA,GA/BUH,OA+BV,CAAA,MAAA,CAAA;EAAA,mBAAA,CAAA,EAAA,MAAA;EAAA,OAAGI,CAAAA,EAAAA,MAAAA,GAAAA,IAAAA;EAAO,mBAAYF,CAAAA,EAAAA,MAAAA;;;;;AAG1B;AAGnB;AA8BA;;;;;;AAAsE;AACtE;AAGA;;;;AAAkH;;;;;;;iBA1C1FD,WAAAA,SAAoBF;KACvCG,WAAAA;KACOC,WAAAA,GAAcC,mBAAmBF,kBAAkBG,eAAeH,uBAAuBA;;;UAGzFE;;;iBAGYE,SAAAA,+BAAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8BxCG,gBAAAA,UAA0BJ,cAAcE,eAAeH,uBAAuBA;iBAC9EM,eAAAA,CAAAA;;;iBAGAC,uBAAAA,UAAiCN,mDAAmDE"}
@@ -1,4 +1,5 @@
1
1
  import { iife } from "./misc.js";
2
+ import { getEnv } from "@langchain/core/utils/env";
2
3
 
3
4
  //#region src/utils/azure.ts
4
5
  /**
@@ -81,7 +82,21 @@ function normalizeHeaders(headers) {
81
82
  });
82
83
  return Object.fromEntries(output.entries());
83
84
  }
85
+ function getFormattedEnv() {
86
+ let env = getEnv();
87
+ if (env === "node" || env === "deno") env = `(${env}/${process.version}; ${process.platform}; ${process.arch})`;
88
+ return env;
89
+ }
90
+ function getHeadersWithUserAgent(headers, isAzure = false, version = "1.0.0") {
91
+ const normalizedHeaders = normalizeHeaders(headers);
92
+ const env = getFormattedEnv();
93
+ const library = `langchainjs${isAzure ? "-azure" : ""}-openai`;
94
+ return {
95
+ ...normalizedHeaders,
96
+ "User-Agent": normalizedHeaders["User-Agent"] ? `${library}/${version} (${env})${normalizedHeaders["User-Agent"]}` : `${library}/${version} (${env})`
97
+ };
98
+ }
84
99
 
85
100
  //#endregion
86
- export { getEndpoint, isHeaders, normalizeHeaders };
101
+ export { getEndpoint, getFormattedEnv, getHeadersWithUserAgent, isHeaders, normalizeHeaders };
87
102
  //# sourceMappingURL=azure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"azure.js","names":["config: OpenAIEndpointConfig","headers: unknown","headers: HeadersLike","entries: [string, string][]"],"sources":["../../src/utils/azure.ts"],"sourcesContent":["import { iife } from \"./misc.js\";\n\nexport interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport function getEndpoint(config: OpenAIEndpointConfig) {\n const {\n azureOpenAIApiDeploymentName,\n azureOpenAIApiInstanceName,\n azureOpenAIApiKey,\n azureOpenAIBasePath,\n baseURL,\n azureADTokenProvider,\n azureOpenAIEndpoint,\n } = config;\n\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIBasePath &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`;\n }\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIEndpoint &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n if (azureOpenAIApiKey || azureADTokenProvider) {\n if (!azureOpenAIApiInstanceName) {\n throw new Error(\n \"azureOpenAIApiInstanceName is required when using azureOpenAIApiKey\"\n );\n }\n if (!azureOpenAIApiDeploymentName) {\n throw new Error(\n \"azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey\"\n );\n }\n return `https://${azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n return baseURL;\n}\n\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike =\n | Headers\n | readonly HeaderValue[][]\n | Record<string, HeaderValue | readonly HeaderValue[]>\n | undefined\n | null\n // NullableHeaders\n | { values: Headers; [key: string]: unknown };\n\nexport function isHeaders(headers: unknown): headers is Headers {\n return (\n typeof Headers !== \"undefined\" &&\n headers !== null &&\n typeof headers === \"object\" &&\n Object.prototype.toString.call(headers) === \"[object Headers]\"\n );\n}\n\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport function normalizeHeaders(\n headers: HeadersLike\n): Record<string, HeaderValue | readonly HeaderValue[]> {\n const output = iife(() => {\n // If headers is a Headers instance\n if (isHeaders(headers)) {\n return headers;\n }\n // If headers is an array of [key, value] pairs\n else if (Array.isArray(headers)) {\n return new Headers(headers);\n }\n // If headers is a NullableHeaders-like object (has 'values' property that is a Headers)\n else if (\n typeof headers === \"object\" &&\n headers !== null &&\n \"values\" in headers &&\n isHeaders(headers.values)\n ) {\n return headers.values;\n }\n // If headers is a plain object\n else if (typeof headers === \"object\" && headers !== null) {\n const entries: [string, string][] = Object.entries(headers)\n .filter(([, v]) => typeof v === \"string\")\n .map(([k, v]) => [k, v as string]);\n return new Headers(entries);\n }\n return new Headers();\n });\n\n return Object.fromEntries(output.entries());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,YAAYA,QAA8B;CACxD,MAAM,EACJ,8BACA,4BACA,mBACA,qBACA,SACA,sBACA,qBACD,GAAG;AAEJ,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,CAAC,EAAE,8BAA8B;AAEjE,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,oBAAoB,EAAE,8BAA8B;AAGpF,KAAI,qBAAqB,sBAAsB;AAC7C,MAAI,CAAC,2BACH,OAAM,IAAI,MACR;AAGJ,MAAI,CAAC,6BACH,OAAM,IAAI,MACR;AAGJ,SAAO,CAAC,QAAQ,EAAE,2BAA2B,qCAAqC,EAAE,8BAA8B;CACnH;AAED,QAAO;AACR;AAYD,SAAgB,UAAUC,SAAsC;AAC9D,QACE,OAAO,YAAY,eACnB,YAAY,QACZ,OAAO,YAAY,YACnB,OAAO,UAAU,SAAS,KAAK,QAAQ,KAAK;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,SAAgB,iBACdC,SACsD;CACtD,MAAM,SAAS,KAAK,MAAM;AAExB,MAAI,UAAU,QAAQ,CACpB,QAAO;WAGA,MAAM,QAAQ,QAAQ,CAC7B,QAAO,IAAI,QAAQ;WAInB,OAAO,YAAY,YACnB,YAAY,QACZ,YAAY,WACZ,UAAU,QAAQ,OAAO,CAEzB,QAAO,QAAQ;WAGR,OAAO,YAAY,YAAY,YAAY,MAAM;GACxD,MAAMC,UAA8B,OAAO,QAAQ,QAAQ,CACxD,OAAO,CAAC,GAAG,EAAE,KAAK,OAAO,MAAM,SAAS,CACxC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAY,EAAC;AACpC,UAAO,IAAI,QAAQ;EACpB;AACD,SAAO,IAAI;CACZ,EAAC;AAEF,QAAO,OAAO,YAAY,OAAO,SAAS,CAAC;AAC5C"}
1
+ {"version":3,"file":"azure.js","names":["config: OpenAIEndpointConfig","headers: unknown","headers: HeadersLike","entries: [string, string][]"],"sources":["../../src/utils/azure.ts"],"sourcesContent":["import { getEnv } from \"@langchain/core/utils/env\";\nimport { iife } from \"./misc.js\";\n\nexport interface OpenAIEndpointConfig {\n azureOpenAIApiDeploymentName?: string;\n azureOpenAIApiInstanceName?: string;\n azureOpenAIApiKey?: string;\n azureADTokenProvider?: () => Promise<string>;\n azureOpenAIBasePath?: string;\n baseURL?: string | null;\n azureOpenAIEndpoint?: string;\n}\n\n/**\n * This function generates an endpoint URL for (Azure) OpenAI\n * based on the configuration parameters provided.\n *\n * @param {OpenAIEndpointConfig} config - The configuration object for the (Azure) endpoint.\n *\n * @property {string} config.azureOpenAIApiDeploymentName - The deployment name of Azure OpenAI.\n * @property {string} config.azureOpenAIApiInstanceName - The instance name of Azure OpenAI, e.g. `example-resource`.\n * @property {string} config.azureOpenAIApiKey - The API Key for Azure OpenAI.\n * @property {string} config.azureOpenAIBasePath - The base path for Azure OpenAI, e.g. `https://example-resource.azure.openai.com/openai/deployments/`.\n * @property {string} config.baseURL - Some other custom base path URL.\n * @property {string} config.azureOpenAIEndpoint - The endpoint for the Azure OpenAI instance, e.g. `https://example-resource.azure.openai.com/`.\n *\n * The function operates as follows:\n * - If both `azureOpenAIBasePath` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`).\n * - If both `azureOpenAIEndpoint` and `azureOpenAIApiDeploymentName` (plus `azureOpenAIApiKey`) are provided, it returns an URL combining these two parameters (`${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`).\n * - If `azureOpenAIApiKey` is provided, it checks for `azureOpenAIApiInstanceName` and `azureOpenAIApiDeploymentName` and throws an error if any of these is missing. If both are provided, it generates an URL incorporating these parameters.\n * - If none of the above conditions are met, return any custom `baseURL`.\n * - The function returns the generated URL as a string, or undefined if no custom paths are specified.\n *\n * @throws Will throw an error if the necessary parameters for generating the URL are missing.\n *\n * @returns {string | undefined} The generated (Azure) OpenAI endpoint URL.\n */\nexport function getEndpoint(config: OpenAIEndpointConfig) {\n const {\n azureOpenAIApiDeploymentName,\n azureOpenAIApiInstanceName,\n azureOpenAIApiKey,\n azureOpenAIBasePath,\n baseURL,\n azureADTokenProvider,\n azureOpenAIEndpoint,\n } = config;\n\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIBasePath &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIBasePath}/${azureOpenAIApiDeploymentName}`;\n }\n if (\n (azureOpenAIApiKey || azureADTokenProvider) &&\n azureOpenAIEndpoint &&\n azureOpenAIApiDeploymentName\n ) {\n return `${azureOpenAIEndpoint}/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n if (azureOpenAIApiKey || azureADTokenProvider) {\n if (!azureOpenAIApiInstanceName) {\n throw new Error(\n \"azureOpenAIApiInstanceName is required when using azureOpenAIApiKey\"\n );\n }\n if (!azureOpenAIApiDeploymentName) {\n throw new Error(\n \"azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey\"\n );\n }\n return `https://${azureOpenAIApiInstanceName}.openai.azure.com/openai/deployments/${azureOpenAIApiDeploymentName}`;\n }\n\n return baseURL;\n}\n\ntype HeaderValue = string | undefined | null;\nexport type HeadersLike =\n | Headers\n | readonly HeaderValue[][]\n | Record<string, HeaderValue | readonly HeaderValue[]>\n | undefined\n | null\n // NullableHeaders\n | { values: Headers; [key: string]: unknown };\n\nexport function isHeaders(headers: unknown): headers is Headers {\n return (\n typeof Headers !== \"undefined\" &&\n headers !== null &&\n typeof headers === \"object\" &&\n Object.prototype.toString.call(headers) === \"[object Headers]\"\n );\n}\n\n/**\n * Normalizes various header formats into a consistent Record format.\n *\n * This function accepts headers in multiple formats and converts them to a\n * Record<string, HeaderValue | readonly HeaderValue[]> for consistent handling.\n *\n * @param headers - The headers to normalize. Can be:\n * - A Headers instance\n * - An array of [key, value] pairs\n * - A plain object with string keys\n * - A NullableHeaders-like object with a 'values' property containing Headers\n * - null or undefined\n * @returns A normalized Record containing the header key-value pairs\n *\n * @example\n * ```ts\n * // With Headers instance\n * const headers1 = new Headers([['content-type', 'application/json']]);\n * const normalized1 = normalizeHeaders(headers1);\n *\n * // With plain object\n * const headers2 = { 'content-type': 'application/json' };\n * const normalized2 = normalizeHeaders(headers2);\n *\n * // With array of pairs\n * const headers3 = [['content-type', 'application/json']];\n * const normalized3 = normalizeHeaders(headers3);\n * ```\n */\nexport function normalizeHeaders(\n headers: HeadersLike\n): Record<string, HeaderValue | readonly HeaderValue[]> {\n const output = iife(() => {\n // If headers is a Headers instance\n if (isHeaders(headers)) {\n return headers;\n }\n // If headers is an array of [key, value] pairs\n else if (Array.isArray(headers)) {\n return new Headers(headers);\n }\n // If headers is a NullableHeaders-like object (has 'values' property that is a Headers)\n else if (\n typeof headers === \"object\" &&\n headers !== null &&\n \"values\" in headers &&\n isHeaders(headers.values)\n ) {\n return headers.values;\n }\n // If headers is a plain object\n else if (typeof headers === \"object\" && headers !== null) {\n const entries: [string, string][] = Object.entries(headers)\n .filter(([, v]) => typeof v === \"string\")\n .map(([k, v]) => [k, v as string]);\n return new Headers(entries);\n }\n return new Headers();\n });\n\n return Object.fromEntries(output.entries());\n}\n\nexport function getFormattedEnv() {\n let env = getEnv();\n if (env === \"node\" || env === \"deno\") {\n env = `(${env}/${process.version}; ${process.platform}; ${process.arch})`;\n }\n return env;\n}\n\n// Note: ideally version would be imported from package.json, but there's\n// currently no good way to do that for all supported environments (Node, Deno, Browser).\nexport function getHeadersWithUserAgent(\n headers: HeadersLike,\n isAzure = false,\n version = \"1.0.0\"\n): Record<string, string> {\n const normalizedHeaders = normalizeHeaders(headers);\n const env = getFormattedEnv();\n const library = `langchainjs${isAzure ? \"-azure\" : \"\"}-openai`;\n return {\n ...normalizedHeaders,\n \"User-Agent\": normalizedHeaders[\"User-Agent\"]\n ? `${library}/${version} (${env})${normalizedHeaders[\"User-Agent\"]}`\n : `${library}/${version} (${env})`,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,YAAYA,QAA8B;CACxD,MAAM,EACJ,8BACA,4BACA,mBACA,qBACA,SACA,sBACA,qBACD,GAAG;AAEJ,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,CAAC,EAAE,8BAA8B;AAEjE,MACG,qBAAqB,yBACtB,uBACA,6BAEA,QAAO,GAAG,oBAAoB,oBAAoB,EAAE,8BAA8B;AAGpF,KAAI,qBAAqB,sBAAsB;AAC7C,MAAI,CAAC,2BACH,OAAM,IAAI,MACR;AAGJ,MAAI,CAAC,6BACH,OAAM,IAAI,MACR;AAGJ,SAAO,CAAC,QAAQ,EAAE,2BAA2B,qCAAqC,EAAE,8BAA8B;CACnH;AAED,QAAO;AACR;AAYD,SAAgB,UAAUC,SAAsC;AAC9D,QACE,OAAO,YAAY,eACnB,YAAY,QACZ,OAAO,YAAY,YACnB,OAAO,UAAU,SAAS,KAAK,QAAQ,KAAK;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BD,SAAgB,iBACdC,SACsD;CACtD,MAAM,SAAS,KAAK,MAAM;AAExB,MAAI,UAAU,QAAQ,CACpB,QAAO;WAGA,MAAM,QAAQ,QAAQ,CAC7B,QAAO,IAAI,QAAQ;WAInB,OAAO,YAAY,YACnB,YAAY,QACZ,YAAY,WACZ,UAAU,QAAQ,OAAO,CAEzB,QAAO,QAAQ;WAGR,OAAO,YAAY,YAAY,YAAY,MAAM;GACxD,MAAMC,UAA8B,OAAO,QAAQ,QAAQ,CACxD,OAAO,CAAC,GAAG,EAAE,KAAK,OAAO,MAAM,SAAS,CACxC,IAAI,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAY,EAAC;AACpC,UAAO,IAAI,QAAQ;EACpB;AACD,SAAO,IAAI;CACZ,EAAC;AAEF,QAAO,OAAO,YAAY,OAAO,SAAS,CAAC;AAC5C;AAED,SAAgB,kBAAkB;CAChC,IAAI,MAAM,QAAQ;AAClB,KAAI,QAAQ,UAAU,QAAQ,QAC5B,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,QAAQ,QAAQ,EAAE,EAAE,QAAQ,SAAS,EAAE,EAAE,QAAQ,KAAK,CAAC,CAAC;AAE3E,QAAO;AACR;AAID,SAAgB,wBACdD,SACA,UAAU,OACV,UAAU,SACc;CACxB,MAAM,oBAAoB,iBAAiB,QAAQ;CACnD,MAAM,MAAM,iBAAiB;CAC7B,MAAM,UAAU,CAAC,WAAW,EAAE,UAAU,WAAW,GAAG,OAAO,CAAC;AAC9D,QAAO;EACL,GAAG;EACH,cAAc,kBAAkB,gBAC5B,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,kBAAkB,eAAe,GAClE,GAAG,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;CACrC;AACF"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const __langchain_core_utils_function_calling = require_rolldown_runtime.__toESM(require("@langchain/core/utils/function_calling"));
2
3
  const __langchain_core_utils_types = require_rolldown_runtime.__toESM(require("@langchain/core/utils/types"));
3
4
  const __langchain_core_utils_json_schema = require_rolldown_runtime.__toESM(require("@langchain/core/utils/json_schema"));
4
- const __langchain_core_utils_function_calling = require_rolldown_runtime.__toESM(require("@langchain/core/utils/function_calling"));
5
5
 
6
6
  //#region src/utils/tools.ts
7
7
  /**
@@ -1,6 +1,6 @@
1
+ import { convertToOpenAITool, isLangChainTool } from "@langchain/core/utils/function_calling";
1
2
  import { isInteropZodSchema } from "@langchain/core/utils/types";
2
3
  import { toJsonSchema } from "@langchain/core/utils/json_schema";
3
- import { convertToOpenAITool, isLangChainTool } from "@langchain/core/utils/function_calling";
4
4
 
5
5
  //#region src/utils/tools.ts
6
6
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/openai",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "OpenAI integrations for LangChain.js",
5
5
  "author": "LangChain",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "homepage": "https://github.com/langchain-ai/langchainjs/tree/main/libs/providers/langchain-openai/",
16
16
  "dependencies": {
17
17
  "js-tiktoken": "^1.0.12",
18
- "openai": "^6.3.0",
18
+ "openai": "^6.9.0",
19
19
  "zod": "^3.25.76 || ^4"
20
20
  },
21
21
  "peerDependencies": {
@@ -35,9 +35,9 @@
35
35
  "uuid": "^11.1.0",
36
36
  "vitest": "^3.2.4",
37
37
  "zod-to-json-schema": "^3.24.6",
38
+ "@langchain/core": "1.0.5",
38
39
  "@langchain/eslint": "0.1.0",
39
- "@langchain/standard-tests": "0.0.0",
40
- "@langchain/core": "1.0.4"
40
+ "@langchain/standard-tests": "0.0.1"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -79,7 +79,8 @@
79
79
  "LICENSE"
80
80
  ],
81
81
  "scripts": {
82
- "build": "pnpm --filter @langchain/build compile @langchain/openai",
82
+ "build": "turbo build:compile --filter @langchain/openai",
83
+ "build:compile": "pnpm --filter @langchain/build compile @langchain/openai",
83
84
  "lint:eslint": "eslint --cache src/",
84
85
  "lint:dpdm": "dpdm --skip-dynamic-imports circular --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
85
86
  "lint": "pnpm lint:eslint && pnpm lint:dpdm",
@@ -92,6 +93,8 @@
92
93
  "test:standard:int": "vitest run --mode standard-int",
93
94
  "test:standard": "pnpm test:standard:unit && pnpm test:standard:int",
94
95
  "format": "prettier --config .prettierrc --write \"src\"",
95
- "format:check": "prettier --config .prettierrc --check \"src\""
96
+ "format:check": "prettier --config .prettierrc --check \"src\"",
97
+ "typegen": "pnpm run typegen:profiles",
98
+ "typegen:profiles": "pnpm --filter @langchain/model-profiles make --config profiles.toml"
96
99
  }
97
100
  }