@azure-rest/ai-inference 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -4
- package/dist/browser/clientDefinitions.d.ts +20 -2
- package/dist/browser/clientDefinitions.d.ts.map +1 -1
- package/dist/browser/clientDefinitions.js +1 -1
- package/dist/browser/clientDefinitions.js.map +1 -1
- package/dist/browser/constants.d.ts +2 -0
- package/dist/browser/constants.d.ts.map +1 -0
- package/dist/browser/constants.js +4 -0
- package/dist/browser/constants.js.map +1 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/isUnexpected.d.ts +3 -1
- package/dist/browser/isUnexpected.d.ts.map +1 -1
- package/dist/browser/isUnexpected.js +4 -3
- package/dist/browser/isUnexpected.js.map +1 -1
- package/dist/browser/logger.js +1 -1
- package/dist/browser/logger.js.map +1 -1
- package/dist/browser/modelClient.d.ts +6 -1
- package/dist/browser/modelClient.d.ts.map +1 -1
- package/dist/browser/modelClient.js +28 -7
- package/dist/browser/modelClient.js.map +1 -1
- package/dist/browser/models.d.ts +54 -39
- package/dist/browser/models.d.ts.map +1 -1
- package/dist/browser/models.js +1 -1
- package/dist/browser/models.js.map +1 -1
- package/dist/browser/outputModels.d.ts +48 -22
- package/dist/browser/outputModels.d.ts.map +1 -1
- package/dist/browser/outputModels.js +1 -1
- package/dist/browser/outputModels.js.map +1 -1
- package/dist/browser/parameters.d.ts +53 -4
- package/dist/browser/parameters.d.ts.map +1 -1
- package/dist/browser/parameters.js +1 -1
- package/dist/browser/parameters.js.map +1 -1
- package/dist/browser/responses.d.ts +29 -1
- package/dist/browser/responses.d.ts.map +1 -1
- package/dist/browser/responses.js +1 -1
- package/dist/browser/responses.js.map +1 -1
- package/dist/browser/tracingHelper.d.ts +9 -0
- package/dist/browser/tracingHelper.d.ts.map +1 -0
- package/dist/browser/tracingHelper.js +198 -0
- package/dist/browser/tracingHelper.js.map +1 -0
- package/dist/browser/tracingPolicy.d.ts +12 -0
- package/dist/browser/tracingPolicy.d.ts.map +1 -0
- package/dist/browser/tracingPolicy.js +68 -0
- package/dist/browser/tracingPolicy.js.map +1 -0
- package/dist/commonjs/clientDefinitions.d.ts +20 -2
- package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
- package/dist/commonjs/clientDefinitions.js +1 -1
- package/dist/commonjs/clientDefinitions.js.map +1 -1
- package/dist/commonjs/constants.d.ts +2 -0
- package/dist/commonjs/constants.d.ts.map +1 -0
- package/dist/commonjs/constants.js +7 -0
- package/dist/commonjs/constants.js.map +1 -0
- package/dist/commonjs/index.js +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/isUnexpected.d.ts +3 -1
- package/dist/commonjs/isUnexpected.d.ts.map +1 -1
- package/dist/commonjs/isUnexpected.js +5 -5
- package/dist/commonjs/isUnexpected.js.map +1 -1
- package/dist/commonjs/logger.js +1 -1
- package/dist/commonjs/logger.js.map +1 -1
- package/dist/commonjs/modelClient.d.ts +6 -1
- package/dist/commonjs/modelClient.d.ts.map +1 -1
- package/dist/commonjs/modelClient.js +28 -7
- package/dist/commonjs/modelClient.js.map +1 -1
- package/dist/commonjs/models.d.ts +54 -39
- package/dist/commonjs/models.d.ts.map +1 -1
- package/dist/commonjs/models.js +1 -1
- package/dist/commonjs/models.js.map +1 -1
- package/dist/commonjs/outputModels.d.ts +48 -22
- package/dist/commonjs/outputModels.d.ts.map +1 -1
- package/dist/commonjs/outputModels.js +1 -1
- package/dist/commonjs/outputModels.js.map +1 -1
- package/dist/commonjs/parameters.d.ts +53 -4
- package/dist/commonjs/parameters.d.ts.map +1 -1
- package/dist/commonjs/parameters.js +1 -1
- package/dist/commonjs/parameters.js.map +1 -1
- package/dist/commonjs/responses.d.ts +29 -1
- package/dist/commonjs/responses.d.ts.map +1 -1
- package/dist/commonjs/responses.js +1 -1
- package/dist/commonjs/responses.js.map +1 -1
- package/dist/commonjs/tracingHelper.d.ts +9 -0
- package/dist/commonjs/tracingHelper.d.ts.map +1 -0
- package/dist/commonjs/tracingHelper.js +205 -0
- package/dist/commonjs/tracingHelper.js.map +1 -0
- package/dist/commonjs/tracingPolicy.d.ts +12 -0
- package/dist/commonjs/tracingPolicy.d.ts.map +1 -0
- package/dist/commonjs/tracingPolicy.js +72 -0
- package/dist/commonjs/tracingPolicy.js.map +1 -0
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/clientDefinitions.d.ts +20 -2
- package/dist/esm/clientDefinitions.d.ts.map +1 -1
- package/dist/esm/clientDefinitions.js +1 -1
- package/dist/esm/clientDefinitions.js.map +1 -1
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/constants.js +4 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/isUnexpected.d.ts +3 -1
- package/dist/esm/isUnexpected.d.ts.map +1 -1
- package/dist/esm/isUnexpected.js +4 -3
- package/dist/esm/isUnexpected.js.map +1 -1
- package/dist/esm/logger.js +1 -1
- package/dist/esm/logger.js.map +1 -1
- package/dist/esm/modelClient.d.ts +6 -1
- package/dist/esm/modelClient.d.ts.map +1 -1
- package/dist/esm/modelClient.js +28 -7
- package/dist/esm/modelClient.js.map +1 -1
- package/dist/esm/models.d.ts +54 -39
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js +1 -1
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/outputModels.d.ts +48 -22
- package/dist/esm/outputModels.d.ts.map +1 -1
- package/dist/esm/outputModels.js +1 -1
- package/dist/esm/outputModels.js.map +1 -1
- package/dist/esm/parameters.d.ts +53 -4
- package/dist/esm/parameters.d.ts.map +1 -1
- package/dist/esm/parameters.js +1 -1
- package/dist/esm/parameters.js.map +1 -1
- package/dist/esm/responses.d.ts +29 -1
- package/dist/esm/responses.d.ts.map +1 -1
- package/dist/esm/responses.js +1 -1
- package/dist/esm/responses.js.map +1 -1
- package/dist/esm/tracingHelper.d.ts +9 -0
- package/dist/esm/tracingHelper.d.ts.map +1 -0
- package/dist/esm/tracingHelper.js +198 -0
- package/dist/esm/tracingHelper.js.map +1 -0
- package/dist/esm/tracingPolicy.d.ts +12 -0
- package/dist/esm/tracingPolicy.d.ts.map +1 -0
- package/dist/esm/tracingPolicy.js +68 -0
- package/dist/esm/tracingPolicy.js.map +1 -0
- package/dist/react-native/clientDefinitions.d.ts +20 -2
- package/dist/react-native/clientDefinitions.d.ts.map +1 -1
- package/dist/react-native/clientDefinitions.js +1 -1
- package/dist/react-native/clientDefinitions.js.map +1 -1
- package/dist/react-native/constants.d.ts +2 -0
- package/dist/react-native/constants.d.ts.map +1 -0
- package/dist/react-native/constants.js +4 -0
- package/dist/react-native/constants.js.map +1 -0
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/isUnexpected.d.ts +3 -1
- package/dist/react-native/isUnexpected.d.ts.map +1 -1
- package/dist/react-native/isUnexpected.js +4 -3
- package/dist/react-native/isUnexpected.js.map +1 -1
- package/dist/react-native/logger.js +1 -1
- package/dist/react-native/logger.js.map +1 -1
- package/dist/react-native/modelClient.d.ts +6 -1
- package/dist/react-native/modelClient.d.ts.map +1 -1
- package/dist/react-native/modelClient.js +28 -7
- package/dist/react-native/modelClient.js.map +1 -1
- package/dist/react-native/models.d.ts +54 -39
- package/dist/react-native/models.d.ts.map +1 -1
- package/dist/react-native/models.js +1 -1
- package/dist/react-native/models.js.map +1 -1
- package/dist/react-native/outputModels.d.ts +48 -22
- package/dist/react-native/outputModels.d.ts.map +1 -1
- package/dist/react-native/outputModels.js +1 -1
- package/dist/react-native/outputModels.js.map +1 -1
- package/dist/react-native/parameters.d.ts +53 -4
- package/dist/react-native/parameters.d.ts.map +1 -1
- package/dist/react-native/parameters.js +1 -1
- package/dist/react-native/parameters.js.map +1 -1
- package/dist/react-native/responses.d.ts +29 -1
- package/dist/react-native/responses.d.ts.map +1 -1
- package/dist/react-native/responses.js +1 -1
- package/dist/react-native/responses.js.map +1 -1
- package/dist/react-native/tracingHelper.d.ts +9 -0
- package/dist/react-native/tracingHelper.d.ts.map +1 -0
- package/dist/react-native/tracingHelper.js +198 -0
- package/dist/react-native/tracingHelper.js.map +1 -0
- package/dist/react-native/tracingPolicy.d.ts +12 -0
- package/dist/react-native/tracingPolicy.d.ts.map +1 -0
- package/dist/react-native/tracingPolicy.js +68 -0
- package/dist/react-native/tracingPolicy.js.map +1 -0
- package/package.json +26 -28
- package/CHANGELOG.md +0 -6
- package/review/ai-inference.api.md +0 -343
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** An abstract representation of a chat message as provided in a request. */\nexport interface ChatRequestMessageParent {\n role: ChatRole;\n}\n\n/**\n * A request chat message containing system instructions that influence how the model will generate a chat completions\n * response.\n */\nexport interface ChatRequestSystemMessage extends ChatRequestMessageParent {\n /** The chat role associated with this message, which is always 'system' for system messages. */\n role: \"system\";\n /** The contents of the system message. */\n content: string;\n}\n\n/** A request chat message representing user input to the assistant. */\nexport interface ChatRequestUserMessage extends ChatRequestMessageParent {\n /** The chat role associated with this message, which is always 'user' for user messages. */\n role: \"user\";\n /** The contents of the user message, with available input types varying by selected model. */\n content: string | Array<ChatMessageContentItem>;\n}\n\n/** An abstract representation of a structured content item within a chat message. */\nexport interface ChatMessageContentItemParent {\n type: string;\n}\n\n/** A structured chat content item containing plain text. */\nexport interface ChatMessageTextContentItem extends ChatMessageContentItemParent {\n /** The discriminated object type: always 'text' for this type. */\n type: \"text\";\n /** The content of the message. */\n text: string;\n}\n\n/** A structured chat content item containing an image reference. */\nexport interface ChatMessageImageContentItem extends ChatMessageContentItemParent {\n /** The discriminated object type: always 'image_url' for this type. */\n type: \"image_url\";\n /** An internet location, which must be accessible to the model,from which the image may be retrieved. */\n image_url: ChatMessageImageUrl;\n}\n\n/** An internet location from which the model may retrieve an image. */\nexport interface ChatMessageImageUrl {\n /** The URL of the image. */\n url: string;\n /**\n * The evaluation quality setting to use, which controls relative prioritization of speed, token consumption, and\n * accuracy.\n *\n * Possible values: \"auto\", \"low\", \"high\"\n */\n detail?: ChatMessageImageDetailLevel;\n}\n\n/** A request chat message representing response or action from the assistant. */\nexport interface ChatRequestAssistantMessage extends ChatRequestMessageParent {\n /** The chat role associated with this message, which is always 'assistant' for assistant messages. */\n role: \"assistant\";\n /** The content of the message. */\n content?: string | null;\n /**\n * The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat\n * completions request to resolve as configured.\n */\n tool_calls?: Array<ChatCompletionsToolCall>;\n}\n\n/** A function tool call requested by the AI model. */\nexport interface ChatCompletionsToolCall {\n /** The ID of the tool call. */\n id: string;\n /** The type of tool call. Currently, only `function` is supported. */\n type: \"function\";\n /** The details of the function call requested by the AI model. */\n function: FunctionCall;\n}\n\n/** The name and arguments of a function that should be called, as generated by the model. */\nexport interface FunctionCall {\n /** The name of the function to call. */\n name: string;\n /**\n * The arguments to call the function with, as generated by the model in JSON format.\n * Note that the model does not always generate valid JSON, and may hallucinate parameters\n * not defined by your function schema. Validate the arguments in your code before calling\n * your function.\n */\n arguments: string;\n}\n\n/** A request chat message representing requested output from a configured tool. */\nexport interface ChatRequestToolMessage extends ChatRequestMessageParent {\n /** The chat role associated with this message, which is always 'tool' for tool messages. */\n role: \"tool\";\n /** The content of the message. */\n content: string | null;\n /** The ID of the tool call resolved by the provided content. */\n tool_call_id: string;\n}\n\n/**\n * Represents the format that the model must output. Use this to enable JSON mode instead of the default text mode.\n * Note that to enable JSON mode, some AI models may also require you to instruct the model to produce JSON\n * via a system or user message.\n */\nexport interface ChatCompletionsResponseFormatParent {\n type: string;\n}\n\n/** A response format for Chat Completions that emits text responses. This is the default response format. */\nexport interface ChatCompletionsResponseFormatText extends ChatCompletionsResponseFormatParent {\n /** Response format type: always 'text' for this object. */\n type: \"text\";\n}\n\n/**\n * A response format for Chat Completions that restricts responses to emitting valid JSON objects.\n * Note that to enable JSON mode, some AI models may also require you to instruct the model to produce JSON\n * via a system or user message.\n */\nexport interface ChatCompletionsResponseFormatJSON extends ChatCompletionsResponseFormatParent {\n /** Response format type: always 'json_object' for this object. */\n type: \"json_object\";\n}\n\n/** The definition of a chat completions tool that can call a function. */\nexport interface ChatCompletionsToolDefinition {\n /** The type of the tool. Currently, only `function` is supported. */\n type: \"function\";\n /** The function definition details for the function tool. */\n function: FunctionDefinition;\n}\n\n/** The definition of a caller-specified function that chat completions may invoke in response to matching user input. */\nexport interface FunctionDefinition {\n /** The name of the function to be called. */\n name: string;\n /**\n * A description of what the function does. The model will use this description when selecting the function and\n * interpreting its parameters.\n */\n description?: string;\n /** The parameters the function accepts, described as a JSON Schema object. */\n parameters?: unknown;\n}\n\n/** A tool selection of a specific, named function tool that will limit chat completions to using the named function. */\nexport interface ChatCompletionsNamedToolSelection {\n /** The type of the tool. Currently, only `function` is supported. */\n type: \"function\";\n /** The function that should be called. */\n function: ChatCompletionsFunctionToolSelection;\n}\n\n/** A tool selection of a specific, named function tool that will limit chat completions to using the named function. */\nexport interface ChatCompletionsFunctionToolSelection {\n /** The name of the function that should be called. */\n name: string;\n}\n\n/** Represents an image with optional text. */\nexport interface ImageEmbeddingInput {\n /** The input image, in PNG format. */\n image: string;\n /**\n * Optional. The text input to feed into the model (like DINO, CLIP).\n * Returns a 422 error if the model doesn't support the value or parameter.\n */\n text?: string;\n}\n\n/** An abstract representation of a chat message as provided in a request. */\nexport type ChatRequestMessage =\n | ChatRequestMessageParent\n | ChatRequestSystemMessage\n | ChatRequestUserMessage\n | ChatRequestAssistantMessage\n | ChatRequestToolMessage;\n/** An abstract representation of a structured content item within a chat message. */\nexport type ChatMessageContentItem =\n | ChatMessageContentItemParent\n | ChatMessageTextContentItem\n | ChatMessageImageContentItem;\n/**\n * Represents the format that the model must output. Use this to enable JSON mode instead of the default text mode.\n * Note that to enable JSON mode, some AI models may also require you to instruct the model to produce JSON\n * via a system or user message.\n */\nexport type ChatCompletionsResponseFormat =\n | ChatCompletionsResponseFormatParent\n | ChatCompletionsResponseFormatText\n | ChatCompletionsResponseFormatJSON;\n/** Alias for ExtraParameters */\nexport type ExtraParameters = string;\n/** Alias for ChatRole */\nexport type ChatRole = string;\n/** Alias for ChatMessageImageDetailLevel */\nexport type ChatMessageImageDetailLevel = string;\n/** Alias for ChatCompletionsToolSelectionPreset */\nexport type ChatCompletionsToolSelectionPreset = string;\n/** Alias for EmbeddingEncodingFormat */\nexport type EmbeddingEncodingFormat = string;\n/** Alias for EmbeddingInputType */\nexport type EmbeddingInputType = string;\n"]}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
* chat completion.
|
|
4
|
-
*/
|
|
5
|
-
export interface ChatCompletionsToolCallOutputParent {
|
|
1
|
+
/** A function tool call requested by the AI model. */
|
|
2
|
+
export interface ChatCompletionsToolCallOutput {
|
|
6
3
|
/** The ID of the tool call. */
|
|
7
4
|
id: string;
|
|
8
|
-
type
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A tool call to a function tool, issued by the model in evaluation of a configured function tool, that represents
|
|
12
|
-
* a function invocation needed for a subsequent chat completions request to resolve.
|
|
13
|
-
*/
|
|
14
|
-
export interface ChatCompletionsFunctionToolCallOutput extends ChatCompletionsToolCallOutputParent {
|
|
15
|
-
/** The type of tool call, in this case always 'function'. */
|
|
5
|
+
/** The type of tool call. Currently, only `function` is supported. */
|
|
16
6
|
type: "function";
|
|
17
|
-
/** The details of the function
|
|
7
|
+
/** The details of the function call requested by the AI model. */
|
|
18
8
|
function: FunctionCallOutput;
|
|
19
9
|
}
|
|
20
10
|
/** The name and arguments of a function that should be called, as generated by the model. */
|
|
@@ -81,7 +71,11 @@ export interface ChatChoiceOutput {
|
|
|
81
71
|
}
|
|
82
72
|
/** A representation of a chat message as received in a response. */
|
|
83
73
|
export interface ChatResponseMessageOutput {
|
|
84
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* The chat role associated with the message.
|
|
76
|
+
*
|
|
77
|
+
* Possible values: "system", "user", "assistant", "tool"
|
|
78
|
+
*/
|
|
85
79
|
role: ChatRoleOutput;
|
|
86
80
|
/** The content of the message. */
|
|
87
81
|
content: string | null;
|
|
@@ -95,20 +89,52 @@ export interface ChatResponseMessageOutput {
|
|
|
95
89
|
export interface ModelInfoOutput {
|
|
96
90
|
/** The name of the AI model. For example: `Phi21` */
|
|
97
91
|
model_name: string;
|
|
98
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* The type of the AI model. A Unique identifier for the profile.
|
|
94
|
+
*
|
|
95
|
+
* Possible values: "embeddings", "image_generation", "text_generation", "image_embeddings", "audio_generation", "chat"
|
|
96
|
+
*/
|
|
99
97
|
model_type: ModelTypeOutput;
|
|
100
98
|
/** The model provider name. For example: `Microsoft Research` */
|
|
101
99
|
model_provider_name: string;
|
|
102
100
|
}
|
|
103
101
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
102
|
+
* Representation of the response data from an embeddings request.
|
|
103
|
+
* Embeddings measure the relatedness of text strings and are commonly used for search, clustering,
|
|
104
|
+
* recommendations, and other similar scenarios.
|
|
106
105
|
*/
|
|
107
|
-
export
|
|
106
|
+
export interface EmbeddingsResultOutput {
|
|
107
|
+
/** Embedding values for the prompts submitted in the request. */
|
|
108
|
+
data: Array<EmbeddingItemOutput>;
|
|
109
|
+
/** Usage counts for tokens input using the embeddings API. */
|
|
110
|
+
usage: EmbeddingsUsageOutput;
|
|
111
|
+
/** The model ID used to generate this result. */
|
|
112
|
+
model: string;
|
|
113
|
+
}
|
|
114
|
+
/** Representation of a single embeddings relatedness comparison. */
|
|
115
|
+
export interface EmbeddingItemOutput {
|
|
116
|
+
/**
|
|
117
|
+
* List of embedding values for the input prompt. These represent a measurement of the
|
|
118
|
+
* vector-based relatedness of the provided input. Or a base64 encoded string of the embedding vector.
|
|
119
|
+
*/
|
|
120
|
+
embedding: string | number[];
|
|
121
|
+
/** Index of the prompt to which the EmbeddingItem corresponds. */
|
|
122
|
+
index: number;
|
|
123
|
+
}
|
|
124
|
+
/** Measurement of the amount of tokens used in this request and response. */
|
|
125
|
+
export interface EmbeddingsUsageOutput {
|
|
126
|
+
/** Number of tokens in the request. */
|
|
127
|
+
prompt_tokens: number;
|
|
128
|
+
/**
|
|
129
|
+
* Total number of tokens transacted in this request/response. Should equal the
|
|
130
|
+
* number of tokens in the request.
|
|
131
|
+
*/
|
|
132
|
+
total_tokens: number;
|
|
133
|
+
}
|
|
108
134
|
/** Alias for ChatRoleOutput */
|
|
109
|
-
export type ChatRoleOutput = string
|
|
135
|
+
export type ChatRoleOutput = string;
|
|
110
136
|
/** Alias for CompletionsFinishReasonOutput */
|
|
111
|
-
export type CompletionsFinishReasonOutput = string
|
|
137
|
+
export type CompletionsFinishReasonOutput = string;
|
|
112
138
|
/** Alias for ModelTypeOutput */
|
|
113
|
-
export type ModelTypeOutput = string
|
|
139
|
+
export type ModelTypeOutput = string;
|
|
114
140
|
//# sourceMappingURL=outputModels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,sDAAsD;AACtD,MAAM,WAAW,6BAA6B;IAC5C,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,sEAAsE;IACtE,IAAI,EAAE,UA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E;IACjE,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,IAAI,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACjC,8DAA8D;IAC9D,KAAK,EAAE,qBAAqB,CAAC;IAC7B,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oEAAoE;AACpE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC7B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,+BAA+B;AAC/B,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AACpC,8CAA8C;AAC9C,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACnD,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** A function tool call requested by the AI model. */\nexport interface ChatCompletionsToolCallOutput {\n /** The ID of the tool call. */\n id: string;\n /** The type of tool call. Currently, only `function` is supported. */\n type: \"function\";\n /** The details of the function call requested by the AI model. */\n function: FunctionCallOutput;\n}\n\n/** The name and arguments of a function that should be called, as generated by the model. */\nexport interface FunctionCallOutput {\n /** The name of the function to call. */\n name: string;\n /**\n * The arguments to call the function with, as generated by the model in JSON format.\n * Note that the model does not always generate valid JSON, and may hallucinate parameters\n * not defined by your function schema. Validate the arguments in your code before calling\n * your function.\n */\n arguments: string;\n}\n\n/**\n * Representation of the response data from a chat completions request.\n * Completions support a wide variety of tasks and generate text that continues from or \"completes\"\n * provided prompt data.\n */\nexport interface ChatCompletionsOutput {\n /** A unique identifier associated with this chat completions response. */\n id: string;\n /**\n * The first timestamp associated with generation activity for this completions response,\n * represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970.\n */\n created: number;\n /** The model used for the chat completion. */\n model: string;\n /** Usage information for tokens processed and generated as part of this completions operation. */\n usage: CompletionsUsageOutput;\n /**\n * The collection of completions choices associated with this completions response.\n * Generally, `n` choices are generated per provided prompt with a default value of 1.\n * Token limits and other settings may limit the number of choices generated.\n */\n choices: Array<ChatChoiceOutput>;\n}\n\n/**\n * Representation of the token counts processed for a completions request.\n * Counts consider all tokens across prompts, choices, choice alternates, best_of generations, and\n * other consumers.\n */\nexport interface CompletionsUsageOutput {\n /** The number of tokens generated across all completions emissions. */\n completion_tokens: number;\n /** The number of tokens in the provided prompts for the completions request. */\n prompt_tokens: number;\n /** The total number of tokens processed for the completions request and response. */\n total_tokens: number;\n}\n\n/**\n * The representation of a single prompt completion as part of an overall chat completions request.\n * Generally, `n` choices are generated per provided prompt with a default value of 1.\n * Token limits and other settings may limit the number of choices generated.\n */\nexport interface ChatChoiceOutput {\n /** The ordered index associated with this chat completions choice. */\n index: number;\n /** The reason that this chat completions choice completed its generated. */\n finish_reason: CompletionsFinishReasonOutput | null;\n /** The chat message for a given chat completions prompt. */\n message: ChatResponseMessageOutput;\n}\n\n/** A representation of a chat message as received in a response. */\nexport interface ChatResponseMessageOutput {\n /**\n * The chat role associated with the message.\n *\n * Possible values: \"system\", \"user\", \"assistant\", \"tool\"\n */\n role: ChatRoleOutput;\n /** The content of the message. */\n content: string | null;\n /**\n * The tool calls that must be resolved and have their outputs appended to subsequent input messages for the chat\n * completions request to resolve as configured.\n */\n tool_calls?: Array<ChatCompletionsToolCallOutput>;\n}\n\n/** Represents some basic information about the AI model. */\nexport interface ModelInfoOutput {\n /** The name of the AI model. For example: `Phi21` */\n model_name: string;\n /**\n * The type of the AI model. A Unique identifier for the profile.\n *\n * Possible values: \"embeddings\", \"image_generation\", \"text_generation\", \"image_embeddings\", \"audio_generation\", \"chat\"\n */\n model_type: ModelTypeOutput;\n /** The model provider name. For example: `Microsoft Research` */\n model_provider_name: string;\n}\n\n/**\n * Representation of the response data from an embeddings request.\n * Embeddings measure the relatedness of text strings and are commonly used for search, clustering,\n * recommendations, and other similar scenarios.\n */\nexport interface EmbeddingsResultOutput {\n /** Embedding values for the prompts submitted in the request. */\n data: Array<EmbeddingItemOutput>;\n /** Usage counts for tokens input using the embeddings API. */\n usage: EmbeddingsUsageOutput;\n /** The model ID used to generate this result. */\n model: string;\n}\n\n/** Representation of a single embeddings relatedness comparison. */\nexport interface EmbeddingItemOutput {\n /**\n * List of embedding values for the input prompt. These represent a measurement of the\n * vector-based relatedness of the provided input. Or a base64 encoded string of the embedding vector.\n */\n embedding: string | number[];\n /** Index of the prompt to which the EmbeddingItem corresponds. */\n index: number;\n}\n\n/** Measurement of the amount of tokens used in this request and response. */\nexport interface EmbeddingsUsageOutput {\n /** Number of tokens in the request. */\n prompt_tokens: number;\n /**\n * Total number of tokens transacted in this request/response. Should equal the\n * number of tokens in the request.\n */\n total_tokens: number;\n}\n\n/** Alias for ChatRoleOutput */\nexport type ChatRoleOutput = string;\n/** Alias for CompletionsFinishReasonOutput */\nexport type CompletionsFinishReasonOutput = string;\n/** Alias for ModelTypeOutput */\nexport type ModelTypeOutput = string;\n"]}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
|
|
2
2
|
import { RequestParameters } from "@azure-rest/core-client";
|
|
3
|
-
import {
|
|
3
|
+
import { ExtraParameters, ChatRequestMessage, ChatCompletionsResponseFormat, ChatCompletionsToolDefinition, ChatCompletionsToolSelectionPreset, ChatCompletionsNamedToolSelection, EmbeddingEncodingFormat, EmbeddingInputType, ImageEmbeddingInput } from "./models.js";
|
|
4
4
|
export interface GetChatCompletionsHeaders {
|
|
5
5
|
/**
|
|
6
|
-
* Controls what happens if
|
|
7
|
-
*
|
|
6
|
+
* Controls what happens if extra parameters, undefined by the REST API,
|
|
7
|
+
* are passed in the JSON request payload.
|
|
8
|
+
* This sets the HTTP request header `extra-parameters`.
|
|
9
|
+
*
|
|
10
|
+
* Possible values: "error", "drop", "pass-through"
|
|
8
11
|
*/
|
|
9
|
-
"
|
|
12
|
+
"extra-parameters"?: ExtraParameters;
|
|
10
13
|
}
|
|
11
14
|
export interface GetChatCompletionsBodyParam {
|
|
12
15
|
body?: {
|
|
@@ -30,4 +33,50 @@ export interface GetChatCompletionsHeaderParam {
|
|
|
30
33
|
}
|
|
31
34
|
export type GetChatCompletionsParameters = GetChatCompletionsHeaderParam & GetChatCompletionsBodyParam & RequestParameters;
|
|
32
35
|
export type GetModelInfoParameters = RequestParameters;
|
|
36
|
+
export interface GetEmbeddingsHeaders {
|
|
37
|
+
/**
|
|
38
|
+
* Controls what happens if extra parameters, undefined by the REST API,
|
|
39
|
+
* are passed in the JSON request payload.
|
|
40
|
+
* This sets the HTTP request header `extra-parameters`.
|
|
41
|
+
*
|
|
42
|
+
* Possible values: "error", "drop", "pass-through"
|
|
43
|
+
*/
|
|
44
|
+
"extra-parameters"?: ExtraParameters;
|
|
45
|
+
}
|
|
46
|
+
export interface GetEmbeddingsBodyParam {
|
|
47
|
+
body?: {
|
|
48
|
+
input: string[];
|
|
49
|
+
dimensions?: number;
|
|
50
|
+
encoding_format?: EmbeddingEncodingFormat;
|
|
51
|
+
input_type?: EmbeddingInputType;
|
|
52
|
+
model?: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface GetEmbeddingsHeaderParam {
|
|
56
|
+
headers?: RawHttpHeadersInput & GetEmbeddingsHeaders;
|
|
57
|
+
}
|
|
58
|
+
export type GetEmbeddingsParameters = GetEmbeddingsHeaderParam & GetEmbeddingsBodyParam & RequestParameters;
|
|
59
|
+
export interface GetImageEmbeddingsHeaders {
|
|
60
|
+
/**
|
|
61
|
+
* Controls what happens if extra parameters, undefined by the REST API,
|
|
62
|
+
* are passed in the JSON request payload.
|
|
63
|
+
* This sets the HTTP request header `extra-parameters`.
|
|
64
|
+
*
|
|
65
|
+
* Possible values: "error", "drop", "pass-through"
|
|
66
|
+
*/
|
|
67
|
+
"extra-parameters"?: ExtraParameters;
|
|
68
|
+
}
|
|
69
|
+
export interface GetImageEmbeddingsBodyParam {
|
|
70
|
+
body?: {
|
|
71
|
+
input: Array<ImageEmbeddingInput>;
|
|
72
|
+
dimensions?: number;
|
|
73
|
+
encoding_format?: EmbeddingEncodingFormat;
|
|
74
|
+
input_type?: EmbeddingInputType;
|
|
75
|
+
model?: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface GetImageEmbeddingsHeaderParam {
|
|
79
|
+
headers?: RawHttpHeadersInput & GetImageEmbeddingsHeaders;
|
|
80
|
+
}
|
|
81
|
+
export type GetImageEmbeddingsParameters = GetImageEmbeddingsHeaderParam & GetImageEmbeddingsBodyParam & RequestParameters;
|
|
33
82
|
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;A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ACrC,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,uBAAuB,CAAC;QAC1C,UAAU,CAAC,EAAE,kBAAkB,CAAC;QAChC,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CAAC;CACtD;AAED,MAAM,MAAM,uBAAuB,GAAG,wBAAwB,GAC5D,sBAAsB,GACtB,iBAAiB,CAAC;AAEpB,MAAM,WAAW,yBAAyB;IACxC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,uBAAuB,CAAC;QAC1C,UAAU,CAAC,EAAE,kBAAkB,CAAC;QAChC,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,mBAAmB,GAAG,yBAAyB,CAAC;CAC3D;AAED,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
|
|
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 { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport {\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,6 +1,6 @@
|
|
|
1
1
|
import { RawHttpHeaders } from "@azure/core-rest-pipeline";
|
|
2
2
|
import { HttpResponse, ErrorResponse } from "@azure-rest/core-client";
|
|
3
|
-
import { ChatCompletionsOutput, ModelInfoOutput } from "./outputModels.js";
|
|
3
|
+
import { ChatCompletionsOutput, ModelInfoOutput, EmbeddingsResultOutput } from "./outputModels.js";
|
|
4
4
|
/** The request has succeeded. */
|
|
5
5
|
export interface GetChatCompletions200Response extends HttpResponse {
|
|
6
6
|
status: "200";
|
|
@@ -29,4 +29,32 @@ export interface GetModelInfoDefaultResponse extends HttpResponse {
|
|
|
29
29
|
body: ErrorResponse;
|
|
30
30
|
headers: RawHttpHeaders & GetModelInfoDefaultHeaders;
|
|
31
31
|
}
|
|
32
|
+
/** The request has succeeded. */
|
|
33
|
+
export interface GetEmbeddings200Response extends HttpResponse {
|
|
34
|
+
status: "200";
|
|
35
|
+
body: EmbeddingsResultOutput;
|
|
36
|
+
}
|
|
37
|
+
export interface GetEmbeddingsDefaultHeaders {
|
|
38
|
+
/** String error code indicating what went wrong. */
|
|
39
|
+
"x-ms-error-code"?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface GetEmbeddingsDefaultResponse extends HttpResponse {
|
|
42
|
+
status: string;
|
|
43
|
+
body: ErrorResponse;
|
|
44
|
+
headers: RawHttpHeaders & GetEmbeddingsDefaultHeaders;
|
|
45
|
+
}
|
|
46
|
+
/** The request has succeeded. */
|
|
47
|
+
export interface GetImageEmbeddings200Response extends HttpResponse {
|
|
48
|
+
status: "200";
|
|
49
|
+
body: EmbeddingsResultOutput;
|
|
50
|
+
}
|
|
51
|
+
export interface GetImageEmbeddingsDefaultHeaders {
|
|
52
|
+
/** String error code indicating what went wrong. */
|
|
53
|
+
"x-ms-error-code"?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface GetImageEmbeddingsDefaultResponse extends HttpResponse {
|
|
56
|
+
status: string;
|
|
57
|
+
body: ErrorResponse;
|
|
58
|
+
headers: RawHttpHeaders & GetImageEmbeddingsDefaultHeaders;
|
|
59
|
+
}
|
|
32
60
|
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEnG,i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BAAiB,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
|
|
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 { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse, ErrorResponse } from \"@azure-rest/core-client\";\nimport { ChatCompletionsOutput, ModelInfoOutput, EmbeddingsResultOutput } 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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TracingSpan } from "@azure/core-tracing";
|
|
2
|
+
import { GetChatCompletionsBodyParam } from "./parameters.js";
|
|
3
|
+
import { PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline";
|
|
4
|
+
export declare function getRequestBody(request: PipelineRequest): GetChatCompletionsBodyParam;
|
|
5
|
+
export declare function getSpanName(request: PipelineRequest): string;
|
|
6
|
+
export declare function onStartTracing(span: TracingSpan, request: PipelineRequest, url: string): void;
|
|
7
|
+
export declare function tryProcessResponse(span: TracingSpan, response?: PipelineResponse): void;
|
|
8
|
+
export declare function tryProcessError(span: TracingSpan, error: unknown): void;
|
|
9
|
+
//# sourceMappingURL=tracingHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracingHelper.d.ts","sourceRoot":"","sources":["../../src/tracingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAa9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AA0B9E,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"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
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");
|
|
6
|
+
var TracingAttributesEnum;
|
|
7
|
+
(function (TracingAttributesEnum) {
|
|
8
|
+
TracingAttributesEnum["Operation_Name"] = "gen_ai.operation.name";
|
|
9
|
+
TracingAttributesEnum["Request_Model"] = "gen_ai.request.model";
|
|
10
|
+
TracingAttributesEnum["System"] = "gen_ai.system";
|
|
11
|
+
TracingAttributesEnum["Error_Type"] = "error.type";
|
|
12
|
+
TracingAttributesEnum["Server_Port"] = "server.port";
|
|
13
|
+
TracingAttributesEnum["Request_Frequency_Penalty"] = "gen_ai.request.frequency_penalty";
|
|
14
|
+
TracingAttributesEnum["Request_Max_Tokens"] = "gen_ai.request.max_tokens";
|
|
15
|
+
TracingAttributesEnum["Request_Presence_Penalty"] = "gen_ai.request.presence_penalty";
|
|
16
|
+
TracingAttributesEnum["Request_Stop_Sequences"] = "gen_ai.request.stop_sequences";
|
|
17
|
+
TracingAttributesEnum["Request_Temperature"] = "gen_ai.request.temperature";
|
|
18
|
+
TracingAttributesEnum["Request_Top_P"] = "gen_ai.request.top_p";
|
|
19
|
+
TracingAttributesEnum["Response_Finish_Reasons"] = "gen_ai.response.finish_reasons";
|
|
20
|
+
TracingAttributesEnum["Response_Id"] = "gen_ai.response.id";
|
|
21
|
+
TracingAttributesEnum["Response_Model"] = "gen_ai.response.model";
|
|
22
|
+
TracingAttributesEnum["Usage_Input_Tokens"] = "gen_ai.usage.input_tokens";
|
|
23
|
+
TracingAttributesEnum["Usage_Output_Tokens"] = "gen_ai.usage.output_tokens";
|
|
24
|
+
TracingAttributesEnum["Server_Address"] = "server.address";
|
|
25
|
+
})(TracingAttributesEnum || (TracingAttributesEnum = {}));
|
|
26
|
+
export function getRequestBody(request) {
|
|
27
|
+
return { body: JSON.parse(request.body) };
|
|
28
|
+
}
|
|
29
|
+
export function getSpanName(request) {
|
|
30
|
+
var _a;
|
|
31
|
+
const { body } = getRequestBody(request);
|
|
32
|
+
return `chat ${(_a = body === null || body === void 0 ? void 0 : body.model) !== null && _a !== void 0 ? _a : ""}`.trim();
|
|
33
|
+
}
|
|
34
|
+
export function onStartTracing(span, request, url) {
|
|
35
|
+
if (!span.isRecording()) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const urlObj = new URL(url);
|
|
39
|
+
const port = Number(urlObj.port) || (urlObj.protocol === "https:" ? undefined : 80);
|
|
40
|
+
if (port) {
|
|
41
|
+
span.setAttribute(TracingAttributesEnum.Server_Port, port);
|
|
42
|
+
}
|
|
43
|
+
span.setAttribute(TracingAttributesEnum.Server_Address, urlObj.hostname);
|
|
44
|
+
span.setAttribute(TracingAttributesEnum.Operation_Name, "chat");
|
|
45
|
+
span.setAttribute(TracingAttributesEnum.System, "az.ai.inference");
|
|
46
|
+
const { body } = getRequestBody(request);
|
|
47
|
+
if (!body)
|
|
48
|
+
return;
|
|
49
|
+
span.setAttribute(TracingAttributesEnum.Request_Model, body.model);
|
|
50
|
+
span.setAttribute(TracingAttributesEnum.Request_Frequency_Penalty, body.frequency_penalty);
|
|
51
|
+
span.setAttribute(TracingAttributesEnum.Request_Max_Tokens, body.max_tokens);
|
|
52
|
+
span.setAttribute(TracingAttributesEnum.Request_Presence_Penalty, body.presence_penalty);
|
|
53
|
+
span.setAttribute(TracingAttributesEnum.Request_Stop_Sequences, body.stop);
|
|
54
|
+
span.setAttribute(TracingAttributesEnum.Request_Temperature, body.temperature);
|
|
55
|
+
span.setAttribute(TracingAttributesEnum.Request_Top_P, body.top_p);
|
|
56
|
+
if (body.messages) {
|
|
57
|
+
addRequestChatMessageEvent(span, body.messages);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function tryProcessResponse(span, response) {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
if (!span.isRecording()) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (response === null || response === void 0 ? void 0 : response.bodyAsText) {
|
|
66
|
+
const body = JSON.parse(response.bodyAsText);
|
|
67
|
+
if ((_a = body.error) !== null && _a !== void 0 ? _a : body.message) {
|
|
68
|
+
span.setAttribute(TracingAttributesEnum.Error_Type, `${(_b = body.status) !== null && _b !== void 0 ? _b : body.statusCode}`);
|
|
69
|
+
span.setStatus({
|
|
70
|
+
status: "error",
|
|
71
|
+
error: (_c = body.error) !== null && _c !== void 0 ? _c : body.message, // message is not in the schema of the response, but it can present if there is crediential error
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
span.setAttribute(TracingAttributesEnum.Response_Id, body.id);
|
|
75
|
+
span.setAttribute(TracingAttributesEnum.Response_Model, body.model);
|
|
76
|
+
if (body.choices) {
|
|
77
|
+
span.setAttribute(TracingAttributesEnum.Response_Finish_Reasons, body.choices.map((choice) => choice.finish_reason).join(","));
|
|
78
|
+
}
|
|
79
|
+
if (body.usage) {
|
|
80
|
+
span.setAttribute(TracingAttributesEnum.Usage_Input_Tokens, body.usage.prompt_tokens);
|
|
81
|
+
span.setAttribute(TracingAttributesEnum.Usage_Output_Tokens, body.usage.completion_tokens);
|
|
82
|
+
}
|
|
83
|
+
addResponseChatMessageEvent(span, body);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function tryProcessError(span, error) {
|
|
87
|
+
span.setStatus({
|
|
88
|
+
status: "error",
|
|
89
|
+
error: isError(error) ? error : undefined,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
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
|
+
function addRequestChatMessageEvent(span, messages) {
|
|
105
|
+
messages.forEach((message) => {
|
|
106
|
+
var _a;
|
|
107
|
+
if (message.role) {
|
|
108
|
+
const content = {};
|
|
109
|
+
const chatMsg = message;
|
|
110
|
+
if (chatMsg.content) {
|
|
111
|
+
content.content = chatMsg.content;
|
|
112
|
+
}
|
|
113
|
+
if (!isContentRecordingEnabled()) {
|
|
114
|
+
content.content = "";
|
|
115
|
+
}
|
|
116
|
+
const assistantMsg = message;
|
|
117
|
+
if (assistantMsg.tool_calls) {
|
|
118
|
+
content.tool_calls = assistantMsg.tool_calls;
|
|
119
|
+
if (!isContentRecordingEnabled()) {
|
|
120
|
+
const toolCalls = JSON.parse(JSON.stringify(content.tool_calls));
|
|
121
|
+
toolCalls.forEach((toolCall) => {
|
|
122
|
+
if (toolCall.function.arguments) {
|
|
123
|
+
toolCall.function.arguments = "";
|
|
124
|
+
}
|
|
125
|
+
toolCall.function.name = "";
|
|
126
|
+
});
|
|
127
|
+
content.tool_calls = toolCalls;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const toolMsg = message;
|
|
131
|
+
if (toolMsg.tool_call_id) {
|
|
132
|
+
content.id = toolMsg.tool_call_id;
|
|
133
|
+
}
|
|
134
|
+
(_a = span.addEvent) === null || _a === void 0 ? void 0 : _a.call(span, `gen_ai.${message.role}.message`, {
|
|
135
|
+
attributes: {
|
|
136
|
+
"gen_ai.system": INFERENCE_GEN_AI_SYSTEM_NAME,
|
|
137
|
+
"gen_ai.event.content": JSON.stringify(content),
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
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
|
+
function addResponseChatMessageEvent(span, body) {
|
|
156
|
+
var _a;
|
|
157
|
+
if (!span.addEvent) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
(_a = body === null || body === void 0 ? void 0 : body.choices) === null || _a === void 0 ? void 0 : _a.forEach((choice) => {
|
|
161
|
+
var _a;
|
|
162
|
+
let message = {};
|
|
163
|
+
if (choice.message.content) {
|
|
164
|
+
message.content = choice.message.content;
|
|
165
|
+
}
|
|
166
|
+
if (choice.message.tool_calls) {
|
|
167
|
+
message.toolCalls = choice.message.tool_calls;
|
|
168
|
+
}
|
|
169
|
+
if (!isContentRecordingEnabled()) {
|
|
170
|
+
message = JSON.parse(JSON.stringify(message));
|
|
171
|
+
message.content = "";
|
|
172
|
+
if (message.toolCalls) {
|
|
173
|
+
message.toolCalls.forEach((toolCall) => {
|
|
174
|
+
if (toolCall.function.arguments) {
|
|
175
|
+
toolCall.function.arguments = "";
|
|
176
|
+
}
|
|
177
|
+
toolCall.function.name = "";
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const response = {
|
|
182
|
+
finish_reason: choice.finish_reason,
|
|
183
|
+
index: choice.index,
|
|
184
|
+
message,
|
|
185
|
+
};
|
|
186
|
+
const attributes = {
|
|
187
|
+
"gen_ai.system": INFERENCE_GEN_AI_SYSTEM_NAME,
|
|
188
|
+
"gen_ai.event.content": JSON.stringify(response),
|
|
189
|
+
};
|
|
190
|
+
(_a = span.addEvent) === null || _a === void 0 ? void 0 : _a.call(span, "gen_ai.choice", { attributes });
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function envVarToBoolean(key) {
|
|
194
|
+
var _a;
|
|
195
|
+
const value = (_a = process.env[key]) !== null && _a !== void 0 ? _a : process.env[key.toLowerCase()];
|
|
196
|
+
return value !== "false" && value !== "0" && Boolean(value);
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=tracingHelper.js.map
|