@azure/ai-projects 2.0.0-beta.2 → 2.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 +212 -8
- package/dist/browser/aiProjectClient.d.ts.map +1 -1
- package/dist/browser/aiProjectClient.js +6 -0
- package/dist/browser/aiProjectClient.js.map +1 -1
- package/dist/browser/api/aiProjectContext.js +1 -1
- package/dist/browser/api/aiProjectContext.js.map +1 -1
- package/dist/browser/constants.d.ts +1 -1
- package/dist/browser/constants.js +1 -1
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/getCustomFetch-browser.d.mts.map +1 -0
- package/dist/browser/getCustomFetch-browser.mjs.map +1 -0
- package/dist/browser/getCustomFetch.d.ts +13 -0
- package/dist/browser/getCustomFetch.js +40 -0
- package/dist/browser/models/models.d.ts +10 -10
- package/dist/browser/models/models.d.ts.map +1 -1
- package/dist/browser/models/models.js +1 -1
- package/dist/browser/models/models.js.map +1 -1
- package/dist/commonjs/aiProjectClient.d.ts.map +1 -1
- package/dist/commonjs/aiProjectClient.js +6 -0
- package/dist/commonjs/aiProjectClient.js.map +1 -1
- package/dist/commonjs/api/aiProjectContext.js +1 -1
- package/dist/commonjs/api/aiProjectContext.js.map +1 -1
- package/dist/commonjs/constants.d.ts +1 -1
- package/dist/commonjs/constants.js +1 -1
- package/dist/commonjs/constants.js.map +1 -1
- package/dist/commonjs/getCustomFetch.d.ts +13 -0
- package/dist/commonjs/getCustomFetch.d.ts.map +1 -0
- package/dist/commonjs/getCustomFetch.js +45 -0
- package/dist/commonjs/getCustomFetch.js.map +1 -0
- package/dist/commonjs/models/models.d.ts +10 -10
- package/dist/commonjs/models/models.d.ts.map +1 -1
- package/dist/commonjs/models/models.js +1 -1
- package/dist/commonjs/models/models.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/aiProjectClient.d.ts.map +1 -1
- package/dist/esm/aiProjectClient.js +6 -0
- package/dist/esm/aiProjectClient.js.map +1 -1
- package/dist/esm/api/aiProjectContext.js +1 -1
- package/dist/esm/api/aiProjectContext.js.map +1 -1
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/getCustomFetch.d.ts +13 -0
- package/dist/esm/getCustomFetch.d.ts.map +1 -0
- package/dist/esm/getCustomFetch.js +42 -0
- package/dist/esm/getCustomFetch.js.map +1 -0
- package/dist/esm/models/models.d.ts +10 -10
- package/dist/esm/models/models.d.ts.map +1 -1
- package/dist/esm/models/models.js +1 -1
- package/dist/esm/models/models.js.map +1 -1
- package/dist/react-native/aiProjectClient.d.ts.map +1 -1
- package/dist/react-native/aiProjectClient.js +6 -0
- package/dist/react-native/aiProjectClient.js.map +1 -1
- package/dist/react-native/api/aiProjectContext.js +1 -1
- package/dist/react-native/api/aiProjectContext.js.map +1 -1
- package/dist/react-native/constants.d.ts +1 -1
- package/dist/react-native/constants.js +1 -1
- package/dist/react-native/constants.js.map +1 -1
- package/dist/react-native/getCustomFetch.d.ts +13 -0
- package/dist/react-native/getCustomFetch.d.ts.map +1 -0
- package/dist/react-native/getCustomFetch.js +42 -0
- package/dist/react-native/getCustomFetch.js.map +1 -0
- package/dist/react-native/models/models.d.ts +10 -10
- package/dist/react-native/models/models.d.ts.map +1 -1
- package/dist/react-native/models/models.js +1 -1
- package/dist/react-native/models/models.js.map +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -4,6 +4,23 @@ The AI Projects client library (in preview) is part of the Microsoft Foundry SDK
|
|
|
4
4
|
resources in your Microsoft Foundry Project. Use it to:
|
|
5
5
|
|
|
6
6
|
- **Create and run Agents** using the `.agents` property on the client.
|
|
7
|
+
* **Enhance Agents with specialized tools**:
|
|
8
|
+
* Agent Memory Search
|
|
9
|
+
* Agent-to-Agent (A2A)
|
|
10
|
+
* Azure AI Search
|
|
11
|
+
* Bing Custom Search
|
|
12
|
+
* Bing Grounding
|
|
13
|
+
* Browser Automation
|
|
14
|
+
* Code Interpreter
|
|
15
|
+
* Computer Use
|
|
16
|
+
* File Search
|
|
17
|
+
* Function Tool
|
|
18
|
+
* Image Generation
|
|
19
|
+
* Microsoft Fabric
|
|
20
|
+
* Model Context Protocol (MCP)
|
|
21
|
+
* OpenAPI
|
|
22
|
+
* SharePoint
|
|
23
|
+
* Web Search
|
|
7
24
|
- **Get an OpenAI client** using the `.getOpenAIClient.` method to run Responses, Conversations, Evals and FineTuning operations with your Agent.
|
|
8
25
|
* **Manage memory stores** for Agent conversations, using the `.memoryStores` operations.
|
|
9
26
|
* **Explore additional evaluation tools** to assess the performance of your generative AI application, using the `.evaluationRules`,
|
|
@@ -37,12 +54,16 @@ The client library uses version `2025-11-15-preview` of the Microsoft Foundry [d
|
|
|
37
54
|
- [Using Agent tools](#using-agent-tools)
|
|
38
55
|
- [Built-in Tools](#built-in-tools)
|
|
39
56
|
- [Connection-Based Tools](#connection-based-tools)
|
|
57
|
+
- [Evaluation operations](#evaluation)
|
|
40
58
|
- [Deployments operations](#deployments-operations)
|
|
41
59
|
- [Connections operations](#connections-operations)
|
|
42
60
|
- [Dataset operations](#dataset-operations)
|
|
43
61
|
- [Files operations](#files-operations)
|
|
44
62
|
- [Indexes operations](#indexes-operations)
|
|
63
|
+
- [fine-tuning operations](#fine-tuning-operations)
|
|
45
64
|
- [Tracing](#tracing)
|
|
65
|
+
- [Installation](#installation)
|
|
66
|
+
- [How to enable tracing](#how-to-enable-tracing)
|
|
46
67
|
- [Troubleshooting](#troubleshooting)
|
|
47
68
|
- [Exceptions](#exceptions)
|
|
48
69
|
- [Reporting issues](#reporting-issues)
|
|
@@ -56,11 +77,12 @@ The client library uses version `2025-11-15-preview` of the Microsoft Foundry [d
|
|
|
56
77
|
- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)
|
|
57
78
|
- An [Azure subscription][azure_sub].
|
|
58
79
|
- A [project in Microsoft Foundry](https://learn.microsoft.com/azure/ai-studio/how-to/create-projects?tabs=ai-studio).
|
|
80
|
+
- The project endpoint URL of the form `https://your-ai-services-account-name.services.ai.azure.com/api/projects/your-project-name`. It can be found in your Microsoft Foundry Project overview page. Below we will assume the environment variable `AZURE_AI_PROJECT_ENDPOINT` was defined to hold this value.
|
|
59
81
|
|
|
60
82
|
### Authorization
|
|
61
83
|
|
|
62
84
|
- [Entra ID][entra_id] is needed to authenticate the client. Your application needs an object that implements the [TokenCredential](https://learn.microsoft.com/javascript/api/@azure/core-auth/tokencredential) interface. Code samples here use [DefaultAzureCredential][default_azure_credential]. To get that working, you will need:
|
|
63
|
-
-
|
|
85
|
+
- An appropriate role assignment. see [Role-based access control in Microsoft Foundry portal](https://learn.microsoft.com/azure/ai-foundry/concepts/rbac-ai-foundry). Role assigned can be done via the "Access Control (IAM)" tab of your Azure AI Project resource in the Azure portal.
|
|
64
86
|
- [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed.
|
|
65
87
|
- You are logged into your Azure account by running `az login`.
|
|
66
88
|
- Note that if you have multiple Azure subscriptions, the subscription that contains your Azure AI Project resource must be your default subscription. Run `az account list --output table` to list all your subscription and see which one is the default. Run `az account set --subscription "Your Subscription ID or Name"` to change your default subscription.
|
|
@@ -68,12 +90,14 @@ The client library uses version `2025-11-15-preview` of the Microsoft Foundry [d
|
|
|
68
90
|
### Install the package
|
|
69
91
|
|
|
70
92
|
```bash
|
|
71
|
-
npm install @azure/ai-projects @azure/identity
|
|
93
|
+
npm install @azure/ai-projects @azure/identity dotenv
|
|
72
94
|
```
|
|
73
95
|
|
|
74
96
|
## Key concepts
|
|
75
97
|
|
|
76
|
-
### Create and authenticate the client
|
|
98
|
+
### Create and authenticate the client with Entra ID
|
|
99
|
+
|
|
100
|
+
Entra ID is the only authentication method supported at the moment by the client.
|
|
77
101
|
|
|
78
102
|
To construct an `AIProjectsClient`, the `projectEndpoint` can be fetched from [projectEndpoint][ai_project_client_endpoint]. Below we will assume the environment variable `AZURE_AI_PROJECT_ENDPOINT` was defined to hold this value:
|
|
79
103
|
|
|
@@ -85,17 +109,15 @@ const projectEndpoint = process.env["AZURE_AI_PROJECT_ENDPOINT"] || "<project en
|
|
|
85
109
|
const client = new AIProjectClient(projectEndpoint, new DefaultAzureCredential());
|
|
86
110
|
```
|
|
87
111
|
|
|
88
|
-
The client uses API version `2025-11-15-preview`, refer to the [API documentation][ai_foundry_data_plane_rest_apis] to learn more about the supported features.
|
|
89
|
-
|
|
90
112
|
## Examples
|
|
91
113
|
|
|
92
114
|
### Performing Responses operations using OpenAI client
|
|
93
115
|
|
|
94
|
-
Your Microsoft Foundry project may have one or more
|
|
116
|
+
Your Microsoft Foundry project may have one or more AI models deployed. These could be OpenAI models, Microsoft models, or models from other providers. Use the code below to get an authenticated [OpenAI](https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai) from the [openai](https://www.npmjs.com/package/openai) package, and execute a chat completions call.
|
|
95
117
|
|
|
96
118
|
Run the code below. Here we assume `deploymentName` (str) is defined. It's the deployment name of an AI model in your Foundry Project. As shown in the "Models + endpoints" tab, under the "Name" column.
|
|
97
119
|
|
|
98
|
-
|
|
120
|
+
See the "responses" folder in the [package samples][samples] for additional samples, including streaming responses.
|
|
99
121
|
|
|
100
122
|
|
|
101
123
|
```ts snippet:openAI
|
|
@@ -342,6 +364,34 @@ console.log(`Response: ${response.output_text}`);
|
|
|
342
364
|
|
|
343
365
|
See the full sample code in [agentWebSearch.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples-dev/agents/tools/agentWebSearch.ts).
|
|
344
366
|
|
|
367
|
+
**Computer Use**
|
|
368
|
+
|
|
369
|
+
Enable agents to interact directly with computer systems for task automation and system operations:
|
|
370
|
+
|
|
371
|
+
```ts snippet:agent-computer-use
|
|
372
|
+
const agent = await project.agents.createVersion("ComputerUseAgent", {
|
|
373
|
+
kind: "prompt" as const,
|
|
374
|
+
model: deploymentName,
|
|
375
|
+
instructions: `
|
|
376
|
+
You are a computer automation assistant.
|
|
377
|
+
|
|
378
|
+
Be direct and efficient. When you reach the search results page, read and describe the actual search result titles and descriptions you can see.
|
|
379
|
+
`.trim(),
|
|
380
|
+
tools: [
|
|
381
|
+
{
|
|
382
|
+
type: "computer_use_preview",
|
|
383
|
+
display_width: 1026,
|
|
384
|
+
display_height: 769,
|
|
385
|
+
environment: "windows" as const,
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
});
|
|
389
|
+
console.log(`Agent created (id: ${agent.id}, name: ${agent.name}, version: ${agent.version})`);
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
*After calling `responses.create()`, process the response in an interaction loop. Handle `computer_call` output items and provide screenshots as `computer_call_output` with `computer_screenshot` type to continue the interaction.*
|
|
393
|
+
|
|
394
|
+
See the full sample code in [agentComputerUse.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples-dev/agents/tools/agentComputerUse.ts).
|
|
345
395
|
|
|
346
396
|
**Model Context Protocol (MCP)**
|
|
347
397
|
|
|
@@ -454,6 +504,54 @@ console.log(`Agent created (id: ${agent.id}, name: ${agent.name}, version: ${age
|
|
|
454
504
|
|
|
455
505
|
See the full sample code in [agentFunctionTool.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples-dev/agents/agentFunctionTool.ts).
|
|
456
506
|
|
|
507
|
+
* **Memory Search Tool**
|
|
508
|
+
|
|
509
|
+
The Memory Store Tool adds Memory to an Agent, allowing the Agent's AI model to search for past information related to the current user prompt.
|
|
510
|
+
|
|
511
|
+
The `embeddingModelDeployment` is the name of the model used to create vector embeddings for storing and searching memories.
|
|
512
|
+
|
|
513
|
+
```ts snippet:agent-memory-search
|
|
514
|
+
const memoryStoreName = "AgentMemoryStore";
|
|
515
|
+
const embeddingModelDeployment =
|
|
516
|
+
process.env["AZURE_AI_EMBEDDING_MODEL_DEPLOYMENT_NAME"] || "<embedding model>";
|
|
517
|
+
const scope = "user_123";
|
|
518
|
+
const memoryStore = await project.memoryStores.create(
|
|
519
|
+
memoryStoreName,
|
|
520
|
+
{
|
|
521
|
+
kind: "default",
|
|
522
|
+
chat_model: deploymentName,
|
|
523
|
+
embedding_model: embeddingModelDeployment,
|
|
524
|
+
options: {
|
|
525
|
+
user_profile_enabled: true,
|
|
526
|
+
chat_summary_enabled: true,
|
|
527
|
+
},
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
description: "Memory store for agent conversations",
|
|
531
|
+
},
|
|
532
|
+
);
|
|
533
|
+
console.log(
|
|
534
|
+
`Created memory store: ${memoryStore.name} (${memoryStore.id}) using chat model '${deploymentName}'`,
|
|
535
|
+
);
|
|
536
|
+
// Create an agent that will use the Memory Search tool
|
|
537
|
+
const agent = await project.agents.createVersion("MemorySearchAgent", {
|
|
538
|
+
kind: "prompt",
|
|
539
|
+
model: deploymentName,
|
|
540
|
+
instructions:
|
|
541
|
+
"You are a helpful assistant that remembers user preferences using the memory search tool.",
|
|
542
|
+
tools: [
|
|
543
|
+
{
|
|
544
|
+
type: "memory_search",
|
|
545
|
+
memory_store_name: memoryStore.name,
|
|
546
|
+
scope,
|
|
547
|
+
update_delay: 1, // wait briefly after conversation inactivity before updating memories
|
|
548
|
+
},
|
|
549
|
+
],
|
|
550
|
+
});
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
See the full sample code in [agentMemorySearch.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples-dev/agents/tools/agentMemorySearch.ts).
|
|
554
|
+
|
|
457
555
|
#### Connection-Based Tools
|
|
458
556
|
|
|
459
557
|
These tools require configuring connections in your AI Foundry project and use `projectConnectionId`.
|
|
@@ -732,6 +830,41 @@ See the full sample code in [agentOpenApiConnectionAuth.ts](https://github.com/A
|
|
|
732
830
|
|
|
733
831
|
For complete working examples of all tools, see the [samples-dev directory](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/samples-dev).
|
|
734
832
|
|
|
833
|
+
### Evaluation
|
|
834
|
+
|
|
835
|
+
Evaluation in Azure AI Project client library provides quantitative, AI-assisted quality and safety metrics to asses performance and Evaluate LLM Models, GenAI Application and Agents. Metrics are defined as evaluators. Built-in or custom evaluators can provide comprehensive evaluation insights.
|
|
836
|
+
|
|
837
|
+
The code below shows some evaluation operations. Full list of sample can be found under "evaluations" folder in the [package samples][samples]
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
```ts snippet:evaluations
|
|
841
|
+
const openAIClient = await project.getOpenAIClient();
|
|
842
|
+
const dataSourceConfig = {
|
|
843
|
+
type: "custom" as const,
|
|
844
|
+
item_schema: {
|
|
845
|
+
type: "object",
|
|
846
|
+
properties: { query: { type: "string" } },
|
|
847
|
+
required: ["query"],
|
|
848
|
+
},
|
|
849
|
+
include_sample_schema: true,
|
|
850
|
+
};
|
|
851
|
+
const evalObject = await openAIClient.evals.create({
|
|
852
|
+
name: "Agent Evaluation",
|
|
853
|
+
data_source_config: dataSourceConfig,
|
|
854
|
+
testing_criteria: [
|
|
855
|
+
{
|
|
856
|
+
type: "azure_ai_evaluator",
|
|
857
|
+
name: "violence_detection",
|
|
858
|
+
evaluator_name: "builtin.violence",
|
|
859
|
+
data_mapping: { query: "{{item.query}}", response: "{{item.response}}" },
|
|
860
|
+
} as any,
|
|
861
|
+
],
|
|
862
|
+
});
|
|
863
|
+
console.log(`Evaluation created (id: ${evalObject.id}, name: ${evalObject.name})`);
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
See the full sample code in [agentEvaluation.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples-dev/evaluations/agentEvaluation.ts).
|
|
867
|
+
|
|
735
868
|
### Deployments operations
|
|
736
869
|
|
|
737
870
|
The code below shows some Deployments operations, which allow you to enumerate the AI models deployed to your Microsoft Foundry Projects. These models can be seen in the "Models + endpoints" tab in your Microsoft Foundry Project. Full samples can be found under the "deployment" folder in the [package samples][samples].
|
|
@@ -884,7 +1017,7 @@ console.log("Get an existing Dataset version `1`:");
|
|
|
884
1017
|
const datasetVersion1 = await project.datasets.get(datasetName, VERSION1);
|
|
885
1018
|
console.log("Dataset version 1:", JSON.stringify(datasetVersion1, null, 2));
|
|
886
1019
|
console.log(`Listing all versions of the Dataset named '${datasetName}':`);
|
|
887
|
-
const datasetVersions =
|
|
1020
|
+
const datasetVersions = project.datasets.listVersions(datasetName);
|
|
888
1021
|
for await (const version of datasetVersions) {
|
|
889
1022
|
console.log("List versions:", version);
|
|
890
1023
|
}
|
|
@@ -977,12 +1110,83 @@ console.log("Delete the Index versions created above:");
|
|
|
977
1110
|
await project.indexes.delete(indexName, version);
|
|
978
1111
|
```
|
|
979
1112
|
|
|
1113
|
+
### Fine-tuning operations
|
|
1114
|
+
|
|
1115
|
+
The code below shows how to create fine-tuning jobs using the OpenAI client. These operations support various fine-tuning techniques like Supervised Fine-Tuning (SFT), Reinforcement Fine-Tuning (RFT), and Direct Performance Optimization (DPO). Full samples can be found under the "finetuning" folder in the [package samples][samples].
|
|
1116
|
+
|
|
1117
|
+
```ts snippet:finetuning
|
|
1118
|
+
import { JobCreateParams } from "openai/resources/fine-tuning/jobs";
|
|
1119
|
+
|
|
1120
|
+
const trainingFilePath = "training_data_path.jsonl";
|
|
1121
|
+
const validationFilePath = "validation_data_path.jsonl";
|
|
1122
|
+
const openAIClient = await project.getOpenAIClient();
|
|
1123
|
+
// 1) Create the training and validation files
|
|
1124
|
+
const trainingFile = await openAIClient.files.create({
|
|
1125
|
+
file: fs.createReadStream(trainingFilePath),
|
|
1126
|
+
purpose: "fine-tune",
|
|
1127
|
+
});
|
|
1128
|
+
console.log(`Uploaded file with ID: ${trainingFile.id}`);
|
|
1129
|
+
const validationFile = await openAIClient.files.create({
|
|
1130
|
+
file: fs.createReadStream(validationFilePath),
|
|
1131
|
+
purpose: "fine-tune",
|
|
1132
|
+
});
|
|
1133
|
+
console.log(`Uploaded file with ID: ${validationFile.id}`);
|
|
1134
|
+
// 2) Wait for the files to be processed
|
|
1135
|
+
await openAIClient.files.waitForProcessing(trainingFile.id);
|
|
1136
|
+
await openAIClient.files.waitForProcessing(validationFile.id);
|
|
1137
|
+
console.log("Files processed.");
|
|
1138
|
+
// 3) Create a supervised fine-tuning job
|
|
1139
|
+
const fineTuningJob = await openAIClient.fineTuning.jobs.create({} as JobCreateParams, {
|
|
1140
|
+
body: {
|
|
1141
|
+
trainingType: "Standard",
|
|
1142
|
+
training_file: trainingFile.id,
|
|
1143
|
+
validation_file: validationFile.id,
|
|
1144
|
+
model: deploymentName,
|
|
1145
|
+
method: {
|
|
1146
|
+
type: "supervised",
|
|
1147
|
+
supervised: {
|
|
1148
|
+
hyperparameters: {
|
|
1149
|
+
n_epochs: 3,
|
|
1150
|
+
batch_size: 1,
|
|
1151
|
+
learning_rate_multiplier: 1.0,
|
|
1152
|
+
},
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
},
|
|
1156
|
+
});
|
|
1157
|
+
console.log("Created fine-tuning job:\n", JSON.stringify(fineTuningJob));
|
|
1158
|
+
```
|
|
1159
|
+
|
|
980
1160
|
## Tracing
|
|
981
1161
|
|
|
982
1162
|
**Note:** Tracing functionality is in preliminary preview and is subject to change. Spans, attributes, and events may be modified in future versions.
|
|
983
1163
|
|
|
984
1164
|
You can add an Application Insights Azure resource to your Microsoft Foundry project. See the Tracing tab in your Microsoft Foundry project. If one was enabled, you can get the Application Insights connection string, configure your AI Projects client, and observe the full execution path through Azure Monitor. Typically, you might want to start tracing before you create a client or Agent.
|
|
985
1165
|
|
|
1166
|
+
### Installation
|
|
1167
|
+
|
|
1168
|
+
```bash
|
|
1169
|
+
npm install @azure/monitor-opentelemetry@^1.14.2 @opentelemetry/api@^1.9.0
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
### How to enable tracing
|
|
1173
|
+
|
|
1174
|
+
Here is a code sample that shows how to enable Azure Monitor tracing:
|
|
1175
|
+
|
|
1176
|
+
```ts snippet:tracing
|
|
1177
|
+
import { AzureMonitorOpenTelemetryOptions, useAzureMonitor } from "@azure/monitor-opentelemetry";
|
|
1178
|
+
|
|
1179
|
+
const TELEMETRY_CONNECTION_STRING = process.env["TELEMETRY_CONNECTION_STRING"];
|
|
1180
|
+
const options: AzureMonitorOpenTelemetryOptions = {
|
|
1181
|
+
azureMonitorExporterOptions: {
|
|
1182
|
+
connectionString: TELEMETRY_CONNECTION_STRING,
|
|
1183
|
+
},
|
|
1184
|
+
};
|
|
1185
|
+
useAzureMonitor(options);
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
See the full sample code in [remoteTelemetry.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples-dev/telemetry/remoteTelemetry.ts).
|
|
1189
|
+
|
|
986
1190
|
## Troubleshooting
|
|
987
1191
|
|
|
988
1192
|
### Exceptions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiProjectClient.d.ts","sourceRoot":"","sources":["../../src/aiProjectClient.ts"],"names":[],"mappings":"AAIA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAqC,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAwB,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAA6B,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,kBAAkB,EAA0B,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAA6B,MAAM,gCAAgC,CAAC;AAClG,OAAO,EACL,yBAAyB,EAE1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,8BAA8B,EAE/B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAA4B,MAAM,+BAA+B,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAyB,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAA0B,MAAM,6BAA6B,CAAC;AACzF,OAAO,EACL,sBAAs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perations } from "./classic/redTeams/index.js";
|
|
19
19
|
import { _getSchedulesOperations } from "./classic/schedules/index.js";
|
|
20
20
|
import { overwriteOpenAIClient } from "./overwriteOpenAIClient.js";
|
|
21
|
+
import { getCustomFetch } from "./getCustomFetch.js";
|
|
21
22
|
/**
|
|
22
23
|
* The main client for the AIProjectClient service. It provides access to the various operations available in the service.
|
|
23
24
|
* @class AIProjectClient
|
|
@@ -111,11 +112,16 @@ export class AIProjectClient {
|
|
|
111
112
|
async getOpenAIClient() {
|
|
112
113
|
const scope = "https://ai.azure.com/.default";
|
|
113
114
|
const azureADTokenProvider = await getBearerTokenProvider(this._credential, scope);
|
|
115
|
+
let customFetch;
|
|
116
|
+
if (this._options.additionalPolicies?.find((policy) => policy.policy.name === "recording policy")) {
|
|
117
|
+
customFetch = getCustomFetch(this._azureScopeClient.pipeline, this._options.httpClient);
|
|
118
|
+
}
|
|
114
119
|
const openAIOptions = {
|
|
115
120
|
apiKey: azureADTokenProvider,
|
|
116
121
|
baseURL: `${this._endpoint}/openai`,
|
|
117
122
|
defaultQuery: { "api-version": this._options?.apiVersion || "2025-11-15-preview" },
|
|
118
123
|
dangerouslyAllowBrowser: true,
|
|
124
|
+
fetch: customFetch,
|
|
119
125
|
};
|
|
120
126
|
const openaiClient = new OpenAI(openAIOptions);
|
|
121
127
|
return overwriteOpenAIClient(openaiClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiProjectClient.js","sourceRoot":"","sources":["../../src/aiProjectClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,iCAAiC;AAEjC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAmD,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAoB,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAyB,yBAAyB,EAAE,MAAM,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yright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable tsdoc/syntax */\n\nimport OpenAI from \"openai\";\nimport { getBearerTokenProvider } from \"@azure/identity\";\nimport { createAIProject, AIProjectContext, AIProjectClientOptionalParams } from \"./api/index.js\";\nimport { AgentsOperations, _getAgentsOperations } from \"./classic/agents/index.js\";\nimport { ConnectionsOperations, _getConnectionsOperations } from \"./classic/connections/index.js\";\nimport { DatasetsOperations, _getDatasetsOperations } from \"./classic/datasets/index.js\";\nimport { DeploymentsOperations, _getDeploymentsOperations } from \"./classic/deployments/index.js\";\nimport {\n EvaluationRulesOperations,\n _getEvaluationRulesOperations,\n} from \"./classic/evaluationRules/index.js\";\nimport {\n EvaluationTaxonomiesOperations,\n _getEvaluationTaxonomiesOperations,\n} from \"./classic/evaluationTaxonomies/index.js\";\nimport { EvaluatorsOperations, _getEvaluatorsOperations } from \"./classic/evaluators/index.js\";\nimport { IndexesOperations, _getIndexesOperations } from \"./classic/indexes/index.js\";\nimport { InsightsOperations, _getInsightsOperations } from \"./classic/insights/index.js\";\nimport {\n MemoryStoresOperations,\n _getMemoryStoresOperations,\n} from \"./classic/memoryStores/index.js\";\nimport { TelemetryOperations, _getTelemetryOperations } from \"./classic/telemetry/index.js\";\nimport { RedTeamsOperations, _getRedTeamsOperations } from \"./classic/redTeams/index.js\";\nimport { SchedulesOperations, _getSchedulesOperations } from \"./classic/schedules/index.js\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { overwriteOpenAIClient } from \"./overwriteOpenAIClient.js\";\n\nexport { AIProjectClientOptionalParams } from \"./api/aiProjectContext.js\";\n\n/**\n * The main client for the AIProjectClient service. It provides access to the various operations available in the service.\n * @class AIProjectClient\n * @extends {AIProjectContext}\n * @description The main client for the AIProjectClient\n * @constructor\n * @param {string} endpoint - The endpoint to use\n * @param {TokenCredential} credential - The credential to use\n * @param {AIProjectClientOptionalParams} [options] - Optional parameters for the client.\n * @property {RedTeamsOperations} redTeams - The operation groups for redTeams\n * @property {DeploymentsOperations} deployments - The operation groups for deployments\n * @property {IndexesOperations} indexes - The operation groups for indexes\n * @property {DatasetsOperations} datasets - The operation groups for datasets\n * @property {ConnectionsOperations} connections - The operation groups for connections\n * @property {MemoryStoresOperations} memoryStores - The operation groups for memoryStores\n * @property {AgentsOperations} agents - The operation groups for agents\n * @property {TelemetryOperations} telemetry - The operation groups for telemetry\n * @property {getEndpointUrl} getEndpointUrl - gets the endpoint of the client\n * @property {getOpenAIClient} getOpenAIClient - gets the OpenAI client\n */\nexport class AIProjectClient {\n private _cognitiveScopeClient: AIProjectContext;\n private _azureScopeClient: AIProjectContext;\n private _endpoint: string;\n private _credential: TokenCredential;\n private _options: AIProjectClientOptionalParams;\n\n constructor(\n endpoint: string,\n credential: TokenCredential,\n options: AIProjectClientOptionalParams = {},\n ) {\n this._endpoint = endpoint;\n this._credential = credential;\n this._options = options;\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._cognitiveScopeClient = createAIProject(endpoint, this._credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n credentials: {\n ...options.credentials,\n scopes: [\"https://ai.azure.com/.default\"],\n },\n });\n this._azureScopeClient = createAIProject(endpoint, credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n\n this.schedules = _getSchedulesOperations(this._cognitiveScopeClient);\n this.insights = _getInsightsOperations(this._cognitiveScopeClient);\n this.evaluators = _getEvaluatorsOperations(this._cognitiveScopeClient);\n this.evaluationTaxonomies = _getEvaluationTaxonomiesOperations(this._cognitiveScopeClient);\n this.evaluationRules = _getEvaluationRulesOperations(this._cognitiveScopeClient);\n this.redTeams = _getRedTeamsOperations(this._cognitiveScopeClient);\n this.deployments = _getDeploymentsOperations(this._azureScopeClient);\n this.indexes = _getIndexesOperations(this._azureScopeClient);\n this.datasets = _getDatasetsOperations(this._azureScopeClient, this._options);\n this.connections = _getConnectionsOperations(this._azureScopeClient);\n this.memoryStores = _getMemoryStoresOperations(this._cognitiveScopeClient);\n this.agents = _getAgentsOperations(this._azureScopeClient);\n this.telemetry = _getTelemetryOperations(this.connections);\n }\n\n /** The operation groups for schedules */\n public readonly schedules: SchedulesOperations;\n /** The operation groups for insights */\n public readonly insights: InsightsOperations;\n /** The operation groups for evaluators */\n public readonly evaluators: EvaluatorsOperations;\n /** The operation groups for evaluationTaxonomies */\n public readonly evaluationTaxonomies: EvaluationTaxonomiesOperations;\n /** The operation groups for evaluationRules */\n public readonly evaluationRules: EvaluationRulesOperations;\n /** The operation groups for redTeams */\n public readonly redTeams: RedTeamsOperations;\n /** The operation groups for deployments */\n public readonly deployments: DeploymentsOperations;\n /** The operation groups for indexes */\n public readonly indexes: IndexesOperations;\n /** The operation groups for datasets */\n public readonly datasets: DatasetsOperations;\n /** The operation groups for connections */\n public readonly connections: ConnectionsOperations;\n /** The operation groups for memoryStores */\n public readonly memoryStores: MemoryStoresOperations;\n /** The operation groups for agents */\n public readonly agents: AgentsOperations;\n /** The operation groups for telemetry */\n public readonly telemetry: TelemetryOperations;\n /**\n * gets the OpenAI client\n * @returns the OpenAI client\n */\n public async getOpenAIClient(): Promise<OpenAI> {\n const scope = \"https://ai.azure.com/.default\";\n const azureADTokenProvider = await getBearerTokenProvider(this._credential, scope);\n\n const openAIOptions: ConstructorParameters<typeof OpenAI>[0] = {\n apiKey: azureADTokenProvider,\n baseURL: `${this._endpoint}/openai`,\n defaultQuery: { \"api-version\": this._options?.apiVersion || \"2025-11-15-preview\" },\n dangerouslyAllowBrowser: true,\n };\n\n const openaiClient = new OpenAI(openAIOptions);\n return overwriteOpenAIClient(openaiClient);\n }\n /**\n * gets the endpoint of the client\n * @returns the endpoint of the client\n */\n public get endpoint(): string {\n return this._endpoint;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"aiProjectClient.js","sourceRoot":"","sources":["../../src/aiProjectClient.ts"],"names":[],"mappings":"AAAA,uCA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,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB,CAAC,EAC7F,CAAC;YACD,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC1F,CAAC;QAED,MAAM,aAAa,GAA4C;YAC7D,MAAM,EAAE,oBAAoB;YAC5B,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,SAAS;YACnC,YAAY,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,IAAI,oBAAoB,EAAE;YAClF,uBAAuB,EAAE,IAAI;YAC7B,KAAK,EAAE,WAAW;SACnB,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,CAAC;QAC/C,OAAO,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;IACD;;;OAGG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* eslint-disable tsdoc/syntax */\n\nimport OpenAI from \"openai\";\nimport { getBearerTokenProvider } from \"@azure/identity\";\nimport { createAIProject, AIProjectContext, AIProjectClientOptionalParams } from \"./api/index.js\";\nimport { AgentsOperations, _getAgentsOperations } from \"./classic/agents/index.js\";\nimport { ConnectionsOperations, _getConnectionsOperations } from \"./classic/connections/index.js\";\nimport { DatasetsOperations, _getDatasetsOperations } from \"./classic/datasets/index.js\";\nimport { DeploymentsOperations, _getDeploymentsOperations } from \"./classic/deployments/index.js\";\nimport {\n EvaluationRulesOperations,\n _getEvaluationRulesOperations,\n} from \"./classic/evaluationRules/index.js\";\nimport {\n EvaluationTaxonomiesOperations,\n _getEvaluationTaxonomiesOperations,\n} from \"./classic/evaluationTaxonomies/index.js\";\nimport { EvaluatorsOperations, _getEvaluatorsOperations } from \"./classic/evaluators/index.js\";\nimport { IndexesOperations, _getIndexesOperations } from \"./classic/indexes/index.js\";\nimport { InsightsOperations, _getInsightsOperations } from \"./classic/insights/index.js\";\nimport {\n MemoryStoresOperations,\n _getMemoryStoresOperations,\n} from \"./classic/memoryStores/index.js\";\nimport { TelemetryOperations, _getTelemetryOperations } from \"./classic/telemetry/index.js\";\nimport { RedTeamsOperations, _getRedTeamsOperations } from \"./classic/redTeams/index.js\";\nimport { SchedulesOperations, _getSchedulesOperations } from \"./classic/schedules/index.js\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { overwriteOpenAIClient } from \"./overwriteOpenAIClient.js\";\nimport { getCustomFetch } from \"./getCustomFetch.js\";\n\nexport { AIProjectClientOptionalParams } from \"./api/aiProjectContext.js\";\n\n/**\n * The main client for the AIProjectClient service. It provides access to the various operations available in the service.\n * @class AIProjectClient\n * @extends {AIProjectContext}\n * @description The main client for the AIProjectClient\n * @constructor\n * @param {string} endpoint - The endpoint to use\n * @param {TokenCredential} credential - The credential to use\n * @param {AIProjectClientOptionalParams} [options] - Optional parameters for the client.\n * @property {RedTeamsOperations} redTeams - The operation groups for redTeams\n * @property {DeploymentsOperations} deployments - The operation groups for deployments\n * @property {IndexesOperations} indexes - The operation groups for indexes\n * @property {DatasetsOperations} datasets - The operation groups for datasets\n * @property {ConnectionsOperations} connections - The operation groups for connections\n * @property {MemoryStoresOperations} memoryStores - The operation groups for memoryStores\n * @property {AgentsOperations} agents - The operation groups for agents\n * @property {TelemetryOperations} telemetry - The operation groups for telemetry\n * @property {getEndpointUrl} getEndpointUrl - gets the endpoint of the client\n * @property {getOpenAIClient} getOpenAIClient - gets the OpenAI client\n */\nexport class AIProjectClient {\n private _cognitiveScopeClient: AIProjectContext;\n private _azureScopeClient: AIProjectContext;\n private _endpoint: string;\n private _credential: TokenCredential;\n private _options: AIProjectClientOptionalParams;\n\n constructor(\n endpoint: string,\n credential: TokenCredential,\n options: AIProjectClientOptionalParams = {},\n ) {\n this._endpoint = endpoint;\n this._credential = credential;\n this._options = options;\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-client`\n : `azsdk-js-client`;\n this._cognitiveScopeClient = createAIProject(endpoint, this._credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n credentials: {\n ...options.credentials,\n scopes: [\"https://ai.azure.com/.default\"],\n },\n });\n this._azureScopeClient = createAIProject(endpoint, credential, {\n ...options,\n userAgentOptions: { userAgentPrefix },\n });\n\n this.schedules = _getSchedulesOperations(this._cognitiveScopeClient);\n this.insights = _getInsightsOperations(this._cognitiveScopeClient);\n this.evaluators = _getEvaluatorsOperations(this._cognitiveScopeClient);\n this.evaluationTaxonomies = _getEvaluationTaxonomiesOperations(this._cognitiveScopeClient);\n this.evaluationRules = _getEvaluationRulesOperations(this._cognitiveScopeClient);\n this.redTeams = _getRedTeamsOperations(this._cognitiveScopeClient);\n this.deployments = _getDeploymentsOperations(this._azureScopeClient);\n this.indexes = _getIndexesOperations(this._azureScopeClient);\n this.datasets = _getDatasetsOperations(this._azureScopeClient, this._options);\n this.connections = _getConnectionsOperations(this._azureScopeClient);\n this.memoryStores = _getMemoryStoresOperations(this._cognitiveScopeClient);\n this.agents = _getAgentsOperations(this._azureScopeClient);\n this.telemetry = _getTelemetryOperations(this.connections);\n }\n\n /** The operation groups for schedules */\n public readonly schedules: SchedulesOperations;\n /** The operation groups for insights */\n public readonly insights: InsightsOperations;\n /** The operation groups for evaluators */\n public readonly evaluators: EvaluatorsOperations;\n /** The operation groups for evaluationTaxonomies */\n public readonly evaluationTaxonomies: EvaluationTaxonomiesOperations;\n /** The operation groups for evaluationRules */\n public readonly evaluationRules: EvaluationRulesOperations;\n /** The operation groups for redTeams */\n public readonly redTeams: RedTeamsOperations;\n /** The operation groups for deployments */\n public readonly deployments: DeploymentsOperations;\n /** The operation groups for indexes */\n public readonly indexes: IndexesOperations;\n /** The operation groups for datasets */\n public readonly datasets: DatasetsOperations;\n /** The operation groups for connections */\n public readonly connections: ConnectionsOperations;\n /** The operation groups for memoryStores */\n public readonly memoryStores: MemoryStoresOperations;\n /** The operation groups for agents */\n public readonly agents: AgentsOperations;\n /** The operation groups for telemetry */\n public readonly telemetry: TelemetryOperations;\n /**\n * gets the OpenAI client\n * @returns the OpenAI client\n */\n public async getOpenAIClient(): Promise<OpenAI> {\n const scope = \"https://ai.azure.com/.default\";\n const azureADTokenProvider = await getBearerTokenProvider(this._credential, scope);\n let customFetch: NonNullable<ConstructorParameters<typeof OpenAI>[0]>[\"fetch\"];\n\n if (\n this._options.additionalPolicies?.find((policy) => policy.policy.name === \"recording policy\")\n ) {\n customFetch = getCustomFetch(this._azureScopeClient.pipeline, this._options.httpClient);\n }\n\n const openAIOptions: ConstructorParameters<typeof OpenAI>[0] = {\n apiKey: azureADTokenProvider,\n baseURL: `${this._endpoint}/openai`,\n defaultQuery: { \"api-version\": this._options?.apiVersion || \"2025-11-15-preview\" },\n dangerouslyAllowBrowser: true,\n fetch: customFetch,\n };\n\n const openaiClient = new OpenAI(openAIOptions);\n return overwriteOpenAIClient(openaiClient);\n }\n /**\n * gets the endpoint of the client\n * @returns the endpoint of the client\n */\n public get endpoint(): string {\n return this._endpoint;\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { getClient } from "@azure-rest/core-client";
|
|
|
6
6
|
export function createAIProject(endpoint, credential, options = {}) {
|
|
7
7
|
const endpointUrl = options.endpoint ?? String(endpoint);
|
|
8
8
|
const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;
|
|
9
|
-
const userAgentInfo = `azsdk-js-ai-projects/2.0.0-beta.
|
|
9
|
+
const userAgentInfo = `azsdk-js-ai-projects/2.0.0-beta.3`;
|
|
10
10
|
const userAgentPrefix = prefixFromOptions
|
|
11
11
|
? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`
|
|
12
12
|
: `azsdk-js-api ${userAgentInfo}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai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AC,SAAS,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAsB,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownApiVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface AIProjectContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownApiVersions} that the service accepts. */\n apiVersion: KnownApiVersions;\n}\n\n/** Optional parameters for the client. */\nexport interface AIProjectClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownApiVersions} that the service accepts. */\n apiVersion?: KnownApiVersions;\n}\n\nexport function createAIProject(\n endpoint: string,\n credential: TokenCredential,\n options: AIProjectClientOptionalParams = {},\n): AIProjectContext {\n const endpointUrl = options.endpoint ?? String(endpoint);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai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mBAAmB,CAAC;IAC9E,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC/B,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;gBACzC,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IACH,OAAO,EAAE,GAAG,aAAa,EAAE,UAAU,EAAsB,CAAC;AAC9D,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { logger } from \"../logger.js\";\nimport { KnownApiVersions } from \"../models/models.js\";\nimport { Client, ClientOptions, getClient } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface AIProjectContext extends Client {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownApiVersions} that the service accepts. */\n apiVersion: KnownApiVersions;\n}\n\n/** Optional parameters for the client. */\nexport interface AIProjectClientOptionalParams extends ClientOptions {\n /** The API version to use for this operation. */\n /** Known values of {@link KnownApiVersions} that the service accepts. */\n apiVersion?: KnownApiVersions;\n}\n\nexport function createAIProject(\n endpoint: string,\n credential: TokenCredential,\n options: AIProjectClientOptionalParams = {},\n): AIProjectContext {\n const endpointUrl = options.endpoint ?? String(endpoint);\n const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix;\n const userAgentInfo = `azsdk-js-ai-projects/2.0.0-beta.3`;\n const userAgentPrefix = prefixFromOptions\n ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}`\n : `azsdk-js-api ${userAgentInfo}`;\n const { apiVersion: _, ...updatedOptions } = {\n ...options,\n userAgentOptions: { userAgentPrefix },\n loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info },\n credentials: {\n scopes: options.credentials?.scopes ?? [\"https://ai.azure.com/.default\"],\n },\n };\n const clientContext = getClient(endpointUrl, credential, updatedOptions);\n clientContext.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n const apiVersion = options.apiVersion ?? KnownApiVersions.v2025_11_15_preview;\n clientContext.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\")) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n return { ...clientContext, apiVersion } as AIProjectContext;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Current version of the `@azure/ai-projects` package.\n */\nexport const SDK_VERSION = `2.0.0-beta.
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Current version of the `@azure/ai-projects` package.\n */\nexport const SDK_VERSION = `2.0.0-beta.3`;\n\n/**\n * The package name of the `@azure/ai-projects` package.\n */\nexport const PACKAGE_NAME = \"@azure/ai-projects\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCustomFetch-browser.d.mts","sourceRoot":"","sources":["../../src/getCustomFetch-browser.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAe,MAAM,2BAA2B,CAAC;AAOnF,KAAK,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,qBAAqB,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAE1F;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,CAAC,EAAE,UAAU,GAAG,OAAO,CA4BzF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCustomFetch-browser.mjs","sourceRoot":"","sources":["../../src/getCustomFetch-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAInC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,QAAkB,EAAE,gBAA6B;IAC9E,OAAO,KAAK,WAAW,QAAQ,EAAE,OAAO;QACtC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,UAAU,GAA2B,EAAE,CAAC;QAC9C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YAChD,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC1B,CAAC;QACD,MAAM,UAAU,GAAG,gBAAgB,IAAI,uBAAuB,EAAE,CAAC;QACjE,IAAI,OAAgC,CAAC;QACrC,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC;YACtB,OAAO,GAAG,MAAM,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7C,CAAC;QACD,MAAM,OAAO,GAAG,qBAAqB,CAAC;YACpC,GAAG,EAAE,YAAY,CAAC,GAAG;YACrB,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,iBAAiB,CAAC,UAAU,CAAC;YACtC,MAAM,EAAE,YAAY,CAAC,MAAqB;YAC1C,WAAW,EAAE,YAAY,CAAC,MAAM;YAChC,yBAAyB,EAAE,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAC9D,oBAAoB,EAAE,IAAI;SAC3B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,EAAE;YAC7D,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;SACzD,CAAC,CAAC;QACH,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type OpenAI from \"openai\";\nimport type { Pipeline, HttpClient, HttpMethods } from \"@azure/core-rest-pipeline\";\nimport {\n createDefaultHttpClient,\n createPipelineRequest,\n createHttpHeaders,\n} from \"@azure/core-rest-pipeline\";\n\ntype FetchFn = NonNullable<NonNullable<ConstructorParameters<typeof OpenAI>[0]>[\"fetch\"]>;\n\n/**\n * A custom `fetch` implementation that forwards requests to an Azure Core Pipeline.\n * This allows us to send traffic to the test proxy for recording and playback.\n * @param pipeline - The pipeline to use\n * @param customHttpClient - The http client to make requests with\n * @returns A fetch-compatible function.\n */\nexport function getCustomFetch(pipeline: Pipeline, customHttpClient?: HttpClient): FetchFn {\n return async function (resource, options): Promise<Response> {\n const fetchRequest = new Request(resource, options);\n const rawHeaders: Record<string, string> = {};\n for (const [key, value] of fetchRequest.headers) {\n rawHeaders[key] = value;\n }\n const httpClient = customHttpClient ?? createDefaultHttpClient();\n let rawBody: ArrayBuffer | undefined;\n if (fetchRequest.body) {\n rawBody = await fetchRequest.arrayBuffer();\n }\n const request = createPipelineRequest({\n url: fetchRequest.url,\n body: rawBody,\n headers: createHttpHeaders(rawHeaders),\n method: fetchRequest.method as HttpMethods,\n abortSignal: fetchRequest.signal,\n streamResponseStatusCodes: new Set([Number.POSITIVE_INFINITY]),\n enableBrowserStreams: true,\n });\n const response = await pipeline.sendRequest(httpClient, request);\n const fetchResponse = new Response(response.browserStreamBody, {\n status: response.status,\n headers: response.headers.toJSON({ preserveCase: true }),\n });\n return fetchResponse;\n };\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type OpenAI from "openai";
|
|
2
|
+
import type { Pipeline, HttpClient } from "@azure/core-rest-pipeline";
|
|
3
|
+
type FetchFn = NonNullable<NonNullable<ConstructorParameters<typeof OpenAI>[0]>["fetch"]>;
|
|
4
|
+
/**
|
|
5
|
+
* A custom `fetch` implementation that forwards requests to an Azure Core Pipeline.
|
|
6
|
+
* This allows us to send traffic to the test proxy for recording and playback.
|
|
7
|
+
* @param pipeline - The pipeline to use
|
|
8
|
+
* @param customHttpClient - The http client to make requests with
|
|
9
|
+
* @returns A fetch-compatible function.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCustomFetch(pipeline: Pipeline, customHttpClient?: HttpClient): FetchFn;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=getCustomFetch-browser.d.mts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
import { createDefaultHttpClient, createPipelineRequest, createHttpHeaders, } from "@azure/core-rest-pipeline";
|
|
4
|
+
/**
|
|
5
|
+
* A custom `fetch` implementation that forwards requests to an Azure Core Pipeline.
|
|
6
|
+
* This allows us to send traffic to the test proxy for recording and playback.
|
|
7
|
+
* @param pipeline - The pipeline to use
|
|
8
|
+
* @param customHttpClient - The http client to make requests with
|
|
9
|
+
* @returns A fetch-compatible function.
|
|
10
|
+
*/
|
|
11
|
+
export function getCustomFetch(pipeline, customHttpClient) {
|
|
12
|
+
return async function (resource, options) {
|
|
13
|
+
const fetchRequest = new Request(resource, options);
|
|
14
|
+
const rawHeaders = {};
|
|
15
|
+
for (const [key, value] of fetchRequest.headers) {
|
|
16
|
+
rawHeaders[key] = value;
|
|
17
|
+
}
|
|
18
|
+
const httpClient = customHttpClient ?? createDefaultHttpClient();
|
|
19
|
+
let rawBody;
|
|
20
|
+
if (fetchRequest.body) {
|
|
21
|
+
rawBody = await fetchRequest.arrayBuffer();
|
|
22
|
+
}
|
|
23
|
+
const request = createPipelineRequest({
|
|
24
|
+
url: fetchRequest.url,
|
|
25
|
+
body: rawBody,
|
|
26
|
+
headers: createHttpHeaders(rawHeaders),
|
|
27
|
+
method: fetchRequest.method,
|
|
28
|
+
abortSignal: fetchRequest.signal,
|
|
29
|
+
streamResponseStatusCodes: new Set([Number.POSITIVE_INFINITY]),
|
|
30
|
+
enableBrowserStreams: true,
|
|
31
|
+
});
|
|
32
|
+
const response = await pipeline.sendRequest(httpClient, request);
|
|
33
|
+
const fetchResponse = new Response(response.browserStreamBody, {
|
|
34
|
+
status: response.status,
|
|
35
|
+
headers: response.headers.toJSON({ preserveCase: true }),
|
|
36
|
+
});
|
|
37
|
+
return fetchResponse;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=getCustomFetch-browser.mjs.map
|
|
@@ -1056,7 +1056,7 @@ export interface ResponseTextFormatConfigurationJsonSchema extends ResponseTextF
|
|
|
1056
1056
|
*/
|
|
1057
1057
|
export interface ResponseFormatJsonSchemaSchema {
|
|
1058
1058
|
/** Additional properties */
|
|
1059
|
-
additionalProperties?:
|
|
1059
|
+
additionalProperties?: boolean;
|
|
1060
1060
|
}
|
|
1061
1061
|
export declare function responseFormatJsonSchemaSchemaSerializer(item: ResponseFormatJsonSchemaSchema): any;
|
|
1062
1062
|
export declare function responseFormatJsonSchemaSchemaDeserializer(item: any): ResponseFormatJsonSchemaSchema;
|
|
@@ -2784,17 +2784,17 @@ export interface EvaluatorVersion {
|
|
|
2784
2784
|
/** Definition of the evaluator */
|
|
2785
2785
|
definition: EvaluatorDefinitionUnion;
|
|
2786
2786
|
/** Creator of the evaluator */
|
|
2787
|
-
readonly created_by
|
|
2787
|
+
readonly created_by?: string;
|
|
2788
2788
|
/** Creation date/time of the evaluator */
|
|
2789
|
-
readonly created_at
|
|
2789
|
+
readonly created_at?: number;
|
|
2790
2790
|
/** Last modified date/time of the evaluator */
|
|
2791
|
-
readonly modified_at
|
|
2791
|
+
readonly modified_at?: number;
|
|
2792
2792
|
/** Asset ID, a unique identifier for the asset */
|
|
2793
2793
|
readonly id?: string;
|
|
2794
2794
|
/** The name of the resource */
|
|
2795
2795
|
readonly name: string;
|
|
2796
2796
|
/** The version of the resource */
|
|
2797
|
-
readonly version
|
|
2797
|
+
readonly version?: string;
|
|
2798
2798
|
/** The asset description text. */
|
|
2799
2799
|
description?: string;
|
|
2800
2800
|
/** Tag dictionary. Tags can be added, removed, and updated. */
|
|
@@ -2866,11 +2866,11 @@ export declare function promptBasedEvaluatorDefinitionDeserializer(item: any): P
|
|
|
2866
2866
|
/** The response body for cluster insights. */
|
|
2867
2867
|
export interface Insight {
|
|
2868
2868
|
/** The unique identifier for the insights report. */
|
|
2869
|
-
readonly id
|
|
2869
|
+
readonly id?: string;
|
|
2870
2870
|
/** Metadata about the insights report. */
|
|
2871
|
-
readonly metadata
|
|
2871
|
+
readonly metadata?: InsightsMetadata;
|
|
2872
2872
|
/** The current state of the insights. */
|
|
2873
|
-
readonly state
|
|
2873
|
+
readonly state?: OperationState;
|
|
2874
2874
|
/** User friendly display name for the insight. */
|
|
2875
2875
|
displayName: string;
|
|
2876
2876
|
/** Request for the insights analysis. */
|
|
@@ -3163,7 +3163,7 @@ export declare function insightArrayDeserializer(result: Array<Insight>): any[];
|
|
|
3163
3163
|
/** Schedule model. */
|
|
3164
3164
|
export interface Schedule {
|
|
3165
3165
|
/** Identifier of the schedule. */
|
|
3166
|
-
readonly id
|
|
3166
|
+
readonly id?: string;
|
|
3167
3167
|
/** Name of the schedule. */
|
|
3168
3168
|
displayName?: string;
|
|
3169
3169
|
/** Description of the schedule. */
|
|
@@ -3181,7 +3181,7 @@ export interface Schedule {
|
|
|
3181
3181
|
/** Schedule's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. */
|
|
3182
3182
|
properties?: Record<string, string>;
|
|
3183
3183
|
/** System metadata for the resource. */
|
|
3184
|
-
readonly systemData
|
|
3184
|
+
readonly systemData?: Record<string, string>;
|
|
3185
3185
|
}
|
|
3186
3186
|
export declare function scheduleSerializer(item: Schedule): any;
|
|
3187
3187
|
export declare function scheduleDeserializer(item: any): Schedule;
|