@azure-rest/ai-inference 1.0.0-beta.4 → 1.0.0-beta.6

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 (172) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +323 -248
  3. package/dist/browser/clientDefinitions.d.ts +14 -5
  4. package/dist/browser/clientDefinitions.d.ts.map +1 -1
  5. package/dist/browser/clientDefinitions.js.map +1 -1
  6. package/dist/browser/constants.d.ts +7 -0
  7. package/dist/browser/constants.d.ts.map +1 -1
  8. package/dist/browser/constants.js +7 -0
  9. package/dist/browser/constants.js.map +1 -1
  10. package/dist/browser/index.d.ts +11 -3
  11. package/dist/browser/index.d.ts.map +1 -1
  12. package/dist/browser/index.js +10 -3
  13. package/dist/browser/index.js.map +1 -1
  14. package/dist/browser/isUnexpected.d.ts +8 -1
  15. package/dist/browser/isUnexpected.d.ts.map +1 -1
  16. package/dist/browser/isUnexpected.js +0 -4
  17. package/dist/browser/isUnexpected.js.map +1 -1
  18. package/dist/browser/logger.d.ts.map +1 -1
  19. package/dist/browser/logger.js +7 -0
  20. package/dist/browser/logger.js.map +1 -1
  21. package/dist/browser/modelClient.d.ts +7 -0
  22. package/dist/browser/modelClient.d.ts.map +1 -1
  23. package/dist/browser/modelClient.js +1 -1
  24. package/dist/browser/modelClient.js.map +1 -1
  25. package/dist/browser/models.d.ts +94 -12
  26. package/dist/browser/models.d.ts.map +1 -1
  27. package/dist/browser/models.js.map +1 -1
  28. package/dist/browser/outputModels.d.ts +26 -17
  29. package/dist/browser/outputModels.d.ts.map +1 -1
  30. package/dist/browser/outputModels.js.map +1 -1
  31. package/dist/browser/parameters.d.ts +15 -8
  32. package/dist/browser/parameters.d.ts.map +1 -1
  33. package/dist/browser/parameters.js.map +1 -1
  34. package/dist/browser/responses.d.ts +9 -2
  35. package/dist/browser/responses.d.ts.map +1 -1
  36. package/dist/browser/responses.js.map +1 -1
  37. package/dist/browser/tracingHelper.d.ts +8 -1
  38. package/dist/browser/tracingHelper.d.ts.map +1 -1
  39. package/dist/browser/tracingHelper.js +26 -26
  40. package/dist/browser/tracingHelper.js.map +1 -1
  41. package/dist/browser/tracingPolicy.d.ts +7 -0
  42. package/dist/browser/tracingPolicy.d.ts.map +1 -1
  43. package/dist/browser/tracingPolicy.js +2 -2
  44. package/dist/browser/tracingPolicy.js.map +1 -1
  45. package/dist/commonjs/clientDefinitions.d.ts +14 -5
  46. package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
  47. package/dist/commonjs/clientDefinitions.js.map +1 -1
  48. package/dist/commonjs/constants.d.ts +7 -0
  49. package/dist/commonjs/constants.d.ts.map +1 -1
  50. package/dist/commonjs/constants.js +9 -2
  51. package/dist/commonjs/constants.js.map +1 -1
  52. package/dist/commonjs/index.d.ts +11 -3
  53. package/dist/commonjs/index.d.ts.map +1 -1
  54. package/dist/commonjs/index.js +10 -3
  55. package/dist/commonjs/index.js.map +1 -1
  56. package/dist/commonjs/isUnexpected.d.ts +8 -1
  57. package/dist/commonjs/isUnexpected.d.ts.map +1 -1
  58. package/dist/commonjs/isUnexpected.js +0 -4
  59. package/dist/commonjs/isUnexpected.js.map +1 -1
  60. package/dist/commonjs/logger.d.ts.map +1 -1
  61. package/dist/commonjs/logger.js +7 -0
  62. package/dist/commonjs/logger.js.map +1 -1
  63. package/dist/commonjs/modelClient.d.ts +7 -0
  64. package/dist/commonjs/modelClient.d.ts.map +1 -1
  65. package/dist/commonjs/modelClient.js +1 -1
  66. package/dist/commonjs/modelClient.js.map +1 -1
  67. package/dist/commonjs/models.d.ts +94 -12
  68. package/dist/commonjs/models.d.ts.map +1 -1
  69. package/dist/commonjs/models.js.map +1 -1
  70. package/dist/commonjs/outputModels.d.ts +26 -17
  71. package/dist/commonjs/outputModels.d.ts.map +1 -1
  72. package/dist/commonjs/outputModels.js.map +1 -1
  73. package/dist/commonjs/parameters.d.ts +15 -8
  74. package/dist/commonjs/parameters.d.ts.map +1 -1
  75. package/dist/commonjs/parameters.js.map +1 -1
  76. package/dist/commonjs/responses.d.ts +9 -2
  77. package/dist/commonjs/responses.d.ts.map +1 -1
  78. package/dist/commonjs/responses.js.map +1 -1
  79. package/dist/commonjs/tracingHelper.d.ts +8 -1
  80. package/dist/commonjs/tracingHelper.d.ts.map +1 -1
  81. package/dist/commonjs/tracingHelper.js +26 -26
  82. package/dist/commonjs/tracingHelper.js.map +1 -1
  83. package/dist/commonjs/tracingPolicy.d.ts +7 -0
  84. package/dist/commonjs/tracingPolicy.d.ts.map +1 -1
  85. package/dist/commonjs/tracingPolicy.js +2 -2
  86. package/dist/commonjs/tracingPolicy.js.map +1 -1
  87. package/dist/commonjs/tsdoc-metadata.json +1 -1
  88. package/dist/esm/clientDefinitions.d.ts +14 -5
  89. package/dist/esm/clientDefinitions.d.ts.map +1 -1
  90. package/dist/esm/clientDefinitions.js.map +1 -1
  91. package/dist/esm/constants.d.ts +7 -0
  92. package/dist/esm/constants.d.ts.map +1 -1
  93. package/dist/esm/constants.js +7 -0
  94. package/dist/esm/constants.js.map +1 -1
  95. package/dist/esm/index.d.ts +11 -3
  96. package/dist/esm/index.d.ts.map +1 -1
  97. package/dist/esm/index.js +10 -3
  98. package/dist/esm/index.js.map +1 -1
  99. package/dist/esm/isUnexpected.d.ts +8 -1
  100. package/dist/esm/isUnexpected.d.ts.map +1 -1
  101. package/dist/esm/isUnexpected.js +0 -4
  102. package/dist/esm/isUnexpected.js.map +1 -1
  103. package/dist/esm/logger.d.ts.map +1 -1
  104. package/dist/esm/logger.js +7 -0
  105. package/dist/esm/logger.js.map +1 -1
  106. package/dist/esm/modelClient.d.ts +7 -0
  107. package/dist/esm/modelClient.d.ts.map +1 -1
  108. package/dist/esm/modelClient.js +1 -1
  109. package/dist/esm/modelClient.js.map +1 -1
  110. package/dist/esm/models.d.ts +94 -12
  111. package/dist/esm/models.d.ts.map +1 -1
  112. package/dist/esm/models.js.map +1 -1
  113. package/dist/esm/outputModels.d.ts +26 -17
  114. package/dist/esm/outputModels.d.ts.map +1 -1
  115. package/dist/esm/outputModels.js.map +1 -1
  116. package/dist/esm/parameters.d.ts +15 -8
  117. package/dist/esm/parameters.d.ts.map +1 -1
  118. package/dist/esm/parameters.js.map +1 -1
  119. package/dist/esm/responses.d.ts +9 -2
  120. package/dist/esm/responses.d.ts.map +1 -1
  121. package/dist/esm/responses.js.map +1 -1
  122. package/dist/esm/tracingHelper.d.ts +8 -1
  123. package/dist/esm/tracingHelper.d.ts.map +1 -1
  124. package/dist/esm/tracingHelper.js +26 -26
  125. package/dist/esm/tracingHelper.js.map +1 -1
  126. package/dist/esm/tracingPolicy.d.ts +7 -0
  127. package/dist/esm/tracingPolicy.d.ts.map +1 -1
  128. package/dist/esm/tracingPolicy.js +2 -2
  129. package/dist/esm/tracingPolicy.js.map +1 -1
  130. package/dist/react-native/clientDefinitions.d.ts +14 -5
  131. package/dist/react-native/clientDefinitions.d.ts.map +1 -1
  132. package/dist/react-native/clientDefinitions.js.map +1 -1
  133. package/dist/react-native/constants.d.ts +7 -0
  134. package/dist/react-native/constants.d.ts.map +1 -1
  135. package/dist/react-native/constants.js +7 -0
  136. package/dist/react-native/constants.js.map +1 -1
  137. package/dist/react-native/index.d.ts +11 -3
  138. package/dist/react-native/index.d.ts.map +1 -1
  139. package/dist/react-native/index.js +10 -3
  140. package/dist/react-native/index.js.map +1 -1
  141. package/dist/react-native/isUnexpected.d.ts +8 -1
  142. package/dist/react-native/isUnexpected.d.ts.map +1 -1
  143. package/dist/react-native/isUnexpected.js +0 -4
  144. package/dist/react-native/isUnexpected.js.map +1 -1
  145. package/dist/react-native/logger.d.ts.map +1 -1
  146. package/dist/react-native/logger.js +7 -0
  147. package/dist/react-native/logger.js.map +1 -1
  148. package/dist/react-native/modelClient.d.ts +7 -0
  149. package/dist/react-native/modelClient.d.ts.map +1 -1
  150. package/dist/react-native/modelClient.js +1 -1
  151. package/dist/react-native/modelClient.js.map +1 -1
  152. package/dist/react-native/models.d.ts +94 -12
  153. package/dist/react-native/models.d.ts.map +1 -1
  154. package/dist/react-native/models.js.map +1 -1
  155. package/dist/react-native/outputModels.d.ts +26 -17
  156. package/dist/react-native/outputModels.d.ts.map +1 -1
  157. package/dist/react-native/outputModels.js.map +1 -1
  158. package/dist/react-native/parameters.d.ts +15 -8
  159. package/dist/react-native/parameters.d.ts.map +1 -1
  160. package/dist/react-native/parameters.js.map +1 -1
  161. package/dist/react-native/responses.d.ts +9 -2
  162. package/dist/react-native/responses.d.ts.map +1 -1
  163. package/dist/react-native/responses.js.map +1 -1
  164. package/dist/react-native/tracingHelper.d.ts +8 -1
  165. package/dist/react-native/tracingHelper.d.ts.map +1 -1
  166. package/dist/react-native/tracingHelper.js +26 -26
  167. package/dist/react-native/tracingHelper.js.map +1 -1
  168. package/dist/react-native/tracingPolicy.d.ts +7 -0
  169. package/dist/react-native/tracingPolicy.d.ts.map +1 -1
  170. package/dist/react-native/tracingPolicy.js +2 -2
  171. package/dist/react-native/tracingPolicy.js.map +1 -1
  172. package/package.json +30 -22
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,6BAA6B,EAC7B,6BAA6B,EAC7B,kCAAkC,EAClC,iCAAiC,EACjC,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,yBAAyB;IACxC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE;QACL,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;Q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CAC3D;AAED,MAAM,MAAM,4BAA4B,GAAG,6BAA6B,GACtE,2BAA2B,GAC3B,iBAAiB,CAAC;AACpB,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AACvD,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAC5D,sBAAsB,GACtB,iBAAiB,CAAC;AACpB,MAAM,MAAM,4BAA4B,GAAG,6BAA6B,GACtE,2BAA2B,GAC3B,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type {\n ExtraParameters,\n ChatRequestMessage,\n ChatCompletionsResponseFormat,\n ChatCompletionsToolDefinition,\n ChatCompletionsToolSelectionPreset,\n ChatCompletionsNamedToolSelection,\n EmbeddingEncodingFormat,\n EmbeddingInputType,\n ImageEmbeddingInput,\n} from \"./models.js\";\n\nexport interface GetChatCompletionsHeaders {\n /**\n * Controls what happens if extra parameters, undefined by the REST API,\n * are passed in the JSON request payload.\n * This sets the HTTP request header `extra-parameters`.\n *\n * Possible values: \"error\", \"drop\", \"pass-through\"\n */\n \"extra-parameters\"?: ExtraParameters;\n}\n\nexport interface GetChatCompletionsBodyParam {\n body?: {\n messages: Array<ChatRequestMessage>;\n frequency_penalty?: number;\n stream?: boolean;\n presence_penalty?: number;\n temperature?: number;\n top_p?: number;\n max_tokens?: number;\n response_format?: ChatCompletionsResponseFormat;\n stop?: string[];\n tools?: Array<ChatCompletionsToolDefinition>;\n tool_choice?: ChatCompletionsToolSelectionPreset | ChatCompletionsNamedToolSelection;\n seed?: number;\n model?: string;\n };\n}\n\nexport interface GetChatCompletionsHeaderParam {\n headers?: RawHttpHeadersInput & GetChatCompletionsHeaders;\n}\n\nexport type GetChatCompletionsParameters = GetChatCompletionsHeaderParam &\n GetChatCompletionsBodyParam &\n RequestParameters;\nexport type GetModelInfoParameters = RequestParameters;\n\nexport interface GetEmbeddingsHeaders {\n /**\n * Controls what happens if extra parameters, undefined by the REST API,\n * are passed in the JSON request payload.\n * This sets the HTTP request header `extra-parameters`.\n *\n * Possible values: \"error\", \"drop\", \"pass-through\"\n */\n \"extra-parameters\"?: ExtraParameters;\n}\n\nexport interface GetEmbeddingsBodyParam {\n body?: {\n input: string[];\n dimensions?: number;\n encoding_format?: EmbeddingEncodingFormat;\n input_type?: EmbeddingInputType;\n model?: string;\n };\n}\n\nexport interface GetEmbeddingsHeaderParam {\n headers?: RawHttpHeadersInput & GetEmbeddingsHeaders;\n}\n\nexport type GetEmbeddingsParameters = GetEmbeddingsHeaderParam &\n GetEmbeddingsBodyParam &\n RequestParameters;\n\nexport interface GetImageEmbeddingsHeaders {\n /**\n * Controls what happens if extra parameters, undefined by the REST API,\n * are passed in the JSON request payload.\n * This sets the HTTP request header `extra-parameters`.\n *\n * Possible values: \"error\", \"drop\", \"pass-through\"\n */\n \"extra-parameters\"?: ExtraParameters;\n}\n\nexport interface GetImageEmbeddingsBodyParam {\n body?: {\n input: Array<ImageEmbeddingInput>;\n dimensions?: number;\n encoding_format?: EmbeddingEncodingFormat;\n input_type?: EmbeddingInputType;\n model?: string;\n };\n}\n\nexport interface GetImageEmbeddingsHeaderParam {\n headers?: RawHttpHeadersInput & GetImageEmbeddingsHeaders;\n}\n\nexport type GetImageEmbeddingsParameters = GetImageEmbeddingsHeaderParam &\n GetImageEmbeddingsBodyParam &\n RequestParameters;\n"]}
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type {\n ChatCompletionsNamedToolChoice,\n ChatCompletionsResponseFormat,\n ChatCompletionsToolChoicePreset,\n ChatCompletionsToolDefinition,\n ChatRequestMessage,\n EmbeddingEncodingFormat,\n EmbeddingInputType,\n ExtraParameters,\n ImageEmbeddingInput,\n} from \"./models.js\";\n\nexport interface GetChatCompletionsHeaders {\n /**\n * Controls what happens if extra parameters, undefined by the REST API,\n * are passed in the JSON request payload.\n * This sets the HTTP request header `extra-parameters`.\n *\n * Possible values: \"error\", \"drop\", \"pass-through\"\n */\n \"extra-parameters\"?: ExtraParameters;\n}\n\nexport interface GetChatCompletionsBodyParam {\n body: {\n messages: Array<ChatRequestMessage>;\n frequency_penalty?: number;\n stream?: boolean;\n presence_penalty?: number;\n temperature?: number;\n top_p?: number;\n max_tokens?: number;\n response_format?: ChatCompletionsResponseFormat;\n stop?: string[];\n tools?: Array<ChatCompletionsToolDefinition>;\n tool_choice?: ChatCompletionsToolChoicePreset | ChatCompletionsNamedToolChoice;\n seed?: number;\n model?: string;\n };\n}\n\nexport interface GetChatCompletionsHeaderParam {\n headers?: RawHttpHeadersInput & GetChatCompletionsHeaders;\n}\n\nexport interface GetEmbeddingsHeaders {\n /**\n * Controls what happens if extra parameters, undefined by the REST API,\n * are passed in the JSON request payload.\n * This sets the HTTP request header `extra-parameters`.\n *\n * Possible values: \"error\", \"drop\", \"pass-through\"\n */\n \"extra-parameters\"?: ExtraParameters;\n}\n\nexport interface GetEmbeddingsBodyParam {\n body?: {\n input: string[];\n dimensions?: number;\n encoding_format?: EmbeddingEncodingFormat;\n input_type?: EmbeddingInputType;\n model?: string;\n };\n}\n\nexport interface GetEmbeddingsHeaderParam {\n headers?: RawHttpHeadersInput & GetEmbeddingsHeaders;\n}\n\nexport interface GetImageEmbeddingsHeaders {\n /**\n * Controls what happens if extra parameters, undefined by the REST API,\n * are passed in the JSON request payload.\n * This sets the HTTP request header `extra-parameters`.\n *\n * Possible values: \"error\", \"drop\", \"pass-through\"\n */\n \"extra-parameters\"?: ExtraParameters;\n}\n\nexport interface GetImageEmbeddingsBodyParam {\n body: {\n input: Array<ImageEmbeddingInput>;\n dimensions?: number;\n encoding_format?: EmbeddingEncodingFormat;\n input_type?: EmbeddingInputType;\n model?: string;\n };\n}\n\nexport interface GetImageEmbeddingsHeaderParam {\n headers?: RawHttpHeadersInput & GetImageEmbeddingsHeaders;\n}\n\nexport type GetChatCompletionsParameters = GetChatCompletionsHeaderParam &\n GetChatCompletionsBodyParam &\n RequestParameters;\nexport type GetModelInfoParameters = RequestParameters;\nexport type GetEmbeddingsParameters = GetEmbeddingsHeaderParam &\n GetEmbeddingsBodyParam &\n RequestParameters;\nexport type GetImageEmbeddingsParameters = GetImageEmbeddingsHeaderParam &\n GetImageEmbeddingsBodyParam &\n RequestParameters;\n"]}
@@ -1,6 +1,13 @@
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
8
+ import type { ErrorResponse, HttpResponse } from "@azure-rest/core-client";
1
9
  import type { RawHttpHeaders } from "@azure/core-rest-pipeline";
2
- import type { HttpResponse, ErrorResponse } from "@azure-rest/core-client";
3
- import type { ChatCompletionsOutput, ModelInfoOutput, EmbeddingsResultOutput } from "./outputModels.js";
10
+ import type { ChatCompletionsOutput, EmbeddingsResultOutput, ModelInfoOutput } from "./outputModels.js";
4
11
  /** The request has succeeded. */
5
12
  export interface GetChatCompletions200Response extends HttpResponse {
6
13
  status: "200";
@@ -1 +1 @@
1
- {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,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;AAED,MAAM,WAAW,2BAA4B,SAAQ,YAAY;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,cAAc,GAAG,0BAA0B,CAAC;CACtD;AAED,iCAAiC;AACjC,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,MAAM,WAAW,2BAA2B;IAC1C,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,4BAA6B,SAAQ,YAAY;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,cAAc,GAAG,2BAA2B,CAAC;CACvD;AAED,iCAAiC;AACjC,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IACjE,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,sBAAsB,CAAC;CAC9B;AAED,MAAM,WAAW,gCAAgC;IAC/C,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iCAAkC,SAAQ,YAAY;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,cAAc,GAAG,gCAAgC,CAAC;CAC5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport type { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport type {\n ChatCompletionsOutput,\n ModelInfoOutput,\n EmbeddingsResultOutput,\n} from \"./outputModels.js\";\n\n/** The request has succeeded. */\nexport interface GetChatCompletions200Response extends HttpResponse {\n status: \"200\";\n body: ChatCompletionsOutput;\n}\n\nexport interface GetChatCompletionsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetChatCompletionsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetChatCompletionsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetModelInfo200Response extends HttpResponse {\n status: \"200\";\n body: ModelInfoOutput;\n}\n\nexport interface GetModelInfoDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetModelInfoDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetModelInfoDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetEmbeddings200Response extends HttpResponse {\n status: \"200\";\n body: EmbeddingsResultOutput;\n}\n\nexport interface GetEmbeddingsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetEmbeddingsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetEmbeddingsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetImageEmbeddings200Response extends HttpResponse {\n status: \"200\";\n body: EmbeddingsResultOutput;\n}\n\nexport interface GetImageEmbeddingsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetImageEmbeddingsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetImageEmbeddingsDefaultHeaders;\n}\n"]}
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport type { ErrorResponse, HttpResponse } from \"@azure-rest/core-client\";\nimport type { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport type {\n ChatCompletionsOutput,\n EmbeddingsResultOutput,\n ModelInfoOutput,\n} from \"./outputModels.js\";\n\n/** The request has succeeded. */\nexport interface GetChatCompletions200Response extends HttpResponse {\n status: \"200\";\n body: ChatCompletionsOutput;\n}\n\nexport interface GetChatCompletionsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetChatCompletionsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetChatCompletionsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetModelInfo200Response extends HttpResponse {\n status: \"200\";\n body: ModelInfoOutput;\n}\n\nexport interface GetModelInfoDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetModelInfoDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetModelInfoDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetEmbeddings200Response extends HttpResponse {\n status: \"200\";\n body: EmbeddingsResultOutput;\n}\n\nexport interface GetEmbeddingsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetEmbeddingsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetEmbeddingsDefaultHeaders;\n}\n\n/** The request has succeeded. */\nexport interface GetImageEmbeddings200Response extends HttpResponse {\n status: \"200\";\n body: EmbeddingsResultOutput;\n}\n\nexport interface GetImageEmbeddingsDefaultHeaders {\n /** String error code indicating what went wrong. */\n \"x-ms-error-code\"?: string;\n}\n\nexport interface GetImageEmbeddingsDefaultResponse extends HttpResponse {\n status: string;\n body: ErrorResponse;\n headers: RawHttpHeaders & GetImageEmbeddingsDefaultHeaders;\n}\n"]}
@@ -1,6 +1,13 @@
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
8
+ import type { PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline";
1
9
  import type { TracingSpan } from "@azure/core-tracing";
2
10
  import type { GetChatCompletionsBodyParam } from "./parameters.js";
3
- import type { PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline";
4
11
  export declare function getRequestBody(request: PipelineRequest): GetChatCompletionsBodyParam;
5
12
  export declare function getSpanName(request: PipelineRequest): string;
6
13
  export declare function onStartTracing(span: TracingSpan, request: PipelineRequest, url: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"tracingHelper.d.ts","sourceRoot":"","sources":["../../src/tracingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAanE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AA0BnF,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,2BAA2B,CAEpF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAG5D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CA6B7F;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,IAAI,CA4BvF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAKvE"}
1
+ {"version":3,"file":"tracingHelper.d.ts","sourceRoot":"","sources":["../../src/tracingHelper.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAavD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAmDnE,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,2BAA2B,CAEpF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAG5D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CA0B7F;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,IAAI,CA4BvF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAKvE"}
@@ -1,8 +1,30 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import { isError } from "@azure/core-util";
4
- const INFERENCE_GEN_AI_SYSTEM_NAME = "az.ai.inference";
5
- const isContentRecordingEnabled = () => envVarToBoolean("AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED");
4
+ /*
5
+ * Add event to span. Sample:
6
+ {
7
+ name: 'gen_ai.user.message',
8
+ attributes: {
9
+ 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',
10
+ 'gen_ai.event.content': `{"role":"user","content":"What's the weather like in Boston?"}`
11
+ },
12
+ time: [ 1725666879, 622695900 ],
13
+ droppedAttributesCount: 0
14
+ },
15
+ */
16
+ /*
17
+ * Add event to span. Sample:
18
+ {
19
+ name: 'gen_ai.choice',
20
+ attributes: {
21
+ 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',
22
+ 'gen_ai.event.content': '{"finish_reason":"tool_calls","index":0,"message":{"content":""}}'
23
+ },
24
+ time: [ 1725666881, 780608000 ],
25
+ droppedAttributesCount: 0
26
+ }
27
+ */
6
28
  var TracingAttributesEnum;
7
29
  (function (TracingAttributesEnum) {
8
30
  TracingAttributesEnum["Operation_Name"] = "gen_ai.operation.name";
@@ -23,6 +45,8 @@ var TracingAttributesEnum;
23
45
  TracingAttributesEnum["Usage_Output_Tokens"] = "gen_ai.usage.output_tokens";
24
46
  TracingAttributesEnum["Server_Address"] = "server.address";
25
47
  })(TracingAttributesEnum || (TracingAttributesEnum = {}));
48
+ const INFERENCE_GEN_AI_SYSTEM_NAME = "az.ai.inference";
49
+ const isContentRecordingEnabled = () => envVarToBoolean("AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED");
26
50
  export function getRequestBody(request) {
27
51
  return { body: JSON.parse(request.body) };
28
52
  }
@@ -89,18 +113,6 @@ export function tryProcessError(span, error) {
89
113
  error: isError(error) ? error : undefined,
90
114
  });
91
115
  }
92
- /*
93
- * Add event to span. Sample:
94
- {
95
- name: 'gen_ai.user.message',
96
- attributes: {
97
- 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',
98
- 'gen_ai.event.content': `{"role":"user","content":"What's the weather like in Boston?"}`
99
- },
100
- time: [ 1725666879, 622695900 ],
101
- droppedAttributesCount: 0
102
- },
103
- */
104
116
  function addRequestChatMessageEvent(span, messages) {
105
117
  messages.forEach((message) => {
106
118
  var _a;
@@ -140,18 +152,6 @@ function addRequestChatMessageEvent(span, messages) {
140
152
  }
141
153
  });
142
154
  }
143
- /*
144
- * Add event to span. Sample:
145
- {
146
- name: 'gen_ai.choice',
147
- attributes: {
148
- 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',
149
- 'gen_ai.event.content': '{"finish_reason":"tool_calls","index":0,"message":{"content":""}}'
150
- },
151
- time: [ 1725666881, 780608000 ],
152
- droppedAttributesCount: 0
153
- }
154
- */
155
155
  function addResponseChatMessageEvent(span, body) {
156
156
  var _a;
157
157
  if (!span.addEvent) {
@@ -1 +1 @@
1
- {"version":3,"file":"tracingHelper.js","sourceRoot":"","sources":["../../src/tracingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAelC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,MAAM,4BAA4B,GAAG,iBAAiB,CAAC;AACvD,MAAM,yBAAyB,GAAG,GAAG,EAAE,CACrC,eAAe,CAAC,gDAAgD,CAAC,CAAC;AAEpE,IAAK,qBAkBJ;AAlBD,WAAK,qBAAqB;IACxB,iEAAwC,CAAA;IACxC,+DAAsC,CAAA;IACtC,iDAAwB,CAAA;IACxB,kDAAyB,CAAA;IACzB,oDAA2B,CAAA;IAC3B,uFAA8D,CAAA;IAC9D,yEAAgD,CAAA;IAChD,qFAA4D,CAAA;IAC5D,iFAAwD,CAAA;IACxD,2EAAkD,CAAA;IAClD,+DAAsC,CAAA;IACtC,mFAA0D,CAAA;IAC1D,2DAAkC,CAAA;IAClC,iEAAwC,CAAA;IACxC,yEAAgD,CAAA;IAChD,2EAAkD,CAAA;IAClD,0DAAiC,CAAA;AACnC,CAAC,EAlBI,qBAAqB,KAArB,qBAAqB,QAkBzB;AAED,MAAM,UAAU,cAAc,CAAC,OAAwB;IACrD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAc,CAAC,EAAE,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAwB;;IAClD,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,QAAQ,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,mCAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,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,CAAC,GAAG,CAAC,mCAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACjE,OAAO,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TracingSpan } from \"@azure/core-tracing\";\nimport type { GetChatCompletionsBodyParam } from \"./parameters.js\";\nimport type {\n ChatRequestAssistantMessage,\n ChatRequestMessage,\n ChatRequestSystemMessage,\n ChatRequestToolMessage,\n} from \"./models.js\";\nimport type {\n ChatChoiceOutput,\n ChatCompletionsOutput,\n ChatCompletionsToolCallOutput,\n} from \"./outputModels.js\";\nimport { isError } from \"@azure/core-util\";\nimport type { PipelineRequest, PipelineResponse } from \"@azure/core-rest-pipeline\";\n\nconst INFERENCE_GEN_AI_SYSTEM_NAME = \"az.ai.inference\";\nconst isContentRecordingEnabled = () =>\n envVarToBoolean(\"AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED\");\n\nenum TracingAttributesEnum {\n Operation_Name = \"gen_ai.operation.name\",\n Request_Model = \"gen_ai.request.model\",\n System = \"gen_ai.system\",\n Error_Type = \"error.type\",\n Server_Port = \"server.port\",\n Request_Frequency_Penalty = \"gen_ai.request.frequency_penalty\",\n Request_Max_Tokens = \"gen_ai.request.max_tokens\",\n Request_Presence_Penalty = \"gen_ai.request.presence_penalty\",\n Request_Stop_Sequences = \"gen_ai.request.stop_sequences\",\n Request_Temperature = \"gen_ai.request.temperature\",\n Request_Top_P = \"gen_ai.request.top_p\",\n Response_Finish_Reasons = \"gen_ai.response.finish_reasons\",\n Response_Id = \"gen_ai.response.id\",\n Response_Model = \"gen_ai.response.model\",\n Usage_Input_Tokens = \"gen_ai.usage.input_tokens\",\n Usage_Output_Tokens = \"gen_ai.usage.output_tokens\",\n Server_Address = \"server.address\",\n}\n\nexport function getRequestBody(request: PipelineRequest): GetChatCompletionsBodyParam {\n return { body: JSON.parse(request.body as string) };\n}\n\nexport function getSpanName(request: PipelineRequest): string {\n const { body } = getRequestBody(request);\n return `chat ${body?.model ?? \"\"}`.trim();\n}\n\nexport function onStartTracing(span: TracingSpan, request: PipelineRequest, url: string): void {\n if (!span.isRecording()) {\n return;\n }\n\n const urlObj = new URL(url);\n const port = Number(urlObj.port) || (urlObj.protocol === \"https:\" ? undefined : 80);\n\n if (port) {\n span.setAttribute(TracingAttributesEnum.Server_Port, port);\n }\n span.setAttribute(TracingAttributesEnum.Server_Address, urlObj.hostname);\n span.setAttribute(TracingAttributesEnum.Operation_Name, \"chat\");\n span.setAttribute(TracingAttributesEnum.System, \"az.ai.inference\");\n\n const { body } = getRequestBody(request);\n if (!body) return;\n\n span.setAttribute(TracingAttributesEnum.Request_Model, body.model);\n span.setAttribute(TracingAttributesEnum.Request_Frequency_Penalty, body.frequency_penalty);\n span.setAttribute(TracingAttributesEnum.Request_Max_Tokens, body.max_tokens);\n span.setAttribute(TracingAttributesEnum.Request_Presence_Penalty, body.presence_penalty);\n span.setAttribute(TracingAttributesEnum.Request_Stop_Sequences, body.stop);\n span.setAttribute(TracingAttributesEnum.Request_Temperature, body.temperature);\n span.setAttribute(TracingAttributesEnum.Request_Top_P, body.top_p);\n\n if (body.messages) {\n addRequestChatMessageEvent(span, body.messages);\n }\n}\n\nexport function tryProcessResponse(span: TracingSpan, response?: PipelineResponse): void {\n if (!span.isRecording()) {\n return;\n }\n\n if (response?.bodyAsText) {\n const body: any = JSON.parse(response.bodyAsText);\n if (body.error ?? body.message) {\n span.setAttribute(TracingAttributesEnum.Error_Type, `${body.status ?? body.statusCode}`);\n span.setStatus({\n status: \"error\",\n error: body.error ?? body.message, // message is not in the schema of the response, but it can present if there is crediential error\n });\n }\n span.setAttribute(TracingAttributesEnum.Response_Id, body.id);\n span.setAttribute(TracingAttributesEnum.Response_Model, body.model);\n if (body.choices) {\n span.setAttribute(\n TracingAttributesEnum.Response_Finish_Reasons,\n body.choices.map((choice: ChatChoiceOutput) => choice.finish_reason).join(\",\"),\n );\n }\n if (body.usage) {\n span.setAttribute(TracingAttributesEnum.Usage_Input_Tokens, body.usage.prompt_tokens);\n span.setAttribute(TracingAttributesEnum.Usage_Output_Tokens, body.usage.completion_tokens);\n }\n addResponseChatMessageEvent(span, body);\n }\n}\n\nexport function tryProcessError(span: TracingSpan, error: unknown): void {\n span.setStatus({\n status: \"error\",\n error: isError(error) ? error : undefined,\n });\n}\n\n/*\n* Add event to span. Sample:\n {\n name: 'gen_ai.user.message',\n attributes: {\n 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',\n 'gen_ai.event.content': `{\"role\":\"user\",\"content\":\"What's the weather like in Boston?\"}` \n },\n time: [ 1725666879, 622695900 ],\n droppedAttributesCount: 0\n },\n*/\nfunction addRequestChatMessageEvent(span: TracingSpan, messages: Array<ChatRequestMessage>): void {\n messages.forEach((message: any) => {\n if (message.role) {\n const content: {\n content?: string;\n tool_calls?: Array<ChatCompletionsToolCallOutput>;\n id?: string;\n } = {};\n\n const chatMsg = message as ChatRequestSystemMessage;\n if (chatMsg.content) {\n content.content = chatMsg.content;\n }\n if (!isContentRecordingEnabled()) {\n content.content = \"\";\n }\n\n const assistantMsg = message as ChatRequestAssistantMessage;\n if (assistantMsg.tool_calls) {\n content.tool_calls = assistantMsg.tool_calls;\n if (!isContentRecordingEnabled()) {\n const toolCalls: Array<ChatCompletionsToolCallOutput> = JSON.parse(\n JSON.stringify(content.tool_calls),\n );\n toolCalls.forEach((toolCall) => {\n if (toolCall.function.arguments) {\n toolCall.function.arguments = \"\";\n }\n toolCall.function.name = \"\";\n });\n content.tool_calls = toolCalls;\n }\n }\n\n const toolMsg: ChatRequestToolMessage = message;\n if (toolMsg.tool_call_id) {\n content.id = toolMsg.tool_call_id;\n }\n\n span.addEvent?.(`gen_ai.${message.role}.message`, {\n attributes: {\n \"gen_ai.system\": INFERENCE_GEN_AI_SYSTEM_NAME,\n \"gen_ai.event.content\": JSON.stringify(content),\n },\n });\n }\n });\n}\n\n/*\n* Add event to span. Sample:\n{\n name: 'gen_ai.choice',\n attributes: {\n 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',\n 'gen_ai.event.content': '{\"finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"content\":\"\"}}'\n },\n time: [ 1725666881, 780608000 ],\n droppedAttributesCount: 0\n} \n*/\nfunction addResponseChatMessageEvent(span: TracingSpan, body: ChatCompletionsOutput): void {\n if (!span.addEvent) {\n return;\n }\n\n body?.choices?.forEach((choice: ChatChoiceOutput) => {\n let message: { content?: string; toolCalls?: Array<ChatCompletionsToolCallOutput> } = {};\n\n if (choice.message.content) {\n message.content = choice.message.content;\n }\n if (choice.message.tool_calls) {\n message.toolCalls = choice.message.tool_calls;\n }\n\n if (!isContentRecordingEnabled()) {\n message = JSON.parse(JSON.stringify(message));\n message.content = \"\";\n if (message.toolCalls) {\n message.toolCalls.forEach((toolCall) => {\n if (toolCall.function.arguments) {\n toolCall.function.arguments = \"\";\n }\n toolCall.function.name = \"\";\n });\n }\n }\n\n const response = {\n finish_reason: choice.finish_reason,\n index: choice.index,\n message,\n };\n const attributes = {\n \"gen_ai.system\": INFERENCE_GEN_AI_SYSTEM_NAME,\n \"gen_ai.event.content\": JSON.stringify(response),\n };\n\n span.addEvent?.(\"gen_ai.choice\", { attributes });\n });\n}\n\nfunction envVarToBoolean(key: string): boolean {\n const value = process.env[key] ?? process.env[key.toLowerCase()];\n return value !== \"false\" && value !== \"0\" && Boolean(value);\n}\n"]}
1
+ {"version":3,"file":"tracingHelper.js","sourceRoot":"","sources":["../../src/tracingHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAa3C;;;;;;;;;;;EAWE;AACF;;;;;;;;;;;EAWE;AAEF,IAAK,qBAkBJ;AAlBD,WAAK,qBAA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AAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9C,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;YACrB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;gBACtB,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACrC,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;wBAChC,QAAQ,CAAC,QAAQ,CAAC,SAAS,GAAG,EAAE,CAAC;oBACnC,CAAC;oBACD,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;gBAC9B,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,MAAM,QAAQ,GAAG;YACf,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,OAAO;SACR,CAAC;QACF,MAAM,UAAU,GAAG;YACjB,eAAe,EAAE,4BAA4B;YAC7C,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SACjD,CAAC;QAEF,MAAA,IAAI,CAAC,QAAQ,qDAAG,eAAe,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,eAAe,CAAC,GAAW;;IAClC,MAAM,KAAK,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,mCAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACjE,OAAO,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport type { PipelineRequest, PipelineResponse } from \"@azure/core-rest-pipeline\";\nimport type { TracingSpan } from \"@azure/core-tracing\";\nimport { isError } from \"@azure/core-util\";\nimport type {\n ChatRequestAssistantMessage,\n ChatRequestMessage,\n ChatRequestSystemMessage,\n ChatRequestToolMessage,\n} from \"./models.js\";\nimport type {\n ChatChoiceOutput,\n ChatCompletionsOutput,\n ChatCompletionsToolCallOutput,\n} from \"./outputModels.js\";\nimport type { GetChatCompletionsBodyParam } from \"./parameters.js\";\n/*\n* Add event to span. Sample:\n {\n name: 'gen_ai.user.message',\n attributes: {\n 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',\n 'gen_ai.event.content': `{\"role\":\"user\",\"content\":\"What's the weather like in Boston?\"}` \n },\n time: [ 1725666879, 622695900 ],\n droppedAttributesCount: 0\n },\n*/\n/*\n* Add event to span. Sample:\n{\n name: 'gen_ai.choice',\n attributes: {\n 'gen_ai.system': 'INFERENCE_GEN_AI_SYSTEM_NAME',\n 'gen_ai.event.content': '{\"finish_reason\":\"tool_calls\",\"index\":0,\"message\":{\"content\":\"\"}}'\n },\n time: [ 1725666881, 780608000 ],\n droppedAttributesCount: 0\n} \n*/\n\nenum TracingAttributesEnum {\n Operation_Name = \"gen_ai.operation.name\",\n Request_Model = \"gen_ai.request.model\",\n System = \"gen_ai.system\",\n Error_Type = \"error.type\",\n Server_Port = \"server.port\",\n Request_Frequency_Penalty = \"gen_ai.request.frequency_penalty\",\n Request_Max_Tokens = \"gen_ai.request.max_tokens\",\n Request_Presence_Penalty = \"gen_ai.request.presence_penalty\",\n Request_Stop_Sequences = \"gen_ai.request.stop_sequences\",\n Request_Temperature = \"gen_ai.request.temperature\",\n Request_Top_P = \"gen_ai.request.top_p\",\n Response_Finish_Reasons = \"gen_ai.response.finish_reasons\",\n Response_Id = \"gen_ai.response.id\",\n Response_Model = \"gen_ai.response.model\",\n Usage_Input_Tokens = \"gen_ai.usage.input_tokens\",\n Usage_Output_Tokens = \"gen_ai.usage.output_tokens\",\n Server_Address = \"server.address\",\n}\n\nconst INFERENCE_GEN_AI_SYSTEM_NAME = \"az.ai.inference\";\n\nconst isContentRecordingEnabled = (): boolean =>\n envVarToBoolean(\"AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED\");\n\nexport function getRequestBody(request: PipelineRequest): GetChatCompletionsBodyParam {\n return { body: JSON.parse(request.body as string) };\n}\n\nexport function getSpanName(request: PipelineRequest): string {\n const { body } = getRequestBody(request);\n return `chat ${body?.model ?? \"\"}`.trim();\n}\n\nexport function onStartTracing(span: TracingSpan, request: PipelineRequest, url: string): void {\n if (!span.isRecording()) {\n return;\n }\n\n const urlObj = new URL(url);\n const port = Number(urlObj.port) || (urlObj.protocol === \"https:\" ? undefined : 80);\n if (port) {\n span.setAttribute(TracingAttributesEnum.Server_Port, port);\n }\n\n span.setAttribute(TracingAttributesEnum.Server_Address, urlObj.hostname);\n span.setAttribute(TracingAttributesEnum.Operation_Name, \"chat\");\n span.setAttribute(TracingAttributesEnum.System, \"az.ai.inference\");\n const { body } = getRequestBody(request);\n if (!body) return;\n span.setAttribute(TracingAttributesEnum.Request_Model, body.model);\n span.setAttribute(TracingAttributesEnum.Request_Frequency_Penalty, body.frequency_penalty);\n span.setAttribute(TracingAttributesEnum.Request_Max_Tokens, body.max_tokens);\n span.setAttribute(TracingAttributesEnum.Request_Presence_Penalty, body.presence_penalty);\n span.setAttribute(TracingAttributesEnum.Request_Stop_Sequences, body.stop);\n span.setAttribute(TracingAttributesEnum.Request_Temperature, body.temperature);\n span.setAttribute(TracingAttributesEnum.Request_Top_P, body.top_p);\n if (body.messages) {\n addRequestChatMessageEvent(span, body.messages);\n }\n}\n\nexport function tryProcessResponse(span: TracingSpan, response?: PipelineResponse): void {\n if (!span.isRecording()) {\n return;\n }\n\n if (response?.bodyAsText) {\n const body: any = JSON.parse(response.bodyAsText);\n if (body.error ?? body.message) {\n span.setAttribute(TracingAttributesEnum.Error_Type, `${body.status ?? body.statusCode}`);\n span.setStatus({\n status: \"error\",\n error: body.error ?? body.message, // message is not in the schema of the response, but it can present if there is crediential error\n });\n }\n span.setAttribute(TracingAttributesEnum.Response_Id, body.id);\n span.setAttribute(TracingAttributesEnum.Response_Model, body.model);\n if (body.choices) {\n span.setAttribute(\n TracingAttributesEnum.Response_Finish_Reasons,\n body.choices.map((choice: ChatChoiceOutput) => choice.finish_reason).join(\",\"),\n );\n }\n if (body.usage) {\n span.setAttribute(TracingAttributesEnum.Usage_Input_Tokens, body.usage.prompt_tokens);\n span.setAttribute(TracingAttributesEnum.Usage_Output_Tokens, body.usage.completion_tokens);\n }\n addResponseChatMessageEvent(span, body);\n }\n}\n\nexport function tryProcessError(span: TracingSpan, error: unknown): void {\n span.setStatus({\n status: \"error\",\n error: isError(error) ? error : undefined,\n });\n}\n\nfunction addRequestChatMessageEvent(span: TracingSpan, messages: Array<ChatRequestMessage>): void {\n messages.forEach((message: any) => {\n if (message.role) {\n const content: {\n content?: string;\n tool_calls?: Array<ChatCompletionsToolCallOutput>;\n id?: string;\n } = {};\n\n const chatMsg = message as ChatRequestSystemMessage;\n if (chatMsg.content) {\n content.content = chatMsg.content;\n }\n if (!isContentRecordingEnabled()) {\n content.content = \"\";\n }\n\n const assistantMsg = message as ChatRequestAssistantMessage;\n if (assistantMsg.tool_calls) {\n content.tool_calls = assistantMsg.tool_calls;\n if (!isContentRecordingEnabled()) {\n const toolCalls: Array<ChatCompletionsToolCallOutput> = JSON.parse(\n JSON.stringify(content.tool_calls),\n );\n toolCalls.forEach((toolCall) => {\n if (toolCall.function.arguments) {\n toolCall.function.arguments = \"\";\n }\n toolCall.function.name = \"\";\n });\n content.tool_calls = toolCalls;\n }\n }\n\n const toolMsg: ChatRequestToolMessage = message;\n if (toolMsg.tool_call_id) {\n content.id = toolMsg.tool_call_id;\n }\n\n span.addEvent?.(`gen_ai.${message.role}.message`, {\n attributes: {\n \"gen_ai.system\": INFERENCE_GEN_AI_SYSTEM_NAME,\n \"gen_ai.event.content\": JSON.stringify(content),\n },\n });\n }\n });\n}\n\nfunction addResponseChatMessageEvent(span: TracingSpan, body: ChatCompletionsOutput): void {\n if (!span.addEvent) {\n return;\n }\n\n body?.choices?.forEach((choice: ChatChoiceOutput) => {\n let message: { content?: string; toolCalls?: Array<ChatCompletionsToolCallOutput> } = {};\n\n if (choice.message.content) {\n message.content = choice.message.content;\n }\n if (choice.message.tool_calls) {\n message.toolCalls = choice.message.tool_calls;\n }\n\n if (!isContentRecordingEnabled()) {\n message = JSON.parse(JSON.stringify(message));\n message.content = \"\";\n if (message.toolCalls) {\n message.toolCalls.forEach((toolCall) => {\n if (toolCall.function.arguments) {\n toolCall.function.arguments = \"\";\n }\n toolCall.function.name = \"\";\n });\n }\n }\n\n const response = {\n finish_reason: choice.finish_reason,\n index: choice.index,\n message,\n };\n const attributes = {\n \"gen_ai.system\": INFERENCE_GEN_AI_SYSTEM_NAME,\n \"gen_ai.event.content\": JSON.stringify(response),\n };\n\n span.addEvent?.(\"gen_ai.choice\", { attributes });\n });\n}\n\nfunction envVarToBoolean(key: string): boolean {\n const value = process.env[key] ?? process.env[key.toLowerCase()];\n return value !== \"false\" && value !== \"0\" && Boolean(value);\n}\n"]}
@@ -1,3 +1,10 @@
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
1
8
  import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
9
  /**
3
10
  * The programmatic identifier of the tracingPolicy.
@@ -1 +1 @@
1
- {"version":3,"file":"tracingPolicy.d.ts","sourceRoot":"","sources":["../../src/tracingPolicy.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AAGnC;;GAEG;AACH,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,cAAc,CAyC9C"}
1
+ {"version":3,"file":"tracingPolicy.d.ts","sourceRoot":"","sources":["../../src/tracingPolicy.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AAkBnC;;GAEG;AACH,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,cAAc,CAwC9C"}
@@ -1,10 +1,10 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
  import { createTracingClient, } from "@azure/core-tracing";
4
- import { logger } from "./logger.js";
5
4
  import { getErrorMessage } from "@azure/core-util";
6
- import { tryProcessResponse, onStartTracing, tryProcessError, getSpanName, getRequestBody, } from "./tracingHelper.js";
7
5
  import { SDK_VERSION } from "./constants.js";
6
+ import { logger } from "./logger.js";
7
+ import { getRequestBody, getSpanName, onStartTracing, tryProcessError, tryProcessResponse, } from "./tracingHelper.js";
8
8
  /**
9
9
  * The programmatic identifier of the tracingPolicy.
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"tracingPolicy.js","sourceRoot":"","sources":["../../src/tracingPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAIL,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,WAAW,EACX,cAAc,GACf,MAAM,oBAAoB,CAAC;AAO5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,aAAa,GAAG,mBAAmB,CAAC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Z,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,aAA4B,EAC5B,OAAwB;IAExB,IAAI,CAAC;QACH,oFAAoF;QACpF,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,WAAW,CAAC,OAAO,CAAC,EACpB,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,EAC1C;YACE,QAAQ,EAAE,QAAQ;SACnB,CACF,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC;IAChF,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,MAAM,CAAC,OAAO,CAAC,qDAAqD,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1F,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n type TracingClient,\n type TracingContext,\n type TracingSpan,\n createTracingClient,\n} from \"@azure/core-tracing\";\nimport { logger } from \"./logger.js\";\nimport { getErrorMessage } from \"@azure/core-util\";\nimport {\n tryProcessResponse,\n onStartTracing,\n tryProcessError,\n getSpanName,\n getRequestBody,\n} from \"./tracingHelper.js\";\nimport type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { SDK_VERSION } from \"./constants.js\";\n\n/**\n * The programmatic identifier of the tracingPolicy.\n */\nexport const tracingPolicyName = \"inferenceTracingPolicy\";\n\n/**\n * A simple policy to create OpenTelemetry Spans for each request made by the pipeline\n * that has SpanOptions with a parent.\n * Requests made without a parent Span will not be recorded.\n */\nexport function tracingPolicy(): PipelinePolicy {\n const tracingClient = createTracingClient({\n namespace: \"Microsoft.CognitiveServices\",\n packageName: \"@azure/ai-inference-rest\",\n packageVersion: SDK_VERSION,\n });\n\n return {\n name: tracingPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const url = new URL(request.url);\n if (\n !tracingClient ||\n !url.href.endsWith(\"/chat/completions\") ||\n getRequestBody(request)?.body?.stream\n ) {\n return next(request);\n }\n\n const { span, tracingContext } = tryCreateSpan(tracingClient, request) ?? {};\n\n if (!span || !tracingContext) {\n return next(request);\n }\n\n try {\n request.tracingOptions ??= {};\n request.tracingOptions.tracingContext = tracingContext;\n\n onStartTracing(span, request, request.url);\n const response = await tracingClient.withContext(tracingContext, next, request);\n tryProcessResponse(span, response);\n return response;\n } catch (err: any) {\n tryProcessError(span, err);\n throw err;\n } finally {\n span.end();\n }\n },\n };\n}\n\nfunction tryCreateSpan(\n tracingClient: TracingClient,\n request: PipelineRequest,\n): { span: TracingSpan; tracingContext: TracingContext } | undefined {\n try {\n // As per spec, we do not need to differentiate between HTTP and HTTPS in span name.\n const { span, updatedOptions } = tracingClient.startSpan(\n getSpanName(request),\n { tracingOptions: request.tracingOptions },\n {\n spanKind: \"client\",\n },\n );\n\n return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };\n } catch (e: any) {\n logger.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"tracingPolicy.js","sourceRoot":"","sources":["../../src/tracingPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAgBlC,OAAO,EAIL,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,o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C,CAAC;gBACnC,OAAO,QAAQ,CAAC;YAClB,CAAC;YAAC,OAAO,GAAQ,EAAE,CAAC;gBAClB,eAAe,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC3B,MAAM,GAAG,CAAC;YACZ,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,GAAG,EAAE,CAAC;YACb,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,aAA4B,EAC5B,OAAwB;IAExB,IAAI,CAAC;QACH,oFAAoF;QACpF,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,SAAS,CACtD,WAAW,CAAC,OAAO,CAAC,EACpB,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,EAC1C;YACE,QAAQ,EAAE,QAAQ;SACnB,CACF,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,CAAC,cAAc,CAAC,cAAc,EAAE,CAAC;IAChF,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,MAAM,CAAC,OAAO,CAAC,qDAAqD,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1F,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport {\n type TracingClient,\n type TracingContext,\n type TracingSpan,\n createTracingClient,\n} from \"@azure/core-tracing\";\nimport { getErrorMessage } from \"@azure/core-util\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { logger } from \"./logger.js\";\nimport {\n getRequestBody,\n getSpanName,\n onStartTracing,\n tryProcessError,\n tryProcessResponse,\n} from \"./tracingHelper.js\";\n\n/**\n * The programmatic identifier of the tracingPolicy.\n */\nexport const tracingPolicyName = \"inferenceTracingPolicy\";\n\n/**\n * A simple policy to create OpenTelemetry Spans for each request made by the pipeline\n * that has SpanOptions with a parent.\n * Requests made without a parent Span will not be recorded.\n */\nexport function tracingPolicy(): PipelinePolicy {\n const tracingClient = createTracingClient({\n namespace: \"Microsoft.CognitiveServices\",\n packageName: \"@azure/ai-inference-rest\",\n packageVersion: SDK_VERSION,\n });\n return {\n name: tracingPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const url = new URL(request.url);\n if (\n !tracingClient ||\n !url.href.endsWith(\"/chat/completions\") ||\n getRequestBody(request)?.body?.stream\n ) {\n return next(request);\n }\n\n const { span, tracingContext } = tryCreateSpan(tracingClient, request) ?? {};\n\n if (!span || !tracingContext) {\n return next(request);\n }\n\n try {\n request.tracingOptions ??= {};\n request.tracingOptions.tracingContext = tracingContext;\n\n onStartTracing(span, request, request.url);\n const response = await tracingClient.withContext(tracingContext, next, request);\n tryProcessResponse(span, response);\n return response;\n } catch (err: any) {\n tryProcessError(span, err);\n throw err;\n } finally {\n span.end();\n }\n },\n };\n}\n\nfunction tryCreateSpan(\n tracingClient: TracingClient,\n request: PipelineRequest,\n): { span: TracingSpan; tracingContext: TracingContext } | undefined {\n try {\n // As per spec, we do not need to differentiate between HTTP and HTTPS in span name.\n const { span, updatedOptions } = tracingClient.startSpan(\n getSpanName(request),\n { tracingOptions: request.tracingOptions },\n {\n spanKind: \"client\",\n },\n );\n\n return { span, tracingContext: updatedOptions.tracingOptions.tracingContext };\n } catch (e: any) {\n logger.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);\n return undefined;\n }\n}\n\n"]}
@@ -1,6 +1,13 @@
1
- import type { GetChatCompletionsParameters, GetModelInfoParameters, GetEmbeddingsParameters, GetImageEmbeddingsParameters } from "./parameters.js";
2
- import type { GetChatCompletions200Response, GetChatCompletionsDefaultResponse, GetModelInfo200Response, GetModelInfoDefaultResponse, GetEmbeddings200Response, GetEmbeddingsDefaultResponse, GetImageEmbeddings200Response, GetImageEmbeddingsDefaultResponse } from "./responses.js";
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
3
8
  import type { Client, StreamableMethod } from "@azure-rest/core-client";
9
+ import type { GetChatCompletionsParameters, GetEmbeddingsParameters, GetImageEmbeddingsParameters, GetModelInfoParameters } from "./parameters.js";
10
+ import type { GetChatCompletions200Response, GetChatCompletionsDefaultResponse, GetEmbeddings200Response, GetEmbeddingsDefaultResponse, GetImageEmbeddings200Response, GetImageEmbeddingsDefaultResponse, GetModelInfo200Response, GetModelInfoDefaultResponse } from "./responses.js";
4
11
  export interface GetChatCompletions {
5
12
  /**
6
13
  * Gets chat completions for the provided chat messages.
@@ -8,12 +15,14 @@ export interface GetChatCompletions {
8
15
  * provided prompt data. The method makes a REST API call to the `/chat/completions` route
9
16
  * on the given endpoint.
10
17
  */
11
- post(options?: GetChatCompletionsParameters): StreamableMethod<GetChatCompletions200Response | GetChatCompletionsDefaultResponse>;
18
+ post(options: GetChatCompletionsParameters): StreamableMethod<GetChatCompletions200Response | GetChatCompletionsDefaultResponse>;
12
19
  }
13
20
  export interface GetModelInfo {
14
21
  /**
15
22
  * Returns information about the AI model.
16
23
  * The method makes a REST API call to the `/info` route on the given endpoint.
24
+ * This method will only work when using Serverless API or Managed Compute endpoint.
25
+ * It will not work for GitHub Models endpoint or Azure OpenAI endpoint.
17
26
  */
18
27
  get(options?: GetModelInfoParameters): StreamableMethod<GetModelInfo200Response | GetModelInfoDefaultResponse>;
19
28
  }
@@ -22,14 +31,14 @@ export interface GetEmbeddings {
22
31
  * Return the embedding vectors for given text prompts.
23
32
  * The method makes a REST API call to the `/embeddings` route on the given endpoint.
24
33
  */
25
- post(options?: GetEmbeddingsParameters): StreamableMethod<GetEmbeddings200Response | GetEmbeddingsDefaultResponse>;
34
+ post(options: GetEmbeddingsParameters): StreamableMethod<GetEmbeddings200Response | GetEmbeddingsDefaultResponse>;
26
35
  }
27
36
  export interface GetImageEmbeddings {
28
37
  /**
29
38
  * Return the embedding vectors for given images.
30
39
  * The method makes a REST API call to the `/images/embeddings` route on the given endpoint.
31
40
  */
32
- post(options?: GetImageEmbeddingsParameters): StreamableMethod<GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse>;
41
+ post(options: GetImageEmbeddingsParameters): StreamableMethod<GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse>;
33
42
  }
34
43
  export interface Routes {
35
44
  /** Resource for '/chat/completions' has methods for the following verbs: post */
@@ -1 +1 @@
1
- {"version":3,"file":"clientDefinitions.d.ts","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,4BAA4B,EAC5B,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAExE,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,CACF,OAAO,CAAC,EAAE,4BAA4B,GACrC,gBAAgB,CAAC,6BAA6B,GAAG,iCAAiC,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,sBAAsB,GAC/B,gBAAgB,CAAC,uBAAuB,GAAG,2BAA2B,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,CACF,OAAO,CAAC,EAAE,uBAAuB,GAChC,gBAAgB,CAAC,wBAAwB,GAAG,4BAA4B,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CACF,OAAO,CAAC,EAAE,4BAA4B,GACrC,gBAAgB,CAAC,6BAA6B,GAAG,iCAAiC,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,MAAM;IACrB,iFAAiF;IACjF,CAAC,IAAI,EAAE,mBAAmB,GAAG,kBAAkB,CAAC;IAChD,oEAAoE;IACpE,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAAC;IAC9B,2EAA2E;IAC3E,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,CAAC;IACrC,kFAAkF;IAClF,CAAC,IAAI,EAAE,oBAAoB,GAAG,kBAAkB,CAAC;CAClD;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
1
+ {"version":3,"file":"clientDefinitions.d.ts","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EACV,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,CACF,OAAO,EAAE,4BAA4B,GACpC,gBAAgB,CAAC,6BAA6B,GAAG,iCAAiC,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,GAAG,CACD,OAAO,CAAC,EAAE,sBAAsB,GAC/B,gBAAgB,CAAC,uBAAuB,GAAG,2BAA2B,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,CACF,OAAO,EAAE,uBAAuB,GAC/B,gBAAgB,CAAC,wBAAwB,GAAG,4BAA4B,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CACF,OAAO,EAAE,4BAA4B,GACpC,gBAAgB,CAAC,6BAA6B,GAAG,iCAAiC,CAAC,CAAC;CACxF;AAED,MAAM,WAAW,MAAM;IACrB,iFAAiF;IACjF,CAAC,IAAI,EAAE,mBAAmB,GAAG,kBAAkB,CAAC;IAChD,oEAAoE;IACpE,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAAC;IAC9B,2EAA2E;IAC3E,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa,CAAC;IACrC,kFAAkF;IAClF,CAAC,IAAI,EAAE,oBAAoB,GAAG,kBAAkB,CAAC;CAClD;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n GetChatCompletionsParameters,\n GetModelInfoParameters,\n GetEmbeddingsParameters,\n GetImageEmbeddingsParameters,\n} from \"./parameters.js\";\nimport type {\n GetChatCompletions200Response,\n GetChatCompletionsDefaultResponse,\n GetModelInfo200Response,\n GetModelInfoDefaultResponse,\n GetEmbeddings200Response,\n GetEmbeddingsDefaultResponse,\n GetImageEmbeddings200Response,\n GetImageEmbeddingsDefaultResponse,\n} from \"./responses.js\";\nimport type { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetChatCompletions {\n /**\n * Gets chat completions for the provided chat messages.\n * Completions support a wide variety of tasks and generate text that continues from or \"completes\"\n * provided prompt data. The method makes a REST API call to the `/chat/completions` route\n * on the given endpoint.\n */\n post(\n options?: GetChatCompletionsParameters,\n ): StreamableMethod<GetChatCompletions200Response | GetChatCompletionsDefaultResponse>;\n}\n\nexport interface GetModelInfo {\n /**\n * Returns information about the AI model.\n * The method makes a REST API call to the `/info` route on the given endpoint.\n */\n get(\n options?: GetModelInfoParameters,\n ): StreamableMethod<GetModelInfo200Response | GetModelInfoDefaultResponse>;\n}\n\nexport interface GetEmbeddings {\n /**\n * Return the embedding vectors for given text prompts.\n * The method makes a REST API call to the `/embeddings` route on the given endpoint.\n */\n post(\n options?: GetEmbeddingsParameters,\n ): StreamableMethod<GetEmbeddings200Response | GetEmbeddingsDefaultResponse>;\n}\n\nexport interface GetImageEmbeddings {\n /**\n * Return the embedding vectors for given images.\n * The method makes a REST API call to the `/images/embeddings` route on the given endpoint.\n */\n post(\n options?: GetImageEmbeddingsParameters,\n ): StreamableMethod<GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/chat/completions' has methods for the following verbs: post */\n (path: \"/chat/completions\"): GetChatCompletions;\n /** Resource for '/info' has methods for the following verbs: get */\n (path: \"/info\"): GetModelInfo;\n /** Resource for '/embeddings' has methods for the following verbs: post */\n (path: \"/embeddings\"): GetEmbeddings;\n /** Resource for '/images/embeddings' has methods for the following verbs: post */\n (path: \"/images/embeddings\"): GetImageEmbeddings;\n}\n\nexport type ModelClient = Client & {\n path: Routes;\n};\n"]}
1
+ {"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport type { Client, StreamableMethod } from \"@azure-rest/core-client\";\nimport type {\n GetChatCompletionsParameters,\n GetEmbeddingsParameters,\n GetImageEmbeddingsParameters,\n GetModelInfoParameters,\n} from \"./parameters.js\";\nimport type {\n GetChatCompletions200Response,\n GetChatCompletionsDefaultResponse,\n GetEmbeddings200Response,\n GetEmbeddingsDefaultResponse,\n GetImageEmbeddings200Response,\n GetImageEmbeddingsDefaultResponse,\n GetModelInfo200Response,\n GetModelInfoDefaultResponse,\n} from \"./responses.js\";\n\nexport interface GetChatCompletions {\n /**\n * Gets chat completions for the provided chat messages.\n * Completions support a wide variety of tasks and generate text that continues from or \"completes\"\n * provided prompt data. The method makes a REST API call to the `/chat/completions` route\n * on the given endpoint.\n */\n post(\n options: GetChatCompletionsParameters,\n ): StreamableMethod<GetChatCompletions200Response | GetChatCompletionsDefaultResponse>;\n}\n\nexport interface GetModelInfo {\n /**\n * Returns information about the AI model.\n * The method makes a REST API call to the `/info` route on the given endpoint.\n * This method will only work when using Serverless API or Managed Compute endpoint.\n * It will not work for GitHub Models endpoint or Azure OpenAI endpoint.\n */\n get(\n options?: GetModelInfoParameters,\n ): StreamableMethod<GetModelInfo200Response | GetModelInfoDefaultResponse>;\n}\n\nexport interface GetEmbeddings {\n /**\n * Return the embedding vectors for given text prompts.\n * The method makes a REST API call to the `/embeddings` route on the given endpoint.\n */\n post(\n options: GetEmbeddingsParameters,\n ): StreamableMethod<GetEmbeddings200Response | GetEmbeddingsDefaultResponse>;\n}\n\nexport interface GetImageEmbeddings {\n /**\n * Return the embedding vectors for given images.\n * The method makes a REST API call to the `/images/embeddings` route on the given endpoint.\n */\n post(\n options: GetImageEmbeddingsParameters,\n ): StreamableMethod<GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse>;\n}\n\nexport interface Routes {\n /** Resource for '/chat/completions' has methods for the following verbs: post */\n (path: \"/chat/completions\"): GetChatCompletions;\n /** Resource for '/info' has methods for the following verbs: get */\n (path: \"/info\"): GetModelInfo;\n /** Resource for '/embeddings' has methods for the following verbs: post */\n (path: \"/embeddings\"): GetEmbeddings;\n /** Resource for '/images/embeddings' has methods for the following verbs: post */\n (path: \"/images/embeddings\"): GetImageEmbeddings;\n}\n\nexport type ModelClient = Client & {\n path: Routes;\n};\n"]}
@@ -1,2 +1,9 @@
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
1
8
  export declare const SDK_VERSION: string;
2
9
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,EAAE,MAAuB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,MAAuB,CAAC"}
@@ -1,4 +1,11 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ /**
4
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
5
+ *
6
+ * Any changes you make here may be lost.
7
+ *
8
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
9
+ */
3
10
  export const SDK_VERSION = "1.0.0-beta.4";
4
11
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"1.0.0-beta.4\";\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\nexport const SDK_VERSION: string = \"1.0.0-beta.4\";\n"]}
@@ -1,10 +1,18 @@
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
1
8
  import ModelClient from "./modelClient.js";
2
- export * from "./modelClient.js";
3
- export * from "./parameters.js";
4
- export * from "./responses.js";
5
9
  export * from "./clientDefinitions.js";
6
10
  export * from "./isUnexpected.js";
11
+ export * from "./modelClient.js";
7
12
  export * from "./models.js";
8
13
  export * from "./outputModels.js";
14
+ export * from "./parameters.js";
15
+ export * from "./responses.js";
16
+ export type { ErrorModel } from "@azure-rest/core-client";
9
17
  export default ModelClient;
10
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAElC,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,eAAe,WAAW,CAAC"}
@@ -1,12 +1,19 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ /**
4
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
5
+ *
6
+ * Any changes you make here may be lost.
7
+ *
8
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
9
+ */
3
10
  import ModelClient from "./modelClient.js";
4
- export * from "./modelClient.js";
5
- export * from "./parameters.js";
6
- export * from "./responses.js";
7
11
  export * from "./clientDefinitions.js";
8
12
  export * from "./isUnexpected.js";
13
+ export * from "./modelClient.js";
9
14
  export * from "./models.js";
10
15
  export * from "./outputModels.js";
16
+ export * from "./parameters.js";
17
+ export * from "./responses.js";
11
18
  export default ModelClient;
12
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAElC,eAAe,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport ModelClient from \"./modelClient.js\";\n\nexport * from \"./modelClient.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\n\nexport default ModelClient;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AAEH,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAE3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAG/B,eAAe,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport ModelClient from \"./modelClient.js\";\n\nexport * from \"./clientDefinitions.js\";\nexport * from \"./isUnexpected.js\";\nexport * from \"./modelClient.js\";\nexport * from \"./models.js\";\nexport * from \"./outputModels.js\";\nexport * from \"./parameters.js\";\nexport * from \"./responses.js\";\nexport type { ErrorModel } from \"@azure-rest/core-client\";\n\nexport default ModelClient;\n"]}
@@ -1,4 +1,11 @@
1
- import type { GetChatCompletions200Response, GetChatCompletionsDefaultResponse, GetModelInfo200Response, GetModelInfoDefaultResponse, GetEmbeddings200Response, GetEmbeddingsDefaultResponse, GetImageEmbeddings200Response, GetImageEmbeddingsDefaultResponse } from "./responses.js";
1
+ /**
2
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
3
+ *
4
+ * Any changes you make here may be lost.
5
+ *
6
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
7
+ */
8
+ import type { GetChatCompletions200Response, GetChatCompletionsDefaultResponse, GetEmbeddings200Response, GetEmbeddingsDefaultResponse, GetImageEmbeddings200Response, GetImageEmbeddingsDefaultResponse, GetModelInfo200Response, GetModelInfoDefaultResponse } from "./responses.js";
2
9
  export declare function isUnexpected(response: GetChatCompletions200Response | GetChatCompletionsDefaultResponse): response is GetChatCompletionsDefaultResponse;
3
10
  export declare function isUnexpected(response: GetModelInfo200Response | GetModelInfoDefaultResponse): response is GetModelInfoDefaultResponse;
4
11
  export declare function isUnexpected(response: GetEmbeddings200Response | GetEmbeddingsDefaultResponse): response is GetEmbeddingsDefaultResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"isUnexpected.d.ts","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AASxB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,6BAA6B,GAAG,iCAAiC,GAC1E,QAAQ,IAAI,iCAAiC,CAAC;AACjD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,uBAAuB,GAAG,2BAA2B,GAC9D,QAAQ,IAAI,2BAA2B,CAAC;AAC3C,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,wBAAwB,GAAG,4BAA4B,GAChE,QAAQ,IAAI,4BAA4B,CAAC;AAC5C,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,6BAA6B,GAAG,iCAAiC,GAC1E,QAAQ,IAAI,iCAAiC,CAAC"}
1
+ {"version":3,"file":"isUnexpected.d.ts","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,iCAAiC,EACjC,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AASxB,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,6BAA6B,GAAG,iCAAiC,GAC1E,QAAQ,IAAI,iCAAiC,CAAC;AACjD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,uBAAuB,GAAG,2BAA2B,GAC9D,QAAQ,IAAI,2BAA2B,CAAC;AAC3C,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,wBAAwB,GAAG,4BAA4B,GAChE,QAAQ,IAAI,4BAA4B,CAAC;AAC5C,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,6BAA6B,GAAG,iCAAiC,GAC1E,QAAQ,IAAI,iCAAiC,CAAC"}
@@ -19,11 +19,7 @@ export function isUnexpected(response) {
19
19
  function getParametrizedPathSuccess(method, path) {
20
20
  var _a, _b, _c, _d;
21
21
  const pathParts = path.split("/");
22
- // Traverse list to match the longest candidate
23
- // matchedLen: the length of candidate path
24
- // matchedValue: the matched status code array
25
22
  let matchedLen = -1, matchedValue = [];
26
- // Iterate the responseMap to find a match
27
23
  for (const [key, value] of Object.entries(responseMap)) {
28
24
  // Extracting the path from the map key which is in format
29
25
  // GET /path/foo
@@ -1 +1 @@
1
- {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAalC,MAAM,WAAW,GAA6B;IAC5C,wBAAwB,EAAE,CAAC,KAAK,CAAC;IACjC,WAAW,EAAE,CAAC,KAAK,CAAC;IACpB,kBAAkB,EAAE,CAAC,KAAK,CAAC;IAC3B,yBAAyB,EAAE,CAAC,KAAK,CAAC;CACnC,CAAC;AAcF,MAAM,UAAU,YAAY,CAC1B,QAQqC;IAMrC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAA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YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n GetChatCompletions200Response,\n GetChatCompletionsDefaultResponse,\n GetModelInfo200Response,\n GetModelInfoDefaultResponse,\n GetEmbeddings200Response,\n GetEmbeddingsDefaultResponse,\n GetImageEmbeddings200Response,\n GetImageEmbeddingsDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /chat/completions\": [\"200\"],\n \"GET /info\": [\"200\"],\n \"POST /embeddings\": [\"200\"],\n \"POST /images/embeddings\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetChatCompletions200Response | GetChatCompletionsDefaultResponse,\n): response is GetChatCompletionsDefaultResponse;\nexport function isUnexpected(\n response: GetModelInfo200Response | GetModelInfoDefaultResponse,\n): response is GetModelInfoDefaultResponse;\nexport function isUnexpected(\n response: GetEmbeddings200Response | GetEmbeddingsDefaultResponse,\n): response is GetEmbeddingsDefaultResponse;\nexport function isUnexpected(\n response: GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse,\n): response is GetImageEmbeddingsDefaultResponse;\nexport function isUnexpected(\n response:\n | GetChatCompletions200Response\n | GetChatCompletionsDefaultResponse\n | GetModelInfo200Response\n | GetModelInfoDefaultResponse\n | GetEmbeddings200Response\n | GetEmbeddingsDefaultResponse\n | GetImageEmbeddings200Response\n | GetImageEmbeddingsDefaultResponse,\n): response is\n | GetChatCompletionsDefaultResponse\n | GetModelInfoDefaultResponse\n | GetEmbeddingsDefaultResponse\n | GetImageEmbeddingsDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
1
+ {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAA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AG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport type {\n GetChatCompletions200Response,\n GetChatCompletionsDefaultResponse,\n GetEmbeddings200Response,\n GetEmbeddingsDefaultResponse,\n GetImageEmbeddings200Response,\n GetImageEmbeddingsDefaultResponse,\n GetModelInfo200Response,\n GetModelInfoDefaultResponse,\n} from \"./responses.js\";\n\nconst responseMap: Record<string, string[]> = {\n \"POST /chat/completions\": [\"200\"],\n \"GET /info\": [\"200\"],\n \"POST /embeddings\": [\"200\"],\n \"POST /images/embeddings\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetChatCompletions200Response | GetChatCompletionsDefaultResponse,\n): response is GetChatCompletionsDefaultResponse;\nexport function isUnexpected(\n response: GetModelInfo200Response | GetModelInfoDefaultResponse,\n): response is GetModelInfoDefaultResponse;\nexport function isUnexpected(\n response: GetEmbeddings200Response | GetEmbeddingsDefaultResponse,\n): response is GetEmbeddingsDefaultResponse;\nexport function isUnexpected(\n response: GetImageEmbeddings200Response | GetImageEmbeddingsDefaultResponse,\n): response is GetImageEmbeddingsDefaultResponse;\nexport function isUnexpected(\n response:\n | GetChatCompletions200Response\n | GetChatCompletionsDefaultResponse\n | GetModelInfo200Response\n | GetModelInfoDefaultResponse\n | GetEmbeddings200Response\n | GetEmbeddingsDefaultResponse\n | GetImageEmbeddings200Response\n | GetImageEmbeddingsDefaultResponse,\n): response is\n | GetChatCompletionsDefaultResponse\n | GetModelInfoDefaultResponse\n | GetEmbeddingsDefaultResponse\n | GetImageEmbeddingsDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n let matchedLen = -1,\n matchedValue: string[] = [];\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM,qCAAqC,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,MAAM,qCAAqC,CAAC"}
@@ -1,5 +1,12 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ /**
4
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
5
+ *
6
+ * Any changes you make here may be lost.
7
+ *
8
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
9
+ */
3
10
  import { createClientLogger } from "@azure/logger";
4
11
  export const logger = createClientLogger("ai-inference");
5
12
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"ai-inference\");\n"]}
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!\n *\n * Any changes you make here may be lost.\n *\n * If you need to make changes, please do so in the original source file, \\{project-root\\}/sources/custom\n */\n\nimport { createClientLogger } from \"@azure/logger\";\n\nexport const logger = createClientLogger(\"ai-inference\");\n"]}