diff --git a/sdk/ai/ai-projects/CHANGELOG.md b/sdk/ai/ai-projects/CHANGELOG.md deleted file mode 100644 index 5ffc7436928f..000000000000 --- a/sdk/ai/ai-projects/CHANGELOG.md +++ /dev/null @@ -1,24 +0,0 @@ -# Release History - -## 1.0.0-beta.3 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - -## 1.0.0-beta.2 (2024-12-19) - -### Bugs Fixed - -- Address issue creating tool definition from connection. -- Improve Error handling api call failure. - -## 1.0.0-beta.1 (2024-12-19) - -### Features Added - -- This is the initial beta release for the Azure AI Projects SDK diff --git a/sdk/ai/ai-projects/LICENSE b/sdk/ai/ai-projects/LICENSE deleted file mode 100644 index b2f52a2bad4e..000000000000 --- a/sdk/ai/ai-projects/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/sdk/ai/ai-projects/README.md b/sdk/ai/ai-projects/README.md deleted file mode 100644 index 9dffed91f514..000000000000 --- a/sdk/ai/ai-projects/README.md +++ /dev/null @@ -1,725 +0,0 @@ -# Azure AI Projects client library for JavaScript - -Use the AI Projects client library (in preview) to: - -- **Enumerate connections** in your Azure AI Foundry project and get connection properties. - For example, get the inference endpoint URL and credentials associated with your Azure OpenAI connection. -- **Develop Agents using the Azure AI Agent Service**, leveraging an extensive ecosystem of models, tools, and capabilities from OpenAI, Microsoft, and other LLM providers. The Azure AI Agent Service enables the building of Agents for a wide range of generative AI use cases. The package is currently in private preview. -- **Enable OpenTelemetry tracing**. - -[Product documentation](https://aka.ms/azsdk/azure-ai-projects/product-doc) - - - - - -## Table of contents - -- [Getting started](#getting-started) - - [Prerequisite](#prerequisite) - - [Install the package](#install-the-package) -- [Key concepts](#key-concepts) - - [Create and authenticate the client](#create-and-authenticate-the-client) -- [Examples](#examples) - - [Enumerate connections](#enumerate-connections) - - [Get properties of all connections](#get-properties-of-all-connections) - - [Get properties of all connections of a particular type](#get-properties-of-all-connections-of-a-particular-type) - - [Get properties of a default connection](#get-properties-of-a-default-connection) - - [Get properties of a connection by its connection name](#get-properties-of-a-connection-by-its-connection-name) - - [Agents (Preview)](#agents-private-preview) - - [Create an Agent](#create-agent) with: - - [File Search](#create-agent-with-file-search) - - [Code interpreter](#create-agent-with-code-interpreter) - - [Bing grounding](#create-agent-with-bing-grounding) - - [Azure AI Search](#create-agent-with-azure-ai-search) - - [Function call](#create-agent-with-function-call) - - [Create thread](#create-thread) with - - [Tool resource](#create-thread-with-tool-resource) - - [Create message](#create-message) with: - - [File search attachment](#create-message-with-file-search-attachment) - - [Code interpreter attachment](#create-message-with-code-interpreter-attachment) - - [Execute Run, Create Thread and Run, or Stream](#create-run-run_and_process-or-stream) - - [Retrieve message](#retrieve-message) - - [Retrieve file](#retrieve-file) - - [Tear down by deleting resource](#teardown) - - [Tracing](#tracing) - - [Tracing](#tracing) - - [Installation](#installation) - - [Tracing example](#tracing-example) -- [Troubleshooting](#troubleshooting) - - [Exceptions](#exceptions) - - [Reporting issues](#reporting-issues) - -- [Contributing](#contributing) - -## Getting started - -### Prerequisite - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- An [Azure subscription][azure_sub]. -- A [project in Azure AI Foundry](https://learn.microsoft.com/azure/ai-studio/how-to/create-projects?tabs=ai-studio). -- The project connection string. It can be found in your Azure AI Foundry project overview page, under "Project details". Below we will assume the environment variable `AZURE_AI_PROJECTS_CONNECTION_STRING` was defined to hold this value. -- 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](https://learn.microsoft.com/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest). To get that working, you will need: - - The `Contributor` role. Role assigned can be done via the "Access Control (IAM)" tab of your Azure AI Project resource in the Azure portal. - - [Azure CLI](https://learn.microsoft.com/cli/azure/install-azure-cli) installed. - - You are logged into your Azure account by running `az login`. - - 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. - -### Install the package - -```bash -npm install @azure/ai-projects @azure/identity -``` - -## Key concepts - -### Create and authenticate the client - -The class factory method `fromConnectionString` is used to construct the client. To construct a client: - -```javascript -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import "dotenv/config"; - -const connectionString = process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -const client = AIProjectsClient.fromConnectionString( - connectionString, - new DefaultAzureCredential(), -); -``` - -## Examples - -### Enumerate connections - -Your Azure AI Foundry project has a "Management center". When you enter it, you will see a tab named "Connected resources" under your project. The `.connections` operations on the client allow you to enumerate the connections and get connection properties. Connection properties include the resource URL and authentication credentials, among other things. - -Below are code examples of the connection operations. Full samples can be found under the "connections" folder in the [package samples][samples]. - -#### Get properties of all connections - -To list the properties of all the connections in the Azure AI Foundry project: - -```javascript -const connections = await client.connections.listConnections(); -for (const connection of connections) { - console.log(connection); -} -``` - -#### Get properties of all connections of a particular type - -To list the properties of connections of a certain type (here Azure OpenAI): - -```javascript -const connections = await client.connections.listConnections({ category: "AzureOpenAI" }); -for (const connection of connections) { - console.log(connection); -} -``` - -#### Get properties of a connection by its connection name - -To get the connection properties of a connection named `connectionName`: - -```javascript -const connection = await client.connections.getConnection("connectionName"); -console.log(connection); -``` - -To get the connection properties with its authentication credentials: - -```javascript -const connection = await client.connections.getConnectionWithSecrets("connectionName"); -console.log(connection); -``` - -### Agents (Preview) - -Agents in the Azure AI Projects client library are designed to facilitate various interactions and operations within your AI projects. They serve as the core components that manage and execute tasks, leveraging different tools and resources to achieve specific goals. The following steps outline the typical sequence for interacting with Agents. See the "agents" folder in the [package samples][samples] for additional Agent samples. - -Agents are actively being developed. A sign-up form for private preview is coming soon. - -#### Create Agent - -Here is an example of how to create an Agent: - -```javascript -const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful assistant", -}); -``` - -To allow Agents to access your resources or custom functions, you need tools. You can pass tools to `createAgent` through the `tools` and `toolResources` arguments. - -You can use `ToolSet` to do this: - -```javascript -const toolSet = new ToolSet(); -toolSet.addFileSearchTool([vectorStore.id]); -toolSet.addCodeInterpreterTool([codeInterpreterFile.id]); - -// Create agent with tool set -const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: toolSet.toolDefinitions, - toolResources: toolSet.toolResources, -}); -console.log(`Created agent, agent ID: ${agent.id}`); -``` - -#### Create Agent with File Search - -To perform file search by an Agent, we first need to upload a file, create a vector store, and associate the file to the vector store. Here is an example: - -```javascript -const localFileStream = fs.createReadStream("sample_file_for_upload.txt"); -const file = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "sample_file_for_upload.txt", -}); -console.log(`Uploaded file, ID: ${file.id}`); - -const vectorStore = await client.agents.createVectorStore({ - fileIds: [file.id], - name: "my_vector_store", -}); -console.log(`Created vector store, ID: ${vectorStore.id}`); - -const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]); - -const agent = await client.agents.createAgent("gpt-4o", { - name: "SDK Test Agent - Retrieval", - instructions: "You are helpful agent that can help fetch data from files you know about.", - tools: [fileSearchTool.definition], - toolResources: fileSearchTool.resources, -}); -console.log(`Created agent, agent ID : ${agent.id}`); -``` - -#### Create Agent with Code Interpreter - -Here is an example to upload a file and use it for code interpreter by an Agent: - -```javascript -const fileStream = fs.createReadStream("nifty_500_quarterly_results.csv"); -const fFile = await client.agents.uploadFile(fileStream, "assistants", { - fileName: "nifty_500_quarterly_results.csv", -}); -console.log(`Uploaded local file, file ID : ${file.id}`); - -const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([file.id]); - -// Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment -const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, -}); -console.log(`Created agent, agent ID: ${agent.id}`); -``` - -#### Create Agent with Bing Grounding - -To enable your Agent to perform search through Bing search API, you use `ToolUtility.createConnectionTool()` along with a connection. - -Here is an example: - -```javascript -const bingGroundingConnectionId = ""; -const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - bingGroundingConnectionId, -]); - -const agent = await client.agents.createAgent("gpt-4-0125-preview", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], -}); -console.log(`Created agent, agent ID : ${agent.id}`); -``` - -#### Create Agent with Azure AI Search - -Azure AI Search is an enterprise search system for high-performance applications. It integrates with Azure OpenAI Service and Azure Machine Learning, offering advanced search technologies like vector search and full-text search. Ideal for knowledge base insights, information discovery, and automation - -Here is an example to integrate Azure AI Search: - -```javascript -const cognitiveServicesConnectionName = ""; -const cognitiveServicesConnection = await client.connections.getConnection( - cognitiveServicesConnectionName, -); -const azureAISearchTool = ToolUtility.createAzureAISearchTool( - cognitiveServicesConnection.id, - cognitiveServicesConnection.name, -); - -// Create agent with the Azure AI search tool -const agent = await client.agents.createAgent("gpt-4-0125-preview", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [azureAISearchTool.definition], - toolResources: azureAISearchTool.resources, -}); -console.log(`Created agent, agent ID : ${agent.id}`); -``` - -#### Create Agent with Function Call - -You can enhance your Agents by defining callback functions as function tools. These can be provided to `createAgent` via the combination of `tools` and `toolResources`. Only the function definitions and descriptions are provided to `createAgent`, without the implementations. The `Run` or `event handler of stream` will raise a `requires_action` status based on the function definitions. Your code must handle this status and call the appropriate functions. - -Here is an example: - -```javascript -class FunctionToolExecutor { - private functionTools: { func: Function, definition: FunctionToolDefinition }[]; - - constructor() { - this.functionTools = [{ - func: this.getUserFavoriteCity, - ...ToolUtility.createFunctionTool({ - name: "getUserFavoriteCity", - description: "Gets the user's favorite city.", - parameters: {} - }) - }, { - func: this.getCityNickname, - ...ToolUtility.createFunctionTool({ - name: "getCityNickname", - description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.", - parameters: { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. Seattle, Wa" } } } - }) - }, { - func: this.getWeather, - ...ToolUtility.createFunctionTool({ - name: "getWeather", - description: "Gets the weather for a location.", - parameters: { type: "object", properties: { location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, unit: { type: "string", enum: ['c', 'f'] } } } - }) - }]; - } - - private getUserFavoriteCity(): {} { - return { "location": "Seattle, WA" }; - } - - private getCityNickname(location: string): {} { - return { "nickname": "The Emerald City" }; - } - - private getWeather(location: string, unit: string): {} { - return { "weather": unit === "f" ? "72f" : "22c" }; - } - - public invokeTool(toolCall: RequiredToolCallOutput & FunctionToolDefinitionOutput): ToolOutput | undefined { - console.log(`Function tool call - ${toolCall.function.name}`); - const args = []; - if (toolCall.function.parameters) { - try { - const params = JSON.parse(toolCall.function.parameters); - for (const key in params) { - if (Object.prototype.hasOwnProperty.call(params, key)) { - args.push(params[key]); - } - } - } catch (error) { - console.error(`Failed to parse parameters: ${toolCall.function.parameters}`, error); - return undefined; - } - } - const result = this.functionTools.find((tool) => tool.definition.function.name === toolCall.function.name)?.func(...args); - return result ? { - toolCallId: toolCall.id, - output: JSON.stringify(result) - } : undefined; - } - - public getFunctionDefinitions(): FunctionToolDefinition[] { - return this.functionTools.map(tool => {return tool.definition}); - } -} - -const functionToolExecutor = new FunctionToolExecutor(); -const functionTools = functionToolExecutor.getFunctionDefinitions(); -const agent = await client.agents.createAgent("gpt-4o", - { - name: "my-agent", - instructions: "You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.", - tools: functionTools - }); -console.log(`Created agent, agent ID: ${agent.id}`); -``` - -#### Create Thread - -For each session or conversation, a thread is required. Here is an example: - -```javascript -const thread = await client.agents.createThread(); -``` - -#### Create Thread with Tool Resource - -In some scenarios, you might need to assign specific resources to individual threads. To achieve this, you provide the `toolResources` argument to `createThread`. In the following example, you create a vector store and upload a file, enable an Agent for file search using the `tools` argument, and then associate the file with the thread using the `toolResources` argument. - -```javascript -const localFileStream = fs.createReadStream("sample_file_for_upload.txt"); -const file = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "sample_file_for_upload.txt", -}); -console.log(`Uploaded file, ID: ${file.id}`); - -const vectorStore = await client.agents.createVectorStore({ - fileIds: [file.id], - name: "my_vector_store", -}); -console.log(`Created vector store, ID: ${vectorStore.id}`); - -const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]); - -const agent = await client.agents.createAgent("gpt-4o", { - name: "SDK Test Agent - Retrieval", - instructions: "You are helpful agent that can help fetch data from files you know about.", - tools: [fileSearchTool.definition], -}); -console.log(`Created agent, agent ID : ${agent.id}`); - -// Create thread with file resources. -// If the agent has multiple threads, only this thread can search this file. -const thread = await client.agents.createThread({ toolResources: fileSearchTool.resources }); -``` - -#### Create Message - -To create a message for assistant to process, you pass `user` as `role` and a question as `content`: - -```javascript -const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", -}); -``` - -#### Create Message with File Search Attachment - -To attach a file to a message for content searching, you use `ToolUtility.createFileSearchTool()` and the `attachments` argument: - -```javascript -const fileSearchTool = ToolUtility.createFileSearchTool(); -const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "What feature does Smart Eyewear offer?", - attachments: { - fileId: file.id, - tools: [fileSearchTool.definition], - }, -}); -``` - -#### Create Message with Code Interpreter Attachment - -To attach a file to a message for data analysis, you use `ToolUtility.createCodeInterpreterTool()` and the `attachment` argument. - -Here is an example: - -```javascript -// notice that CodeInterpreter must be enabled in the agent creation, -// otherwise the agent will not be able to see the file attachment for code interpretation -const codeInterpreterTool = ToolUtility.createCodeInterpreterTool(); -const agent = await client.agents.createAgent("gpt-4-1106-preview", { - name: "my-assistant", - instructions: "You are helpful assistant", - tools: [codeInterpreterTool.definition], -}); -console.log(`Created agent, agent ID: ${agent.id}`); - -const thread = await client.agents.createThread(); -console.log(`Created thread, thread ID: ${thread.id}`); - -const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create bar chart in TRANSPORTATION sector for the operating profit from the uploaded csv file and provide file to me?", - attachments: { - fileId: file.id, - tools: [codeInterpreterTool.definition], - }, -}); -console.log(`Created message, message ID: ${message.id}`); -``` - -#### Create Run, Run_and_Process, or Stream - -Here is an example of `createRun` and poll until the run is completed: - -```javascript -let run = await client.agents.createRun(thread.id, agent.id); - -// Poll the run as long as run status is queued or in progress -while ( - run.status === "queued" || - run.status === "in_progress" || - run.status === "requires_action" -) { - // Wait for a second - await new Promise((resolve) => setTimeout(resolve, 1000)); - run = await client.agents.getRun(thread.id, run.id); -} -``` - -To have the SDK poll on your behalf, use the `createThreadAndRun` method. - -Here is an example: - -```javascript -const run = await client.agents.createThreadAndRun(agent.id, { - thread: { - messages: [ - { - role: "user", - content: "hello, world!" - } - ] - } -}); -``` - -With streaming, polling also need not be considered. - -Here is an example: - -```javascript -const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); -``` - -Event handling can be done as follows: - -```javascript -for await (const eventMessage of streamEventMessages) { -switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`) - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent - const textValue = textContent.text?.value || "No text" - console.log(`Text delta received:: ${textValue}`) - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } -} -``` - -#### Retrieve Message - -To retrieve messages from agents, use the following example: - -```javascript -const messages = await client.agents.listMessages(thread.id); -while (messages.hasMore) { - const nextMessages = await client.agents.listMessages(currentRun.threadId, { after: messages.lastId }); - messages.data = messages.data.concat(nextMessages.data); - messages.hasMore = nextMessages.hasMore; - messages.lastId = nextMessages.lastId; -} - -// The messages are following in the reverse order, -// we will iterate them and output only text contents. -for (const dataPoint of messages.data.reverse()) { - const lastMessageContent: MessageContentOutput = dataPoint.content[dataPoint.content.length - 1]; - console.log( lastMessageContent); - if (isOutputOfType(lastMessageContent, "text")) { - console.log(`${dataPoint.role}: ${(lastMessageContent as MessageTextContentOutput).text.value}`); - } - } -``` - -### Retrieve File - -Files uploaded by Agents cannot be retrieved back. If your use case needs to access the file content uploaded by the Agents, you are advised to keep an additional copy accessible by your application. However, files generated by Agents are retrievable by `getFileContent`. - -Here is an example retrieving file ids from messages: - -```javascript -const messages = await client.agents.listMessages(thread.id); -const imageFile = (messages.data[0].content[0] as MessageImageFileContentOutput).imageFile; -const imageFileName = (await client.agents.getFile(imageFile.fileId)).filename; - -const fileContent = await (await client.agents.getFileContent(imageFile.fileId).asNodeStream()).body; -if (fileContent) { - const chunks: Buffer[] = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); -} else { - console.error("Failed to retrieve file content: fileContent is undefined"); -} -console.log(`Saved image file to: ${imageFileName}`); -``` - -#### Teardown - -To remove resources after completing tasks, use the following functions: - -```javascript -await client.agents.deleteVectorStore(vectorStore.id); -console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - -await client.agents.deleteFile(file.id); -console.log(`Deleted file, file ID: ${file.id}`); - -client.agents.deleteAgent(agent.id); -console.log(`Deleted agent, agent ID: ${agent.id}`); -``` - -### Tracing - -You can add an Application Insights Azure resource to your Azure AI Foundry project. See the Tracing tab in your studio. If one was enabled, you can get the Application Insights connection string, configure your Agents, and observe the full execution path through Azure Monitor. Typically, you might want to start tracing before you create an Agent. - -#### Installation - -Make sure to install OpenTelemetry and the Azure SDK tracing plugin via - -```bash -npm install @opentelemetry/api \ - @opentelemetry/instrumentation \ - @opentelemetry/sdk-trace-node \ - @azure/opentelemetry-instrumentation-azure-sdk \ - @azure/monitor-opentelemetry-exporter -``` - -You will also need an exporter to send telemetry to your observability backend. You can print traces to the console or use a local viewer such as [Aspire Dashboard](https://learn.microsoft.com/dotnet/aspire/fundamentals/dashboard/standalone?tabs=bash). - -To connect to Aspire Dashboard or another OpenTelemetry compatible backend, install OTLP exporter: - -```bash -npm install @opentelemetry/exporter-trace-otlp-proto \ - @opentelemetry/exporter-metrics-otlp-proto -``` - -#### Tracing example - -Here is a code sample to be included above `createAgent`: - -```javascript -import { trace } from "@opentelemetry/api"; -import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter" -import { - ConsoleSpanExporter, - NodeTracerProvider, - SimpleSpanProcessor, -} from "@opentelemetry/sdk-trace-node"; - -const provider = new NodeTracerProvider(); -provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -provider.register(); - -const tracer = trace.getTracer("Agents Sample", "1.0.0"); - -const client = AIProjectsClient.fromConnectionString( - connectionString || "", new DefaultAzureCredential() -); - -if (!appInsightsConnectionString) { - appInsightsConnectionString = await client.telemetry.getConnectionString(); -} - -if (appInsightsConnectionString) { - const exporter = new AzureMonitorTraceExporter({ - connectionString: appInsightsConnectionString - }); - provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); -} - -await tracer.startActiveSpan("main", async (span) => { - client.telemetry.updateSettings({enableContentRecording: true}) -// ... -``` - -## Troubleshooting - -### Exceptions - -Client methods that make service calls raise an [RestError](https://learn.microsoft.com/javascript/api/%40azure/core-rest-pipeline/resterror) for a non-success HTTP status code response from the service. The exception's `code` will hold the HTTP response status code. The exception's `error.message` contains a detailed message that may be helpful in diagnosing the issue: - -```javascript -import { RestError } from "@azure/core-rest-pipeline" - -// ... - -try { - const result = await client.connections.listConnections(); -} catch (e as RestError) { - console.log(`Status code: ${e.code}`); - console.log(e.message); -} -``` - -For example, when you provide wrong credentials: - -```text -Status code: 401 (Unauthorized) -Operation returned an invalid status 'Unauthorized' -``` - -### Reporting issues - -To report issues with the client library, or request additional features, please open a GitHub issue [here](https://github.com/Azure/azure-sdk-for-js/issues) - - - -## Contributing - -This project welcomes contributions and suggestions. Most contributions require -you to agree to a Contributor License Agreement (CLA) declaring that you have -the right to, and actually do, grant us the rights to use your contribution. -For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether -you need to provide a CLA and decorate the PR appropriately (e.g., label, -comment). Simply follow the instructions provided by the bot. You will only -need to do this once across all repos using our CLA. - -This project has adopted the -[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, -see the Code of Conduct FAQ or contact opencode@microsoft.com with any -additional questions or comments. - - - - - -[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ -[entra_id]: https://learn.microsoft.com/azure/ai-services/authentication?tabs=powershell#authenticate-with-microsoft-entra-id -[azure_identity_npm]: https://www.npmjs.com/package/@azure/identity -[default_azure_credential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential -[azure_sub]: https://azure.microsoft.com/free/ -[evaluators]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk -[evaluator_library]: https://learn.microsoft.com/azure/ai-studio/how-to/evaluate-generative-ai-app#view-and-manage-the-evaluators-in-the-evaluator-library diff --git a/sdk/ai/ai-projects/api-extractor.json b/sdk/ai/ai-projects/api-extractor.json deleted file mode 100644 index d61912ac5bee..000000000000 --- a/sdk/ai/ai-projects/api-extractor.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist/esm/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/ai-projects.d.ts" - }, - "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, - "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } - } - } -} diff --git a/sdk/ai/ai-projects/assets.json b/sdk/ai/ai-projects/assets.json deleted file mode 100644 index b5a4c55a1121..000000000000 --- a/sdk/ai/ai-projects/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/ai/ai-projects", - "Tag": "js/ai/ai-projects_5619a8d024" -} diff --git a/sdk/ai/ai-projects/eslint.config.mjs b/sdk/ai/ai-projects/eslint.config.mjs deleted file mode 100644 index 52be04401c47..000000000000 --- a/sdk/ai/ai-projects/eslint.config.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; - -export default azsdkEslint.config([ - { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - }, - }, - { - files: ["**/*.ts", "**/*.cts", "**/*.mts"], - languageOptions: { - parserOptions: { - project: ["./tsconfig.test.json"], - }, - }, - }, -]); diff --git a/sdk/ai/ai-projects/package.json b/sdk/ai/ai-projects/package.json deleted file mode 100644 index 7311d72edb4e..000000000000 --- a/sdk/ai/ai-projects/package.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "name": "@azure/ai-projects", - "version": "1.0.0-beta.3", - "description": "A generated SDK for ProjectsClient.", - "engines": { - "node": ">=18.0.0" - }, - "sideEffects": false, - "autoPublish": false, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts" - }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], - "selfLink": false, - "project": "./tsconfig.src.json" - }, - "type": "module", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "files": [ - "dist", - "README.md", - "LICENSE" - ], - "sdk-type": "client", - "repository": "github:Azure/azure-sdk-for-js", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", - "//metadata": { - "constantPaths": [ - { - "path": "src/generated/src/projectsClient.ts", - "prefix": "userAgentInfo" - }, - { - "path": "src/constants.ts", - "prefix": "SDK_VERSION" - } - ] - }, - "dependencies": { - "@azure-rest/core-client": "^2.1.0", - "@azure/abort-controller": "^2.1.2", - "@azure/core-auth": "^1.6.0", - "@azure/core-rest-pipeline": "^1.5.0", - "@azure/core-util": "^1.9.0", - "@azure/logger": "^1.1.4", - "@azure/core-lro": "^2.0.0", - "tslib": "^2.6.2", - "@azure/core-paging": "^1.5.0", - "@azure/core-sse": "^2.1.3", - "@azure/core-tracing": "^1.2.0" - }, - "devDependencies": { - "@azure/dev-tool": "^1.0.0", - "@azure/eslint-plugin-azure-sdk": "^3.0.0", - "@azure/identity": "^4.3.0", - "@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.7", - "@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.28", - "@azure-tools/test-credential": "^2.0.0", - "@azure-tools/test-recorder": "^4.1.0", - "@azure-tools/test-utils-vitest": "^1.0.0", - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/instrumentation": "0.57.0", - "@opentelemetry/sdk-trace-node": "^1.30.0", - "@vitest/browser": "^3.0.3", - "@vitest/coverage-istanbul": "^3.0.3", - "@types/node": "^18.0.0", - "dotenv": "^16.0.0", - "eslint": "^9.9.0", - "prettier": "^3.2.5", - "playwright": "^1.41.2", - "typescript": "~5.7.2", - "vitest": "^3.0.3" - }, - "scripts": { - "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api", - "build:samples": "echo skipped", - "build:test": "npm run clean && dev-tool run build-package && dev-tool run build-test", - "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", - "clean": "dev-tool run vendored rimraf --glob dist dist-* test-dist temp types *.tgz *.log", - "execute:samples": "dev-tool samples run samples-dev", - "extract-api": "dev-tool run vendored rimraf review && dev-tool run extract-api", - "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"samples-dev/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ", - "generate": "dev-tool run vendored rimraf ./src/generated && dev-tool run vendored mkdirp ./src/generated && cp tsp-location.yaml ./src/generated && tsp-client update -o ./src/generated && dev-tool run vendored rimraf ./src/generated/tsp-location.yaml", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "npm run unit-test:browser --no-test-proxy", - "integration-test:node": "npm run unit-test:node --no-test-proxy", - "lint": "eslint package.json api-extractor.json src test", - "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]", - "pack": "npm pack 2>&1", - "test": "npm run clean && dev-tool run build-package && npm run unit-test:node && dev-tool run bundle && npm run unit-test:browser && npm run integration-test", - "test:browser": "npm run clean && npm run unit-test:browser && npm run integration-test:browser", - "test:node": "npm run clean && dev-tool run build-package && npm run unit-test:node && npm run integration-test:node", - "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "npm run build:test && dev-tool run test:vitest --browser", - "unit-test:node": "dev-tool run test:vitest" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - } - }, - "//sampleConfiguration": { - "productName": "Azure AI Projects", - "productSlugs": [ - "azure" - ], - "extraFiles": { - "./samples-dev/data": [ - "javascript/data", - "typescript/src/data" - ] - }, - "apiRefLink": "https://learn.microsoft.com/javascript/api/@azure/ai-projects" - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "module": "./dist/esm/index.js" -} diff --git a/sdk/ai/ai-projects/review/ai-projects.api.md b/sdk/ai/ai-projects/review/ai-projects.api.md deleted file mode 100644 index 1a46e7081b97..000000000000 --- a/sdk/ai/ai-projects/review/ai-projects.api.md +++ /dev/null @@ -1,1970 +0,0 @@ -## API Report File for "@azure/ai-projects" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import type { AbortSignalLike } from '@azure/abort-controller'; -import { ClientOptions } from '@azure-rest/core-client'; -import type { OperationOptions } from '@azure-rest/core-client'; -import type { PollerLike } from '@azure/core-lro'; -import type { PollOperationState } from '@azure/core-lro'; -import { StreamableMethod } from '@azure-rest/core-client'; -import type { TokenCredential } from '@azure/core-auth'; - -// @public -export interface AgentDeletionStatusOutput { - deleted: boolean; - id: string; - object: "assistant.deleted"; -} - -// @public -export interface AgentEventMessage { - data: AgentEventStreamDataOutput; - event: AgentStreamEventType | string; -} - -// @public -export interface AgentEventMessageStream extends AsyncDisposable, AsyncIterable { -} - -// @public -export type AgentEventStreamDataOutput = AgentThreadOutput | ThreadRunOutput | RunStepOutput | ThreadMessageOutput | MessageDeltaChunk | RunStepDeltaChunk | string; - -// @public -export interface AgentOutput { - createdAt: Date; - description: string | null; - id: string; - instructions: string | null; - metadata: Record | null; - model: string; - name: string | null; - object: "assistant"; - responseFormat?: AgentsApiResponseFormatOptionOutput | null; - temperature: number | null; - toolResources: ToolResourcesOutput | null; - tools: Array; - topP: number | null; -} - -// @public -export type AgentRunResponse = PromiseLike & { - stream: () => Promise; -}; - -// @public -export interface AgentsApiResponseFormat { - type?: ApiResponseFormat; -} - -// @public -export type AgentsApiResponseFormatMode = string; - -// @public -export type AgentsApiResponseFormatModeOutput = string; - -// @public -export type AgentsApiResponseFormatOption = string | AgentsApiResponseFormatMode | AgentsApiResponseFormat; - -// @public -export type AgentsApiResponseFormatOptionOutput = string | AgentsApiResponseFormatModeOutput | AgentsApiResponseFormatOutput; - -// @public -export interface AgentsApiResponseFormatOutput { - type?: ApiResponseFormatOutput; -} - -// @public -export type AgentsApiToolChoiceOption = string | AgentsApiToolChoiceOptionMode | AgentsNamedToolChoice; - -// @public -export type AgentsApiToolChoiceOptionMode = string; - -// @public -export type AgentsApiToolChoiceOptionModeOutput = string; - -// @public -export type AgentsApiToolChoiceOptionOutput = string | AgentsApiToolChoiceOptionModeOutput | AgentsNamedToolChoiceOutput; - -// @public -export interface AgentsNamedToolChoice { - function?: FunctionName; - type: AgentsNamedToolChoiceType; -} - -// @public -export interface AgentsNamedToolChoiceOutput { - function?: FunctionNameOutput; - type: AgentsNamedToolChoiceTypeOutput; -} - -// @public -export type AgentsNamedToolChoiceType = string; - -// @public -export type AgentsNamedToolChoiceTypeOutput = string; - -// @public -export interface AgentsOperations { - cancelRun: (threadId: string, runId: string, options?: CancelRunOptionalParams) => Promise; - cancelVectorStoreFileBatch: (vectorStoreId: string, batchId: string, options?: CancelVectorStoreFileBatchOptionalParams) => Promise; - createAgent: (model: string, options?: CreateAgentOptionalParams) => Promise; - createMessage: (threadId: string, messageOptions: ThreadMessageOptions, options?: CreateMessageOptionalParams) => Promise; - createRun: (threadId: string, assistantId: string, options?: CreateRunOptionalParams) => AgentRunResponse; - createThread: (options?: CreateAgentThreadOptionalParams) => Promise; - createThreadAndRun: (assistantId: string, options?: CreateAndRunThreadOptionalParams) => AgentRunResponse; - createVectorStore: (options?: CreateVectorStoreOptionalParams) => Promise; - createVectorStoreAndPoll: (options?: CreateVectorStoreWithPollingOptionalParams) => PollerLike, VectorStoreOutput>; - createVectorStoreFile: (vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams) => Promise; - createVectorStoreFileAndPoll: (vectorStoreId: string, options?: CreateVectorStoreFileWithPollingOptionalParams) => PollerLike, VectorStoreFileOutput>; - createVectorStoreFileBatch: (vectorStoreId: string, options?: CreateVectorStoreFileBatchOptionalParams) => Promise; - createVectorStoreFileBatchAndPoll: (vectorStoreId: string, options?: CreateVectorStoreFileBatchWithPollingOptionalParams) => PollerLike, VectorStoreFileBatchOutput>; - deleteAgent: (assistantId: string, options?: DeleteAgentOptionalParams) => Promise; - deleteFile: (fileId: string, options?: DeleteFileOptionalParams) => Promise; - deleteThread: (threadId: string, options?: DeleteAgentThreadOptionalParams) => Promise; - deleteVectorStore: (vectorStoreId: string, options?: DeleteVectorStoreOptionalParams) => Promise; - deleteVectorStoreFile: (vectorStoreId: string, fileId: string, options?: DeleteVectorStoreFileOptionalParams) => Promise; - getAgent: (assistantId: string, options?: GetAgentOptionalParams) => Promise; - getFile: (fileId: string, options?: GetFileOptionalParams) => Promise; - getFileContent: (fileId: string, options?: GetFileContentOptionalParams) => StreamableMethod; - getRun: (threadId: string, runId: string, options?: GetRunOptionalParams) => Promise; - getRunStep: (threadId: string, runId: string, stepId: string, options?: GetRunStepOptionalParams) => Promise; - getThread: (threadId: string, options?: GetAgentThreadOptionalParams) => Promise; - getVectorStore: (vectorStoreId: string, options?: DeleteVectorStoreOptionalParams) => Promise; - getVectorStoreFile: (vectorStoreId: string, fileId: string, options?: GetVectorStoreFileOptionalParams) => Promise; - getVectorStoreFileBatch: (vectorStoreId: string, batchId: string, options?: GetVectorStoreFileBatchOptionalParams) => Promise; - listAgents: (options?: ListAgentsOptionalParams) => Promise; - listFiles: (options?: ListFilesOptionalParams) => Promise; - listMessages: (threadId: string, options?: ListMessagesOptionalParams) => Promise; - listRuns: (threadId: string, options?: ListRunQueryOptionalParams) => Promise; - listRunSteps: (threadId: string, runId: string, options?: ListRunQueryOptionalParams) => Promise; - listVectorStoreFileBatchFiles: (vectorStoreId: string, batchId: string, options?: ListVectorStoreFileBatchFilesOptionalParams) => Promise; - listVectorStoreFiles: (vectorStoreId: string, options?: ListVectorStoreFilesOptionalParams) => Promise; - listVectorStores: (options?: DeleteVectorStoreOptionalParams) => Promise; - modifyVectorStore: (vectorStoreId: string, options?: UpdateVectorStoreOptionalParams) => Promise; - submitToolOutputsToRun: (threadId: string, runId: string, toolOutputs: Array, options?: SubmitToolOutputsToRunOptionalParams) => AgentRunResponse; - updateAgent: (assistantId: string, options: UpdateAgentOptionalParams) => Promise; - updateMessage: (threadId: string, messageId: string, options?: UpdateMessageOptionalParams) => Promise; - updateRun: (threadId: string, runId: string, options?: UpdateRunOptionalParams) => Promise; - updateThread: (threadId: string, options?: UpdateAgentThreadOptionalParams) => Promise; - uploadFile: (data: ReadableStream | NodeJS.ReadableStream, purpose: FilePurpose, options?: UploadFileOptionalParams) => Promise; - uploadFileAndPoll: (data: ReadableStream | NodeJS.ReadableStream, purpose: FilePurpose, options?: UploadFileWithPollingOptionalParams) => PollerLike, OpenAIFileOutput>; -} - -// @public -export type AgentStreamEventType = ThreadStreamEvent | RunStreamEvent | RunStepStreamEvent | MessageStreamEvent | ErrorEvent_2 | DoneEvent; - -// @public -export interface AgentThreadCreationOptions { - messages?: Array; - metadata?: Record | null; - toolResources?: ToolResources | null; -} - -// @public -export interface AgentThreadOutput { - createdAt: Date; - id: string; - metadata: Record | null; - object: "thread"; - toolResources: ToolResourcesOutput | null; -} - -// @public -export class AIProjectsClient { - constructor(endpointParam: string, subscriptionId: string, resourceGroupName: string, projectName: string, credential: TokenCredential, options?: AIProjectsClientOptions); - readonly agents: AgentsOperations; - readonly connections: ConnectionsOperations; - static fromConnectionString(connectionString: string, credential: TokenCredential, options?: AIProjectsClientOptions): AIProjectsClient; - readonly telemetry: TelemetryOperations; -} - -// @public -export interface AIProjectsClientOptions extends ProjectsClientOptions { -} - -// @public -export type ApiResponseFormat = string; - -// @public -export type ApiResponseFormatOutput = string; - -// @public -export type AuthenticationTypeOutput = "ApiKey" | "AAD" | "SAS"; - -// @public -export interface AzureAISearchResource { - indexes?: Array; -} - -// @public -export interface AzureAISearchResourceOutput { - indexes?: Array; -} - -// @public -export interface AzureAISearchToolDefinition extends ToolDefinitionParent { - type: "azure_ai_search"; -} - -// @public -export interface AzureAISearchToolDefinitionOutput extends ToolDefinitionOutputParent { - type: "azure_ai_search"; -} - -// @public -export interface BingGroundingToolDefinition extends ToolDefinitionParent { - bingGrounding: ToolConnectionList; - type: "bing_grounding"; -} - -// @public -export interface BingGroundingToolDefinitionOutput extends ToolDefinitionOutputParent { - bingGrounding: ToolConnectionListOutput; - type: "bing_grounding"; -} - -// @public -export interface CancelRunOptionalParams extends OperationOptions { -} - -// @public -export interface CancelVectorStoreFileBatchOptionalParams extends OperationOptions { -} - -// @public -export interface CodeInterpreterToolDefinition extends ToolDefinitionParent { - type: "code_interpreter"; -} - -// @public -export interface CodeInterpreterToolDefinitionOutput extends ToolDefinitionOutputParent { - type: "code_interpreter"; -} - -// @public -export interface CodeInterpreterToolResource { - dataSources?: Array; - fileIds?: string[]; -} - -// @public -export interface CodeInterpreterToolResourceOutput { - dataSources?: Array; - fileIds?: string[]; -} - -// @public -export interface ConnectionsOperations { - getConnection: (connectionName: string, options?: GetConnectionOptionalParams) => Promise; - getConnectionWithSecrets: (connectionName: string, options?: GetConnectionWithSecretsOptionalParams) => Promise; - listConnections: (options?: ListConnectionsOptionalParams) => Promise>; -} - -// @public -export enum connectionToolType { - BingGrounding = "bing_grounding", - MicrosoftFabric = "microsoft_fabric", - SharepointGrounding = "sharepoint_grounding" -} - -// @public -export type ConnectionType = "AzureOpenAI" | "Serverless" | "AzureBlob" | "AIServices" | "CognitiveSearch"; - -// @public -export type ConnectionTypeOutput = "AzureOpenAI" | "Serverless" | "AzureBlob" | "AIServices" | "CognitiveSearch"; - -// @public -export interface CreateAgentOptionalParams extends Omit, OperationOptions { -} - -// @public -export interface CreateAgentOptions { - description?: string | null; - instructions?: string | null; - metadata?: Record | null; - model: string; - name?: string | null; - responseFormat?: AgentsApiResponseFormatOption | null; - temperature?: number | null; - toolResources?: ToolResources | null; - tools?: Array; - topP?: number | null; -} - -// @public -export interface CreateAgentThreadOptionalParams extends AgentThreadCreationOptions, OperationOptions { -} - -// @public -export type CreateAndRunThreadOptionalParams = Omit & OperationOptions; - -// @public -export interface CreateAndRunThreadOptions { - assistantId: string; - instructions?: string | null; - maxCompletionTokens?: number | null; - maxPromptTokens?: number | null; - metadata?: Record | null; - model?: string | null; - responseFormat?: AgentsApiResponseFormatOption | null; - stream?: boolean; - temperature?: number | null; - thread?: AgentThreadCreationOptions; - toolChoice?: AgentsApiToolChoiceOption | null; - toolResources?: UpdateToolResourcesOptions | null; - tools?: Array | null; - topP?: number | null; - truncationStrategy?: TruncationObject | null; -} - -// @public -export interface CreateMessageOptionalParams extends OperationOptions { -} - -// @public -export type CreateRunOptionalParams = Omit & OperationOptions; - -// @public -export interface CreateRunOptions { - additionalInstructions?: string | null; - additionalMessages?: Array | null; - assistantId: string; - instructions?: string | null; - maxCompletionTokens?: number | null; - maxPromptTokens?: number | null; - metadata?: Record | null; - model?: string | null; - responseFormat?: AgentsApiResponseFormatOption | null; - stream?: boolean; - temperature?: number | null; - toolChoice?: AgentsApiToolChoiceOption | null; - tools?: Array; - topP?: number | null; - truncationStrategy?: TruncationObject | null; -} - -// @public -export interface CreateVectorStoreFileBatchOptionalParams extends CreateVectorStoreFileBatchOptions, OperationOptions { -} - -// @public -export interface CreateVectorStoreFileBatchOptions { - chunkingStrategy?: VectorStoreChunkingStrategyRequest; - dataSources?: VectorStoreDataSource[]; - fileIds?: string[]; -} - -// @public -export interface CreateVectorStoreFileBatchWithPollingOptionalParams extends CreateVectorStoreFileBatchOptionalParams, PollingOptionsParams { -} - -// @public -export interface CreateVectorStoreFileOptionalParams extends CreateVectorStoreFileOptions, OperationOptions { -} - -// @public -export interface CreateVectorStoreFileOptions { - chunkingStrategy?: VectorStoreChunkingStrategyRequest; - dataSources?: Array; - fileId?: string; -} - -// @public -export interface CreateVectorStoreFileWithPollingOptionalParams extends CreateVectorStoreFileOptions, PollingOptionsParams, OperationOptions { -} - -// @public -export interface CreateVectorStoreOptionalParams extends VectorStoreOptions, OperationOptions { -} - -// @public -export interface CreateVectorStoreWithPollingOptionalParams extends CreateVectorStoreOptionalParams, PollingOptionsParams { -} - -// @public -export interface CredentialsApiKeyAuthOutput { - key: string; -} - -// @public -export interface CredentialsSASAuthOutput { - SAS: string; -} - -// @public -export interface DeleteAgentOptionalParams extends OperationOptions { -} - -// @public -export interface DeleteAgentThreadOptionalParams extends OperationOptions { -} - -// @public -export interface DeleteFileOptionalParams extends OperationOptions { -} - -// @public -export interface DeleteVectorStoreFileOptionalParams extends OperationOptions { -} - -// @public -export interface DeleteVectorStoreOptionalParams extends OperationOptions { -} - -// @public -export enum DoneEvent { - Done = "done" -} - -// @public -enum ErrorEvent_2 { - Error = "error" -} -export { ErrorEvent_2 as ErrorEvent } - -// @public -export interface FileDeletionStatusOutput { - deleted: boolean; - id: string; - object: "file"; -} - -// @public -export interface FileListResponseOutput { - data: Array; - object: "list"; -} - -// @public -export type FilePurpose = string; - -// @public -export type FilePurposeOutput = string; - -// @public -export interface FileSearchRankingOptions { - ranker: string; - scoreThreshold: number; -} - -// @public -export interface FileSearchRankingOptionsOutput { - ranker: string; - scoreThreshold: number; -} - -// @public -export interface FileSearchToolDefinition extends ToolDefinitionParent { - fileSearch?: FileSearchToolDefinitionDetails; - type: "file_search"; -} - -// @public -export interface FileSearchToolDefinitionDetails { - maxNumResults?: number; - // (undocumented) - rankingOptions?: FileSearchRankingOptions; -} - -// @public -export interface FileSearchToolDefinitionDetailsOutput { - maxNumResults?: number; - // (undocumented) - rankingOptions?: FileSearchRankingOptionsOutput; -} - -// @public -export interface FileSearchToolDefinitionOutput extends ToolDefinitionOutputParent { - fileSearch?: FileSearchToolDefinitionDetailsOutput; - type: "file_search"; -} - -// @public -export interface FileSearchToolResource { - vectorStoreIds?: string[]; - vectorStores?: Array; -} - -// @public -export interface FileSearchToolResourceOutput { - vectorStoreIds?: string[]; - vectorStores?: Array; -} - -// @public -export type FileStateOutput = string; - -// @public -export interface FileStatusFilter { - filter?: VectorStoreFileStatusFilter; -} - -// @public -export interface FunctionDefinition { - description?: string; - name: string; - parameters: unknown; -} - -// @public -export interface FunctionDefinitionOutput { - description?: string; - name: string; - parameters: any; -} - -// @public -export interface FunctionName { - name: string; -} - -// @public -export interface FunctionNameOutput { - name: string; -} - -// @public -export interface FunctionToolDefinition extends ToolDefinitionParent { - function: FunctionDefinition; - type: "function"; -} - -// @public -export interface FunctionToolDefinitionOutput extends ToolDefinitionOutputParent { - function: FunctionDefinitionOutput; - type: "function"; -} - -// @public -export interface GetAgentOptionalParams extends OperationOptions { -} - -// @public -export interface GetAgentThreadOptionalParams extends OperationOptions { -} - -// @public -export interface GetConnectionOptionalParams extends OperationOptions { -} - -// @public -export interface GetConnectionResponseOutput { - id: string; - name: string; - properties: InternalConnectionPropertiesOutput; -} - -// @public -export interface GetConnectionWithSecretsOptionalParams extends OperationOptions { -} - -// @public -export interface GetFileContentOptionalParams extends OperationOptions { -} - -// @public -export interface GetFileOptionalParams extends OperationOptions { -} - -// @public -export interface GetRunOptionalParams extends OperationOptions { -} - -// @public -export interface GetRunStepOptionalParams extends OperationOptions { -} - -// @public -export interface GetVectorStoreFileBatchOptionalParams extends OperationOptions { -} - -// @public -export interface GetVectorStoreFileOptionalParams extends OperationOptions { -} - -// @public -export interface GetVectorStoreOptionalParams extends OperationOptions { -} - -// @public -export interface GetWorkspaceOptionalParams extends OperationOptions { -} - -// @public -export type IncompleteRunDetailsOutput = string; - -// @public -export interface IndexResource { - indexConnectionId: string; - indexName: string; -} - -// @public -export interface IndexResourceOutput { - indexConnectionId: string; - indexName: string; -} - -// @public -export interface InternalConnectionPropertiesAADAuthOutput extends InternalConnectionPropertiesOutputParent { - authType: "AAD"; -} - -// @public -export interface InternalConnectionPropertiesApiKeyAuthOutput extends InternalConnectionPropertiesOutputParent { - authType: "ApiKey"; - credentials: CredentialsApiKeyAuthOutput; -} - -// @public -export type InternalConnectionPropertiesOutput = InternalConnectionPropertiesOutputParent | InternalConnectionPropertiesApiKeyAuthOutput | InternalConnectionPropertiesAADAuthOutput | InternalConnectionPropertiesSASAuthOutput; - -// @public -export interface InternalConnectionPropertiesOutputParent { - // (undocumented) - authType: AuthenticationTypeOutput; - category: ConnectionTypeOutput; - target: string; -} - -// @public -export interface InternalConnectionPropertiesSASAuthOutput extends InternalConnectionPropertiesOutputParent { - authType: "SAS"; - credentials: CredentialsSASAuthOutput; -} - -// @public -export function isOutputOfType(output: RequiredActionOutput | RequiredToolCallOutput | ToolDefinitionOutputParent, type: string): output is T; - -// @public -export interface ListAgentsOptionalParams extends ListQueryParameters, OperationOptions { -} - -// @public -export interface ListConnectionsOptionalParams extends ListConnectionsQueryParamProperties, OperationOptions { -} - -// @public (undocumented) -export interface ListConnectionsQueryParamProperties { - category?: ConnectionType; - includeAll?: boolean; - target?: string; -} - -// @public -export interface ListFilesOptionalParams extends ListFilesQueryParamProperties, OperationOptions { -} - -// @public (undocumented) -export interface ListFilesQueryParamProperties { - purpose?: FilePurpose; -} - -// @public -export interface ListMessagesOptionalParams extends ListMessagesQueryParamProperties, OperationOptions { -} - -// @public (undocumented) -export interface ListMessagesQueryParamProperties { - after?: string; - before?: string; - limit?: number; - order?: ListSortOrder; - runId?: string; -} - -// @public -export interface ListQueryParameters { - after?: string; - before?: string; - limit?: number; - order?: "asc" | "desc"; -} - -// @public -export interface ListRunQueryOptionalParams extends ListQueryParameters, OperationOptions { -} - -// @public -export interface ListRunStepsOptionalParams extends ListQueryParameters, OperationOptions { -} - -// @public -export type ListSortOrder = "asc" | "desc"; - -// @public -export interface ListVectorStoreFileBatchFilesOptionalParams extends ListQueryParameters, OperationOptions { - filter?: VectorStoreFileStatusFilter; -} - -// @public -export interface ListVectorStoreFilesOptionalParams extends ListQueryParameters, OperationOptions { -} - -// @public -export interface ListVectorStoresOptionalParams extends ListQueryParameters, OperationOptions { -} - -// @public -export interface MessageAttachment { - dataSources?: Array; - fileId?: string; - tools: MessageAttachmentToolDefinition[]; -} - -// @public -export interface MessageAttachmentOutput { - dataSources?: Array; - fileId?: string; - tools: MessageAttachmentToolDefinitionOutput[]; -} - -// @public -export type MessageAttachmentToolDefinition = CodeInterpreterToolDefinition | FileSearchToolDefinition; - -// @public -export type MessageAttachmentToolDefinitionOutput = CodeInterpreterToolDefinitionOutput | FileSearchToolDefinitionOutput; - -// @public -export type MessageContent = MessageContentParent | MessageTextContent | MessageImageFileContent; - -// @public -export type MessageContentOutput = MessageContentOutputParent | MessageTextContentOutput | MessageImageFileContentOutput; - -// @public -export interface MessageContentOutputParent { - // (undocumented) - type: string; -} - -// @public -export interface MessageContentParent { - // (undocumented) - type: string; -} - -// @public -export interface MessageDelta { - content: Array; - role: MessageRole; -} - -// @public -export interface MessageDeltaChunk { - delta: MessageDelta; - id: string; - object: "thread.message.delta"; -} - -// @public -export type MessageDeltaContent = MessageDeltaContentParent | MessageDeltaTextContent | MessageDeltaImageFileContent; - -// @public -export interface MessageDeltaContentParent { - index: number; - type: string; -} - -// @public -export interface MessageDeltaImageFileContent extends MessageDeltaContentParent { - imageFile?: MessageDeltaImageFileContentObject; - type: "image_file"; -} - -// @public -export interface MessageDeltaImageFileContentObject { - fileId?: string; -} - -// @public -export type MessageDeltaTextAnnotation = MessageDeltaTextAnnotationParent | MessageDeltaTextFileCitationAnnotation | MessageDeltaTextFilePathAnnotation; - -// @public -export interface MessageDeltaTextAnnotationParent { - index: number; - type: string; -} - -// @public -export interface MessageDeltaTextContent extends MessageDeltaContentParent { - text?: MessageDeltaTextContentObject; - type: "text"; -} - -// @public -export interface MessageDeltaTextContentObject { - annotations?: Array; - value?: string; -} - -// @public -export interface MessageDeltaTextFileCitationAnnotation extends MessageDeltaTextAnnotationParent { - endIndex?: number; - fileCitation?: MessageDeltaTextFileCitationAnnotationObject; - startIndex?: number; - text?: string; - type: "file_citation"; -} - -// @public -export interface MessageDeltaTextFileCitationAnnotationObject { - fileId?: string; - quote?: string; -} - -// @public -export interface MessageDeltaTextFilePathAnnotation extends MessageDeltaTextAnnotationParent { - endIndex?: number; - filePath?: MessageDeltaTextFilePathAnnotationObject; - startIndex?: number; - text?: string; - type: "file_path"; -} - -// @public -export interface MessageDeltaTextFilePathAnnotationObject { - fileId?: string; -} - -// @public -export interface MessageDeltaTextUrlCitationDetails { - title?: string; - url?: string; -} - -// @public -export interface MessageImageFileContent extends MessageContentParent { - imageFile: MessageImageFileDetails; - type: "image_file"; -} - -// @public -export interface MessageImageFileContentOutput extends MessageContentOutputParent { - imageFile: MessageImageFileDetailsOutput; - type: "image_file"; -} - -// @public -export interface MessageImageFileDetails { - fileId: string; -} - -// @public -export interface MessageImageFileDetailsOutput { - fileId: string; -} - -// @public -export interface MessageIncompleteDetails { - reason: MessageIncompleteDetailsReason; -} - -// @public -export interface MessageIncompleteDetailsOutput { - reason: MessageIncompleteDetailsReasonOutput; -} - -// @public -export type MessageIncompleteDetailsReason = string; - -// @public -export type MessageIncompleteDetailsReasonOutput = string; - -// @public -export type MessageRole = string; - -// @public -export type MessageRoleOutput = string; - -// @public -export type MessageStatus = string; - -// @public -export type MessageStatusOutput = string; - -// @public -export enum MessageStreamEvent { - ThreadMessageCompleted = "thread.message.completed", - ThreadMessageCreated = "thread.message.created", - ThreadMessageDelta = "thread.message.delta", - ThreadMessageIncomplete = "thread.message.incomplete", - ThreadMessageInProgress = "thread.message.in_progress" -} - -// @public -export type MessageTextAnnotation = MessageTextAnnotationParent | MessageTextFileCitationAnnotation | MessageTextFilePathAnnotation; - -// @public -export type MessageTextAnnotationOutput = MessageTextAnnotationOutputParent | MessageTextFileCitationAnnotationOutput | MessageTextFilePathAnnotationOutput; - -// @public -export interface MessageTextAnnotationOutputParent { - text: string; - // (undocumented) - type: string; -} - -// @public -export interface MessageTextAnnotationParent { - text: string; - // (undocumented) - type: string; -} - -// @public -export interface MessageTextContent extends MessageContentParent { - text: MessageTextDetails; - type: "text"; -} - -// @public -export interface MessageTextContentOutput extends MessageContentOutputParent { - text: MessageTextDetailsOutput; - type: "text"; -} - -// @public -export interface MessageTextDetails { - annotations: Array; - value: string; -} - -// @public -export interface MessageTextDetailsOutput { - annotations: Array; - value: string; -} - -// @public -export interface MessageTextFileCitationAnnotation extends MessageTextAnnotationParent { - endIndex?: number; - fileCitation: MessageTextFileCitationDetails; - startIndex?: number; - type: "file_citation"; -} - -// @public -export interface MessageTextFileCitationAnnotationOutput extends MessageTextAnnotationOutputParent { - endIndex?: number; - fileCitation: MessageTextFileCitationDetailsOutput; - startIndex?: number; - type: "file_citation"; -} - -// @public -export interface MessageTextFileCitationDetails { - fileId: string; - quote: string; -} - -// @public -export interface MessageTextFileCitationDetailsOutput { - fileId: string; - quote: string; -} - -// @public -export interface MessageTextFilePathAnnotation extends MessageTextAnnotationParent { - endIndex?: number; - filePath: MessageTextFilePathDetails; - startIndex?: number; - type: "file_path"; -} - -// @public -export interface MessageTextFilePathAnnotationOutput extends MessageTextAnnotationOutputParent { - endIndex?: number; - filePath: MessageTextFilePathDetailsOutput; - startIndex?: number; - type: "file_path"; -} - -// @public -export interface MessageTextFilePathDetails { - fileId: string; -} - -// @public -export interface MessageTextFilePathDetailsOutput { - fileId: string; -} - -// @public -export interface MicrosoftFabricToolDefinition extends ToolDefinitionParent { - microsoftFabric: ToolConnectionList; - type: "microsoft_fabric"; -} - -// @public -export interface MicrosoftFabricToolDefinitionOutput extends ToolDefinitionOutputParent { - microsoftFabric: ToolConnectionListOutput; - type: "microsoft_fabric"; -} - -// @public -export interface OpenAIFileOutput { - bytes: number; - createdAt: Date; - filename: string; - id: string; - object: "file"; - purpose: FilePurposeOutput; - status?: FileStateOutput; - statusDetails?: string; -} - -// @public -export interface OpenAIPageableListOfAgentOutput { - data: Array; - firstId: string; - hasMore: boolean; - lastId: string; - object: "list"; -} - -// @public -export interface OpenAIPageableListOfRunStepOutput { - data: Array; - firstId: string; - hasMore: boolean; - lastId: string; - object: "list"; -} - -// @public -export interface OpenAIPageableListOfThreadMessageOutput { - data: Array; - firstId: string; - hasMore: boolean; - lastId: string; - object: "list"; -} - -// @public -export interface OpenAIPageableListOfThreadRunOutput { - data: Array; - firstId: string; - hasMore: boolean; - lastId: string; - object: "list"; -} - -// @public -export interface OpenAIPageableListOfVectorStoreFileOutput { - data: Array; - firstId: string; - hasMore: boolean; - lastId: string; - object: "list"; -} - -// @public -export interface OpenAIPageableListOfVectorStoreOutput { - data: Array; - firstId: string; - hasMore: boolean; - lastId: string; - object: "list"; -} - -// @public -export interface PollingOptions { - abortSignal?: AbortSignalLike; - sleepIntervalInMs?: number; -} - -// @public -export interface PollingOptionsParams { - pollingOptions?: PollingOptions; -} - -// @public -export interface ProjectsClientOptions extends ClientOptions { - apiVersion?: string; -} - -// @public -export type RequiredActionOutput = RequiredActionOutputParent | SubmitToolOutputsActionOutput; - -// @public -export interface RequiredActionOutputParent { - // (undocumented) - type: string; -} - -// @public -export interface RequiredFunctionToolCallDetailsOutput { - arguments: string; - name: string; -} - -// @public -export interface RequiredFunctionToolCallOutput extends RequiredToolCallOutputParent { - function: RequiredFunctionToolCallDetailsOutput; - type: "function"; -} - -// @public -export type RequiredToolCallOutput = RequiredToolCallOutputParent | RequiredFunctionToolCallOutput; - -// @public -export interface RequiredToolCallOutputParent { - id: string; - // (undocumented) - type: string; -} - -// @public -export interface RunCompletionUsageOutput { - completionTokens: number; - promptTokens: number; - totalTokens: number; -} - -// @public -export interface RunErrorOutput { - code: string; - message: string; -} - -// @public -export type RunStatusOutput = string; - -// @public -export interface RunStepAzureAISearchToolCallOutput extends RunStepToolCallOutputParent { - azureAISearch: Record; - type: "azure_ai_search"; -} - -// @public -export interface RunStepBingGroundingToolCallOutput extends RunStepToolCallOutputParent { - bingGrounding: Record; - type: "bing_grounding"; -} - -// @public -export interface RunStepCodeInterpreterImageOutputOutput extends RunStepCodeInterpreterToolCallOutputOutputParent { - image: RunStepCodeInterpreterImageReferenceOutput; - type: "image"; -} - -// @public -export interface RunStepCodeInterpreterImageReferenceOutput { - fileId: string; -} - -// @public -export interface RunStepCodeInterpreterLogOutputOutput extends RunStepCodeInterpreterToolCallOutputOutputParent { - logs: string; - type: "logs"; -} - -// @public -export interface RunStepCodeInterpreterToolCallDetailsOutput { - input: string; - outputs: Array; -} - -// @public -export interface RunStepCodeInterpreterToolCallOutput extends RunStepToolCallOutputParent { - codeInterpreter: RunStepCodeInterpreterToolCallDetailsOutput; - type: "code_interpreter"; -} - -// @public -export type RunStepCodeInterpreterToolCallOutputOutput = RunStepCodeInterpreterToolCallOutputOutputParent | RunStepCodeInterpreterLogOutputOutput | RunStepCodeInterpreterImageOutputOutput; - -// @public -export interface RunStepCodeInterpreterToolCallOutputOutputParent { - // (undocumented) - type: string; -} - -// @public -export interface RunStepCompletionUsageOutput { - completionTokens: number; - promptTokens: number; - totalTokens: number; -} - -// @public -export interface RunStepDelta { - stepDetails?: RunStepDeltaDetail; -} - -// @public -export interface RunStepDeltaChunk { - delta: RunStepDelta; - id: string; - object: "thread.run.step.delta"; -} - -// @public -export interface RunStepDeltaCodeInterpreterDetailItemObject { - input?: string; - outputs?: Array; -} - -// @public -export interface RunStepDeltaCodeInterpreterImageOutput extends RunStepDeltaCodeInterpreterOutputParent { - image?: RunStepDeltaCodeInterpreterImageOutputObject; - type: "image"; -} - -// @public -export interface RunStepDeltaCodeInterpreterImageOutputObject { - fileId?: string; -} - -// @public -export interface RunStepDeltaCodeInterpreterLogOutput extends RunStepDeltaCodeInterpreterOutputParent { - logs?: string; - type: "logs"; -} - -// @public -export type RunStepDeltaCodeInterpreterOutput = RunStepDeltaCodeInterpreterOutputParent | RunStepDeltaCodeInterpreterLogOutput | RunStepDeltaCodeInterpreterImageOutput; - -// @public -export interface RunStepDeltaCodeInterpreterOutputParent { - index: number; - type: string; -} - -// @public -export interface RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCallParent { - codeInterpreter?: RunStepDeltaCodeInterpreterDetailItemObject; - type: "code_interpreter"; -} - -// @public -export interface RunStepDeltaDetail { - type: string; -} - -// @public -export interface RunStepDeltaFileSearchToolCall extends RunStepDeltaToolCallParent { - fileSearch?: Array; - type: "file_search"; -} - -// @public -export interface RunStepDeltaFunction { - arguments?: string; - name?: string; - output?: string | null; -} - -// @public -export interface RunStepDeltaFunctionToolCall extends RunStepDeltaToolCallParent { - function?: RunStepDeltaFunction; - type: "function"; -} - -// @public -export interface RunStepDeltaMessageCreation extends RunStepDeltaDetail { - messageCreation?: RunStepDeltaMessageCreationObject; - type: "message_creation"; -} - -// @public -export interface RunStepDeltaMessageCreationObject { - messageId?: string; -} - -// @public -export type RunStepDeltaToolCall = RunStepDeltaToolCallParent | RunStepDeltaFunctionToolCall | RunStepDeltaFileSearchToolCall | RunStepDeltaCodeInterpreterToolCall; - -// @public -export interface RunStepDeltaToolCallObject extends RunStepDeltaDetail { - toolCalls?: Array; - type: "tool_calls"; -} - -// @public -export interface RunStepDeltaToolCallParent { - id: string; - index: number; - type: string; -} - -// @public -export type RunStepDetailsOutput = RunStepDetailsOutputParent | RunStepMessageCreationDetailsOutput | RunStepToolCallDetailsOutput; - -// @public -export interface RunStepDetailsOutputParent { - // (undocumented) - type: RunStepTypeOutput; -} - -// @public -export type RunStepErrorCodeOutput = string; - -// @public -export interface RunStepErrorOutput { - code: RunStepErrorCodeOutput; - message: string; -} - -// @public -export interface RunStepFileSearchToolCallOutput extends RunStepToolCallOutputParent { - fileSearch: Record; - type: "file_search"; -} - -// @public -export interface RunStepFunctionToolCallDetailsOutput { - arguments: string; - name: string; - output: string | null; -} - -// @public -export interface RunStepFunctionToolCallOutput extends RunStepToolCallOutputParent { - function: RunStepFunctionToolCallDetailsOutput; - type: "function"; -} - -// @public -export interface RunStepMessageCreationDetailsOutput extends RunStepDetailsOutputParent { - messageCreation: RunStepMessageCreationReferenceOutput; - type: "message_creation"; -} - -// @public -export interface RunStepMessageCreationReferenceOutput { - messageId: string; -} - -// @public -export interface RunStepMicrosoftFabricToolCallOutput extends RunStepToolCallOutputParent { - microsoftFabric: Record; - type: "microsoft_fabric"; -} - -// @public -export interface RunStepOutput { - assistantId: string; - cancelledAt: Date | null; - completedAt: Date | null; - createdAt: Date; - expiredAt: Date | null; - failedAt: Date | null; - id: string; - lastError: RunStepErrorOutput | null; - metadata: Record | null; - object: "thread.run.step"; - runId: string; - status: RunStepStatusOutput; - stepDetails: RunStepDetailsOutput; - threadId: string; - type: RunStepTypeOutput; - usage?: RunStepCompletionUsageOutput | null; -} - -// @public -export interface RunStepSharepointToolCallOutput extends RunStepToolCallOutputParent { - sharepointGrounding: Record; - type: "sharepoint_grounding"; -} - -// @public -export type RunStepStatusOutput = string; - -// @public -export enum RunStepStreamEvent { - ThreadRunStepCancelled = "thread.run.step.cancelled", - ThreadRunStepCompleted = "thread.run.step.completed", - ThreadRunStepCreated = "thread.run.step.created", - ThreadRunStepDelta = "thread.run.step.delta", - ThreadRunStepExpired = "thread.run.step.expired", - ThreadRunStepFailed = "thread.run.step.failed", - ThreadRunStepInProgress = "thread.run.step.in_progress" -} - -// @public -export interface RunStepToolCallDetailsOutput extends RunStepDetailsOutputParent { - toolCalls: Array; - type: "tool_calls"; -} - -// @public -export type RunStepToolCallOutput = RunStepToolCallOutputParent | RunStepCodeInterpreterToolCallOutput | RunStepFileSearchToolCallOutput | RunStepBingGroundingToolCallOutput | RunStepAzureAISearchToolCallOutput | RunStepSharepointToolCallOutput | RunStepMicrosoftFabricToolCallOutput | RunStepFunctionToolCallOutput; - -// @public -export interface RunStepToolCallOutputParent { - id: string; - // (undocumented) - type: string; -} - -// @public -export type RunStepTypeOutput = string; - -// @public -export enum RunStreamEvent { - ThreadRunCancelled = "thread.run.cancelled", - ThreadRunCancelling = "thread.run.cancelling", - ThreadRunCompleted = "thread.run.completed", - ThreadRunCreated = "thread.run.created", - ThreadRunExpired = "thread.run.expired", - ThreadRunFailed = "thread.run.failed", - ThreadRunInProgress = "thread.run.in_progress", - ThreadRunQueued = "thread.run.queued", - ThreadRunRequiresAction = "thread.run.requires_action" -} - -// @public -export interface SharepointToolDefinition extends ToolDefinitionParent { - sharepointGrounding: ToolConnectionList; - type: "sharepoint_grounding"; -} - -// @public -export interface SharepointToolDefinitionOutput extends ToolDefinitionOutputParent { - sharepointGrounding: ToolConnectionListOutput; - type: "sharepoint_grounding"; -} - -// @public -export interface SubmitToolOutputsActionOutput extends RequiredActionOutputParent { - submitToolOutputs: SubmitToolOutputsDetailsOutput; - type: "submit_tool_outputs"; -} - -// @public -export interface SubmitToolOutputsDetailsOutput { - toolCalls: Array; -} - -// @public -export interface SubmitToolOutputsToRunOptionalParams extends OperationOptions { - stream?: boolean; -} - -// @public -export interface TelemetryOperations { - getConnectionString(): Promise; - getSettings(): TelemetryOptions; - updateSettings(options: TelemetryOptions): void; -} - -// @public -export interface TelemetryOptions { - enableContentRecording: boolean; -} - -// @public -export interface ThreadDeletionStatusOutput { - deleted: boolean; - id: string; - object: "thread.deleted"; -} - -// @public -export interface ThreadMessage { - assistantId: string | null; - attachments: Array | null; - completedAt: number | null; - content: Array; - createdAt: number; - id: string; - incompleteAt: number | null; - incompleteDetails: MessageIncompleteDetails | null; - metadata: Record | null; - object: "thread.message"; - role: MessageRole; - runId: string | null; - status: MessageStatus; - threadId: string; -} - -// @public -export interface ThreadMessageOptions { - attachments?: Array | null; - content: string; - metadata?: Record | null; - role: MessageRole; -} - -// @public -export interface ThreadMessageOutput { - assistantId: string | null; - attachments: Array | null; - completedAt: Date | null; - content: Array; - createdAt: Date; - id: string; - incompleteAt: Date | null; - incompleteDetails: MessageIncompleteDetailsOutput | null; - metadata: Record | null; - object: "thread.message"; - role: MessageRoleOutput; - runId: string | null; - status: MessageStatusOutput; - threadId: string; -} - -// @public -export interface ThreadRunOutput { - assistantId: string; - cancelledAt: Date | null; - completedAt: Date | null; - createdAt: Date; - expiresAt: Date | null; - failedAt: Date | null; - id: string; - incompleteDetails: IncompleteRunDetailsOutput | null; - instructions: string; - lastError: RunErrorOutput | null; - maxCompletionTokens: number | null; - maxPromptTokens: number | null; - metadata: Record | null; - model: string; - object: "thread.run"; - parallelToolCalls?: boolean; - requiredAction?: RequiredActionOutput | null; - responseFormat: AgentsApiResponseFormatOptionOutput | null; - startedAt: Date | null; - status: RunStatusOutput; - temperature?: number | null; - threadId: string; - toolChoice: AgentsApiToolChoiceOptionOutput | null; - toolResources?: UpdateToolResourcesOptionsOutput | null; - tools: Array; - topP?: number | null; - truncationStrategy: TruncationObjectOutput | null; - usage: RunCompletionUsageOutput | null; -} - -// @public -export enum ThreadStreamEvent { - ThreadCreated = "thread.created" -} - -// @public -export interface ToolConnection { - connectionId: string; -} - -// @public -export interface ToolConnectionList { - connections?: Array; -} - -// @public -export interface ToolConnectionListOutput { - connections?: Array; -} - -// @public -export interface ToolConnectionOutput { - connectionId: string; -} - -// @public -export type ToolDefinition = ToolDefinitionParent | CodeInterpreterToolDefinition | FileSearchToolDefinition | FunctionToolDefinition | BingGroundingToolDefinition | MicrosoftFabricToolDefinition | SharepointToolDefinition | AzureAISearchToolDefinition; - -// @public -export type ToolDefinitionOutput = ToolDefinitionOutputParent | CodeInterpreterToolDefinitionOutput | FileSearchToolDefinitionOutput | FunctionToolDefinitionOutput | BingGroundingToolDefinitionOutput | MicrosoftFabricToolDefinitionOutput | SharepointToolDefinitionOutput | AzureAISearchToolDefinitionOutput; - -// @public -export interface ToolDefinitionOutputParent { - // (undocumented) - type: string; -} - -// @public -export interface ToolDefinitionParent { - // (undocumented) - type: string; -} - -// @public -export interface ToolOutput { - output?: string; - toolCallId?: string; -} - -// @public -export interface ToolResources { - azureAISearch?: AzureAISearchResource; - codeInterpreter?: CodeInterpreterToolResource; - fileSearch?: FileSearchToolResource; -} - -// @public -export interface ToolResourcesOutput { - azureAISearch?: AzureAISearchResourceOutput; - codeInterpreter?: CodeInterpreterToolResourceOutput; - fileSearch?: FileSearchToolResourceOutput; -} - -// @public -export class ToolSet { - addAzureAISearchTool(indexConnectionId: string, indexName: string): { - definition: AzureAISearchToolDefinition; - resources: ToolResources; - }; - addCodeInterpreterTool(fileIds?: string[], dataSources?: Array): { - definition: CodeInterpreterToolDefinition; - resources: ToolResources; - }; - addConnectionTool(toolType: connectionToolType, connectionIds: string[]): { - definition: ToolDefinition; - }; - addFileSearchTool(vectorStoreIds?: string[], vectorStores?: Array, definitionDetails?: FileSearchToolDefinitionDetails): { - definition: FileSearchToolDefinition; - resources: ToolResources; - }; - toolDefinitions: ToolDefinition[]; - toolResources: ToolResources; -} - -// @public -export class ToolUtility { - static createAzureAISearchTool(indexConnectionId: string, indexName: string): { - definition: AzureAISearchToolDefinition; - resources: ToolResources; - }; - static createCodeInterpreterTool(fileIds?: string[], dataSources?: Array): { - definition: CodeInterpreterToolDefinition; - resources: ToolResources; - }; - static createConnectionTool(toolType: connectionToolType, connectionIds: string[]): { - definition: ToolDefinition; - }; - static createFileSearchTool(vectorStoreIds?: string[], vectorStores?: Array, definitionDetails?: FileSearchToolDefinitionDetails): { - definition: FileSearchToolDefinition; - resources: ToolResources; - }; - static createFunctionTool(functionDefinition: FunctionDefinition): { - definition: FunctionToolDefinition; - }; -} - -// @public -export interface TruncationObject { - lastMessages?: number | null; - type: TruncationStrategy; -} - -// @public -export interface TruncationObjectOutput { - lastMessages?: number | null; - type: TruncationStrategyOutput; -} - -// @public -export type TruncationStrategy = string; - -// @public -export type TruncationStrategyOutput = string; - -// @public -export interface UpdateAgentOptionalParams extends UpdateAgentOptions, OperationOptions { -} - -// @public -export interface UpdateAgentOptions { - description?: string | null; - instructions?: string | null; - metadata?: Record | null; - model?: string; - name?: string | null; - responseFormat?: AgentsApiResponseFormatOption | null; - temperature?: number | null; - toolResources?: ToolResources; - tools?: Array; - topP?: number | null; -} - -// @public -export interface UpdateAgentThreadOptionalParams extends UpdateAgentThreadOptions, OperationOptions { -} - -// @public -export interface UpdateAgentThreadOptions { - metadata?: Record | null; - toolResources?: ToolResources | null; -} - -// @public -export interface UpdateCodeInterpreterToolResourceOptions { - fileIds?: string[]; -} - -// @public -export interface UpdateCodeInterpreterToolResourceOptionsOutput { - fileIds?: string[]; -} - -// @public -export interface UpdateFileSearchToolResourceOptions { - vectorStoreIds?: string[]; -} - -// @public -export interface UpdateFileSearchToolResourceOptionsOutput { - vectorStoreIds?: string[]; -} - -// @public -export interface UpdateMessageOptionalParams extends OperationOptions { - metadata?: Record | null; -} - -// @public -export interface UpdateRunOptionalParams extends OperationOptions { - metadata?: Record | null; -} - -// @public -export interface UpdateToolResourcesOptions { - azureAISearch?: AzureAISearchResource; - codeInterpreter?: UpdateCodeInterpreterToolResourceOptions; - fileSearch?: UpdateFileSearchToolResourceOptions; -} - -// @public -export interface UpdateToolResourcesOptionsOutput { - azureAISearch?: AzureAISearchResourceOutput; - codeInterpreter?: UpdateCodeInterpreterToolResourceOptionsOutput; - fileSearch?: UpdateFileSearchToolResourceOptionsOutput; -} - -// @public -export interface UpdateVectorStoreOptionalParams extends VectorStoreUpdateOptions, OperationOptions { -} - -// @public -export interface UploadFileOptionalParams extends OperationOptions { - fileName?: string; -} - -// @public -export interface UploadFileWithPollingOptionalParams extends UploadFileOptionalParams, PollingOptionsParams { -} - -// @public -export interface VectorStoreAutoChunkingStrategyRequest extends VectorStoreChunkingStrategyRequestParent { - type: "auto"; -} - -// @public -export interface VectorStoreAutoChunkingStrategyResponseOutput extends VectorStoreChunkingStrategyResponseOutputParent { - type: "other"; -} - -// @public -export type VectorStoreChunkingStrategyRequest = VectorStoreChunkingStrategyRequestParent | VectorStoreAutoChunkingStrategyRequest | VectorStoreStaticChunkingStrategyRequest; - -// @public -export interface VectorStoreChunkingStrategyRequestParent { - // (undocumented) - type: VectorStoreChunkingStrategyRequestType; -} - -// @public -export type VectorStoreChunkingStrategyRequestType = string; - -// @public -export type VectorStoreChunkingStrategyResponseOutput = VectorStoreChunkingStrategyResponseOutputParent | VectorStoreAutoChunkingStrategyResponseOutput | VectorStoreStaticChunkingStrategyResponseOutput; - -// @public -export interface VectorStoreChunkingStrategyResponseOutputParent { - // (undocumented) - type: VectorStoreChunkingStrategyResponseTypeOutput; -} - -// @public -export type VectorStoreChunkingStrategyResponseTypeOutput = string; - -// @public -export interface VectorStoreConfiguration { - dataSources: Array; -} - -// @public -export interface VectorStoreConfigurationOutput { - dataSources: Array; -} - -// @public -export interface VectorStoreConfigurations { - configuration: VectorStoreConfiguration; - name: string; -} - -// @public -export interface VectorStoreConfigurationsOutput { - configuration: VectorStoreConfigurationOutput; - name: string; -} - -// @public -export interface VectorStoreDataSource { - type: VectorStoreDataSourceAssetType; - uri: string; -} - -// @public -export type VectorStoreDataSourceAssetType = "uri_asset" | "id_asset"; - -// @public -export type VectorStoreDataSourceAssetTypeOutput = "uri_asset" | "id_asset"; - -// @public -export interface VectorStoreDataSourceOutput { - type: VectorStoreDataSourceAssetTypeOutput; - uri: string; -} - -// @public -export interface VectorStoreDeletionStatusOutput { - deleted: boolean; - id: string; - object: "vector_store.deleted"; -} - -// @public -export interface VectorStoreExpirationPolicy { - anchor: VectorStoreExpirationPolicyAnchor; - days: number; -} - -// @public -export type VectorStoreExpirationPolicyAnchor = string; - -// @public -export type VectorStoreExpirationPolicyAnchorOutput = string; - -// @public -export interface VectorStoreExpirationPolicyOutput { - anchor: VectorStoreExpirationPolicyAnchorOutput; - days: number; -} - -// @public -export interface VectorStoreFileBatchOutput { - createdAt: Date; - fileCounts: VectorStoreFileCountOutput; - id: string; - object: "vector_store.files_batch"; - status: VectorStoreFileBatchStatusOutput; - vectorStoreId: string; -} - -// @public -export type VectorStoreFileBatchStatusOutput = string; - -// @public -export interface VectorStoreFileCountOutput { - cancelled: number; - completed: number; - failed: number; - inProgress: number; - total: number; -} - -// @public -export interface VectorStoreFileDeletionStatusOutput { - deleted: boolean; - id: string; - object: "vector_store.file.deleted"; -} - -// @public -export type VectorStoreFileErrorCodeOutput = string; - -// @public -export interface VectorStoreFileErrorOutput { - code: VectorStoreFileErrorCodeOutput; - message: string; -} - -// @public -export interface VectorStoreFileOutput { - chunkingStrategy: VectorStoreChunkingStrategyResponseOutput; - createdAt: Date; - id: string; - lastError: VectorStoreFileErrorOutput | null; - object: "vector_store.file"; - status: VectorStoreFileStatusOutput; - usageBytes: number; - vectorStoreId: string; -} - -// @public -export type VectorStoreFileStatusFilter = string; - -// @public -export type VectorStoreFileStatusOutput = string; - -// @public -export interface VectorStoreOptions { - chunkingStrategy?: VectorStoreChunkingStrategyRequest; - configuration?: VectorStoreConfiguration; - expiresAfter?: VectorStoreExpirationPolicy; - fileIds?: string[]; - metadata?: Record | null; - name?: string; -} - -// @public -export interface VectorStoreOutput { - createdAt: Date; - expiresAfter?: VectorStoreExpirationPolicyOutput; - expiresAt?: Date | null; - fileCounts: VectorStoreFileCountOutput; - id: string; - lastActiveAt: Date | null; - metadata: Record | null; - name: string; - object: "vector_store"; - status: VectorStoreStatusOutput; - usageBytes: number; -} - -// @public -export interface VectorStoreStaticChunkingStrategyOptions { - chunkOverlapTokens: number; - maxChunkSizeTokens: number; -} - -// @public -export interface VectorStoreStaticChunkingStrategyOptionsOutput { - chunkOverlapTokens: number; - maxChunkSizeTokens: number; -} - -// @public -export interface VectorStoreStaticChunkingStrategyRequest extends VectorStoreChunkingStrategyRequestParent { - static: VectorStoreStaticChunkingStrategyOptions; - type: "static"; -} - -// @public -export interface VectorStoreStaticChunkingStrategyResponseOutput extends VectorStoreChunkingStrategyResponseOutputParent { - static: VectorStoreStaticChunkingStrategyOptionsOutput; - type: "static"; -} - -// @public -export type VectorStoreStatusOutput = string; - -// @public -export interface VectorStoreUpdateOptions { - expiresAfter?: VectorStoreExpirationPolicy | null; - metadata?: Record | null; - name?: string | null; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/ai/ai-projects/sample.env b/sdk/ai/ai-projects/sample.env deleted file mode 100644 index 0d9bbe518d6f..000000000000 --- a/sdk/ai/ai-projects/sample.env +++ /dev/null @@ -1,3 +0,0 @@ -AZURE_AI_PROJECTS_CONNECTION_STRING="" - -APPLICATIONINSIGHTS_CONNECTION_STRING="" diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentCreateWithTracingConsole.ts b/sdk/ai/ai-projects/samples-dev/agents/agentCreateWithTracingConsole.ts deleted file mode 100644 index 57e4dcb4d285..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentCreateWithTracingConsole.ts +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * Demonstrates How to instrument and get tracing using open telemetry. - * - * @summary Create Agent and instrument using open telemetry. - */ - -import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter"; -import { createAzureSdkInstrumentation } from "@azure/opentelemetry-instrumentation-azure-sdk"; -import { context, trace } from "@opentelemetry/api"; -import { registerInstrumentations } from "@opentelemetry/instrumentation"; -import { - ConsoleSpanExporter, - NodeTracerProvider, - SimpleSpanProcessor, -} from "@opentelemetry/sdk-trace-node"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const provider = new NodeTracerProvider(); -provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -provider.register(); - -registerInstrumentations({ - instrumentations: [createAzureSdkInstrumentation()], -}); - -import { AIProjectsClient } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; -let appInsightsConnectionString = process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"]; - -export async function main(): Promise { - const tracer = trace.getTracer("Agents Sample", "1.0.0"); - - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - if (!appInsightsConnectionString) { - appInsightsConnectionString = await client.telemetry.getConnectionString(); - } - - if (appInsightsConnectionString) { - const exporter = new AzureMonitorTraceExporter({ - connectionString: appInsightsConnectionString, - }); - provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - } - - await tracer.startActiveSpan("main", async (span) => { - client.telemetry.updateSettings({ enableContentRecording: true }); - - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - tracingOptions: { tracingContext: context.active() }, - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - const thread = await client.agents.createThread(); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Hello, tell me a joke", - }); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - console.log(`Created Run, Run ID: ${run.id}`); - - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - } - - await client.agents.deleteAgent(agent.id); - - console.log(`Deleted agent`); - - await client.agents.listMessages(thread.id); - - span.end(); - }); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentsAzureAiSearch.ts b/sdk/ai/ai-projects/samples-dev/agents/agentsAzureAiSearch.ts deleted file mode 100644 index aa149d93e408..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentsAzureAiSearch.ts +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with the Azure AI Search tool from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with the Azure AI Search tool. - * - */ - -import type { MessageContentOutput, MessageTextContentOutput } from "@azure/ai-projects"; -import { AIProjectsClient, isOutputOfType, ToolUtility } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const connectionName = process.env["AZURE_AI_SEARCH_CONNECTION_NAME"] || ""; - const connection = await client.connections.getConnection(connectionName); - - // Initialize Azure AI Search tool - const azureAISearchTool = ToolUtility.createAzureAISearchTool(connection.id, connection.name); - - // Create agent with the Azure AI search tool - const agent = await client.agents.createAgent("gpt-4-0125-preview", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [azureAISearchTool.definition], - toolResources: azureAISearchTool.resources, - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Hello, send an email with the datetime and weather information in New York", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run in thread with tools - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the assistant when done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage: MessageContentOutput = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentsBasics.ts b/sdk/ai/ai-projects/samples-dev/agents/agentsBasics.ts deleted file mode 100644 index 0d82b38a7506..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentsBasics.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic agent operations. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - await client.agents.deleteAgent(agent.id); - - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentsBingGrounding.ts b/sdk/ai/ai-projects/samples-dev/agents/agentsBingGrounding.ts deleted file mode 100644 index 1663f45e3ce9..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentsBingGrounding.ts +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with the Grounding with Bing Search tool - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with the Grounding with Bing Search tool. - * - */ - -import type { MessageContentOutput, MessageTextContentOutput } from "@azure/ai-projects"; -import { - AIProjectsClient, - ToolUtility, - connectionToolType, - isOutputOfType, -} from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const bingConnection = await client.connections.getConnection( - process.env["BING_CONNECTION_NAME"] || "", - ); - const connectionId = bingConnection.id; - - // Initialize agent bing tool with the connection id - const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - connectionId, - ]); - - // Create agent with the bing tool and process assistant run - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "How does wikipedia explain Euler's Identity?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run in thread with tools - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the assistant when done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage: MessageContentOutput = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentsBingGroundingWithStreaming.ts b/sdk/ai/ai-projects/samples-dev/agents/agentsBingGroundingWithStreaming.ts deleted file mode 100644 index 86abe4dac765..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentsBingGroundingWithStreaming.ts +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with the Grounding with Bing Search tool - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with the Grounding with Bing Search tool using streaming. - * - */ - -import type { - MessageContentOutput, - MessageDeltaChunk, - MessageDeltaTextContent, - MessageTextContentOutput, - ThreadRunOutput, -} from "@azure/ai-projects"; -import { - AIProjectsClient, - DoneEvent, - ErrorEvent, - MessageStreamEvent, - RunStreamEvent, - ToolUtility, - connectionToolType, - isOutputOfType, -} from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const bingConnection = await client.connections.getConnection( - process.env["BING_CONNECTION_NAME"] || "", - ); - const connectionId = bingConnection.id; - - const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - connectionId, - ]); - - // Create agent with the bing tool and process assistant run - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "How does wikipedia explain Euler's Identity?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run with streaming in thread with tools - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - // Delete the assistant when done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage: MessageContentOutput = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentsWithFunctionTool.ts b/sdk/ai/ai-projects/samples-dev/agents/agentsWithFunctionTool.ts deleted file mode 100644 index 8f846b8be02f..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentsWithFunctionTool.ts +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/* eslint-disable @typescript-eslint/no-unsafe-function-type */ - -/** - * This sample demonstrates how to use basic agent operations with function tool from the Azure Agents service. - * - * @summary demonstrates how to use basic agent operations using function tool. - * - */ - -import type { - FunctionToolDefinition, - FunctionToolDefinitionOutput, - MessageContentOutput, - MessageImageFileContentOutput, - MessageTextContentOutput, - RequiredToolCallOutput, - SubmitToolOutputsActionOutput, - ToolOutput, -} from "@azure/ai-projects"; -import { AIProjectsClient, ToolUtility, isOutputOfType } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const agents = client.agents; - class FunctionToolExecutor { - private functionTools: { func: Function; definition: FunctionToolDefinition }[]; - - constructor() { - this.functionTools = [ - { - func: this.getUserFavoriteCity, - ...ToolUtility.createFunctionTool({ - name: "getUserFavoriteCity", - description: "Gets the user's favorite city.", - parameters: {}, - }), - }, - { - func: this.getCityNickname, - ...ToolUtility.createFunctionTool({ - name: "getCityNickname", - description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.", - parameters: { - type: "object", - properties: { - location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, - }, - }, - }), - }, - { - func: this.getWeather, - ...ToolUtility.createFunctionTool({ - name: "getWeather", - description: "Gets the weather for a location.", - parameters: { - type: "object", - properties: { - location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, - unit: { type: "string", enum: ["c", "f"] }, - }, - }, - }), - }, - ]; - } - - private getUserFavoriteCity(): {} { - return { location: "Seattle, WA" }; - } - - private getCityNickname(_location: string): {} { - return { nickname: "The Emerald City" }; - } - - private getWeather(_location: string, unit: string): {} { - return { weather: unit === "f" ? "72f" : "22c" }; - } - - public invokeTool( - toolCall: RequiredToolCallOutput & FunctionToolDefinitionOutput, - ): ToolOutput | undefined { - console.log(`Function tool call - ${toolCall.function.name}`); - const args = []; - if (toolCall.function.parameters) { - try { - const params = JSON.parse(toolCall.function.parameters); - for (const key in params) { - if (Object.prototype.hasOwnProperty.call(params, key)) { - args.push(params[key]); - } - } - } catch (error) { - console.error(`Failed to parse parameters: ${toolCall.function.parameters}`, error); - return undefined; - } - } - const result = this.functionTools - .find((tool) => tool.definition.function.name === toolCall.function.name) - ?.func(...args); - return result - ? { - toolCallId: toolCall.id, - output: JSON.stringify(result), - } - : undefined; - } - - public getFunctionDefinitions(): FunctionToolDefinition[] { - return this.functionTools.map((tool) => { - return tool.definition; - }); - } - } - - const functionToolExecutor = new FunctionToolExecutor(); - const functionTools = functionToolExecutor.getFunctionDefinitions(); - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: - "You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.", - tools: functionTools, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "What's the weather like in my favorite city?", - }); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await agents.createRun(thread.id, agent.id); - console.log(`Created Run, Run ID: ${run.id}`); - - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - if (run.status === "requires_action" && run.requiredAction) { - console.log(`Run requires action - ${run.requiredAction}`); - if ( - isOutputOfType(run.requiredAction, "submit_tool_outputs") - ) { - const submitToolOutputsActionOutput = run.requiredAction as SubmitToolOutputsActionOutput; - const toolCalls = submitToolOutputsActionOutput.submitToolOutputs.toolCalls; - const toolResponses = []; - for (const toolCall of toolCalls) { - if (isOutputOfType(toolCall, "function")) { - const toolResponse = functionToolExecutor.invokeTool(toolCall); - if (toolResponse) { - toolResponses.push(toolResponse); - } - } - } - if (toolResponses.length > 0) { - run = await agents.submitToolOutputsToRun(thread.id, run.id, toolResponses); - console.log(`Submitted tool response - ${run.status}`); - } - } - } - } - - console.log(`Run status - ${run.status}, run ID: ${run.id}`); - const messages = await agents.listMessages(thread.id); - await messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content: MessageContentOutput) => { - if (isOutputOfType(content, "text")) { - const textContent = content as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content as MessageImageFileContentOutput; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/agentsWithToolset.ts b/sdk/ai/ai-projects/samples-dev/agents/agentsWithToolset.ts deleted file mode 100644 index ed1f383eddc0..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/agentsWithToolset.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with toolset and iteration in streaming - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with toolset. - * - */ - -import { AIProjectsClient, ToolSet } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; - -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file for code interpreter tool - const filePath1 = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const fileStream1 = fs.createReadStream(filePath1); - const codeInterpreterFile = await client.agents.uploadFile(fileStream1, "assistants", { - fileName: "myLocalFile", - }); - - console.log(`Uploaded local file, file ID : ${codeInterpreterFile.id}`); - - // Upload file for file search tool - const filePath2 = path.resolve(__dirname, "../data/sampleFileForUpload.txt"); - const fileStream2 = fs.createReadStream(filePath2); - const fileSearchFile = await client.agents.uploadFile(fileStream2, "assistants", { - fileName: "sampleFileForUpload.txt", - }); - console.log(`Uploaded file, file ID: ${fileSearchFile.id}`); - - // Create vector store for file search tool - const vectorStore = await client.agents - .createVectorStoreAndPoll({ - fileIds: [fileSearchFile.id], - }) - .pollUntilDone(); - - // Create tool set - const toolSet = new ToolSet(); - await toolSet.addFileSearchTool([vectorStore.id]); - await toolSet.addCodeInterpreterTool([codeInterpreterFile.id]); - - // Create agent with tool set - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: toolSet.toolDefinitions, - toolResources: toolSet.toolResources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create threads, messages, and runs to interact with agent as desired - - // Delete agent - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/batchVectorStoreWithFiles.ts b/sdk/ai/ai-projects/samples-dev/agents/batchVectorStoreWithFiles.ts deleted file mode 100644 index 18e8126e08d9..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/batchVectorStoreWithFiles.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the batch vector store with the list of files. - * - * @summary demonstrates how to create the batch vector store with the list of files. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload first file - const file1Content = "Hello, Vector Store!"; - const readable1 = new Readable(); - await readable1.push(file1Content); - await readable1.push(null); // end the stream - const file1 = await client.agents.uploadFile(readable1, "assistants", { - fileName: "vectorFile1.txt", - }); - console.log(`Uploaded file1, file ID: ${file1.id}`); - - // Create and upload second file - const file2Content = "This is another file for the Vector Store!"; - const readable2 = new Readable(); - await readable2.push(file2Content); - await readable2.push(null); // end the stream - const file2 = await client.agents.uploadFile(readable2, "assistants", { - fileName: "vectorFile2.txt", - }); - console.log(`Uploaded file2, file ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await client.agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await client.agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // List vector store files in the batch - const vectorStoreFiles = await client.agents.listVectorStoreFileBatchFiles( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `List of vector store files in the batch: ${vectorStoreFiles.data.map((f) => f.id).join(", ")}`, - ); - - // Delete files - await client.agents.deleteFile(file1.id); - console.log(`Deleted file1, file ID: ${file1.id}`); - await client.agents.deleteFile(file2.id); - console.log(`Deleted file2, file ID: ${file2.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/batchVectorStoreWithFilesAndPolling.ts b/sdk/ai/ai-projects/samples-dev/agents/batchVectorStoreWithFilesAndPolling.ts deleted file mode 100644 index ba39ef83546f..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/batchVectorStoreWithFilesAndPolling.ts +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the batch vector store with the list of files using polling operation. - * - * @summary demonstrates how to create the batch vector store with the list of files using polling operation. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload first file - const file1Content = "Hello, Vector Store!"; - const readable1 = new Readable(); - await readable1.push(file1Content); - await readable1.push(null); // end the stream - const file1 = await client.agents.uploadFile(readable1, "assistants", { - fileName: "vectorFile1.txt", - }); - console.log(`Uploaded file1, file ID: ${file1.id}`); - - // Create and upload second file - const file2Content = "This is another file for the Vector Store!"; - const readable2 = new Readable(); - await readable2.push(file2Content); - await readable2.push(null); // end the stream - const file2 = await client.agents.uploadFile(readable2, "assistants", { - fileName: "vectorFile2.txt", - }); - console.log(`Uploaded file2, file ID: ${file2.id}`); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create vector store file batch - const vectorStoreFileBatchOptions = { - fileIds: [file1.id, file2.id], - pollingOptions: { abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreFileBatchAndPoll( - vectorStore.id, - vectorStoreFileBatchOptions, - ); - const vectorStoreFileBatch = await poller.pollUntilDone(); - console.log( - `Created vector store file batch with status ${vectorStoreFileBatch.status}, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await client.agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // Delete files - await client.agents.deleteFile(file1.id); - console.log(`Deleted file1, file ID: ${file1.id}`); - await client.agents.deleteFile(file2.id); - console.log(`Deleted file2, file ID: ${file2.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/codeInterpreter.ts b/sdk/ai/ai-projects/samples-dev/agents/codeInterpreter.ts deleted file mode 100644 index 6ea3d3ae4ae1..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/codeInterpreter.ts +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with code interpreter from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with code interpreter. - * - */ - -import type { MessageImageFileContentOutput, MessageTextContentOutput } from "@azure/ai-projects"; -import { AIProjectsClient, isOutputOfType, ToolUtility } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file and wait for it to be processed - const filePath = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "localFile", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Create code interpreter tool - const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]); - - // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment - const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create a thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create a message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create a bar chart in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provide the file to me?", - }); - - console.log(`Created message, message ID: ${message.id}`); - - // Create and execute a run - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - // Check if you got "Rate limit is exceeded.", then you want to get more quota - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the original file from the agent to free up space (note: this does not delete your version of the file) - await client.agents.deleteFile(localFile.id); - console.log(`Deleted file, file ID: ${localFile.id}`); - - // Print the messages from the agent - const messages = await client.agents.listMessages(thread.id); - console.log("Messages:", messages); - - // Get most recent message from the assistant - const assistantMessage = messages.data.find((msg) => msg.role === "assistant"); - if (assistantMessage) { - const textContent = assistantMessage.content.find((content) => - isOutputOfType(content, "text"), - ) as MessageTextContentOutput; - if (textContent) { - console.log(`Last message: ${textContent.text.value}`); - } - } - - // Save the newly created file - console.log(`Saving new files...`); - const imageFile = (messages.data[0].content[0] as MessageImageFileContentOutput).imageFile; - console.log(`Image file ID : ${imageFile}`); - const imageFileName = path.resolve( - __dirname, - "../data/" + (await client.agents.getFile(imageFile.fileId)).filename + "ImageFile.png", - ); - - const fileContent = await ( - await client.agents.getFileContent(imageFile.fileId).asNodeStream() - ).body; - if (fileContent) { - const chunks: Buffer[] = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); - } else { - console.error("Failed to retrieve file content: fileContent is undefined"); - } - console.log(`Saved image file to: ${imageFileName}`); - - // Iterate through messages and print details for each annotation - console.log(`Message Details:`); - await messages.data.forEach((m) => { - console.log(`File Paths:`); - console.log(`Type: ${m.content[0].type}`); - if (isOutputOfType(m.content[0], "text")) { - const textContent = m.content[0] as MessageTextContentOutput; - console.log(`Text: ${textContent.text.value}`); - } - console.log(`File ID: ${m.id}`); - console.log(`Start Index: ${messages.firstId}`); - console.log(`End Index: ${messages.lastId}`); - }); - - // Delete the agent once done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/codeInterpreterWithStreaming.ts b/sdk/ai/ai-projects/samples-dev/agents/codeInterpreterWithStreaming.ts deleted file mode 100644 index 86c9d5100e62..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/codeInterpreterWithStreaming.ts +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with code interpreter from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with code interpreter. - * @azsdk-weight 100 - * - */ - -import type { - MessageDeltaChunk, - MessageDeltaTextContent, - MessageImageFileContentOutput, - MessageTextContentOutput, - ThreadRunOutput, -} from "@azure/ai-projects"; -import { - AIProjectsClient, - DoneEvent, - ErrorEvent, - isOutputOfType, - MessageStreamEvent, - RunStreamEvent, - ToolUtility, -} from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file and wait for it to be processed - const filePath = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "myLocalFile", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Create code interpreter tool - const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]); - - // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment - const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create a thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create a message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create a bar chart in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provide the file to me?", - }); - - console.log(`Created message, message ID: ${message.id}`); - - // Create and execute a run - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - // Delete the original file from the agent to free up space (note: this does not delete your version of the file) - await client.agents.deleteFile(localFile.id); - console.log(`Deleted file, file ID : ${localFile.id}`); - - // Print the messages from the agent - const messages = await client.agents.listMessages(thread.id); - console.log("Messages:", messages); - - // Get most recent message from the assistant - const assistantMessage = messages.data.find((msg) => msg.role === "assistant"); - if (assistantMessage) { - const textContent = assistantMessage.content.find((content) => - isOutputOfType(content, "text"), - ) as MessageTextContentOutput; - if (textContent) { - console.log(`Last message: ${textContent.text.value}`); - } - } - - // Save the newly created file - console.log(`Saving new files...`); - const imageFileOutput = messages.data[0].content[0] as MessageImageFileContentOutput; - const imageFile = imageFileOutput.imageFile.fileId; - const imageFileName = path.resolve( - __dirname, - "../data/" + (await client.agents.getFile(imageFile)).filename + "ImageFile.png", - ); - console.log(`Image file name : ${imageFileName}`); - - const fileContent = await (await client.agents.getFileContent(imageFile).asNodeStream()).body; - if (fileContent) { - const chunks: Buffer[] = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); - } else { - console.error("Failed to retrieve file content: fileContent is undefined"); - } - console.log(`Saved image file to: ${imageFileName}`); - - // Iterate through messages and print details for each annotation - console.log(`Message Details:`); - await messages.data.forEach((m) => { - console.log(`File Paths:`); - console.log(`Type: ${m.content[0].type}`); - if (isOutputOfType(m.content[0], "text")) { - const textContent = m.content[0] as MessageTextContentOutput; - console.log(`Text: ${textContent.text.value}`); - } - console.log(`File ID: ${m.id}`); - console.log(`Start Index: ${messages.firstId}`); - console.log(`End Index: ${messages.lastId}`); - }); - - // Delete the agent once done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/fileSearch.ts b/sdk/ai/ai-projects/samples-dev/agents/fileSearch.ts deleted file mode 100644 index d93a798fe259..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/fileSearch.ts +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with file searching from the Azure Agents service. - * - * @summary This sample demonstrates how to use agent operations with file searching. - * - */ - -import type { - MessageContentOutput, - MessageImageFileContentOutput, - MessageTextContentOutput, -} from "@azure/ai-projects"; -import { AIProjectsClient, isOutputOfType, ToolUtility } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file - const filePath = path.resolve(__dirname, "../data/sampleFileForUpload.txt"); - const localFileStream = fs.createReadStream(filePath); - const file = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "sampleFileForUpload.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store - const vectorStore = await client.agents.createVectorStore({ - fileIds: [file.id], - name: "myVectorStore", - }); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Initialize file search tool - const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]); - - // Create agent with files - const agent = await client.agents.createAgent("gpt-4o", { - name: "SDK Test Agent - Retrieval", - instructions: "You are helpful agent that can help fetch data from files you know about.", - tools: [fileSearchTool.definition], - toolResources: fileSearchTool.resources, - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Can you give me the documented codes for 'banana' and 'orange'?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - while (["queued", "in_progress"].includes(run.status)) { - await delay(500); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - } - - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - const messages = await client.agents.listMessages(thread.id); - await messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content: MessageContentOutput) => { - if (isOutputOfType(content, "text")) { - const textContent = content as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content as MessageImageFileContentOutput; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - - // Delete agent - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/files.ts b/sdk/ai/ai-projects/samples-dev/agents/files.ts deleted file mode 100644 index 884c44592e64..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/files.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic files agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic files agent operations. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create and upload file - const fileContent = "Hello, World!"; - const readable = new Readable(); - await readable.push(fileContent); - await readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { fileName: "myFile.txt" }); - console.log(`Uploaded file, file ID : ${file.id}`); - - // List uploaded files - const files = await client.agents.listFiles(); - - console.log(`List of files : ${files.data[0].filename}`); - - // Retrieve file - const _file = await client.agents.getFile(file.id); - - console.log(`Retrieved file, file ID : ${_file.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - - console.log(`Deleted file, file ID : ${file.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/filesWithLocalUpload.ts b/sdk/ai/ai-projects/samples-dev/agents/filesWithLocalUpload.ts deleted file mode 100644 index 703ac1f2bd70..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/filesWithLocalUpload.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic files agent operations with local file upload from the Azure Agents service. - * - * @summary demonstrates how to use basic files agent operations with local file upload. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload local file - const filePath = path.resolve(__dirname, "../data/localFile.txt"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "myLocalFile.txt", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Retrieve local file - const retrievedLocalFile = await client.agents.getFile(localFile.id); - - console.log(`Retrieved local file, file ID : ${retrievedLocalFile.id}`); - - // Delete local file - await client.agents.deleteFile(localFile.id); - - console.log(`Deleted local file, file ID : ${localFile.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/filesWithPolling.ts b/sdk/ai/ai-projects/samples-dev/agents/filesWithPolling.ts deleted file mode 100644 index a8fd23cfd3ea..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/filesWithPolling.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to upload a file and poll for its status. - * - * @summary demonstrates how to upload a file and poll for its status. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create file content - const fileContent = "Hello, World!"; - const readable = new Readable(); - await readable.push(fileContent); - await readable.push(null); // end the stream - - // Upload file and poll - const poller = client.agents.uploadFileAndPoll(readable, "assistants", { - fileName: "myPollingFile", - }); - const file = await poller.pollUntilDone(); - console.log(`Uploaded file with status ${file.status}, file ID : ${file.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID ${file.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/messages.ts b/sdk/ai/ai-projects/samples-dev/agents/messages.ts deleted file mode 100644 index 8e62c72d15b5..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/messages.ts +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic message agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic message agent operations. - * - */ - -import type { MessageTextContentOutput } from "@azure/ai-projects"; -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - const thread = await client.agents.createThread(); - - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - const messages = await client.agents.listMessages(thread.id); - console.log( - `Message ${message.id} contents: ${(messages.data[0].content[0] as MessageTextContentOutput).text.value}`, - ); - - const updatedMessage = await client.agents.updateMessage(thread.id, message.id, { - metadata: { introduction: "true" }, - }); - console.log(`Updated message metadata - introduction: ${updatedMessage.metadata?.introduction}`); - - await client.agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID : ${thread.id}`); - - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID : ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/runSteps.ts b/sdk/ai/ai-projects/samples-dev/agents/runSteps.ts deleted file mode 100644 index 7b35d72331f4..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/runSteps.ts +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic run agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic run agent operations. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create agent - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - console.log(`Created run, run ID: ${run.id}`); - - // Wait for run to complete - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await new Promise((resolve) => setTimeout(resolve, 1000)); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Run status: ${run.status}`); - } - - // List run steps - const runSteps = await client.agents.listRunSteps(thread.id, run.id); - console.log(`Listed run steps, run ID: ${run.id}`); - - // Get specific run step - const stepId = runSteps.data[0].id; - const step = await client.agents.getRunStep(thread.id, run.id, stepId); - console.log(`Retrieved run step, step ID: ${step.id}`); - - // Clean up - await client.agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/streaming.ts b/sdk/ai/ai-projects/samples-dev/agents/streaming.ts deleted file mode 100644 index 045b5f339861..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/streaming.ts +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations in streaming from the Azure Agents service. - * - * @summary demonstrates how to use agent operations in streaming. - * - */ - -import type { - MessageDeltaChunk, - MessageDeltaTextContent, - ThreadRunOutput, -} from "@azure/ai-projects"; -import { - AIProjectsClient, - DoneEvent, - ErrorEvent, - MessageStreamEvent, - RunStreamEvent, -} from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const agent = await client.agents.createAgent("gpt-4-1106-preview", { - name: "my-assistant", - instructions: "You are helpful agent", - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - const thread = await client.agents.createThread(); - - console.log(`Created thread, thread ID : ${agent.id}`); - - await client.agents.createMessage(thread.id, { role: "user", content: "Hello, tell me a joke" }); - - console.log(`Created message, thread ID : ${agent.id}`); - - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - await client.agents.deleteAgent(agent.id); - console.log(`Delete agent, agent ID : ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/threads.ts b/sdk/ai/ai-projects/samples-dev/agents/threads.ts deleted file mode 100644 index bb25307478f3..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/threads.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic thread agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic thread agent operations. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const thread = await client.agents.createThread(); - - console.log(`Created thread, thread ID : ${thread.id}`); - - const _thread = await client.agents.getThread(thread.id); - - console.log(`Retrieved thread, thread ID : ${_thread.id}`); - - await client.agents.deleteThread(thread.id); - - console.log(`Deleted thread, thread ID : ${_thread.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/vectorStoreWithFiles.ts b/sdk/ai/ai-projects/samples-dev/agents/vectorStoreWithFiles.ts deleted file mode 100644 index f29b4535a9d6..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/vectorStoreWithFiles.ts +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store with the list of files. - * - * @summary demonstrates how to create the vector store with the list of files. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload file - const fileContent = "Hello, Vector Store!"; - const readable = new Readable(); - await readable.push(fileContent); - await readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { - fileName: "vectorFile.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await client.agents.createVectorStoreFile(vectorStore.id, { - fileId: file.id, - }); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Retrieve vector store file - const _vectorStoreFile = await client.agents.getVectorStoreFile( - vectorStore.id, - vectorStoreFile.id, - ); - console.log(`Retrieved vector store file, vector store file ID: ${_vectorStoreFile.id}`); - - // List vector store files - const vectorStoreFiles = await client.agents.listVectorStoreFiles(vectorStore.id); - console.log(`List of vector store files: ${vectorStoreFiles.data.map((f) => f.id).join(", ")}`); - - // Delete vector store file - await client.agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/vectorStoreWithFilesAndPolling.ts b/sdk/ai/ai-projects/samples-dev/agents/vectorStoreWithFilesAndPolling.ts deleted file mode 100644 index 7d8bd6aa8187..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/vectorStoreWithFilesAndPolling.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store with the list of files using polling operation. - * - * @summary demonstrates how to create the vector store with the list of files using polling operation. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload file - const fileContent = "Hello, Vector Store!"; - const readable = new Readable(); - await readable.push(fileContent); - await readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { - fileName: "vectorFile.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create vector store file - const vectorStoreFileOptions = { - fileId: file.id, - pollingOptions: { sleepIntervalInMs: 2000, abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreFileAndPoll(vectorStore.id, vectorStoreFileOptions); - const vectorStoreFile = await poller.pollUntilDone(); - console.log( - `Created vector store file with status ${vectorStoreFile.status}, vector store file ID: ${vectorStoreFile.id}`, - ); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/vectorStores.ts b/sdk/ai/ai-projects/samples-dev/agents/vectorStores.ts deleted file mode 100644 index bcfd96c16cec..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/vectorStores.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store. - * - * @summary demonstrates how to create the vector store. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create a vector store - const vectorStore = await client.agents.createVectorStore({ name: "myVectorStore" }); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // List vector stores - const vectorStores = await client.agents.listVectorStores(); - console.log("List of vector stores:", vectorStores); - - // Modify the vector store - const updatedVectorStore = await client.agents.modifyVectorStore(vectorStore.id, { - name: "updatedVectorStore", - }); - console.log(`Updated vector store, vector store ID: ${updatedVectorStore.id}`); - - // Get a specific vector store - const retrievedVectorStore = await client.agents.getVectorStore(vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${retrievedVectorStore.id}`); - - // Delete the vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/agents/vectorStoresWithPolling.ts b/sdk/ai/ai-projects/samples-dev/agents/vectorStoresWithPolling.ts deleted file mode 100644 index f5611860f210..000000000000 --- a/sdk/ai/ai-projects/samples-dev/agents/vectorStoresWithPolling.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store using polling operation. - * - * @summary demonstrates how to create the vector store using polling operation. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create a vector store - const vectorStoreOptions = { - name: "myVectorStore", - pollingOptions: { sleepIntervalInMs: 2000, abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreAndPoll(vectorStoreOptions); - const vectorStore = await poller.pollUntilDone(); - console.log( - `Created vector store with status ${vectorStore.status}, vector store ID: ${vectorStore.id}`, - ); - - // Get a specific vector store - const retrievedVectorStore = await client.agents.getVectorStore(vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${retrievedVectorStore.id}`); - - // Delete the vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/connections/connectionsBasics.ts b/sdk/ai/ai-projects/samples-dev/connections/connectionsBasics.ts deleted file mode 100644 index e9e576615f9d..000000000000 --- a/sdk/ai/ai-projects/samples-dev/connections/connectionsBasics.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to how to use basic connections operations. - * - * @summary Given an AIProjectClient, this sample demonstrates how to enumerate the properties of all connections, - * get the properties of a default connection, and get the properties of a connection by its name. - * - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Get the properties of the specified machine learning workspace - const workspace = await client.connections.getWorkspace(); - console.log(`Retrieved workspace, workspace name: ${workspace.name}`); - - // List the details of all the connections - const connections = await client.connections.listConnections(); - console.log(`Retrieved ${connections.length} connections`); - - // Get the details of a connection, without credentials - const connectionName = connections[0].name; - const connection = await client.connections.getConnection(connectionName); - console.log(`Retrieved connection, connection name: ${connection.name}`); - - // Get the details of a connection, including credentials (if available) - const connectionWithSecrets = await client.connections.getConnectionWithSecrets(connectionName); - console.log(`Retrieved connection with secrets, connection name: ${connectionWithSecrets.name}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples-dev/data/localFile.txt b/sdk/ai/ai-projects/samples-dev/data/localFile.txt deleted file mode 100644 index 8ab686eafeb1..000000000000 --- a/sdk/ai/ai-projects/samples-dev/data/localFile.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! diff --git a/sdk/ai/ai-projects/samples-dev/data/nifty500QuarterlyResults.csv b/sdk/ai/ai-projects/samples-dev/data/nifty500QuarterlyResults.csv deleted file mode 100644 index e02068e09042..000000000000 --- a/sdk/ai/ai-projects/samples-dev/data/nifty500QuarterlyResults.csv +++ /dev/null @@ -1,502 +0,0 @@ -name,NSE_code,BSE_code,sector,industry,revenue,operating_expenses,operating_profit,operating_profit_margin,depreciation,interest,profit_before_tax,tax,net_profit,EPS,profit_TTM,EPS_TTM -3M India Ltd.,3MINDIA,523395,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"1,057",847.4,192.1,18.48%,12.9,0.7,195.9,49.8,146.1,129.7,535.9,475.7 -ACC Ltd.,ACC,500410,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"4,644.8","3,885.4",549.3,12.39%,212.8,28.9,517.7,131.5,387.9,20.7,"1,202.7",64 -AIA Engineering Ltd.,AIAENG,532683,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,"1,357.1",912.7,382.1,29.51%,24.5,7.4,412.5,88.4,323.1,34.3,"1,216.1",128.9 -APL Apollo Tubes Ltd.,APLAPOLLO,533758,METALS & MINING,IRON & STEEL PRODUCTS,"4,65","4,305.4",325,7.02%,41.3,26.6,276.7,73.8,202.9,7.3,767.5,27.7 -Au Small Finance Bank Ltd.,AUBANK,540611,BANKING AND FINANCE,BANKS,"2,956.5","1,026.7",647.7,25.59%,0,"1,282.1",533.4,131.5,401.8,6,"1,606.2",24 -Adani Ports & Special Economic Zone Ltd.,ADANIPORTS,532921,TRANSPORTATION,MARINE PORT & SERVICES,"6,951.9","2,982.4","3,664",55.13%,974.5,520.1,"2,474.9",759,"1,747.8",8.1,"6,337",29.3 -Adani Energy Solutions Ltd.,ADANIENSOL,ASM,UTILITIES,ELECTRIC UTILITIES,"3,766.5","2,169.3","1,504.6",40.95%,432.1,640.8,369.9,84.9,275.9,2.5,"1,315.1",11.8 -Aditya Birla Fashion and Retail Ltd.,ABFRL,535755,RETAILING,DEPARTMENT STORES,"3,272.2","2,903.6",322.9,10.01%,388.8,208.4,-228.6,-28.2,-179.2,-1.9,-491.7,-5.2 -Aegis Logistics Ltd.,AEGISCHEM,500003,OIL & GAS,OIL MARKETING & DISTRIBUTION,"1,279.3","1,026.5",208.3,16.87%,34.1,26.6,192,42,127,3.6,509,14.5 -Ajanta Pharma Ltd.,AJANTPHARM,532331,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,049.8",737.8,290.7,28.26%,33.7,2.3,275.9,80.6,195.3,15.5,660.2,52.3 -Alembic Pharmaceuticals Ltd.,APLLTD,533573,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,605.1","1,386.7",208.2,13.06%,67.6,15.7,135.1,-1.9,136.6,7,531.7,27 -Alkem Laboratories Ltd.,ALKEM,539523,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"3,503.4","2,693.4",746.7,21.71%,73.9,30.3,648,33.1,620.5,51.9,"1,432.9",119.9 -Amara Raja Energy & Mobility Ltd.,ARE&M,500008,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,988.6","2,556.9",402.5,13.60%,115.7,6.2,309.8,83.5,226.3,13.2,779.8,45.7 -Ambuja Cements Ltd.,AMBUJACEM,500425,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"7,9","6,122.1","1,301.8",17.54%,380.9,61.2,"1,335.7",352.5,793,4,"2,777.9",14 -Apollo Hospitals Enterprise Ltd.,APOLLOHOSP,508869,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"4,869.1","4,219.4",627.5,12.95%,163.4,111.3,376.9,130.2,232.9,16.2,697.5,48.5 -Apollo Tyres Ltd.,APOLLOTYRE,500877,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"6,304.9","5,119.8","1,159.8",18.47%,360.3,132.8,679.9,205.8,474.3,7.5,"1,590.7",25 -Ashok Leyland Ltd.,ASHOKLEY,500477,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"11,463","9,558.6","1,870.4",16.37%,226.6,715.1,924.4,358,526,1.8,"2,141.5",7.3 -Asian Paints Ltd.,ASIANPAINT,500820,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"8,643.8","6,762.3","1,716.2",20.24%,208.7,50.9,"1,621.8",418.6,"1,205.4",12.6,"5,062.6",52.8 -Astral Ltd.,ASTRAL,532830,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,"1,376.4","1,142.9",220.1,16.15%,48.7,8,176.8,45.1,131.2,4.9,549.7,20.4 -Atul Ltd.,ATUL,500027,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,215.8","1,038.5",155.2,13.00%,54,1.9,121.5,32.5,90.3,30.6,392.3,132.9 -Aurobindo Pharma Ltd.,AUROPHARMA,524804,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"7,406.4","5,846","1,373.4",19.02%,417.5,68.2,"1,074.7",323.7,757.2,12.8,"2,325.5",39.7 -Avanti Feeds Ltd.,AVANTIFEED,512573,FOOD BEVERAGES & TOBACCO,OTHER FOOD PRODUCTS,"1,312","1,184.5",94,7.35%,14.3,0.2,113,30.5,74.2,5.5,336.4,24.7 -Avenue Supermarts Ltd.,DMART,540376,RETAILING,DEPARTMENT STORES,"12,661.3","11,619.4","1,005",7.96%,174.4,15.6,851.9,228.6,623.6,9.6,"2,332.1",35.8 -Axis Bank Ltd.,AXISBANK,532215,BANKING AND FINANCE,BANKS,"33,122.2","9,207.3","9,166",33.43%,0,"14,749","8,313.8","2,096.1","6,204.1",20.1,"13,121",42.6 -Bajaj Auto Ltd.,BAJAJ-AUTO,532977,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"11,206.8","8,708.1","2,130.1",19.65%,91.8,6.5,"2,400.4",564,"2,02",71.4,"6,841.6",241.8 -Bajaj Finance Ltd.,BAJFINANCE,500034,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"13,381.8","2,851.5","9,449.7",70.63%,158.5,"4,537.1","4,757.6","1,207","3,550.8",58.7,"13,118.5",216.7 -Bajaj Finserv Ltd.,BAJAJFINSV,532978,DIVERSIFIED,HOLDING COMPANIES,"26,022.7","14,992.2","9,949.9",38.24%,208.8,"4,449.1","5,292","1,536.5","1,929",12.1,"7,422.6",46.6 -Bajaj Holdings & Investment Ltd.,BAJAJHLDNG,500490,DIVERSIFIED,HOLDING COMPANIES,240.1,33.5,191.2,85.08%,8.4,0.2,197.9,73.9,"1,491.2",134,"5,545.1",498.3 -Balkrishna Industries Ltd.,BALKRISIND,502355,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"2,360.3","1,720.5",532.7,23.64%,160.4,23.9,455.5,108.1,347.4,18,"1,047.5",54.2 -Balrampur Chini Mills Ltd.,BALRAMCHIN,500038,FOOD BEVERAGES & TOBACCO,SUGAR,"1,649","1,374.6",164.9,10.71%,41.2,17.2,215.9,56.6,166.3,8.2,540.5,26.8 -Bank of Baroda,BANKBARODA,532134,BANKING AND FINANCE,BANKS,"35,766","8,430.4","9,807.9",33.52%,0,"17,527.7","6,022.8","1,679.7","4,458.4",8.5,"18,602.9",35.9 -Bank of India,BANKINDIA,532149,BANKING AND FINANCE,BANKS,"16,779.4","3,704.9","3,818.8",25.35%,0,"9,255.7","2,977.4","1,488.6","1,498.5",3.6,"5,388.7",13.1 -Bata India Ltd.,BATAINDIA,500043,RETAILING,FOOTWEAR,834.6,637.5,181.7,22.18%,81.7,28.4,46.1,12.1,34,2.6,289.7,22.5 -Berger Paints (India) Ltd.,BERGEPAINT,509480,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"2,782.6","2,293.7",473.6,17.12%,82.9,21.1,385,96.7,291.6,2.5,"1,032.6",8.9 -Bharat Electronics Ltd.,BEL,500049,GENERAL INDUSTRIALS,DEFENCE,"4,146.1","2,994.9","1,014.2",25.30%,108.3,1.5,"1,041.5",260.7,789.4,1.1,"3,323",4.5 -Bharat Forge Ltd.,BHARATFORG,500493,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"3,826.7","3,152.8",621.4,16.47%,211.3,124.3,336.1,121.8,227.2,4.9,783.7,16.8 -Bharat Heavy Electricals Ltd.,BHEL,500103,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"5,305.4","5,513",-387.7,-7.56%,59.9,180.4,-447.9,-197.9,-238.1,-0.7,71.3,0.2 -Bharat Petroleum Corporation Ltd.,BPCL,500547,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"103,72","90,103.9","12,940.5",12.56%,"1,605.3",973.2,"10,755.7","2,812.2","8,243.5",38.7,"27,505.3",129.2 -Bharti Airtel Ltd.,BHARTIARTL,532454,TELECOM SERVICES,TELECOM SERVICES,"37,374.2","17,530.1","19,513.7",52.68%,"9,734.3","5,185.8","3,353.7","1,846.5","1,340.7",2.4,"7,547",13.2 -Indus Towers Ltd.,INDUSTOWER,534816,TELECOM SERVICES,OTHER TELECOM SERVICES,"7,229.7","3,498.8","3,633.7",50.95%,"1,525.6",458.6,"1,746.7",452,"1,294.7",4.8,"3,333.5",12.4 -Biocon Ltd.,BIOCON,532523,PHARMACEUTICALS & BIOTECHNOLOGY,BIOTECHNOLOGY,"3,620.2","2,720.7",741.6,21.42%,389.3,247.7,238.5,41.6,125.6,1.1,498.4,4.2 -Birla Corporation Ltd.,BIRLACORPN,500335,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,313.2","1,997",288.9,12.64%,143.5,95.4,77.1,18.8,58.4,7.6,153.1,19.9 -Blue Dart Express Ltd.,BLUEDART,526612,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"1,329.7","1,101.8",222.7,16.82%,110.6,19.5,97.9,24.8,73.1,30.8,292.4,123.2 -Blue Star Ltd.,BLUESTARCO,500067,CONSUMER DURABLES,CONSUMER ELECTRONICS,"1,903.4","1,767.7",122.7,6.49%,23,17.6,95,24.3,70.7,3.6,437.7,21.3 -Bombay Burmah Trading Corporation Ltd.,BBTC,501425,FOOD BEVERAGES & TOBACCO,TEA & COFFEE,"4,643.5","3,664.7",859.2,18.99%,74.7,154.6,697.1,212.6,122,17.5,"-1,499.5",-214.8 -Bosch Ltd.,BOSCHLTD,500530,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"4,284.3","3,638.8",491.3,11.90%,101.3,12.2,"1,317",318.1,999.8,339,"2,126.9",721 -Brigade Enterprises Ltd.,BRIGADE,532929,REALTY,REALTY,"1,407.9","1,041.8",324.8,23.77%,75.7,110,180.3,67.8,133.5,5.8,298.2,12.9 -Britannia Industries Ltd.,BRITANNIA,500825,FMCG,PACKAGED FOODS,"4,485.2","3,560.5",872.4,19.68%,71.7,53.4,799.7,212.1,587.6,24.4,"2,536.2",105.3 -CCL Products India Ltd.,CCL,519600,FOOD BEVERAGES & TOBACCO,TEA & COFFEE,608.3,497.7,109.9,18.09%,22.6,18.4,69.7,8.8,60.9,4.6,279.9,21 -Crisil Ltd.,CRISIL,500092,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,771.8,544.2,191.7,26.05%,26.5,0.8,200.3,48.3,152,20.8,606.3,82.9 -Zydus Lifesciences Ltd.,ZYDUSLIFE,532321,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"4,422.8","3,222.7","1,146.1",26.23%,184.2,8.7,"1,007.2",226.4,800.7,7.9,"2,807.1",27.7 -Can Fin Homes Ltd.,CANFINHOME,511196,BANKING AND FINANCE,HOUSING FINANCE,871,49.7,749.2,86.01%,2.8,548.4,198,39.9,158.1,11.9,658.8,49.5 -Canara Bank,CANBK,532483,BANKING AND FINANCE,BANKS,"33,891.2","8,250.3","7,706.6",28.24%,0,"17,934.3","5,098","1,420.6","3,86",20.9,"13,968.4",77 -Carborundum Universal Ltd.,CARBORUNIV,513375,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"1,166",978.8,167.5,14.61%,45.9,4.9,136.4,43.7,101.9,5.4,461.3,24.3 -Castrol India Ltd.,CASTROLIND,500870,OIL & GAS,OIL MARKETING & DISTRIBUTION,"1,203.2",914.4,268.6,22.70%,22.9,2.4,263.5,69.1,194.4,2,815.5,8.2 -Ceat Ltd.,CEATLTD,500878,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"3,063.8","2,597.2",456.1,14.94%,124.5,71.7,270.4,68.3,208,51.4,521.7,129 -Central Bank of India,CENTRALBK,532885,BANKING AND FINANCE,BANKS,"8,438.5","2,565.4","1,535.4",20.81%,0,"4,337.7",567.2,-41.5,622,0.7,"2,181.4",2.5 -Century Plyboards (India) Ltd.,CENTURYPLY,532548,FOREST MATERIALS,FOREST PRODUCTS,"1,011.4",852.5,144.3,14.47%,23.4,6.1,129.4,32.2,96.9,4.4,380.7,17.1 -Cera Sanitaryware Ltd.,CERA,532443,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,476.2,387.2,76.5,16.49%,8.9,1.4,77.2,19.8,56.9,43.8,232.4,178.7 -Chambal Fertilisers & Chemicals Ltd.,CHAMBLFERT,500085,FERTILIZERS,FERTILIZERS,"5,467.3","4,770.5",615,11.42%,78.4,45.8,572.6,200.2,381,9.2,"1,137.7",27.3 -Cholamandalam Investment & Finance Company Ltd.,CHOLAFIN,511243,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"4,695.2",987.6,"3,235.1",69.99%,38.5,"2,204.2","1,065",288.8,772.9,9.4,"3,022.8",36.7 -Cipla Ltd.,CIPLA,500087,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"6,854.5","4,944.4","1,733.8",25.96%,290,25.8,"1,594.2",438.4,"1,130.9",14,"3,449.1",42.7 -City Union Bank Ltd.,CUB,532210,BANKING AND FINANCE,BANKS,"1,486.1",333.9,386.6,29.65%,0,765.6,330.6,50,280.6,3.8,943.8,12.7 -Coal India Ltd.,COALINDIA,533278,METALS & MINING,COAL,"34,760.3","24,639.4","8,137",24.83%,"1,178.2",182.5,"8,760.2","2,036.5","6,799.8",11,"28,059.6",45.5 -Colgate-Palmolive (India) Ltd.,COLPAL,500830,FMCG,PERSONAL PRODUCTS,"1,492.1",989,482.1,32.77%,44.3,1.1,457.8,117.8,340.1,12.5,"1,173.2",43.1 -Container Corporation of India Ltd.,CONCOR,531344,COMMERCIAL SERVICES & SUPPLIES,WAREHOUSING AND LOGISTICS,"2,299.8","1,648.4",546.5,24.90%,153.1,16.5,481.8,119,367.4,6,"1,186.2",19.5 -Coromandel International Ltd.,COROMANDEL,506395,FERTILIZERS,FERTILIZERS,"7,032.9","5,929.4","1,058.7",15.15%,54,46.2,"1,003.3",245,756.9,25.7,"2,024.2",68.8 -Crompton Greaves Consumer Electricals Ltd.,CROMPTON,539876,CONSUMER DURABLES,HOUSEHOLD APPLIANCES,"1,797.2","1,607.8",174.5,9.79%,32.1,21.5,135.8,34.9,97.2,1.5,432,6.7 -Cummins India Ltd.,CUMMINSIND,500480,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"2,011.3","1,575.4",346.2,18.02%,38.3,6.8,390.9,99.6,329.1,11.9,"1,445.5",52.1 -Cyient Ltd.,CYIENT,532175,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,792","1,452.7",325.8,18.32%,65.8,27,240.3,56.7,178.3,16.3,665.6,60.1 -DCM Shriram Ltd.,DCMSHRIRAM,523367,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"2,73","2,593.9",114.1,4.21%,74,14.7,47.5,15.2,32.2,2.1,617.6,39.4 -DLF Ltd.,DLF,532868,REALTY,REALTY,"1,476.4",885.3,462.4,34.31%,37,90.2,464,112.2,622.8,2.5,"2,239",9 -Dabur India Ltd.,DABUR,500096,FMCG,PERSONAL PRODUCTS,"3,320.2","2,543",660.9,20.63%,98.3,28.1,650.8,144.3,515,2.9,"1,755.7",9.9 -Delta Corp Ltd.,DELTACORP,532848,COMMERCIAL SERVICES & SUPPLIES,MISC. COMMERCIAL SERVICES,282.6,170.5,100.1,36.99%,16.9,2.7,92.4,23,69.4,2.6,273.3,10.2 -Divi's Laboratories Ltd.,DIVISLAB,532488,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,995","1,43",479,25.09%,95,1,469,121,348,13.1,"1,331.8",50.3 -Dr. Lal Pathlabs Ltd.,LALPATHLAB,539524,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,619.4,423.5,177.8,29.57%,35.9,7.8,152.2,41.5,109.3,13.2,301.4,36.1 -Dr. Reddy's Laboratories Ltd.,DRREDDY,500124,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"7,217.6","4,888.8","2,008.3",29.09%,375.5,35.3,"1,912.5",434.5,"1,482.2",89.1,"5,091.2",305.2 -EID Parry (India) Ltd.,EIDPARRY,500125,FOOD BEVERAGES & TOBACCO,OTHER FOOD PRODUCTS,"9,210.3","8,002","1,057.5",11.67%,101.2,74.2,"1,032.8",246.8,452.3,25.5,991,55.8 -Eicher Motors Ltd.,EICHERMOT,505200,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"4,388.3","3,027.4","1,087.2",26.42%,142.5,12.7,"1,205.7",291.1,"1,016.2",37.1,"3,581",130.8 -Emami Ltd.,EMAMILTD,531162,FMCG,PERSONAL PRODUCTS,876,631.2,233.7,27.02%,46.1,2.2,196.4,15.8,178.5,4.1,697.8,16 -Endurance Technologies Ltd.,ENDURANCE,540153,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,560.5","2,226.7",318.3,12.51%,118.4,9.8,205.6,51.1,154.6,11,562.8,40 -Engineers India Ltd.,ENGINERSIN,532178,COMMERCIAL SERVICES & SUPPLIES,CONSULTING SERVICES,833.6,691.3,98.5,12.47%,8.3,0.4,133.6,32.2,127.5,2.3,472.7,8.4 -Escorts Kubota Ltd.,ESCORTS,500495,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"2,154.4","1,798.6",260.7,12.66%,40.8,3.1,311.9,79.7,223.3,20.6,910.5,82.4 -Exide Industries Ltd.,EXIDEIND,500086,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"4,408.9","3,872.4",499.1,11.42%,141.5,29.7,365.3,95.2,269.4,3.2,872.7,10.3 -Federal Bank Ltd.,FEDERALBNK,500469,BANKING AND FINANCE,BANKS,"6,548.2","1,603.8","1,400.3",24.18%,0,"3,544.1","1,342.7",342.6,994.1,4.3,"3,671.4",15.6 -Finolex Cables Ltd.,FINCABLES,500144,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,229.3","1,041.3",146.1,12.30%,10.8,0.4,176.7,52.3,154.2,10.1,643.9,42.1 -Finolex Industries Ltd.,FINPIPE,500940,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,944.5,780.2,103,11.66%,27.4,12.5,124.5,35.4,98,1.6,459.3,7.4 -Firstsource Solutions Ltd.,FSL,532809,SOFTWARE & SERVICES,BPO/KPO,"1,556.9","1,311.2",228.8,14.86%,65.4,26.1,154.3,27.8,126.5,1.9,551.7,7.9 -GAIL (India) Ltd.,GAIL,532155,UTILITIES,UTILITIES,"33,191","29,405.5","3,580.2",10.85%,837.3,199.6,"2,748.7",696.3,"2,444.1",3.7,"5,283.8",8 -GlaxoSmithKline Pharmaceuticals Ltd.,GLAXO,500660,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,985.2,667.5,289.5,30.25%,18.1,0.4,299.2,81.7,217.5,12.8,647.8,38.2 -Glenmark Pharmaceuticals Ltd.,GLENMARK,532296,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"3,209.1","2,745.1",462.3,14.41%,141.5,121.5,-124.4,55.9,-81.9,-2.9,-196.3,-7 -Godrej Consumer Products Ltd.,GODREJCP,532424,FMCG,PERSONAL PRODUCTS,"3,667.9","2,897.8",704.2,19.55%,60.9,77.3,619.4,186.6,432.8,4.2,"1,750.1",17.1 -Godrej Industries Ltd.,GODREJIND,500164,DIVERSIFIED,DIVERSIFIED,"4,256.9","3,672.1",265.5,6.74%,89.3,333.1,162.4,75.9,87.3,2.6,880,26.1 -Godrej Properties Ltd.,GODREJPROP,533150,REALTY,REALTY,605.1,404.7,-61.7,-17.98%,7.4,48,145.1,38.8,66.8,2.4,662.6,23.8 -Granules India Ltd.,GRANULES,532482,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,191",976.5,213,17.90%,52.5,26,136,33.9,102.1,4.2,393.9,16.3 -Great Eastern Shipping Company Ltd.,GESHIP,500620,TRANSPORTATION,SHIPPING,"1,461.5",585.6,643.4,52.35%,186.7,77.1,611.9,17.3,594.7,41.6,"2,520.1",176.5 -Gujarat Alkalies & Chemicals Ltd.,GUJALKALI,530001,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"1,042.3",926.1,45.2,4.65%,95.2,10.8,10.2,-0.1,-18.4,-2.5,82.7,11.3 -Gujarat Gas Ltd.,GUJGASLTD,539336,UTILITIES,UTILITIES,"4,019.3","3,494.5",496.6,12.44%,117.9,7.8,399.1,102.9,296.2,4.3,"1,254.3",18.2 -Gujarat Narmada Valley Fertilizers & Chemicals Ltd.,GNFC,500670,FERTILIZERS,FERTILIZERS,"2,232","1,911",169,8.12%,78,1,242,64,182,11.7,932,60.1 -Gujarat Pipavav Port Ltd.,GPPL,533248,TRANSPORTATION,MARINE PORT & SERVICES,270.4,102,150.6,59.64%,28.8,2.2,141.1,53.4,92.3,1.9,341.8,7.1 -Gujarat State Fertilizer & Chemicals Ltd.,GSFC,500690,FERTILIZERS,FERTILIZERS,"3,313.2","2,881.4",237.3,7.61%,45.7,1.6,387,78.1,308.9,7.8,"1,056.2",26.5 -Gujarat State Petronet Ltd.,GSPL,532702,UTILITIES,UTILITIES,"4,455.9","3,497.2",913.7,20.72%,165,14.5,779.2,198.7,454.6,8.1,"1,522",27 -HCL Technologies Ltd.,HCLTECH,532281,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"27,037","20,743","5,929",22.23%,"1,01",156,"5,128","1,295","3,832",14.2,"15,445",56.9 -HDFC Bank Ltd.,HDFCBANK,500180,BANKING AND FINANCE,BANKS,"107,566.6","42,037.6","24,279.1",32.36%,0,"41,249.9","20,967.4","3,655","16,811.4",22.2,"54,474.6",71.8 -Havells India Ltd.,HAVELLS,517354,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"3,952.8","3,527",373.4,9.57%,81.2,9.3,335.3,86.2,249.1,4,"1,177.7",18.8 -Hero MotoCorp Ltd.,HEROMOTOCO,500182,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"9,741.2","8,173.5","1,359.5",14.26%,187.1,25,"1,355.6",353.1,"1,006.3",50.3,"3,247.6",162.5 -HFCL Ltd.,HFCL,500183,TELECOMMUNICATIONS EQUIPMENT,TELECOM CABLES,"1,128.7",978.9,132.6,11.93%,21.4,34.8,93.5,24,69.4,0.5,305.5,2.1 -Hindalco Industries Ltd.,HINDALCO,500440,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"54,632","48,557","5,612",10.36%,"1,843","1,034","3,231","1,035","2,196",9.9,"8,423",37.9 -Hindustan Copper Ltd.,HINDCOPPER,513599,METALS & MINING,COPPER,392.6,260.2,121.2,31.77%,45.6,4.1,82.6,21.9,60.7,0.6,320.5,3.3 -Hindustan Petroleum Corporation Ltd.,HINDPETRO,500104,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"96,093.4","87,512","8,24",8.61%,"1,247.3",590,"6,744.1","1,616","5,827",41.1,"16,645",117.3 -Hindustan Unilever Ltd.,HINDUNILVR,500696,FMCG,PERSONAL PRODUCTS,"15,806","11,826","3,797",24.30%,297,88,"3,59",931,"2,656",11.3,"10,284",43.8 -Hindustan Zinc Ltd.,HINDZINC,500188,METALS & MINING,ZINC,"7,014","3,652","3,139",46.22%,825,232,"2,305",576,"1,729",4.1,"8,432",20 -Housing and Urban Development Corporation Ltd.,HUDCO,540530,BANKING AND FINANCE,HOUSING FINANCE,"1,880.8",82.7,"1,809.6",97.04%,2.4,"1,216.8",606.4,154.7,451.6,2.3,"1,790.7",8.9 -ITC Ltd.,ITC,500875,FOOD BEVERAGES & TOBACCO,CIGARETTES-TOBACCO PRODUCTS,"18,439.3","11,320.2","6,454.2",36.31%,453,9.9,"6,656.2","1,700.3","4,898.1",3.9,"20,185.1",16.2 -ICICI Bank Ltd.,ICICIBANK,532174,BANKING AND FINANCE,BANKS,"57,292.3","23,911","15,473.2",39.74%,0,"17,908","14,824.2","3,808.8","11,805.6",15.6,"41,086.8",58.7 -ICICI Prudential Life Insurance Company Ltd.,ICICIPRULI,540133,BANKING AND FINANCE,LIFE INSURANCE,"17,958.1","17,612.3",-229.6,-1.32%,0,0,340.2,32.5,243.9,1.7,906.9,6.3 -IDBI Bank Ltd.,IDBI,500116,BANKING AND FINANCE,BANKS,"7,063.7","1,922.3","2,175.3",36.02%,0,"2,966.1","2,396.9","1,003.7","1,385.4",1.3,"4,776.3",4.4 -IDFC First Bank Ltd.,IDFCFIRSTB,539437,BANKING AND FINANCE,BANKS,"8,765.8","3,849","1,511.2",20.54%,0,"3,405.6",982.8,236,746.9,1.1,"2,911.1",4.3 -IDFC Ltd.,IDFC,532659,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),36.7,6,30.6,83.56%,0,0,30.6,6.6,223.5,1.4,"4,147.1",25.9 -IRB Infrastructure Developers Ltd.,IRB,532947,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,874.5",950.4,794.6,45.54%,232.7,434.6,256.9,85.8,95.7,0.2,501,0.8 -ITI Ltd.,ITI,523610,TELECOMMUNICATIONS EQUIPMENT,TELECOM EQUIPMENT,256.1,299.3,-52.8,-21.42%,13.3,69.3,-125.8,0,-126,-1.3,-388.4,-4 -Vodafone Idea Ltd.,IDEA,532822,TELECOM SERVICES,TELECOM SERVICES,"10,750.8","6,433.5","4,282.8",39.97%,"5,667.3","6,569","-7,919",817.7,"-8,737.9",-1.8,"-30,986.8",-6.4 -India Cements Ltd.,INDIACEM,530005,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,272.4","1,26",4.4,0.35%,55,60.4,-103,-17.4,-80.1,-2.6,-261.1,-8.4 -Indiabulls Housing Finance Ltd.,IBULHSGFIN,535789,BANKING AND FINANCE,HOUSING FINANCE,"2,242.3",190.6,"1,779.2",79.88%,22.9,"1,349.8",421.6,123.6,298,6.5,"1,146",24.3 -Indian Bank,INDIANB,532814,BANKING AND FINANCE,BANKS,"15,929.4","3,599.1","4,327.7",31.44%,0,"8,002.6","2,776.7",768.6,"2,068.5",16.6,"6,893.3",55.3 -Indian Hotels Company Ltd.,INDHOTEL,500850,HOTELS RESTAURANTS & TOURISM,HOTELS,"1,480.9","1,078.4",354.8,24.75%,111.2,59,232.2,72.3,166.9,1.2,"1,100.3",7.7 -Indian Oil Corporation Ltd.,IOC,530965,OIL & GAS,OIL MARKETING & DISTRIBUTION,"179,752.1","156,013.1","23,328.4",13.01%,"3,609.6","2,135","18,090.2","4,699.7","13,114.3",9.5,"38,614.3",27.3 -Indian Overseas Bank,IOB,532388,BANKING AND FINANCE,BANKS,"6,941.5","1,785.1","1,679.8",28.84%,0,"3,476.6",635.5,8.3,627.2,0.3,"2,341.9",1.2 -Indraprastha Gas Ltd.,IGL,532514,UTILITIES,UTILITIES,"3,520.2","2,801.6",656.9,18.99%,102.2,2.5,613.9,151.4,552.7,7.9,"1,806.2",25.8 -IndusInd Bank Ltd.,INDUSINDBK,532187,BANKING AND FINANCE,BANKS,"13,529.7","3,449.9","3,908.7",34.75%,0,"6,171.1","2,934.9",732.9,"2,202.2",28.4,"8,333.7",107.2 -Info Edge (India) Ltd.,NAUKRI,532777,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,792,421.2,204.7,32.70%,25.9,8.2,382.8,68.7,205.1,15.9,-25.6,-2 -InterGlobe Aviation Ltd.,INDIGO,539448,TRANSPORTATION,AIRLINES,"15,502.9","12,743.6","2,200.3",14.72%,"1,549","1,021.3",189.1,0.2,188.9,4.9,"5,621.3",145.7 -Ipca Laboratories Ltd.,IPCALAB,524494,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,072.5","1,712.7",321.3,15.80%,90.3,44.1,225.4,87.9,145.1,5.7,492.2,19.4 -J B Chemicals & Pharmaceuticals Ltd.,JBCHEPHARM,506943,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,889.4,638.2,243.5,27.62%,32.2,10.4,208.7,58.1,150.6,9.7,486.6,31.4 -JK Cement Ltd.,JKCEMENT,532644,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,782.1","2,285.8",467,16.96%,137.1,115,244.2,65.7,178.1,23.1,444,57.5 -JK Lakshmi Cement Ltd.,JKLAKSHMI,500380,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,588.5","1,357.3",217.3,13.80%,56.6,33.6,141,45.1,92.7,7.9,357.6,30.4 -JM Financial Ltd.,JMFINANCIL,523405,DIVERSIFIED,HOLDING COMPANIES,"1,214",407.9,662.6,55.34%,13.2,388.1,277.9,72.4,194.9,2,608.1,6.4 -JSW Energy Ltd.,JSWENERGY,533148,UTILITIES,ELECTRIC UTILITIES,"3,387.4","1,379","1,880.4",57.69%,408.7,513.7,"1,085.9",235.1,850.2,5.2,"1,591.7",9.7 -JSW Steel Ltd.,JSWSTEEL,500228,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"44,821","36,698","7,886",17.69%,"2,019","2,084","4,609","1,812","2,76",11.4,"9,252",38.1 -Jindal Stainless Ltd.,JSL,532508,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"9,829","8,566.5","1,230.6",12.56%,221.9,155.6,985.7,229.1,774.3,9.4,"2,600.2",31.6 -Jindal Steel & Power Ltd.,JINDALSTEL,532286,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"12,282","9,964.5","2,285.7",18.66%,603.7,329.4,"1,384.5",-5.8,"1,387.8",13.8,"4,056",40.4 -Jubilant Foodworks Ltd.,JUBLFOOD,533155,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,"1,375.7","1,091.4",277.2,20.25%,141.9,56.8,85.5,23.3,97.2,1.5,235,3.6 -Just Dial Ltd.,JUSTDIAL,535648,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,318.5,211.8,48.8,18.71%,12.2,2.4,92.1,20.3,71.8,8.4,314.1,36.9 -Jyothy Labs Ltd.,JYOTHYLAB,532926,FMCG,PERSONAL PRODUCTS,745.6,597,135.4,18.48%,12.3,1.2,135.1,31.1,104.2,2.8,326.9,8.9 -KRBL Ltd.,KRBL,530813,FMCG,PACKAGED FOODS,"1,246.5","1,018.9",194.5,16.03%,19.9,0.8,206.8,53.6,153.3,6.5,671.4,29.3 -Kajaria Ceramics Ltd.,KAJARIACER,500233,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"1,129.9",941.9,179.7,16.02%,36.1,4.3,147.7,36.6,108,6.8,397.8,25 -Kalpataru Projects International Ltd.,KPIL,522287,UTILITIES,ELECTRIC UTILITIES,"4,53","4,148",370,8.19%,113,137,132,42,89,5.5,478,29.9 -Kansai Nerolac Paints Ltd.,KANSAINER,500165,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"1,978.6","1,683.3",273.2,13.97%,47.4,7.6,240.3,64.8,177.2,2.2,"1,118.8",13.8 -Karur Vysya Bank Ltd.,KARURVYSYA,590003,BANKING AND FINANCE,BANKS,"2,336",616.4,637.9,31.94%,0,"1,081.7",511.5,133.1,378.4,4.7,"1,364.2",17 -KEC International Ltd.,KEC,532714,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"4,514.9","4,224.7",274.3,6.10%,46.5,177.8,65.8,9.9,55.8,2.2,187.9,7.3 -Kotak Mahindra Bank Ltd.,KOTAKBANK,500247,BANKING AND FINANCE,BANKS,"21,559.5","9,681","6,343",46.24%,0,"5,535.5","5,888.3","1,465.5","4,461",22.4,"17,172.7",86.4 -L&T Finance Holdings Ltd.,L&TFH,533519,DIVERSIFIED,HOLDING COMPANIES,"3,482.1",935.3,"1,882.4",58.57%,28.3,"1,324.9",797.4,203.2,595.1,2.4,"2,080.8",8.4 -L&T Technology Services Ltd.,LTTS,540115,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,427.7","1,910.9",475.6,19.93%,68.1,12.6,436.1,120.2,315.4,29.8,"1,239.7",117.5 -LIC Housing Finance Ltd.,LICHSGFIN,500253,BANKING AND FINANCE,HOUSING FINANCE,"6,765.9",250.6,"6,095.7",90.10%,13.2,"4,599.9","1,483",291.2,"1,193.5",21.7,"4,164.5",75.7 -Lakshmi Machine Works Ltd.,LAXMIMACH,500252,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"1,355.5","1,184.5",136,10.30%,23.6,0,147.4,32.3,115.1,107.8,416,389.5 -Laurus Labs Ltd.,LAURUSLABS,540222,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,226.2","1,036.6",187.9,15.34%,93.4,42.4,53.9,14.6,37,0.7,367.8,6.8 -Lupin Ltd.,LUPIN,500257,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"5,079","4,120.8",917.8,18.21%,247.8,80.6,629.7,134.3,489.5,10.8,"1,331.2",29.2 -MMTC Ltd.,MMTC,513377,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,-167.2,-180.1,-30.4,14.42%,0.8,1.1,12.1,1.5,52,0.3,174.1,1.2 -MRF Ltd.,MRF,500290,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"6,287.8","5,060.2","1,156.9",18.61%,351.5,85.5,790.6,203.9,586.7,1383.3,"1,690.9",3988 -Mahanagar Gas Ltd.,MGL,539957,UTILITIES,UTILITIES,"1,772.7","1,250.1",478.9,27.70%,65.8,2.5,454.3,115.8,338.5,34.3,"1,147.8",116.2 -Mahindra & Mahindra Financial Services Ltd.,M&MFIN,532720,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"3,863.5","1,077.5","2,109.3",55.03%,67.1,"1,703.4",369.1,96,281.1,2.3,"1,982.5",16 -Mahindra & Mahindra Ltd.,M&M,500520,AUTOMOBILES & AUTO COMPONENTS,CARS & UTILITY VEHICLES,"35,027.2","28,705.9","5,729.6",16.64%,"1,138.6","1,835.2","3,347.5","1,083.7","2,347.8",21.1,"11,169.4",100.2 -Mahindra Holidays & Resorts India Ltd.,MHRIL,533088,HOTELS RESTAURANTS & TOURISM,HOTELS,672.2,519.3,136,20.76%,83.8,33.3,35.8,14,21.3,1.1,66,3.3 -Manappuram Finance Ltd.,MANAPPURAM,531213,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"2,174",555.6,"1,481.3",68.68%,62.5,689.4,746.7,186.1,558.4,6.6,"1,859.8",22 -Mangalore Refinery And Petrochemicals Ltd.,MRPL,500109,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"22,904.7","20,705.6","2,138.2",9.36%,296,311.2,"1,592",546.2,"1,051.7",6,"3,784.9",21.6 -Marico Ltd.,MARICO,531642,FMCG,PERSONAL PRODUCTS,"2,514","1,979",497,20.07%,39,20,476,116,353,2.7,"1,41",10.9 -Maruti Suzuki India Ltd.,MARUTI,532500,AUTOMOBILES & AUTO COMPONENTS,CARS & UTILITY VEHICLES,"37,902.1","32,282.5","4,790.3",12.92%,794.4,35.1,"4,790.1","1,083.8","3,764.3",124.6,"11,351.8",375.9 -Max Financial Services Ltd.,MFSL,500271,BANKING AND FINANCE,LIFE INSURANCE,"10,189.1","10,024.6",143.9,1.42%,0.8,9.4,158.2,-12.1,147.9,4.3,506.4,14.7 -UNO Minda Ltd.,UNOMINDA,532539,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"3,630.2","3,219.8",401.6,11.09%,125.4,27.2,257.9,73.3,225,3.9,742.4,13 -Motilal Oswal Financial Services Ltd.,MOTILALOFS,532892,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,"1,650.7",724.1,904.5,55.18%,17.3,241.1,657.6,124.2,531.2,35.9,"1,449.3",97.8 -MphasiS Ltd.,MPHASIS,526299,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"3,325.5","2,680.9",595.6,18.18%,89,34,521.7,129.7,391.9,20.8,"1,605.6",85.1 -Muthoot Finance Ltd.,MUTHOOTFIN,533398,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"3,631.9",723.4,"2,801.6",77.69%,22.2,"1,335","1,470.2",374.9,"1,059.6",26.4,"3,982.9",99.2 -Natco Pharma Ltd.,NATCOPHARM,524816,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,060.8",573.4,458,44.41%,43.6,4.2,439.6,70.6,369,20.6,"1,127.4",63 -NBCC (India) Ltd.,NBCC,534309,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"2,129.1","1,957.7",95.5,4.65%,1.3,0,104.6,22.9,79.6,0.4,332.2,1.8 -NCC Ltd.,NCC,500294,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"4,746.4","4,415.9",303.7,6.44%,53.2,153.5,123.8,38.8,77.3,1.2,599.4,9.5 -NHPC Ltd.,NHPC,533098,UTILITIES,ELECTRIC UTILITIES,"3,113.8","1,173.9","1,757.4",59.95%,294.9,104.8,"1,618.3",-75,"1,545.8",1.5,"3,897.8",3.9 -Coforge Ltd.,COFORGE,532541,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,285.1","1,935.3",340.9,14.98%,77.2,31.9,240.7,52.8,187.9,29.6,696.2,113.2 -NLC India Ltd.,NLCINDIA,513683,UTILITIES,ELECTRIC UTILITIES,"3,234","2,143",834.6,28.03%,455.1,213.9,"1,700.6",614.7,"1,084.7",7.8,"1,912.3",13.8 -NTPC Ltd.,NTPC,532555,UTILITIES,ELECTRIC UTILITIES,"45,384.6","32,303.2","12,680.2",28.19%,"4,037.7","2,920.5","6,342.9","2,019.7","4,614.6",4.8,"19,125.2",19.7 -Narayana Hrudayalaya Ltd.,NH,539551,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,323.6",997.1,308.1,23.61%,55.3,22.9,248.4,21.7,226.6,11.2,737.5,36.1 -National Aluminium Company Ltd.,NATIONALUM,532234,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"3,112","2,646.9",396.5,13.03%,186.2,4,275,68.7,187.3,1,"1,272.4",6.9 -Navin Fluorine International Ltd.,NAVINFLUOR,532504,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,494.9,373.4,98.3,20.84%,24.2,20,77.2,16.6,60.6,12.2,365,73.7 -Oberoi Realty Ltd.,OBEROIRLTY,533273,REALTY,REALTY,"1,243.8",579.2,638.2,52.42%,11.3,56.5,596.8,142.1,456.8,12.6,"1,961.3",53.9 -Oil And Natural Gas Corporation Ltd.,ONGC,500312,OIL & GAS,EXPLORATION & PRODUCTION,"149,388.5","118,618.4","28,255.3",19.24%,"6,698.1","2,603.3","21,564.9","5,633.6","13,734.1",10.9,"43,072.5",34.2 -Oil India Ltd.,OIL,533106,OIL & GAS,EXPLORATION & PRODUCTION,"9,200.1","5,293.3","3,523.2",39.96%,499,278.9,762,67.6,420.7,3.9,"5,874.5",54.2 -Oracle Financial Services Software Ltd.,OFSS,532466,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,509.6",886.4,558.1,38.64%,19,8,596.2,178.8,417.4,48.2,"1,835.1",211.9 -PI Industries Ltd.,PIIND,523642,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"2,163.8","1,565.5",551.4,26.05%,80.3,7.8,510.2,31.7,480.5,31.7,"1,495.8",98.4 -PNB Housing Finance Ltd.,PNBHOUSING,540173,BANKING AND FINANCE,HOUSING FINANCE,"1,779.4",158.8,"1,574.1",88.54%,11.3,"1,057.3",507.1,124.1,383,14.8,"1,278.7",49.3 -PNC Infratech Ltd.,PNCINFRA,539150,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,932.4","1,511.6",399.8,20.92%,40.9,161.3,218.6,70.7,147.9,5.8,614.3,23.9 -PVR INOX Ltd.,PVRINOX,532689,RETAILING,SPECIALTY RETAIL,"2,023.7","1,293.1",706.8,35.34%,308.6,200.3,221.7,55.5,166.3,17,-232.5,-23.7 -Page Industries Ltd.,PAGEIND,532827,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,"1,126.8",891.6,233.5,20.76%,24.6,11.2,199.4,49.1,150.3,134.7,510.7,457.9 -Persistent Systems Ltd.,PERSISTENT,533179,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,449","2,006.5",405.2,16.80%,74.4,12.3,355.8,92.5,263.3,35,981.5,127.6 -Petronet LNG Ltd.,PETRONET,532522,OIL & GAS,OIL MARKETING & DISTRIBUTION,"12,686.2","11,317.9","1,214.7",9.69%,194.8,74.7,"1,098.8",283.9,855.7,5.7,"3,490.3",23.3 -Pfizer Ltd.,PFIZER,500680,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,611.3,392.6,182.6,31.75%,15.4,2.7,200.5,51.6,149,32.6,522.8,114.3 -Phoenix Mills Ltd.,PHOENIXLTD,503100,REALTY,REALTY,906.6,361.2,506,57.82%,65.9,96.5,375.2,71.4,252.6,14.2,923.6,51.7 -Pidilite Industries Ltd.,PIDILITIND,500331,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"3,107.6","2,396.3",679.7,22.10%,75.2,13.1,623,163.1,450.1,8.8,"1,505.5",29.6 -Power Finance Corporation Ltd.,PFC,532810,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"22,403.7",315.4,"22,941.9",102.46%,12.7,"14,313.1","8,628.8","2,000.6","4,833.1",14.7,"17,946.4",54.4 -Power Grid Corporation of India Ltd.,POWERGRID,532898,UTILITIES,ELECTRIC UTILITIES,"11,530.4","1,358.7","9,908.4",87.94%,"3,277","2,341.3","4,393.4",573.7,"3,781.4",4.1,"15,344.4",16.5 -Prestige Estates Projects Ltd.,PRESTIGE,ASM,REALTY,REALTY,"3,256","1,643.9",592.5,26.49%,174.1,263.9,"1,174.1",256.4,850.9,21.2,"1,714",42.8 -Prism Johnson Ltd.,PRSMJOHNSN,500338,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,846","1,745.4",92.4,5.03%,95.2,43.5,210,30.4,182.7,3.6,154.2,3.1 -Procter & Gamble Hygiene & Healthcare Ltd.,PGHH,500459,FMCG,PERSONAL PRODUCTS,"1,154.1",853.5,284.9,25.03%,14.3,1.9,284.5,73.8,210.7,64.9,734.4,226.3 -Punjab National Bank,PNB,532461,BANKING AND FINANCE,BANKS,"29,857","6,798.1","6,239.1",23.23%,0,"16,819.8","2,778.3","1,013.8","1,990.2",1.8,"5,904.8",5.4 -Quess Corp Ltd.,QUESS,539978,SOFTWARE & SERVICES,BPO/KPO,"4,763.5","4,584.8",163.6,3.44%,69.7,28.1,79.3,8.3,71.9,4.8,240.9,16.2 -RBL Bank Ltd.,RBLBANK,540065,BANKING AND FINANCE,BANKS,"3,720.6","1,422.6",765.4,25.45%,0,"1,532.6",125,-206.1,331.1,5.5,"1,173.9",19.5 -Radico Khaitan Ltd.,RADICO,532497,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,925.7,803.8,121.2,13.10%,26.1,12.5,83.3,21.4,64.8,4.8,237,17.7 -Rain Industries Ltd.,RAIN,500339,CHEMICALS & PETROCHEMICALS,PETROCHEMICALS,"4,208.9","3,794.3",366,8.80%,192.5,241.7,-19.5,46.2,-90.2,-2.7,270.4,8 -Rajesh Exports Ltd.,RAJESHEXPO,531500,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"38,079.4","38,015.8",50.1,0.13%,10.7,0,53,7.7,45.3,1.5,"1,142.2",38.7 -Rallis India Ltd.,RALLIS,500355,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,837,699,133,15.99%,26,3,110,28,82,4.2,98.4,5.2 -Rashtriya Chemicals & Fertilizers Ltd.,RCF,524230,FERTILIZERS,FERTILIZERS,"4,222.1","4,049.3",105.9,2.55%,56.1,44,72.8,21.1,51,0.9,523.6,9.5 -Redington Ltd.,REDINGTON,532805,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,"22,296.6","21,738.7",481.4,2.17%,43.7,105.8,408.3,96.7,303.5,3.9,"1,242",15.9 -Relaxo Footwears Ltd.,RELAXO,530517,RETAILING,FOOTWEAR,725.9,623.8,91.5,12.79%,36.9,4.7,60.4,16.2,44.2,1.8,193.9,7.8 -Reliance Industries Ltd.,RELIANCE,500325,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"238,797","193,988","40,968",17.44%,"12,585","5,731","26,493","6,673","17,394",25.7,"68,496",101.2 -REC Ltd.,RECLTD,532955,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"11,701.3",275.1,"12,180.5",104.21%,6.1,"7,349.8","4,837.6","1,047.7","3,789.9",14.4,"12,738.6",48.4 -SJVN Ltd.,SJVN,533206,UTILITIES,ELECTRIC UTILITIES,951.6,172.2,706.2,80.40%,101.9,124.2,567.7,129.2,439.6,1.1,"1,016",2.6 -SKF India Ltd.,SKFINDIA,500472,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,"1,145.5","1,003.7",121.5,10.80%,19.3,0.5,122,31.7,90,18.2,484,97.9 -SRF Ltd.,SRF,503806,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"3,206.5","2,551.2",626.2,19.71%,161.2,79.3,414.8,114,300.8,10.2,"1,733.4",58.5 -Sanofi India Ltd.,SANOFI,500674,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,726.4,506.1,208.5,29.17%,9.9,0.3,210.1,57.9,152.1,66.1,596.3,259.3 -Schaeffler India Ltd.,SCHAEFFLER,505790,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,879.2","1,506.3",342,18.50%,55.6,1.6,315.7,80.7,235,15,922.6,59 -Shree Cements Ltd.,SHREECEM,500387,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"4,932.1","3,914.1",886,18.46%,411.7,67,539.2,92.6,446.6,123.8,"1,826.8",506.3 -Shriram Finance Ltd.,SHRIRAMFIN,511218,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"8,893","1,409.4","6,334.3",71.30%,141.4,"3,798","2,404.2",614.9,"1,786.1",47.6,"6,575.4",175.2 -Siemens Ltd.,SIEMENS,500550,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"5,953.2","5,107.5",700.2,12.06%,78.6,4.9,762.2,190.5,571.3,16.1,"1,960.9",55.1 -Sobha Ltd.,SOBHA,532784,REALTY,REALTY,773.6,665.8,75.4,10.18%,19.3,63.9,24.7,9.7,14.9,1.6,107.4,11.3 -Solar Industries India Ltd.,SOLARINDS,532725,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"1,355.2","1,011.3",336.1,24.95%,33.7,24.9,285.3,75.5,200.1,22.1,808.2,89.3 -Sonata Software Ltd.,SONATSOFTW,532221,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,935.8","1,715.2",197.3,10.32%,33.3,20.7,166.5,42.3,124.2,9,475.7,34.3 -State Bank of India,SBIN,500112,BANKING AND FINANCE,BANKS,"144,256.1","58,597.6","22,703.3",21.14%,0,"62,955.2","21,935.7","5,552.5","17,196.2",18,"69,304.1",77.7 -Steel Authority of India (SAIL) Ltd.,SAIL,500113,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"29,858.2","25,836.7","3,875.4",13.04%,"1,326.6",605.2,"1,674.7",464.2,"1,305.6",3.2,"3,219.5",7.8 -Sun Pharma Advanced Research Company Ltd.,SPARC,532872,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,29.7,112.7,-91.5,-431.87%,3.2,0.3,-86.4,0,-86.4,-2.7,-253.6,-7.8 -Sun Pharmaceutical Industries Ltd.,SUNPHARMA,524715,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"12,486","9,013","3,179.4",26.08%,632.8,49.3,"2,790.9",390.1,"2,375.5",9.9,"8,548.5",35.6 -Sun TV Network Ltd.,SUNTV,532733,MEDIA,BROADCASTING & CABLE TV,"1,160.2",320.6,727.8,69.42%,218.8,1.7,619.1,154.4,464.7,11.8,"1,861.8",47.2 -Sundram Fasteners Ltd.,SUNDRMFAST,500403,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,429.1","1,191.1",230.7,16.23%,54.5,7.4,176.2,43.1,131.9,6.3,502.9,23.9 -Sunteck Realty Ltd.,SUNTECK,512179,REALTY,REALTY,36.2,39.1,-14.1,-56.70%,2.2,15.8,-20.9,-6.4,-13.9,-1,-46.5,-3.3 -Supreme Industries Ltd.,SUPREMEIND,509930,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,"2,321.4","1,952.5",356.2,15.43%,71.9,1.6,295.4,76.3,243.2,19.1,"1,028.2",80.9 -Suzlon Energy Ltd.,SUZLON,ASM,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"1,428.7","1,196.4",225,15.83%,51.2,43.7,102.4,0.1,102.3,0.1,561.4,0.4 -Syngene International Ltd.,SYNGENE,539268,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,931.7,656,254.1,27.92%,104.6,13,150.7,34.2,116.5,2.9,498.3,12.4 -TTK Prestige Ltd.,TTKPRESTIG,517506,CONSUMER DURABLES,HOUSEWARE,747.2,648.6,80.8,11.08%,15.9,3.1,79.5,20.5,59.3,4.3,224.3,16.2 -TV18 Broadcast Ltd.,TV18BRDCST,532800,MEDIA,BROADCASTING & CABLE TV,"1,989","1,992.2",-198.1,-11.04%,50.1,33.8,-87.1,-6.5,-28.9,-0.2,92.2,0.5 -TVS Motor Company Ltd.,TVSMOTOR,532343,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"9,983.8","8,576.9","1,355.9",13.65%,237.1,483.3,686.4,259.8,386.3,8.1,"1,457.6",30.7 -Tata Consultancy Services Ltd.,TCS,532540,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"60,698","43,946","15,746",26.38%,"1,263",159,"15,33","3,95","11,342",31,"44,654",122 -Tata Elxsi Ltd.,TATAELXSI,500408,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,912.8,618.2,263.5,29.89%,25,5.8,263.9,63.8,200,32.1,785.1,126.1 -Tata Consumer Products Ltd.,TATACONSUM,500800,FMCG,PACKAGED FOODS,"3,823.6","3,196.7",537.1,14.38%,93.9,27.6,490.9,131.7,338.2,3.6,"1,275.2",13.7 -Tata Motors Limited (DVR),TATAMTRDVR,570001,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,,,,,,,,,,,, -Tata Motors Ltd.,TATAMOTORS,500570,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"106,759","91,361.3","13,766.9",13.10%,"6,636.4","2,651.7","5,985.9","2,202.8","3,764",9.8,"15,332.3",40 -Tata Power Company Ltd.,TATAPOWER,500400,UTILITIES,ELECTRIC UTILITIES,"16,029.5","12,647","3,091",19.64%,925.9,"1,181.8",979.2,213.3,875.5,2.7,"3,570.8",11.2 -Tata Steel Ltd.,TATASTEEL,500470,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"55,910.2","51,414.1","4,267.8",7.66%,"2,479.8","1,959.4","-6,842.1",-228,"-6,196.2",-5.1,"-6,081.3",-5 -Tech Mahindra Ltd.,TECHM,532755,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"13,128.1","11,941.1",922.8,7.17%,465.7,97.5,623.8,110,493.9,5.6,"3,600.7",40.9 -The Ramco Cements Ltd.,RAMCOCEM,500260,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,352.1","1,935",405.6,17.33%,162.8,116.5,137.8,37,72,3.1,348.9,14.8 -Thermax Ltd.,THERMAX,500411,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,368.3","2,097.8",204.6,8.89%,33,19.8,217.7,58.9,157.7,14,498.8,44.3 -Timken India Ltd.,TIMKEN,522113,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,692.1,546.5,135.5,19.87%,21.1,0.9,123.6,30.6,93,12.4,358.3,47.6 -Titan Company Ltd.,TITAN,500114,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"12,653","11,118","1,411",11.26%,144,140,"1,251",336,915,10.3,"3,302",37.1 -Torrent Pharmaceuticals Ltd.,TORNTPHARM,500420,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,686","1,835",825,31.02%,201,91,559,173,386,11.4,"1,334",39.4 -Torrent Power Ltd.,TORNTPOWER,532779,UTILITIES,ELECTRIC UTILITIES,"7,069.1","5,739.5","1,221.4",17.55%,341.7,247.2,740.7,198.1,525.9,10.9,"2,176.8",45.3 -Trent Ltd.,TRENT,500251,RETAILING,DEPARTMENT STORES,"3,062.5","2,525.8",456.6,15.31%,152.2,95.5,288.9,86.3,234.7,6.6,629.4,17.7 -Trident Ltd.,TRIDENT,521064,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,812","1,557.3",240.3,13.37%,89.4,35,130.4,40.1,90.7,0.2,458.1,0.9 -UPL Ltd.,UPL,512070,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"10,275","8,807","1,325",13.03%,657,871,-185,-96,-189,-2.5,"1,856",24.7 -UltraTech Cement Ltd.,ULTRACEMCO,532538,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"16,179.3","13,461.2","2,550.9",15.93%,797.8,233.9,"1,686.2",409.4,"1,281.5",44.5,"5,694.1",197.2 -Union Bank of India,UNIONBANK,532477,BANKING AND FINANCE,BANKS,"28,952.5","6,189.3","7,265",29.38%,0,"15,498.2","5,492.3","1,944","3,571.8",5.1,"11,918.9",16.1 -United Breweries Ltd.,UBL,532478,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,"1,902.1","1,705.8",184.3,9.75%,50.9,1.4,144,36.9,107.3,4.1,251.3,9.5 -United Spirits Ltd.,MCDOWELL-N,532432,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,"6,776.6","6,269.8",466.7,6.93%,65.3,26.2,446,106.3,339.3,4.8,"1,133",15.6 -V-Guard Industries Ltd.,VGUARD,532953,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,147.9","1,041.3",92.5,8.16%,19.8,9.3,77.5,18.6,59,1.4,215.2,5 -Vardhman Textiles Ltd.,VTL,502986,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,487","2,192.1",205.4,8.57%,103.7,22,169.2,41.7,134.3,4.7,531.9,18.7 -Varun Beverages Ltd.,VBL,540180,FOOD BEVERAGES & TOBACCO,NON-ALCOHOLIC BEVERAGES,"3,889","2,988.4",882.1,22.79%,170.8,62.5,667.3,152.9,501.1,3.9,"1,998.7",15.4 -Vinati Organics Ltd.,VINATIORGA,524200,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,464.4,337.3,110.8,24.73%,13.7,0.3,113,28.9,84.2,8.2,408.2,39.7 -Voltas Ltd.,VOLTAS,500575,CONSUMER DURABLES,CONSUMER ELECTRONICS,"2,363.7","2,222.5",70.3,3.06%,11.7,11.4,118.1,49.3,36.7,1.1,199.5,6 -ZF Commercial Vehicle Control Systems India Ltd.,ZFCVINDIA,533023,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,015.8",846.2,145.5,14.67%,27.1,1.3,141.2,35.5,105.7,55.7,392,206.7 -Welspun Corp Ltd.,WELCORP,ASM,METALS & MINING,IRON & STEEL PRODUCTS,"4,161.4","3,659.9",399.5,9.84%,85.7,75,340.8,79,384.7,14.7,809.2,30.9 -Welspun Living Ltd.,WELSPUNLIV,514162,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,542.4","2,151.1",358,14.27%,98.5,33.8,258.9,58.7,196.7,2,526.1,5.4 -Whirlpool of India Ltd.,WHIRLPOOL,500238,CONSUMER DURABLES,CONSUMER ELECTRONICS,"1,555.5","1,448.4",73.2,4.81%,49.2,5.6,52.3,14.1,36.6,2.9,198.8,15.7 -Wipro Ltd.,WIPRO,507685,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"23,255.7","18,543.2","3,972.7",17.64%,897,303.3,"3,512.2",841.9,"2,646.3",5.1,"11,643.8",22.3 -Zee Entertainment Enterprises Ltd.,ZEEL,505537,MEDIA,BROADCASTING & CABLE TV,"2,509.6","2,105",332.8,13.65%,77.2,23.4,184.2,54.4,123,1.3,-102.2,-1.1 -eClerx Services Ltd.,ECLERX,532927,SOFTWARE & SERVICES,BPO/KPO,735.9,517,204.7,28.37%,30.3,6.1,182.4,46.3,136,28.2,506,105 -Sterlite Technologies Ltd.,STLTECH,532374,TELECOMMUNICATIONS EQUIPMENT,TELECOM CABLES,"1,497","1,281",213,14.26%,85,95,36,12,34,0.9,203,5.1 -HEG Ltd.,HEG,509631,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,642.2,512.3,101.9,16.58%,38.5,8.5,82.9,21.7,96,24.9,439.5,113.9 -SBI Life Insurance Company Ltd.,SBILIFE,540719,BANKING AND FINANCE,LIFE INSURANCE,"28,816.2","28,183.8",609.9,2.12%,0,0,621.5,43.9,380.2,3.8,"1,842.2",18.4 -General Insurance Corporation of India,GICRE,540755,BANKING AND FINANCE,GENERAL INSURANCE,"13,465.9","11,574","1,464.6",11.20%,0,0,"1,855.4",243.7,"1,689",15.2,"6,628",37.8 -Tube Investments of India Ltd.,TIINDIA,540762,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,005.4","1,718.2",251.4,12.76%,34.6,7.7,244.8,63.4,181.4,9.4,717.5,37.1 -Honeywell Automation India Ltd.,HONAUT,517174,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,144.3",965.9,138.3,12.52%,13.8,0.7,163.9,42,121.9,137.8,443.4,503.9 -Indian Energy Exchange Ltd.,IEX,540750,BANKING AND FINANCE,EXCHANGE,133,16.6,92,84.73%,5.1,0.7,110.6,27.9,86.5,1,327.8,3.7 -ICICI Lombard General Insurance Company Ltd.,ICICIGI,540716,BANKING AND FINANCE,GENERAL INSURANCE,"5,271.1","4,612.4",743.5,14.16%,0,0,763.6,186.4,577.3,11.8,"1,757.1",35.8 -Aster DM Healthcare Ltd.,ASTERDM,540975,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"3,325.2","2,939.4",377.3,11.38%,227.2,101.9,2.1,10.2,-30.8,-0.6,284.3,5.7 -Central Depository Services (India) Ltd.,CDSL,CDSL,OTHERS,INVESTMENT COMPANIES,230.1,77.9,129.4,62.40%,6.5,0,145.6,35.8,108.9,10.4,320.2,30.6 -Graphite India Ltd.,GRAPHITE,509488,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,884,823,-30,-3.78%,19,4,992,190,804,41.1,856,43.9 -Grasim Industries Ltd.,GRASIM,500300,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"30,505.3","25,995.9","4,224.8",13.98%,"1,245.2",397.8,"2,866.4",837.7,"1,163.8",17.7,"6,624.9",100.6 -KNR Constructions Ltd.,KNRCON,532942,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"1,043.8",806.9,231.6,22.30%,39.2,20.6,177.1,34.6,147.4,5.2,537.5,19.1 -Aditya Birla Capital Ltd.,ABCAPITAL,540691,DIVERSIFIED,HOLDING COMPANIES,"7,730.4","4,550.1","2,821.9",36.55%,48,"1,827",956.8,284.1,705,2.7,"5,231.9",20.1 -Dixon Technologies (India) Ltd.,DIXON,540699,CONSUMER DURABLES,CONSUMER ELECTRONICS,"4,943.9","4,744.3",198.9,4.02%,36.4,17.1,146.1,35.2,107.3,19,308.7,51.8 -Cholamandalam Financial Holdings Ltd.,CHOLAHLDNG,504973,DIVERSIFIED,HOLDING COMPANIES,"6,372.2","2,495.1","3,404.8",54.05%,52.1,"2,209.4","1,215.8",324.6,420.9,22.4,"1,532.3",81.6 -Cochin Shipyard Ltd.,COCHINSHIP,540678,TRANSPORTATION,MARINE PORT & SERVICES,"1,100.4",820.5,191.2,18.90%,18.9,9.6,251.4,69.9,181.5,13.8,429.9,32.7 -Bharat Dynamics Ltd.,BDL,541143,GENERAL INDUSTRIALS,DEFENCE,694.1,481.8,134,21.77%,17.4,0.8,194.1,47,147.1,8,425.4,23.2 -Lux Industries Ltd.,LUXIND,539542,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,643.6,584.2,55,8.61%,5.9,5.4,48,12.1,37.1,12.3,103.1,32.9 -Zensar Technologies Ltd.,ZENSARTECH,504067,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,277.1","1,009.9",230.9,18.61%,36.6,5.7,224.9,51,173.9,7.7,525.8,23.2 -PCBL Ltd.,PCBL,506590,CHEMICALS & PETROCHEMICALS,CARBON BLACK,"1,489.4","1,248.6",238.1,16.02%,48.2,21,171.6,48.8,122.6,3.2,431.6,11.4 -Zydus Wellness Ltd.,ZYDUSWELL,531335,FMCG,PACKAGED FOODS,444,423.1,16.8,3.82%,5.8,6.5,8.6,2.7,5.9,0.9,281.2,44.2 -Linde India Ltd.,LINDEINDIA,523457,GENERAL INDUSTRIALS,INDUSTRIAL GASES,729.9,537.7,173.6,24.41%,49.7,1.2,141.3,34.6,108.7,12.8,417.9,49 -FDC Ltd.,FDC,531599,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,513.6,409.9,76.4,15.71%,9.9,1.1,92.7,22.9,69.8,4.2,251.2,15.4 -The New India Assurance Company Ltd.,NIACL,540769,BANKING AND FINANCE,GENERAL INSURANCE,"10,571","10,773.4",-246.5,-2.33%,0,0,-242,-46.7,-176.1,-1.1,947,5.7 -Sundaram Finance Ltd.,SUNDARMFIN,590071,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"1,710.6",322.5,"1,332.1",77.98%,43.6,820.3,470.6,142.8,365.4,33.2,"1,506.7",135.6 -TeamLease Services Ltd.,TEAMLEASE,539658,COMMERCIAL SERVICES & SUPPLIES,MISC. COMMERCIAL SERVICES,"2,285.6","2,240.8",31.8,1.40%,12.9,2.5,29.4,1.8,27.3,16.3,106.6,63.5 -Galaxy Surfactants Ltd.,GALAXYSURF,540935,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,985.8,858.2,124.9,12.70%,24.7,5.4,97.5,20.1,77.4,21.8,349.3,98.5 -Bandhan Bank Ltd.,BANDHANBNK,541153,BANKING AND FINANCE,BANKS,"5,032.2","1,400.2","1,583.4",35.25%,0,"2,048.6",947.2,226.1,721.2,4.5,"2,541.1",15.8 -ICICI Securities Ltd.,ISEC,541179,BANKING AND FINANCE,CAPITAL MARKETS,"1,249",433.5,810.2,64.87%,25.8,215.1,569.4,145.7,423.6,13.1,"1,238.1",38.3 -V-Mart Retail Ltd.,VMART,534976,RETAILING,DEPARTMENT STORES,551.4,548.8,0.7,0.12%,53.2,35.9,-86.4,-22.3,-64.1,-32.4,-103.1,-52.1 -Nippon Life India Asset Management Ltd.,NAM-INDIA,540767,BANKING AND FINANCE,ASSET MANAGEMENT COS.,475.4,156.1,241.4,60.73%,7.2,1.7,310.4,66.1,244.4,3.9,883.3,14.1 -Grindwell Norton Ltd.,GRINDWELL,506076,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,690,536,131.4,19.69%,16.9,1.8,135.3,33.1,101.9,9.2,378.3,34.2 -HDFC Life Insurance Company Ltd.,HDFCLIFE,540777,BANKING AND FINANCE,LIFE INSURANCE,"23,276.6","23,659.3",-508.1,-2.20%,0,0,-373.1,-657.5,378.2,1.8,"1,472.8",6.9 -Elgi Equipments Ltd.,ELGIEQUIP,522074,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,817.8,663.4,142.7,17.71%,18.7,6.6,129.2,38.8,91.3,2.9,401.9,12.7 -Hindustan Aeronautics Ltd.,HAL,541154,GENERAL INDUSTRIALS,DEFENCE,"6,105.1","4,108.1","1,527.6",27.11%,349.6,0.3,"1,647",414.8,"1,236.7",18.5,"6,037.3",90.3 -BSE Ltd.,BSE,BSE,BANKING AND FINANCE,EXCHANGE,367,172.8,189.2,52.26%,22.7,8.5,163,63.6,120.5,8.8,706,52.1 -Rites Ltd.,RITES,541556,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,608.8,444.5,137.8,23.67%,14.1,1.4,148.8,40.1,101.2,4.2,488.1,20.3 -Fortis Healthcare Ltd.,FORTIS,532843,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,783.5","1,439.8",330.2,18.65%,84.1,31.8,231.4,48.8,173.7,2.3,547.6,7.3 -Varroc Engineering Ltd.,VARROC,541578,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,893.5","1,692.6",194.3,10.30%,84.9,50.3,65.9,18.2,54.2,3.5,146.5,9.6 -Adani Green Energy Ltd.,ADANIGREEN,ASM,UTILITIES,ELECTRIC UTILITIES,"2,589",521,"1,699",76.53%,474,"1,165",413,119,372,2.2,"1,305",8.2 -VIP Industries Ltd.,VIPIND,507880,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,548.7,493.2,52.9,9.68%,23.8,12.4,19.3,6,13.3,0.9,110.9,7.8 -CreditAccess Grameen Ltd.,CREDITACC,541770,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"1,247.6",248.8,902.3,72.36%,12.3,423.9,466.8,119.7,347,21.8,"1,204.2",75.7 -CESC Ltd.,CESC,500084,UTILITIES,ELECTRIC UTILITIES,"4,414","3,706",646,14.84%,303,305,461,98,348,2.6,"1,447",10.9 -Jamna Auto Industries Ltd.,JAMNAAUTO,520051,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,608.7,528.2,79.1,13.03%,10.9,0.8,68.7,18.6,50.1,2.4,189.3,4.7 -Suprajit Engineering Ltd.,SUPRAJIT,532509,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,727.6,639.1,69.8,9.85%,25.7,13.6,49.2,14.5,34.8,2.5,146.9,10.6 -JK Paper Ltd.,JKPAPER,532162,COMMERCIAL SERVICES & SUPPLIES,PAPER & PAPER PRODUCTS,"1,708.8","1,242.8",407.3,24.68%,83.5,42,340.6,34.9,302.4,17.9,"1,220.6",72.1 -Bank of Maharashtra,MAHABANK,532525,BANKING AND FINANCE,BANKS,"5,735.5","1,179.4","1,920.5",37.90%,0,"2,635.7",935.7,16,919.8,1.3,"3,420.8",4.8 -Aavas Financiers Ltd.,AAVAS,541988,BANKING AND FINANCE,HOUSING FINANCE,497.6,123.5,367.8,74.03%,7.6,203.6,157.4,35.7,121.7,15.4,465.4,58.8 -HDFC Asset Management Company Ltd.,HDFCAMC,541729,BANKING AND FINANCE,ASSET MANAGEMENT COS.,765.4,162,481.1,74.81%,13,2.3,588.1,151.6,436.5,20.4,"1,659.3",77.7 -KEI Industries Ltd.,KEI,517569,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,954.2","1,742.7",203.9,10.47%,15.6,7.5,188.4,48.2,140.2,15.5,528.3,58.5 -Orient Electric Ltd.,ORIENTELEC,541301,CONSUMER DURABLES,CONSUMER ELECTRONICS,570.3,546.2,20.7,3.65%,14.2,5.2,23.4,4.9,18.4,0.9,95.3,4.5 -Deepak Nitrite Ltd.,DEEPAKNTR,506401,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"1,795.1","1,475.8",302.3,17.00%,39.4,2.7,277.2,72.1,205.1,15,797.9,58.5 -Fine Organic Industries Ltd.,FINEORG,541557,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,557.6,409.4,131.1,24.25%,14.4,0.7,133.1,28.9,103.4,33.7,458.8,149.6 -LTIMindtree Ltd.,LTIM,540005,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"9,048.6","7,274.1","1,631.3",18.32%,208.2,47,"1,519.3",357,"1,161.8",39.3,"4,427.5",149.6 -Dalmia Bharat Ltd.,DALBHARAT,542216,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"3,234","2,56",589,18.70%,401,101,172,48,118,6.3,"1,041",54.8 -Godfrey Phillips India Ltd.,GODFRYPHLP,500163,FOOD BEVERAGES & TOBACCO,CIGARETTES-TOBACCO PRODUCTS,"1,412.5","1,151",223.6,16.27%,36.5,6.6,218.5,55.5,202.1,38.9,802.9,154.4 -Vaibhav Global Ltd.,VAIBHAVGBL,532156,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,708.4,641.5,63.5,9.01%,22.6,2.9,41.4,12.4,29.4,1.8,121.3,7.3 -Abbott India Ltd.,ABBOTINDIA,500488,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,549.7","1,113.3",380.9,25.49%,17.8,3.1,415.4,102.5,312.9,147.3,"1,081.4",508.9 -Adani Total Gas Ltd.,ATGL,ASM,UTILITIES,UTILITIES,"1,104.8",815.7,279.9,25.55%,37.6,27.3,224.2,57.2,172.7,1.6,571,5.2 -Nestle India Ltd.,NESTLEIND,500790,FMCG,PACKAGED FOODS,"5,070.1","3,811.9","1,224.9",24.32%,111.2,31.4,"1,222",313.9,908.1,94.2,"2,971.1",308.2 -Bayer Cropscience Ltd.,BAYERCROP,506285,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"1,633.3","1,312.3",304.9,18.85%,11.6,3.7,305.7,82.8,222.9,49.6,844.4,188.1 -Amber Enterprises India Ltd.,AMBER,540902,CONSUMER DURABLES,CONSUMER ELECTRONICS,939.8,867.5,59.6,6.43%,45.2,36.6,-9.5,-3.8,-6.9,-2.1,156.8,46.5 -Rail Vikas Nigam Ltd.,RVNL,542649,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"5,210.3","4,616",298.3,6.07%,6.2,132.7,455.4,85.2,394.3,1.9,"1,478.8",7.1 -Metropolis Healthcare Ltd.,METROPOLIS,542650,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,309.7,233.7,74.8,24.25%,22.2,5.7,48.1,12.5,35.5,6.9,133.4,26 -Polycab India Ltd.,POLYCAB,542652,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"4,253","3,608.8",608.9,14.44%,60.3,26.8,557.2,127.4,425.6,28.4,"1,607.2",107.1 -Multi Commodity Exchange of India Ltd.,MCX,534091,BANKING AND FINANCE,EXCHANGE,184,193.8,-28.7,-17.38%,6.6,0.1,-16.4,1.6,-19.1,-3.7,44.8,8.8 -IIFL Finance Ltd.,IIFL,532636,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,"2,533.7",788.3,"1,600.8",64.66%,43.3,932.1,683.5,158,474.3,12.4,"1,690.7",44.4 -Ratnamani Metals & Tubes Ltd.,RATNAMANI,520111,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"1,141.9",886.3,244.9,21.65%,23.6,10.8,221.1,56.8,163.9,23.4,622.6,88.8 -RHI Magnesita India Ltd.,RHIM,534076,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,989.7,839,147.9,14.98%,44.2,8.5,97.9,26.3,71.3,3.5,-502.2,-24.3 -Birlasoft Ltd.,BSOFT,532400,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,325.4","1,102.7",207.1,15.81%,21.5,5.7,195.5,50.4,145.1,5.2,378.4,13.7 -EIH Ltd.,EIHOTEL,500840,HOTELS RESTAURANTS & TOURISM,HOTELS,552.5,387.6,142.9,26.94%,33.2,5.6,126.1,36.2,93.1,1.5,424.1,6.8 -Affle (India) Ltd.,AFFLE,542752,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,441.2,344.1,87.2,20.22%,18.4,5.5,73.2,6.4,66.8,5,264.3,19.8 -Westlife Foodworld Ltd.,WESTLIFE,505533,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,618,516.5,98.2,15.98%,43.9,27.4,30.2,7.8,22.4,1.4,107.7,6.9 -IndiaMART InterMESH Ltd.,INDIAMART,542726,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,329.3,214.7,80,27.15%,8,2.3,104.3,23.9,69.4,11.4,321.1,53.6 -Infosys Ltd.,INFY,500209,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"39,626","29,554","9,44",24.21%,"1,166",138,"8,768","2,553","6,212",15,"24,871",60.1 -Sterling and Wilson Renewable Energy Ltd.,SWSOLAR,542760,COMMERCIAL SERVICES & SUPPLIES,CONSULTING SERVICES,776.7,758,1.5,0.19%,4.3,64.3,-50,4.6,-54.2,-2.9,-668.4,-35.2 -ABB India Ltd.,ABB,500002,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,846","2,330.7",438.5,15.84%,30.3,0.9,484.2,122.2,362.9,17.1,"1,208.7",57 -Poly Medicure Ltd.,POLYMED,531768,HEALTHCARE EQUIPMENT & SUPPLIES,HEALTHCARE SUPPLIES,351.4,253.1,84.2,24.97%,16,2.2,80.9,18.8,62.2,6.5,233.7,24.4 -GMM Pfaudler Ltd.,GMMPFAUDLR,505255,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,946,795.5,142,15.15%,32.2,21.5,96.8,26.5,71.1,15.8,183.2,40.8 -Gujarat Fluorochemicals Ltd.,FLUOROCHEM,542812,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,960.3,783.7,163.1,17.23%,67.5,34.2,74.8,22.1,52.7,4.8,915.2,83.3 -360 One Wam Ltd.,360ONE,542772,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,617.1,235.6,317.8,57.31%,13.7,139.9,226.8,40.8,186,5.2,696.8,19.5 -Tata Communications Ltd.,TATACOMM,500483,TELECOM SERVICES,OTHER TELECOM SERVICES,"4,897.9","3,857.1","1,015.5",20.84%,605.1,137.4,298.3,77.9,220.7,7.7,"1,322.3",46.4 -Alkyl Amines Chemicals Ltd.,ALKYLAMINE,506767,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,354.5,303.9,48.3,13.71%,12.5,1.7,36.4,9.2,27.2,5.3,171.3,33.5 -CSB Bank Ltd.,CSBBANK,542867,BANKING AND FINANCE,BANKS,835.8,317.5,174.6,25.41%,0,343.6,178,44.8,133.2,7.7,577.7,33.3 -Indian Railway Catering & Tourism Corporation Ltd.,IRCTC,542830,DIVERSIFIED CONSUMER SERVICES,TRAVEL SUPPORT SERVICES,"1,042.4",628.8,366.6,36.83%,14,4.4,395.2,100.5,294.7,3.7,"1,061.2",13.3 -Sumitomo Chemical India Ltd.,SUMICHEM,542920,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,928,715.5,187.9,20.80%,15.8,1.2,195.5,52,143.4,2.9,367.7,7.4 -Century Textiles & Industries Ltd.,CENTURYTEX,500040,COMMERCIAL SERVICES & SUPPLIES,PAPER & PAPER PRODUCTS,"1,114.9","1,069.2",33.8,3.07%,59.2,17,-30.5,-3.3,-30.4,-2.8,117.7,10.5 -SBI Cards and Payment Services Ltd.,SBICARD,543066,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"4,221.4","2,018.8","1,327",32.47%,46.8,604.9,809.4,206.4,603,6.4,"2,302.2",24.3 -Hitachi Energy India Ltd.,POWERINDIA,543187,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"1,228.2","1,162.6",65.3,5.32%,22.5,10.7,32.4,7.6,24.7,5.8,82.5,19.5 -Suven Pharmaceuticals Ltd.,SUVENPHAR,543064,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,250.9,133.1,98,42.40%,11.9,0.5,105.4,25.8,79.6,3.1,431.8,17 -Tata Chemicals Ltd.,TATACHEM,500770,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"4,083","3,179",819,20.49%,234,145,627,120,428,16.8,"2,06",80.8 -Aarti Drugs Ltd.,AARTIDRUGS,524348,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,642.2,565.1,76.4,11.92%,12.6,8.2,56.3,16.7,39.6,4.3,180.2,19.6 -Gujarat Ambuja Exports Ltd.,GAEL,524226,FMCG,EDIBLE OILS,"1,157.7","1,012.2",103.3,9.26%,30.5,5.9,109.1,26.3,82.8,3.6,305.1,13.3 -Polyplex Corporation Ltd.,POLYPLEX,524051,COMMERCIAL SERVICES & SUPPLIES,CONTAINERS & PACKAGING,"1,595.7","1,451.5",120.6,7.67%,75.1,9.9,59.1,10.9,27.9,8.9,71.1,22.6 -Chalet Hotels Ltd.,CHALET,542399,HOTELS RESTAURANTS & TOURISM,HOTELS,318.2,188.6,126,40.04%,35,50.1,44.5,8,36.4,1.8,266.7,13 -Adani Enterprises Ltd.,ADANIENT,512599,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,"23,066","20,087.2","2,430.1",10.79%,757,"1,342.8",791,397.8,227.8,2,"2,444.3",21.4 -YES Bank Ltd.,YESBANK,532648,BANKING AND FINANCE,BANKS,"7,980.6","2,377.1",810,12.06%,0,"4,793.6",304.4,75.7,228.6,0.1,836.6,0.3 -EPL Ltd.,EPL,500135,COMMERCIAL SERVICES & SUPPLIES,CONTAINERS & PACKAGING,"1,011.2",820.6,181,18.07%,83.6,30.6,76.4,25.4,50.5,1.6,251.9,7.9 -Network18 Media & Investments Ltd.,NETWORK18,532798,MEDIA,BROADCASTING & CABLE TV,"2,052.2","2,083.8",-218.3,-11.70%,56.8,66.2,-154.5,-6.5,-61,-0.6,-144.2,-1.4 -CIE Automotive India Ltd.,CIEINDIA,532756,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,299.4","1,934",345.4,15.15%,78.3,31,256.1,69.1,375.4,9.9,298.4,7.9 -Vedanta Ltd.,VEDL,500295,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"39,585","27,466","11,479",29.47%,"2,642","2,523","8,177","9,092","-1,783",-4.8,"5,202",14 -Rossari Biotech Ltd.,ROSSARI,543213,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,484.8,419.9,63.6,13.15%,15.1,5,44.8,11.9,32.9,6,116.8,21.2 -KPIT Technologies Ltd.,KPITTECH,542651,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,208.6",959.2,239.9,20.01%,48.1,13.6,187.7,46.3,140.9,5.2,486.9,18 -Intellect Design Arena Ltd.,INTELLECT,538835,SOFTWARE & SERVICES,IT SOFTWARE PRODUCTS,631.7,497.2,121.9,19.69%,33.7,0.8,96.5,25.7,70.4,5.2,316.6,23.2 -Balaji Amines Ltd.,BALAMINES,530999,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,387.3,326.8,53.8,14.13%,10.8,1.8,48,11.6,34.7,10.7,197.3,60.9 -UTI Asset Management Company Ltd.,UTIAMC,543238,BANKING AND FINANCE,ASSET MANAGEMENT COS.,405.6,172.5,231.5,57.30%,10.4,2.8,219.8,37,182.8,14.4,562.9,44.3 -Mazagon Dock Shipbuilders Ltd.,MAZDOCK,543237,TRANSPORTATION,SHIPPING,"2,079.2","1,651.1",176.6,9.66%,20.2,1.3,406.6,102.8,332.9,16.5,"1,327.6",65.8 -Computer Age Management Services Ltd.,CAMS,543232,BANKING AND FINANCE,CAPITAL MARKETS,284.7,153,122.1,44.39%,17.4,2,112.4,28.6,84.5,17.2,309.2,62.9 -Happiest Minds Technologies Ltd.,HAPPSTMNDS,543227,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,428.8,324,82.6,20.32%,14.6,11.2,79.1,20.7,58.5,3.9,232,15.6 -Triveni Turbine Ltd.,TRITURBINE,533655,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,402.3,313.4,74.3,19.17%,5.1,0.6,83.2,19,64.2,2,233.1,7.3 -Angel One Ltd.,ANGELONE,ASM,BANKING AND FINANCE,CAPITAL MARKETS,"1,049.3",602.6,443.4,42.31%,11.2,26.4,407.2,102.7,304.5,36.3,"1,020.2",121.7 -Tanla Platforms Ltd.,TANLA,532790,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,014.9",811.8,196.8,19.51%,22.6,1.8,178.7,36.2,142.5,10.6,514.7,38.3 -Max Healthcare Institute Ltd.,MAXHEALTH,543220,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,408.6",975.8,387.4,28.42%,57.9,8.5,366.4,89.7,276.7,2.9,990.1,10.2 -Asahi India Glass Ltd.,ASAHIINDIA,515030,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,122.6",934,185.6,16.58%,43,34.4,111.3,30.2,86.9,3.6,343.5,14.1 -Prince Pipes & Fittings Ltd.,PRINCEPIPE,542907,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,660.4,562.3,94.2,14.35%,22.5,0.7,92.8,22.2,70.6,5.2,219.8,19.9 -Route Mobile Ltd.,ROUTE,543228,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,018.3",886.5,128.1,12.63%,21.4,6.5,103.8,15.5,88.8,14.2,365.3,58.3 -KPR Mill Ltd.,KPRMILL,532889,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,533","1,212.9",298,19.72%,46,18.1,256,54.2,201.8,5.9,788.8,23.1 -Infibeam Avenues Ltd.,INFIBEAM,539807,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,792.6,719.7,70.2,8.89%,17.1,0.5,55.2,14.7,41,0.1,142.2,0.5 -Restaurant Brands Asia Ltd.,RBA,543248,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,628.2,568.7,56.2,9.00%,78.6,31.5,-50.7,0,-46,-0.9,-220.3,-4.5 -Larsen & Toubro Ltd.,LT,500510,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"52,157","45,392.1","5,632",11.04%,909.9,864,"4,991.1","1,135.5","3,222.6",22.9,"12,255.3",89.2 -Gland Pharma Ltd.,GLAND,543245,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,426.6","1,049.3",324.1,23.60%,81.3,6,289.9,95.8,194.1,11.8,698.8,42.4 -Macrotech Developers Ltd.,LODHA,543287,REALTY,REALTY,"1,755.1","1,333.5",416.1,23.78%,29.3,123.1,269.2,62.4,201.9,2.1,"1,529.2",15.9 -Poonawalla Fincorp Ltd.,POONAWALLA,524000,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),745.3,178.9,531.7,71.98%,14.7,215.5,"1,124.6",270,860.2,11.2,"1,466.4",19.1 -The Fertilisers and Chemicals Travancore Ltd.,FACT,590024,FERTILIZERS,FERTILIZERS,"1,713.6","1,530.8",132.4,7.96%,5.3,61.2,105.2,0,105.2,1.6,508.4,7.9 -Home First Finance Company India Ltd.,HOMEFIRST,543259,BANKING AND FINANCE,HOUSING FINANCE,278,53.7,211.6,77.43%,2.8,117,96.4,22.1,74.3,8.4,266.2,30.2 -CG Power and Industrial Solutions Ltd.,CGPOWER,500093,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,019","1,692.9",308.6,15.42%,22.9,0.4,329.9,86.2,242.3,1.6,"1,1",7.2 -Laxmi Organic Industries Ltd.,LXCHEM,543277,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,660.5,613.3,38.9,5.97%,27.5,2.1,17.5,6.8,10.7,0.4,100.6,3.8 -Anupam Rasayan India Ltd.,ANURAS,543275,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,395.6,284.7,107.5,27.41%,19.8,20.4,70.7,22,40.7,3.8,178.9,16.6 -Kalyan Jewellers India Ltd.,KALYANKJIL,ASM,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"4,427.7","4,100.9",313.7,7.11%,66.9,81.7,178.1,43.3,135.2,1.3,497.9,4.8 -Jubilant Pharmova Ltd.,JUBLPHARMA,530019,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,690.2","1,438.5",241.8,14.39%,96.6,66.1,89,35.9,62.5,3.9,-44.6,-2.8 -Indigo Paints Ltd.,INDIGOPNTS,543258,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,273.4,228.7,41.8,15.45%,10,0.5,34.3,8.2,26.1,5.5,132.4,27.8 -Indian Railway Finance Corporation Ltd.,IRFC,543257,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"6,767.5",33.5,"6,732.4",99.50%,2.1,"5,181.5","1,549.9",0,"1,549.9",1.2,"6,067.6",4.6 -Mastek Ltd.,MASTEK,523704,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,770.4,642.5,123,16.07%,20.9,12.6,90.3,25,62.8,20.5,269.7,88 -Equitas Small Finance Bank Ltd.,EQUITASBNK,543243,BANKING AND FINANCE,BANKS,"1,540.4",616.8,330.2,24.30%,0,593.4,267,68.9,198.1,1.8,749.5,6.7 -Tata Teleservices (Maharashtra) Ltd.,TTML,532371,TELECOM SERVICES,TELECOM SERVICES,288.6,159.3,127.5,44.45%,36.3,403.2,-310.2,0,-310.2,-1.6,"-1,168.3",-6 -Praj Industries Ltd.,PRAJIND,522205,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,893.3,798.4,84,9.52%,9.1,1,84.8,22.4,62.4,3.4,271.4,14.8 -Nazara Technologies Ltd.,NAZARA,543280,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,309.5,269.4,26.7,8.98%,15.1,2.7,21.2,-1.3,19.8,3,60,9.1 -Jubilant Ingrevia Ltd.,JUBLINGREA,543271,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,028.5",902.3,117.7,11.54%,33.9,12.5,79.8,22.4,57.5,3.6,258.9,16.4 -Sona BLW Precision Forgings Ltd.,SONACOMS,543300,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,796.9,567.5,223.3,28.24%,53.4,6,164.1,40.1,123.8,2.1,462.8,7.9 -Chemplast Sanmar Ltd.,CHEMPLASTS,543336,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,025",941.8,46,4.65%,35.3,38.6,9.2,-16.8,26.1,1.6,35.3,2.2 -Aptus Value Housing Finance India Ltd.,APTUS,543335,BANKING AND FINANCE,HOUSING FINANCE,344.5,50.6,277.5,83.18%,2.6,96.1,189.6,41.5,148,3,551.1,11.1 -Clean Science & Technology Ltd.,CLEAN,543318,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,187.1,106.3,74.8,41.32%,11.1,0.3,69.5,17.3,52.2,4.9,275.5,25.9 -Medplus Health Services Ltd.,MEDPLUS,543427,HEALTHCARE EQUIPMENT & SUPPLIES,HEALTHCARE SUPPLIES,"1,419","1,323.5",85.1,6.04%,55.5,23.5,16.4,1.9,14.6,1.2,58.3,4.9 -Nuvoco Vistas Corporation Ltd.,NUVOCO,543334,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,578.9","2,243",329.9,12.82%,225.6,139.9,-29.6,-31.1,1.5,0,141.8,4 -Star Health and Allied Insurance Company Ltd.,STARHEALTH,543412,BANKING AND FINANCE,GENERAL INSURANCE,"3,463.2","3,295.8",165.7,4.79%,0,0,167.1,41.8,125.3,2.1,725.4,12.4 -Go Fashion (India) Ltd.,GOCOLORS,543401,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,192.8,132.2,56.6,29.98%,25.8,8.9,25.8,5.7,20,3.7,85.4,15.8 -PB Fintech Ltd.,POLICYBZR,543390,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,909.1,900.7,-89.1,-10.98%,22.3,7.2,-21.1,-0.3,-20.2,-0.5,-127.9,-2.8 -FSN E-Commerce Ventures Ltd.,NYKAA,543384,SOFTWARE & SERVICES,INTERNET & CATALOGUE RETAIL,"1,515.6","1,426.4",80.6,5.35%,54.6,21.3,13.3,4,5.8,0,19.8,0.1 -Krishna Institute of Medical Sciences Ltd.,KIMS,543308,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,655.4,475.2,177.3,27.17%,32.6,8.9,138.6,37.3,92,11.5,342.1,42.7 -Zomato Ltd.,ZOMATO,543320,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"3,06","2,895",-47,-1.65%,128,16,21,-15,36,0,-496.8,-0.6 -Brightcom Group Ltd.,BCG,532368,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,690.5","1,172.3",518,30.65%,72.3,0.1,445.8,124.3,321.5,1.6,"1,415.2",7 -Shyam Metalics and Energy Ltd.,SHYAMMETL,543299,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"2,978.9","2,633.6",307.1,10.44%,176.5,35.4,133.4,-348.6,484.1,18.9,"1,049.9",41.2 -G R Infraprojects Ltd.,GRINFRA,543317,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,909.2","1,415.7",467.1,24.81%,61.7,144.6,287.1,69.9,217.2,22.5,"1,240.3",128.3 -RattanIndia Enterprises Ltd.,RTNINDIA,534597,UTILITIES,ELECTRIC UTILITIES,"1,618.1","1,392.8",1.5,0.11%,4.3,28.8,142.2,1.7,140.9,1,147.6,1.1 -Borosil Renewables Ltd.,BORORENEW,502219,CONSUMER DURABLES,HOUSEWARE,406.3,369.2,32.5,8.09%,31,9.6,28.9,-1.1,25.1,1.9,32.1,2.5 -HLE Glascoat Ltd.,HLEGLAS,522215,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,227.8,198,26.5,11.79%,6.1,5.8,16.1,5.3,10,1.6,54.4,8 -Tata Investment Corporation Ltd.,TATAINVEST,501301,DIVERSIFIED,HOLDING COMPANIES,125,10.1,113.8,91.88%,0.2,4.7,110.1,-1.3,124.4,24.6,326.1,64.4 -Sapphire Foods India Ltd.,SAPPHIRE,543397,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,650.1,527.5,115.1,17.91%,76.8,24.5,21.4,6.2,15.3,2.4,208.5,32.7 -Devyani International Ltd.,DEVYANI,543330,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,826,665,154.4,18.84%,86.3,41.7,19,-16.8,33.4,0.3,177.5,1.5 -Vijaya Diagnostic Centre Ltd.,VIJAYA,543350,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,145.6,81.5,57.4,41.31%,13.7,5.9,44.6,11,33.3,3.3,103.4,10.1 -C.E. Info Systems Ltd.,MAPMYINDIA,543425,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,99.3,50.1,41,44.98%,3.7,0.7,44.7,11.1,33,6.1,122.9,22.7 -Latent View Analytics Ltd.,LATENTVIEW,543398,SOFTWARE & SERVICES,DATA PROCESSING SERVICES,172.7,124.9,30.8,19.78%,2.3,0.8,44.7,10.6,34,1.7,153.6,7.5 -Metro Brands Ltd.,METROBRAND,543426,RETAILING,FOOTWEAR,571.9,400.3,155.4,27.96%,57.2,19.7,94.7,27.5,66.7,2.5,340,12.5 -Easy Trip Planners Ltd.,EASEMYTRIP,543272,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,144.6,76.9,64.8,45.71%,1,2,64.7,17.7,47.2,0.3,146,0.8 -Shree Renuka Sugars Ltd.,RENUKA,532670,FOOD BEVERAGES & TOBACCO,SUGAR,"2,564.7","2,491",63.7,2.49%,64.1,216.8,-207.2,-1.6,-204.9,-1,-286,-1.3 -One97 Communications Ltd.,PAYTM,543396,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"2,662.5","2,749.6",-231,-9.17%,180.1,7,-279.9,12.7,-290.5,-5,"-1,207.9",-19 -MTAR Technologies Ltd.,MTARTECH,543270,GENERAL INDUSTRIALS,DEFENCE,167.7,130.7,36.1,21.64%,5.8,5.5,25.7,5.2,20.5,6.7,103.3,33.6 -Capri Global Capital Ltd.,CGCL,531595,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),557.4,229.3,304.8,54.70%,23.1,195.8,86,20.8,65.2,3.2,231.2,11.2 -GMR Airports Infrastructure Ltd.,GMRINFRA,ASM,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"2,185","1,336.8",726.7,35.22%,373,695.8,-252,54.9,-91,-0.1,-370.9,-0.6 -Triveni Engineering & Industries Ltd.,TRIVENI,532356,FOOD BEVERAGES & TOBACCO,SUGAR,"1,629.7","1,554.5",62.9,3.89%,25.8,10.2,39.3,10.1,29.1,1.3,434.3,19.8 -Delhivery Ltd.,DELHIVERY,543529,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"2,043","1,957.3",-15.6,-0.80%,171.2,19.6,-105.2,-2.1,-102.9,-1.4,-546.7,-7.5 -Life Insurance Corporation of India,LICI,543526,BANKING AND FINANCE,LIFE INSURANCE,"202,394.9","193,612.5","8,445",4.18%,0,0,"8,696.5","1,083.9","8,030.3",12.7,"37,204.8",58.8 -Campus Activewear Ltd.,CAMPUS,543523,RETAILING,FOOTWEAR,259.1,234.2,24.5,9.46%,18.1,6.5,0.4,0.1,0.3,0,103.1,3.4 -Motherson Sumi Wiring India Ltd.,MSUMI,543498,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,110.2","1,856.5",248.1,11.79%,36.4,7.4,210,54.1,155.9,0.3,523.6,1.2 -Olectra Greentech Ltd.,OLECTRA,532439,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,310.3,266.6,40.5,13.20%,8.8,9.7,25.2,8,18.6,2.2,78.5,9.6 -Patanjali Foods Ltd.,PATANJALI,500368,FMCG,EDIBLE OILS,"7,845.8","7,426.6",395.3,5.05%,60.1,24,335.1,80.5,254.5,7,875.2,24.2 -Raymond Ltd.,RAYMOND,500330,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,320.7","1,938.8",314.6,13.96%,65.4,89.3,204.2,50.7,159.8,24,"1,514.2",227.5 -Swan Energy Ltd.,SWANENERGY,503310,REALTY,REALTY,"1,230.1",966.3,257,21.01%,27.1,58.3,178.4,12.8,84.6,6.7,308.4,11.7 -Samvardhana Motherson International Ltd.,MOTHERSON,517334,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"23,639.2","21,585","1,888.8",8.05%,867.4,487.9,449.5,229.2,201.6,0.3,"1,910.3",2.8 -Vedant Fashions Ltd.,MANYAVAR,543463,RETAILING,SPECIALTY RETAIL,233.4,125.5,92.8,42.51%,32.5,10.7,64.8,16.1,48.7,2,399.9,16.5 -Adani Wilmar Ltd.,AWL,543458,FMCG,EDIBLE OILS,"12,331.2","12,123.5",143.7,1.17%,95.7,220.2,-161.8,-31.5,-130.7,-1,130.1,1 -Mahindra Lifespace Developers Ltd.,MAHLIFE,532313,REALTY,REALTY,25.7,52.7,-34.9,-196.45%,3.1,0.2,-30.3,-10.8,-18.9,-1.2,10.5,0.7 -Tejas Networks Ltd.,TEJASNET,540595,TELECOM SERVICES,OTHER TELECOM SERVICES,413.9,383,13,3.28%,41.7,7,-17.7,-5.1,-12.6,-0.7,-61.3,-3.5 -Aether Industries Ltd.,AETHER,543534,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,178.3,118.2,46,28.00%,9.7,1.6,48.7,12.1,36.7,2.8,139.1,10.5 -JBM Auto Ltd.,JBMA,ASM,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,238.8","1,091.3",139.7,11.35%,41.2,47.9,58.3,11.3,44.2,3.7,136.8,11.6 -Deepak Fertilisers & Petrochemicals Corporation Ltd.,DEEPAKFERT,500645,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"2,443.2","2,138.1",286.1,11.80%,81.2,107.1,116.8,53.3,60.1,4.8,674.5,53.4 -Sharda Cropchem Ltd.,SHARDACROP,538666,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,604.3,559.6,21.2,3.65%,74,4.6,-33.8,-6.3,-27.6,-3.1,191,21.2 -Shoppers Stop Ltd.,SHOPERSTOP,532638,RETAILING,DEPARTMENT STORES,"1,049.7",878.2,160.9,15.49%,108.2,54.9,3.5,0.8,2.7,0.2,94.2,8.6 -BEML Ltd.,BEML,500048,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,924,855.3,61.5,6.70%,15.8,10.8,42.2,-9.6,51.8,12.4,200.8,48.2 -Lemon Tree Hotels Ltd.,LEMONTREE,541233,HOTELS RESTAURANTS & TOURISM,HOTELS,230.1,125.3,101.9,44.84%,22.6,47.3,34.8,8.6,22.6,0.3,130.1,1.6 -Rainbow Childrens Medicare Ltd.,RAINBOW,543524,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,340.5,215.1,117.6,35.34%,26.8,13.3,85.2,22.1,62.9,6.2,215.4,21.2 -UCO Bank,UCOBANK,532505,BANKING AND FINANCE,BANKS,"5,865.6","1,581.5",981.9,18.81%,0,"3,302.3",639.8,238.1,403.5,0.3,"1,84",1.5 -Piramal Pharma Ltd.,PPLPHARMA,543635,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,960.6","1,645.7",265.6,13.90%,184.5,109.9,20.4,34.5,5,0,-133.6,-1 -KSB Ltd.,KSB,500249,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,572.2,493.4,70.3,12.47%,12.3,2,64.5,17.1,50.1,14.4,209.7,60.3 -Data Patterns (India) Ltd.,DATAPATTNS,543428,GENERAL INDUSTRIALS,DEFENCE,119.2,67.5,40.8,37.63%,3.1,2.3,46.3,12.5,33.8,6,148.3,26.5 -Global Health Ltd.,MEDANTA,543654,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,864.7,631.1,212.9,25.22%,42.9,20.1,170.6,45.4,125.2,4.7,408.9,15.2 -Aarti Industries Ltd.,AARTIIND,524208,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,454","1,221.2",232.8,16.01%,93,58.2,81.6,-9.1,90.7,2.5,446.2,12.3 -BLS International Services Ltd.,BLS,540073,DIVERSIFIED CONSUMER SERVICES,TRAVEL SUPPORT SERVICES,416.4,321,86.7,21.27%,7.3,1,87.2,5.2,78.7,1.9,267.6,6.5 -Archean Chemical Industries Ltd.,ACI,543657,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,301.7,195,95.5,32.86%,17.5,1.9,87.3,21.3,66,5.4,394.4,32.1 -Adani Power Ltd.,ADANIPOWER,ASM,UTILITIES,ELECTRIC UTILITIES,"14,935.7","7,819.2","5,171.4",39.81%,"1,004.5",888.4,"5,223.6","-1,370.6","6,594.2",16.5,"20,604.8",53.4 -Craftsman Automation Ltd.,CRAFTSMAN,543276,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,183.8",941.6,237.5,20.14%,66.8,41.6,133.8,29.6,94.5,44.1,298.3,141.2 -NMDC Ltd.,NMDC,526371,METALS & MINING,MINING,"4,335","2,823.6","1,190.4",29.66%,88.8,18.6,"1,404.1",379,"1,026.2",3.5,"5,862.2",20 -Epigral Ltd.,EPIGRAL,543332,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,479.1,370.2,107.9,22.57%,31.5,21.3,56.1,17.9,38,9.1,223.4,53.8 -Apar Industries Ltd.,APARINDS,532259,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"3,944.7","3,576.2",349.8,8.91%,28.2,103.1,237.3,62.9,173.9,45.4,783.9,204.8 -Bikaji Foods International Ltd.,BIKAJI,543653,FMCG,PACKAGED FOODS,614.7,521,87.7,14.41%,15.6,2.9,75.2,15.4,61.2,2.5,173.6,6.9 -Five-Star Business Finance Ltd.,FIVESTAR,543663,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),522.4,133.2,375,72.28%,5.7,105.9,267,67.6,199.4,6.8,703,24.1 -Ingersoll-Rand (India) Ltd.,INGERRAND,500210,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,282.8,210.7,65.7,23.76%,4.6,0.6,67,17.2,49.7,15.8,218.5,69.2 -KFIN Technologies Ltd.,KFINTECH,543720,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,215.3,115.3,93.7,44.82%,12.6,3.2,84.2,22.3,61.4,3.6,215.1,12.6 -Piramal Enterprises Ltd.,PEL,500302,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"2,205.2","1,320.1","1,117.9",50.97%,38.3,"1,038.9",-11.8,10.7,48.2,2,"3,906.5",173.9 -NMDC Steel Ltd.,NSLNISP,543768,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,290.3,349.6,-72.2,-26.04%,74.5,40.8,-174.7,-43.6,-131.1,-0.5,, -Eris Lifesciences Ltd.,ERIS,540596,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,508.8,324.2,181.1,35.85%,42.1,16.3,126.2,3.9,123.4,9.1,385.6,28.3 -Mankind Pharma Ltd.,MANKIND,543904,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,768.1","2,025.5",682.6,25.21%,96.5,8.6,637.5,129.8,501,12.5,"1,564.8",39.1 -Kaynes Technology India Ltd.,KAYNES,ASM,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,369.8,312.1,48.8,13.52%,6.5,11.8,39.4,7.1,32.3,5.5,143.2,24.6 -Safari Industries (India) Ltd.,SAFARI,523025,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,372.9,306.6,63.5,17.15%,12.2,2.2,51.9,12.1,39.8,16.7,162.3,68.2 -Saregama India Ltd.,SAREGAMA,532163,MEDIA,MOVIES & ENTERTAINMENT,185.6,111.5,60.9,35.32%,8.2,0.2,65.6,17.6,48.1,2.5,193.4,10 -Syrma SGS Technology Ltd.,SYRMA,543573,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,720.6,662.7,49,6.88%,11.6,8,37,6.4,28.3,1.6,132.4,7.5 -Jindal Saw Ltd.,JINDALSAW,ASM,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"5,488.9","4,662",804.2,14.71%,142.5,188.7,495.6,139.6,375.7,11.8,"1,135.8",35.5 -Godawari Power & Ispat Ltd.,GPIL,532734,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"1,314.2",929.6,361.4,28.00%,34.8,10.2,339.6,86.1,256.9,20.6,785.5,63 -Gillette India Ltd.,GILLETTE,507815,FMCG,PERSONAL PRODUCTS,676.2,530.8,136.7,20.48%,20.1,0.1,125.2,32.5,92.7,28.4,361.6,111 -Symphony Ltd.,SYMPHONY,517385,CONSUMER DURABLES,CONSUMER ELECTRONICS,286,234,41,14.91%,7,2,43,8,35,5.1,114,16.5 -Glenmark Life Sciences Ltd.,GLS,543322,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,600.7,428.3,167.1,28.06%,13.1,0.4,158.9,40.2,118.7,9.7,505.5,41.3 -Usha Martin Ltd.,USHAMART,517146,METALS & MINING,IRON & STEEL PRODUCTS,806,640.4,144.3,18.39%,18,6.4,141.2,35,109.5,3.6,399.4,13.1 -Ircon International Ltd.,IRCON,541956,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"3,136.3","2,771.2",215.7,7.22%,27.1,36.9,301.2,77.6,250.7,2.7,884.6,9.4 -Ujjivan Small Finance Bank Ltd.,UJJIVANSFB,542904,BANKING AND FINANCE,BANKS,"1,579.8",528.6,483.4,34.75%,0,567.8,436.4,108.7,327.7,1.7,"1,254.5",6.4 -Procter & Gamble Health Ltd.,PGHL,500126,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,311,216.3,88.7,29.08%,6.5,0.2,88,22.5,65.6,39.5,231.4,139.4 -Allcargo Logistics Ltd.,ALLCARGO,532749,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"3,336.3","3,188.8",118,3.57%,106.7,36.7,14.2,1.3,21.8,0.9,361.9,14.7 -Sheela Foam Ltd.,SFL,540203,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,637.6,547,66.2,10.80%,21.9,8.6,60.2,15.6,44,4.5,192.4,17.7 -Alok Industries Ltd.,ALOKINDS,521070,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,369.3","1,323.1",35.9,2.64%,78.6,142.2,-174.6,0,-174.8,-0.3,-948.4,-1.9 -Minda Corporation Ltd.,MINDACORP,538962,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,197.9","1,064.5",131.3,10.98%,41.4,14.9,77,18.7,58.8,2.5,278.2,11.6 -Concord Biotech Ltd.,CONCORDBIO,543960,PHARMACEUTICALS & BIOTECHNOLOGY,BIOTECHNOLOGY,270.5,143.2,119.2,45.43%,13.3,0.8,113.2,28.7,81,7.7,, \ No newline at end of file diff --git a/sdk/ai/ai-projects/samples-dev/data/sampleFileForUpload.txt b/sdk/ai/ai-projects/samples-dev/data/sampleFileForUpload.txt deleted file mode 100644 index ab553b3304c1..000000000000 --- a/sdk/ai/ai-projects/samples-dev/data/sampleFileForUpload.txt +++ /dev/null @@ -1 +0,0 @@ -The word 'apple' uses the code 442345, while the word 'banana' uses the code 673457. diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/README.md b/sdk/ai/ai-projects/samples/v1-beta/javascript/README.md deleted file mode 100644 index 0c121d9619b6..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/README.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -page_type: sample -languages: - - javascript -products: - - azure -urlFragment: ai-projects-javascript-beta ---- - -# Azure AI Projects client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for Azure AI Projects in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| [agents\codeInterpreterWithStreaming.js][agents_codeinterpreterwithstreaming] | demonstrates how to use agent operations with code interpreter. | -| [agents\agentCreateWithTracingConsole.js][agents_agentcreatewithtracingconsole] | Create Agent and instrument using open telemetry. | -| [agents\agentsAzureAiSearch.js][agents_agentsazureaisearch] | demonstrates how to use agent operations with the Azure AI Search tool. | -| [agents\agentsBasics.js][agents_agentsbasics] | demonstrates how to use basic agent operations. | -| [agents\agentsBingGrounding.js][agents_agentsbinggrounding] | demonstrates how to use agent operations with the Grounding with Bing Search tool. | -| [agents\agentsBingGroundingWithStreaming.js][agents_agentsbinggroundingwithstreaming] | demonstrates how to use agent operations with the Grounding with Bing Search tool using streaming. | -| [agents\agentsWithFunctionTool.js][agents_agentswithfunctiontool] | demonstrates how to use basic agent operations using function tool. | -| [agents\agentsWithToolset.js][agents_agentswithtoolset] | demonstrates how to use agent operations with toolset. | -| [agents\batchVectorStoreWithFiles.js][agents_batchvectorstorewithfiles] | demonstrates how to create the batch vector store with the list of files. | -| [agents\batchVectorStoreWithFilesAndPolling.js][agents_batchvectorstorewithfilesandpolling] | demonstrates how to create the batch vector store with the list of files using polling operation. | -| [agents\codeInterpreter.js][agents_codeinterpreter] | demonstrates how to use agent operations with code interpreter. | -| [agents\fileSearch.js][agents_filesearch] | This sample demonstrates how to use agent operations with file searching. | -| [agents\files.js][agents_files] | demonstrates how to use basic files agent operations. | -| [agents\filesWithLocalUpload.js][agents_fileswithlocalupload] | demonstrates how to use basic files agent operations with local file upload. | -| [agents\filesWithPolling.js][agents_fileswithpolling] | demonstrates how to upload a file and poll for its status. | -| [agents\messages.js][agents_messages] | demonstrates how to use basic message agent operations. | -| [agents\runSteps.js][agents_runsteps] | demonstrates how to use basic run agent operations. | -| [agents\streaming.js][agents_streaming] | demonstrates how to use agent operations in streaming. | -| [agents\threads.js][agents_threads] | demonstrates how to use basic thread agent operations. | -| [agents\vectorStoreWithFiles.js][agents_vectorstorewithfiles] | demonstrates how to create the vector store with the list of files. | -| [agents\vectorStoreWithFilesAndPolling.js][agents_vectorstorewithfilesandpolling] | demonstrates how to create the vector store with the list of files using polling operation. | -| [agents\vectorStores.js][agents_vectorstores] | demonstrates how to create the vector store. | -| [agents\vectorStoresWithPolling.js][agents_vectorstoreswithpolling] | demonstrates how to create the vector store using polling operation. | -| [connections\connectionsBasics.js][connections_connectionsbasics] | Given an AIProjectClient, this sample demonstrates how to enumerate the properties of all connections, get the properties of a default connection, and get the properties of a connection by its name. | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node agents\codeInterpreterWithStreaming.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env AZURE_AI_PROJECTS_CONNECTION_STRING="" node agents\codeInterpreterWithStreaming.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[agents_codeinterpreterwithstreaming]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreterWithStreaming.js -[agents_agentcreatewithtracingconsole]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentCreateWithTracingConsole.js -[agents_agentsazureaisearch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsAzureAiSearch.js -[agents_agentsbasics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBasics.js -[agents_agentsbinggrounding]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGrounding.js -[agents_agentsbinggroundingwithstreaming]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGroundingWithStreaming.js -[agents_agentswithfunctiontool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithFunctionTool.js -[agents_agentswithtoolset]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithToolset.js -[agents_batchvectorstorewithfiles]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFiles.js -[agents_batchvectorstorewithfilesandpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFilesAndPolling.js -[agents_codeinterpreter]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreter.js -[agents_filesearch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/fileSearch.js -[agents_files]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/files.js -[agents_fileswithlocalupload]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithLocalUpload.js -[agents_fileswithpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithPolling.js -[agents_messages]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/messages.js -[agents_runsteps]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/runSteps.js -[agents_streaming]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/streaming.js -[agents_threads]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/threads.js -[agents_vectorstorewithfiles]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFiles.js -[agents_vectorstorewithfilesandpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFilesAndPolling.js -[agents_vectorstores]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStores.js -[agents_vectorstoreswithpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoresWithPolling.js -[connections_connectionsbasics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/javascript/connections/connectionsBasics.js - -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/README.md diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentCreateWithTracingConsole.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentCreateWithTracingConsole.js deleted file mode 100644 index bb81023028ea..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentCreateWithTracingConsole.js +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * Demonstrates How to instrument and get tracing using open telemetry. - * - * @summary Create Agent and instrument using open telemetry. - */ - -const { AzureMonitorTraceExporter } = require("@azure/monitor-opentelemetry-exporter"); -const { createAzureSdkInstrumentation } = require("@azure/opentelemetry-instrumentation-azure-sdk"); -const { context, trace } = require("@opentelemetry/api"); -const { registerInstrumentations } = require("@opentelemetry/instrumentation"); -const { - ConsoleSpanExporter, - NodeTracerProvider, - SimpleSpanProcessor, -} = require("@opentelemetry/sdk-trace-node"); - -require("dotenv").config(); - -const provider = new NodeTracerProvider(); -provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -provider.register(); - -registerInstrumentations({ - instrumentations: [createAzureSdkInstrumentation()], -}); - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { delay } = require("@azure/core-util"); -const { DefaultAzureCredential } = require("@azure/identity"); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; -let appInsightsConnectionString = process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"]; - -async function main() { - const tracer = trace.getTracer("Agents Sample", "1.0.0"); - - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - if (!appInsightsConnectionString) { - appInsightsConnectionString = await client.telemetry.getConnectionString(); - } - - if (appInsightsConnectionString) { - const exporter = new AzureMonitorTraceExporter({ - connectionString: appInsightsConnectionString, - }); - provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - } - - await tracer.startActiveSpan("main", async (span) => { - client.telemetry.updateSettings({ enableContentRecording: true }); - - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - tracingOptions: { tracingContext: context.active() }, - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - const thread = await client.agents.createThread(); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Hello, tell me a joke", - }); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - console.log(`Created Run, Run ID: ${run.id}`); - - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - } - - await client.agents.deleteAgent(agent.id); - - console.log(`Deleted agent`); - - await client.agents.listMessages(thread.id); - - span.end(); - }); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsAzureAiSearch.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsAzureAiSearch.js deleted file mode 100644 index e02cd85e24c3..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsAzureAiSearch.js +++ /dev/null @@ -1,73 +0,0 @@ -const { AIProjectsClient, isOutputOfType, ToolUtility } = require("@azure/ai-projects"); -const { delay } = require("@azure/core-util"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const connectionName = process.env["AZURE_AI_SEARCH_CONNECTION_NAME"] || ""; - const connection = await client.connections.getConnection(connectionName); - - // Initialize Azure AI Search tool - const azureAISearchTool = ToolUtility.createAzureAISearchTool(connection.id, connection.name); - - // Create agent with the Azure AI search tool - const agent = await client.agents.createAgent("gpt-4-0125-preview", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [azureAISearchTool.definition], - toolResources: azureAISearchTool.resources, - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Hello, send an email with the datetime and weather information in New York", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run in thread with tools - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the assistant when done - client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBasics.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBasics.js deleted file mode 100644 index 9a54616331ac..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBasics.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic agent operations. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - client.agents.deleteAgent(agent.id); - - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGrounding.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGrounding.js deleted file mode 100644 index c455574249fd..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGrounding.js +++ /dev/null @@ -1,81 +0,0 @@ -const { - AIProjectsClient, - ToolUtility, - connectionToolType, - isOutputOfType, -} = require("@azure/ai-projects"); -const { delay } = require("@azure/core-util"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const bingConnection = await client.connections.getConnection( - process.env["BING_CONNECTION_NAME"] || "", - ); - const connectionId = bingConnection.id; - - // Initialize agent bing tool with the connection id - const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - connectionId, - ]); - - // Create agent with the bing tool and process assistant run - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "How does wikipedia explain Euler's Identity?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run in thread with tools - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the assistant when done - client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGroundingWithStreaming.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGroundingWithStreaming.js deleted file mode 100644 index ac21304ece29..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsBingGroundingWithStreaming.js +++ /dev/null @@ -1,105 +0,0 @@ -const { - AIProjectsClient, - DoneEvent, - ErrorEvent, - MessageStreamEvent, - RunStreamEvent, - ToolUtility, - connectionToolType, - isOutputOfType, -} = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const bingConnection = await client.connections.getConnection( - process.env["BING_CONNECTION_NAME"] || "", - ); - const connectionId = bingConnection.id; - - const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - connectionId, - ]); - - // Create agent with the bing tool and process assistant run - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "How does wikipedia explain Euler's Identity?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run with streaming in thread with tools - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${eventMessage.data.status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - // Delete the assistant when done - client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithFunctionTool.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithFunctionTool.js deleted file mode 100644 index 1a0b1a06fb51..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithFunctionTool.js +++ /dev/null @@ -1,181 +0,0 @@ -const { AIProjectsClient, ToolUtility, isOutputOfType } = require("@azure/ai-projects"); -const { delay } = require("@azure/core-util"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const agents = client.agents; - class FunctionToolExecutor { - functionTools; - - constructor() { - this.functionTools = [ - { - func: this.getUserFavoriteCity, - ...ToolUtility.createFunctionTool({ - name: "getUserFavoriteCity", - description: "Gets the user's favorite city.", - parameters: {}, - }), - }, - { - func: this.getCityNickname, - ...ToolUtility.createFunctionTool({ - name: "getCityNickname", - description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.", - parameters: { - type: "object", - properties: { - location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, - }, - }, - }), - }, - { - func: this.getWeather, - ...ToolUtility.createFunctionTool({ - name: "getWeather", - description: "Gets the weather for a location.", - parameters: { - type: "object", - properties: { - location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, - unit: { type: "string", enum: ["c", "f"] }, - }, - }, - }), - }, - ]; - } - - getUserFavoriteCity() { - return { location: "Seattle, WA" }; - } - - getCityNickname(_location) { - return { nickname: "The Emerald City" }; - } - - getWeather(_location, unit) { - return { weather: unit === "f" ? "72f" : "22c" }; - } - - invokeTool(toolCall) { - console.log(`Function tool call - ${toolCall.function.name}`); - const args = []; - if (toolCall.function.parameters) { - try { - const params = JSON.parse(toolCall.function.parameters); - for (const key in params) { - if (Object.prototype.hasOwnProperty.call(params, key)) { - args.push(params[key]); - } - } - } catch (error) { - console.error(`Failed to parse parameters: ${toolCall.function.parameters}`, error); - return undefined; - } - } - const result = this.functionTools - .find((tool) => tool.definition.function.name === toolCall.function.name) - ?.func(...args); - return result - ? { - toolCallId: toolCall.id, - output: JSON.stringify(result), - } - : undefined; - } - - getFunctionDefinitions() { - return this.functionTools.map((tool) => { - return tool.definition; - }); - } - } - - const functionToolExecutor = new FunctionToolExecutor(); - const functionTools = functionToolExecutor.getFunctionDefinitions(); - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: - "You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.", - tools: functionTools, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "What's the weather like in my favorite city?", - }); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await agents.createRun(thread.id, agent.id); - console.log(`Created Run, Run ID: ${run.id}`); - - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - if (run.status === "requires_action" && run.requiredAction) { - console.log(`Run requires action - ${run.requiredAction}`); - if (isOutputOfType(run.requiredAction, "submit_tool_outputs")) { - const submitToolOutputsActionOutput = run.requiredAction; - const toolCalls = submitToolOutputsActionOutput.submitToolOutputs.toolCalls; - const toolResponses = []; - for (const toolCall of toolCalls) { - if (isOutputOfType(toolCall, "function")) { - const toolResponse = functionToolExecutor.invokeTool(toolCall); - if (toolResponse) { - toolResponses.push(toolResponse); - } - } - } - if (toolResponses.length > 0) { - run = await agents.submitToolOutputsToRun(thread.id, run.id, toolResponses); - console.log(`Submitted tool response - ${run.status}`); - } - } - } - } - - console.log(`Run status - ${run.status}, run ID: ${run.id}`); - const messages = await agents.listMessages(thread.id); - messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content) => { - if (isOutputOfType(content, "text")) { - const textContent = content; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - // Delete agent - agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithToolset.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithToolset.js deleted file mode 100644 index 497c2d1b06ef..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/agentsWithToolset.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with toolset and iteration in streaming - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with toolset. - */ - -const { AIProjectsClient, ToolSet } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const fs = require("fs"); -const path = require("node:path"); - -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file for code interpreter tool - const filePath1 = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const fileStream1 = fs.createReadStream(filePath1); - const codeInterpreterFile = await client.agents.uploadFile(fileStream1, "assistants", { - fileName: "myLocalFile", - }); - - console.log(`Uploaded local file, file ID : ${codeInterpreterFile.id}`); - - // Upload file for file search tool - const filePath2 = path.resolve(__dirname, "../data/sampleFileForUpload.txt"); - const fileStream2 = fs.createReadStream(filePath2); - const fileSearchFile = await client.agents.uploadFile(fileStream2, "assistants", { - fileName: "sampleFileForUpload.txt", - }); - console.log(`Uploaded file, file ID: ${fileSearchFile.id}`); - - // Create vector store for file search tool - const vectorStore = await client.agents - .createVectorStoreAndPoll({ - fileIds: [fileSearchFile.id], - }) - .pollUntilDone(); - - // Create tool set - const toolSet = new ToolSet(); - toolSet.addFileSearchTool([vectorStore.id]); - toolSet.addCodeInterpreterTool([codeInterpreterFile.id]); - - // Create agent with tool set - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: toolSet.toolDefinitions, - toolResources: toolSet.toolResources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create threads, messages, and runs to interact with agent as desired - - // Delete agent - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFiles.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFiles.js deleted file mode 100644 index e5f9ec7a84fe..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFiles.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the batch vector store with the list of files. - * - * @summary demonstrates how to create the batch vector store with the list of files. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const { Readable } = require("stream"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload first file - const file1Content = "Hello, Vector Store!"; - const readable1 = new Readable(); - readable1.push(file1Content); - readable1.push(null); // end the stream - const file1 = await client.agents.uploadFile(readable1, "assistants", { - fileName: "vectorFile1.txt", - }); - console.log(`Uploaded file1, file ID: ${file1.id}`); - - // Create and upload second file - const file2Content = "This is another file for the Vector Store!"; - const readable2 = new Readable(); - readable2.push(file2Content); - readable2.push(null); // end the stream - const file2 = await client.agents.uploadFile(readable2, "assistants", { - fileName: "vectorFile2.txt", - }); - console.log(`Uploaded file2, file ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await client.agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await client.agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // List vector store files in the batch - const vectorStoreFiles = await client.agents.listVectorStoreFileBatchFiles( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `List of vector store files in the batch: ${vectorStoreFiles.data.map((f) => f.id).join(", ")}`, - ); - - // Delete files - await client.agents.deleteFile(file1.id); - console.log(`Deleted file1, file ID: ${file1.id}`); - await client.agents.deleteFile(file2.id); - console.log(`Deleted file2, file ID: ${file2.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFilesAndPolling.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFilesAndPolling.js deleted file mode 100644 index d1ef60dc4886..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/batchVectorStoreWithFilesAndPolling.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the batch vector store with the list of files using polling operation. - * - * @summary demonstrates how to create the batch vector store with the list of files using polling operation. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const { Readable } = require("stream"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload first file - const file1Content = "Hello, Vector Store!"; - const readable1 = new Readable(); - readable1.push(file1Content); - readable1.push(null); // end the stream - const file1 = await client.agents.uploadFile(readable1, "assistants", { - fileName: "vectorFile1.txt", - }); - console.log(`Uploaded file1, file ID: ${file1.id}`); - - // Create and upload second file - const file2Content = "This is another file for the Vector Store!"; - const readable2 = new Readable(); - readable2.push(file2Content); - readable2.push(null); // end the stream - const file2 = await client.agents.uploadFile(readable2, "assistants", { - fileName: "vectorFile2.txt", - }); - console.log(`Uploaded file2, file ID: ${file2.id}`); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create vector store file batch - const vectorStoreFileBatchOptions = { - fileIds: [file1.id, file2.id], - pollingOptions: { abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreFileBatchAndPoll( - vectorStore.id, - vectorStoreFileBatchOptions, - ); - const vectorStoreFileBatch = await poller.pollUntilDone(); - console.log( - `Created vector store file batch with status ${vectorStoreFileBatch.status}, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await client.agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // Delete files - await client.agents.deleteFile(file1.id); - console.log(`Deleted file1, file ID: ${file1.id}`); - await client.agents.deleteFile(file2.id); - console.log(`Deleted file2, file ID: ${file2.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreter.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreter.js deleted file mode 100644 index 74f631d8de49..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreter.js +++ /dev/null @@ -1,128 +0,0 @@ -const { AIProjectsClient, isOutputOfType, ToolUtility } = require("@azure/ai-projects"); -const { delay } = require("@azure/core-util"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const fs = require("fs"); -const path = require("node:path"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file and wait for it to be processed - const filePath = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "localFile", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Create code interpreter tool - const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]); - - // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment - const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create a thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create a message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create a bar chart in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provide the file to me?", - }); - - console.log(`Created message, message ID: ${message.id}`); - - // Create and execute a run - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - // Check if you got "Rate limit is exceeded.", then you want to get more quota - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the original file from the agent to free up space (note: this does not delete your version of the file) - await client.agents.deleteFile(localFile.id); - console.log(`Deleted file, file ID: ${localFile.id}`); - - // Print the messages from the agent - const messages = await client.agents.listMessages(thread.id); - console.log("Messages:", messages); - - // Get most recent message from the assistant - const assistantMessage = messages.data.find((msg) => msg.role === "assistant"); - if (assistantMessage) { - const textContent = assistantMessage.content.find((content) => isOutputOfType(content, "text")); - if (textContent) { - console.log(`Last message: ${textContent.text.value}`); - } - } - - // Save the newly created file - console.log(`Saving new files...`); - const imageFile = messages.data[0].content[0].imageFile; - console.log(`Image file ID : ${imageFile}`); - const imageFileName = path.resolve( - __dirname, - "../data/" + (await client.agents.getFile(imageFile.fileId)).filename + "ImageFile.png", - ); - - const fileContent = await ( - await client.agents.getFileContent(imageFile.fileId).asNodeStream() - ).body; - if (fileContent) { - const chunks = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); - } else { - console.error("Failed to retrieve file content: fileContent is undefined"); - } - console.log(`Saved image file to: ${imageFileName}`); - - // Iterate through messages and print details for each annotation - console.log(`Message Details:`); - messages.data.forEach((m) => { - console.log(`File Paths:`); - console.log(`Type: ${m.content[0].type}`); - if (isOutputOfType(m.content[0], "text")) { - const textContent = m.content[0]; - console.log(`Text: ${textContent.text.value}`); - } - console.log(`File ID: ${m.id}`); - console.log(`Start Index: ${messages.firstId}`); - console.log(`End Index: ${messages.lastId}`); - }); - - // Delete the agent once done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreterWithStreaming.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreterWithStreaming.js deleted file mode 100644 index d61178d3638f..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/codeInterpreterWithStreaming.js +++ /dev/null @@ -1,156 +0,0 @@ -const { - AIProjectsClient, - DoneEvent, - ErrorEvent, - isOutputOfType, - MessageStreamEvent, - RunStreamEvent, - ToolUtility, -} = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -const dotenv = require("dotenv"); -const fs = require("fs"); -const path = require("node:path"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file and wait for it to be processed - const filePath = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "myLocalFile", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Create code interpreter tool - const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]); - - // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment - const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create a thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create a message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create a bar chart in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provide the file to me?", - }); - - console.log(`Created message, message ID: ${message.id}`); - - // Create and execute a run - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${eventMessage.data.status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - // Delete the original file from the agent to free up space (note: this does not delete your version of the file) - await client.agents.deleteFile(localFile.id); - console.log(`Deleted file, file ID : ${localFile.id}`); - - // Print the messages from the agent - const messages = await client.agents.listMessages(thread.id); - console.log("Messages:", messages); - - // Get most recent message from the assistant - const assistantMessage = messages.data.find((msg) => msg.role === "assistant"); - if (assistantMessage) { - const textContent = assistantMessage.content.find((content) => isOutputOfType(content, "text")); - if (textContent) { - console.log(`Last message: ${textContent.text.value}`); - } - } - - // Save the newly created file - console.log(`Saving new files...`); - const imageFileOutput = messages.data[0].content[0]; - const imageFile = imageFileOutput.imageFile.fileId; - const imageFileName = path.resolve( - __dirname, - "../data/" + (await client.agents.getFile(imageFile)).filename + "ImageFile.png", - ); - console.log(`Image file name : ${imageFileName}`); - - const fileContent = await (await client.agents.getFileContent(imageFile).asNodeStream()).body; - if (fileContent) { - const chunks = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); - } else { - console.error("Failed to retrieve file content: fileContent is undefined"); - } - console.log(`Saved image file to: ${imageFileName}`); - - // Iterate through messages and print details for each annotation - console.log(`Message Details:`); - messages.data.forEach((m) => { - console.log(`File Paths:`); - console.log(`Type: ${m.content[0].type}`); - if (isOutputOfType(m.content[0], "text")) { - const textContent = m.content[0]; - console.log(`Text: ${textContent.text.value}`); - } - console.log(`File ID: ${m.id}`); - console.log(`Start Index: ${messages.firstId}`); - console.log(`End Index: ${messages.lastId}`); - }); - - // Delete the agent once done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/fileSearch.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/fileSearch.js deleted file mode 100644 index e29c79511bf8..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/fileSearch.js +++ /dev/null @@ -1,91 +0,0 @@ -const { AIProjectsClient, isOutputOfType, ToolUtility } = require("@azure/ai-projects"); -const { delay } = require("@azure/core-util"); -const { DefaultAzureCredential } = require("@azure/identity"); - -const dotenv = require("dotenv"); -const fs = require("fs"); -const path = require("node:path"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file - const filePath = path.resolve(__dirname, "../data/sampleFileForUpload.txt"); - const localFileStream = fs.createReadStream(filePath); - const file = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "sampleFileForUpload.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store - const vectorStore = await client.agents.createVectorStore({ - fileIds: [file.id], - name: "myVectorStore", - }); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Initialize file search tool - const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]); - - // Create agent with files - const agent = await client.agents.createAgent("gpt-4o", { - name: "SDK Test Agent - Retrieval", - instructions: "You are helpful agent that can help fetch data from files you know about.", - tools: [fileSearchTool.definition], - toolResources: fileSearchTool.resources, - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Can you give me the documented codes for 'banana' and 'orange'?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - while (["queued", "in_progress"].includes(run.status)) { - await delay(500); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - } - - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - const messages = await client.agents.listMessages(thread.id); - messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content) => { - if (isOutputOfType(content, "text")) { - const textContent = content; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - - // Delete agent - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/files.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/files.js deleted file mode 100644 index eddabeccf8b8..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/files.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic files agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic files agent operations. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -const dotenv = require("dotenv"); -const { Readable } = require("stream"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create and upload file - const fileContent = "Hello, World!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { fileName: "myFile.txt" }); - console.log(`Uploaded file, file ID : ${file.id}`); - - // List uploaded files - const files = await client.agents.listFiles(); - - console.log(`List of files : ${files.data[0].filename}`); - - // Retrieve file - const _file = await client.agents.getFile(file.id); - - console.log(`Retrieved file, file ID : ${_file.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - - console.log(`Deleted file, file ID : ${file.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithLocalUpload.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithLocalUpload.js deleted file mode 100644 index af31ee7700ee..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithLocalUpload.js +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic files agent operations with local file upload from the Azure Agents service. - * - * @summary demonstrates how to use basic files agent operations with local file upload. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -const dotenv = require("dotenv"); -const fs = require("fs"); -const path = require("node:path"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload local file - const filePath = path.resolve(__dirname, "../data/localFile.txt"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "myLocalFile.txt", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Retrieve local file - const retrievedLocalFile = await client.agents.getFile(localFile.id); - - console.log(`Retrieved local file, file ID : ${retrievedLocalFile.id}`); - - // Delete local file - await client.agents.deleteFile(localFile.id); - - console.log(`Deleted local file, file ID : ${localFile.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithPolling.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithPolling.js deleted file mode 100644 index cf299ae57114..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/filesWithPolling.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to upload a file and poll for its status. - * - * @summary demonstrates how to upload a file and poll for its status. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const { Readable } = require("stream"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create file content - const fileContent = "Hello, World!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - - // Upload file and poll - const poller = client.agents.uploadFileAndPoll(readable, "assistants", { - fileName: "myPollingFile", - }); - const file = await poller.pollUntilDone(); - console.log(`Uploaded file with status ${file.status}, file ID : ${file.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID ${file.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/messages.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/messages.js deleted file mode 100644 index 1bb4454956a5..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/messages.js +++ /dev/null @@ -1,45 +0,0 @@ -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - const thread = await client.agents.createThread(); - - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - const messages = await client.agents.listMessages(thread.id); - console.log(`Message ${message.id} contents: ${messages.data[0].content[0].text.value}`); - - const updatedMessage = await client.agents.updateMessage(thread.id, message.id, { - metadata: { introduction: "true" }, - }); - console.log(`Updated message metadata - introduction: ${updatedMessage.metadata?.introduction}`); - - await client.agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID : ${thread.id}`); - - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID : ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/runSteps.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/runSteps.js deleted file mode 100644 index 022cde39b349..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/runSteps.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic run agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic run agent operations. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create agent - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - console.log(`Created run, run ID: ${run.id}`); - - // Wait for run to complete - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await new Promise((resolve) => setTimeout(resolve, 1000)); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Run status: ${run.status}`); - } - - // List run steps - const runSteps = await client.agents.listRunSteps(thread.id, run.id); - console.log(`Listed run steps, run ID: ${run.id}`); - - // Get specific run step - const stepId = runSteps.data[0].id; - const step = await client.agents.getRunStep(thread.id, run.id, stepId); - console.log(`Retrieved run step, step ID: ${step.id}`); - - // Clean up - await client.agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/streaming.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/streaming.js deleted file mode 100644 index f94f3447510a..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/streaming.js +++ /dev/null @@ -1,76 +0,0 @@ -const { - AIProjectsClient, - DoneEvent, - ErrorEvent, - MessageStreamEvent, - RunStreamEvent, -} = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const agent = await client.agents.createAgent("gpt-4-1106-preview", { - name: "my-assistant", - instructions: "You are helpful agent", - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - const thread = await client.agents.createThread(); - - console.log(`Created thread, thread ID : ${agent.id}`); - - await client.agents.createMessage(thread.id, { role: "user", content: "Hello, tell me a joke" }); - - console.log(`Created message, thread ID : ${agent.id}`); - - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${eventMessage.data.status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - await client.agents.deleteAgent(agent.id); - console.log(`Delete agent, agent ID : ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/threads.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/threads.js deleted file mode 100644 index 655262cb701e..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/threads.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic thread agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic thread agent operations. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const thread = await client.agents.createThread(); - - console.log(`Created thread, thread ID : ${thread.id}`); - - const _thread = await client.agents.getThread(thread.id); - - console.log(`Retrieved thread, thread ID : ${_thread.id}`); - - client.agents.deleteThread(thread.id); - - console.log(`Deleted thread, thread ID : ${_thread.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFiles.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFiles.js deleted file mode 100644 index 9e1632feb525..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFiles.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store with the list of files. - * - * @summary demonstrates how to create the vector store with the list of files. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const { Readable } = require("stream"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload file - const fileContent = "Hello, Vector Store!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { - fileName: "vectorFile.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await client.agents.createVectorStoreFile(vectorStore.id, { - fileId: file.id, - }); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Retrieve vector store file - const _vectorStoreFile = await client.agents.getVectorStoreFile( - vectorStore.id, - vectorStoreFile.id, - ); - console.log(`Retrieved vector store file, vector store file ID: ${_vectorStoreFile.id}`); - - // List vector store files - const vectorStoreFiles = await client.agents.listVectorStoreFiles(vectorStore.id); - console.log(`List of vector store files: ${vectorStoreFiles.data.map((f) => f.id).join(", ")}`); - - // Delete vector store file - await client.agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFilesAndPolling.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFilesAndPolling.js deleted file mode 100644 index c2971741015b..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoreWithFilesAndPolling.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store with the list of files using polling operation. - * - * @summary demonstrates how to create the vector store with the list of files using polling operation. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); -const dotenv = require("dotenv"); -const { Readable } = require("stream"); -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload file - const fileContent = "Hello, Vector Store!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { - fileName: "vectorFile.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create vector store file - const vectorStoreFileOptions = { - fileId: file.id, - pollingOptions: { sleepIntervalInMs: 2000, abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreFileAndPoll(vectorStore.id, vectorStoreFileOptions); - const vectorStoreFile = await poller.pollUntilDone(); - console.log( - `Created vector store file with status ${vectorStoreFile.status}, vector store file ID: ${vectorStoreFile.id}`, - ); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStores.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStores.js deleted file mode 100644 index c4738431e4de..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStores.js +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store. - * - * @summary demonstrates how to create the vector store. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create a vector store - const vectorStore = await client.agents.createVectorStore({ name: "myVectorStore" }); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // List vector stores - const vectorStores = await client.agents.listVectorStores(); - console.log("List of vector stores:", vectorStores); - - // Modify the vector store - const updatedVectorStore = await client.agents.modifyVectorStore(vectorStore.id, { - name: "updatedVectorStore", - }); - console.log(`Updated vector store, vector store ID: ${updatedVectorStore.id}`); - - // Get a specific vector store - const retrievedVectorStore = await client.agents.getVectorStore(vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${retrievedVectorStore.id}`); - - // Delete the vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoresWithPolling.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoresWithPolling.js deleted file mode 100644 index e1f57e9307ec..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/agents/vectorStoresWithPolling.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store using polling operation. - * - * @summary demonstrates how to create the vector store using polling operation. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create a vector store - const vectorStoreOptions = { - name: "myVectorStore", - pollingOptions: { sleepIntervalInMs: 2000, abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreAndPoll(vectorStoreOptions); - const vectorStore = await poller.pollUntilDone(); - console.log( - `Created vector store with status ${vectorStore.status}, vector store ID: ${vectorStore.id}`, - ); - - // Get a specific vector store - const retrievedVectorStore = await client.agents.getVectorStore(vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${retrievedVectorStore.id}`); - - // Delete the vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/connections/connectionsBasics.js b/sdk/ai/ai-projects/samples/v1-beta/javascript/connections/connectionsBasics.js deleted file mode 100644 index 23e02f38153b..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/connections/connectionsBasics.js +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to how to use basic connections operations. - * - * @summary Given an AIProjectClient, this sample demonstrates how to enumerate the properties of all connections, - * get the properties of a default connection, and get the properties of a connection by its name. - */ - -const { AIProjectsClient } = require("@azure/ai-projects"); -const { DefaultAzureCredential } = require("@azure/identity"); - -require("dotenv").config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main() { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Get the properties of the specified machine learning workspace - const workspace = await client.connections.getWorkspace(); - console.log(`Retrieved workspace, workspace name: ${workspace.name}`); - - // List the details of all the connections - const connections = await client.connections.listConnections(); - console.log(`Retrieved ${connections.length} connections`); - - // Get the details of a connection, without credentials - const connectionName = connections[0].name; - const connection = await client.connections.getConnection(connectionName); - console.log(`Retrieved connection, connection name: ${connection.name}`); - - // Get the details of a connection, including credentials (if available) - const connectionWithSecrets = await client.connections.getConnectionWithSecrets(connectionName); - console.log(`Retrieved connection with secrets, connection name: ${connectionWithSecrets.name}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); - -module.exports = { main }; diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/data/localFile.txt b/sdk/ai/ai-projects/samples/v1-beta/javascript/data/localFile.txt deleted file mode 100644 index 8ab686eafeb1..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/data/localFile.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/data/nifty500QuarterlyResults.csv b/sdk/ai/ai-projects/samples/v1-beta/javascript/data/nifty500QuarterlyResults.csv deleted file mode 100644 index e02068e09042..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/data/nifty500QuarterlyResults.csv +++ /dev/null @@ -1,502 +0,0 @@ -name,NSE_code,BSE_code,sector,industry,revenue,operating_expenses,operating_profit,operating_profit_margin,depreciation,interest,profit_before_tax,tax,net_profit,EPS,profit_TTM,EPS_TTM -3M India Ltd.,3MINDIA,523395,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"1,057",847.4,192.1,18.48%,12.9,0.7,195.9,49.8,146.1,129.7,535.9,475.7 -ACC Ltd.,ACC,500410,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"4,644.8","3,885.4",549.3,12.39%,212.8,28.9,517.7,131.5,387.9,20.7,"1,202.7",64 -AIA Engineering Ltd.,AIAENG,532683,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,"1,357.1",912.7,382.1,29.51%,24.5,7.4,412.5,88.4,323.1,34.3,"1,216.1",128.9 -APL Apollo Tubes Ltd.,APLAPOLLO,533758,METALS & MINING,IRON & STEEL PRODUCTS,"4,65","4,305.4",325,7.02%,41.3,26.6,276.7,73.8,202.9,7.3,767.5,27.7 -Au Small Finance Bank Ltd.,AUBANK,540611,BANKING AND FINANCE,BANKS,"2,956.5","1,026.7",647.7,25.59%,0,"1,282.1",533.4,131.5,401.8,6,"1,606.2",24 -Adani Ports & Special Economic Zone Ltd.,ADANIPORTS,532921,TRANSPORTATION,MARINE PORT & SERVICES,"6,951.9","2,982.4","3,664",55.13%,974.5,520.1,"2,474.9",759,"1,747.8",8.1,"6,337",29.3 -Adani Energy Solutions Ltd.,ADANIENSOL,ASM,UTILITIES,ELECTRIC UTILITIES,"3,766.5","2,169.3","1,504.6",40.95%,432.1,640.8,369.9,84.9,275.9,2.5,"1,315.1",11.8 -Aditya Birla Fashion and Retail Ltd.,ABFRL,535755,RETAILING,DEPARTMENT STORES,"3,272.2","2,903.6",322.9,10.01%,388.8,208.4,-228.6,-28.2,-179.2,-1.9,-491.7,-5.2 -Aegis Logistics Ltd.,AEGISCHEM,500003,OIL & GAS,OIL MARKETING & DISTRIBUTION,"1,279.3","1,026.5",208.3,16.87%,34.1,26.6,192,42,127,3.6,509,14.5 -Ajanta Pharma Ltd.,AJANTPHARM,532331,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,049.8",737.8,290.7,28.26%,33.7,2.3,275.9,80.6,195.3,15.5,660.2,52.3 -Alembic Pharmaceuticals Ltd.,APLLTD,533573,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,605.1","1,386.7",208.2,13.06%,67.6,15.7,135.1,-1.9,136.6,7,531.7,27 -Alkem Laboratories Ltd.,ALKEM,539523,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"3,503.4","2,693.4",746.7,21.71%,73.9,30.3,648,33.1,620.5,51.9,"1,432.9",119.9 -Amara Raja Energy & Mobility Ltd.,ARE&M,500008,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,988.6","2,556.9",402.5,13.60%,115.7,6.2,309.8,83.5,226.3,13.2,779.8,45.7 -Ambuja Cements Ltd.,AMBUJACEM,500425,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"7,9","6,122.1","1,301.8",17.54%,380.9,61.2,"1,335.7",352.5,793,4,"2,777.9",14 -Apollo Hospitals Enterprise Ltd.,APOLLOHOSP,508869,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"4,869.1","4,219.4",627.5,12.95%,163.4,111.3,376.9,130.2,232.9,16.2,697.5,48.5 -Apollo Tyres Ltd.,APOLLOTYRE,500877,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"6,304.9","5,119.8","1,159.8",18.47%,360.3,132.8,679.9,205.8,474.3,7.5,"1,590.7",25 -Ashok Leyland Ltd.,ASHOKLEY,500477,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"11,463","9,558.6","1,870.4",16.37%,226.6,715.1,924.4,358,526,1.8,"2,141.5",7.3 -Asian Paints Ltd.,ASIANPAINT,500820,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"8,643.8","6,762.3","1,716.2",20.24%,208.7,50.9,"1,621.8",418.6,"1,205.4",12.6,"5,062.6",52.8 -Astral Ltd.,ASTRAL,532830,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,"1,376.4","1,142.9",220.1,16.15%,48.7,8,176.8,45.1,131.2,4.9,549.7,20.4 -Atul Ltd.,ATUL,500027,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,215.8","1,038.5",155.2,13.00%,54,1.9,121.5,32.5,90.3,30.6,392.3,132.9 -Aurobindo Pharma Ltd.,AUROPHARMA,524804,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"7,406.4","5,846","1,373.4",19.02%,417.5,68.2,"1,074.7",323.7,757.2,12.8,"2,325.5",39.7 -Avanti Feeds Ltd.,AVANTIFEED,512573,FOOD BEVERAGES & TOBACCO,OTHER FOOD PRODUCTS,"1,312","1,184.5",94,7.35%,14.3,0.2,113,30.5,74.2,5.5,336.4,24.7 -Avenue Supermarts Ltd.,DMART,540376,RETAILING,DEPARTMENT STORES,"12,661.3","11,619.4","1,005",7.96%,174.4,15.6,851.9,228.6,623.6,9.6,"2,332.1",35.8 -Axis Bank Ltd.,AXISBANK,532215,BANKING AND FINANCE,BANKS,"33,122.2","9,207.3","9,166",33.43%,0,"14,749","8,313.8","2,096.1","6,204.1",20.1,"13,121",42.6 -Bajaj Auto Ltd.,BAJAJ-AUTO,532977,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"11,206.8","8,708.1","2,130.1",19.65%,91.8,6.5,"2,400.4",564,"2,02",71.4,"6,841.6",241.8 -Bajaj Finance Ltd.,BAJFINANCE,500034,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"13,381.8","2,851.5","9,449.7",70.63%,158.5,"4,537.1","4,757.6","1,207","3,550.8",58.7,"13,118.5",216.7 -Bajaj Finserv Ltd.,BAJAJFINSV,532978,DIVERSIFIED,HOLDING COMPANIES,"26,022.7","14,992.2","9,949.9",38.24%,208.8,"4,449.1","5,292","1,536.5","1,929",12.1,"7,422.6",46.6 -Bajaj Holdings & Investment Ltd.,BAJAJHLDNG,500490,DIVERSIFIED,HOLDING COMPANIES,240.1,33.5,191.2,85.08%,8.4,0.2,197.9,73.9,"1,491.2",134,"5,545.1",498.3 -Balkrishna Industries Ltd.,BALKRISIND,502355,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"2,360.3","1,720.5",532.7,23.64%,160.4,23.9,455.5,108.1,347.4,18,"1,047.5",54.2 -Balrampur Chini Mills Ltd.,BALRAMCHIN,500038,FOOD BEVERAGES & TOBACCO,SUGAR,"1,649","1,374.6",164.9,10.71%,41.2,17.2,215.9,56.6,166.3,8.2,540.5,26.8 -Bank of Baroda,BANKBARODA,532134,BANKING AND FINANCE,BANKS,"35,766","8,430.4","9,807.9",33.52%,0,"17,527.7","6,022.8","1,679.7","4,458.4",8.5,"18,602.9",35.9 -Bank of India,BANKINDIA,532149,BANKING AND FINANCE,BANKS,"16,779.4","3,704.9","3,818.8",25.35%,0,"9,255.7","2,977.4","1,488.6","1,498.5",3.6,"5,388.7",13.1 -Bata India Ltd.,BATAINDIA,500043,RETAILING,FOOTWEAR,834.6,637.5,181.7,22.18%,81.7,28.4,46.1,12.1,34,2.6,289.7,22.5 -Berger Paints (India) Ltd.,BERGEPAINT,509480,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"2,782.6","2,293.7",473.6,17.12%,82.9,21.1,385,96.7,291.6,2.5,"1,032.6",8.9 -Bharat Electronics Ltd.,BEL,500049,GENERAL INDUSTRIALS,DEFENCE,"4,146.1","2,994.9","1,014.2",25.30%,108.3,1.5,"1,041.5",260.7,789.4,1.1,"3,323",4.5 -Bharat Forge Ltd.,BHARATFORG,500493,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"3,826.7","3,152.8",621.4,16.47%,211.3,124.3,336.1,121.8,227.2,4.9,783.7,16.8 -Bharat Heavy Electricals Ltd.,BHEL,500103,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"5,305.4","5,513",-387.7,-7.56%,59.9,180.4,-447.9,-197.9,-238.1,-0.7,71.3,0.2 -Bharat Petroleum Corporation Ltd.,BPCL,500547,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"103,72","90,103.9","12,940.5",12.56%,"1,605.3",973.2,"10,755.7","2,812.2","8,243.5",38.7,"27,505.3",129.2 -Bharti Airtel Ltd.,BHARTIARTL,532454,TELECOM SERVICES,TELECOM SERVICES,"37,374.2","17,530.1","19,513.7",52.68%,"9,734.3","5,185.8","3,353.7","1,846.5","1,340.7",2.4,"7,547",13.2 -Indus Towers Ltd.,INDUSTOWER,534816,TELECOM SERVICES,OTHER TELECOM SERVICES,"7,229.7","3,498.8","3,633.7",50.95%,"1,525.6",458.6,"1,746.7",452,"1,294.7",4.8,"3,333.5",12.4 -Biocon Ltd.,BIOCON,532523,PHARMACEUTICALS & BIOTECHNOLOGY,BIOTECHNOLOGY,"3,620.2","2,720.7",741.6,21.42%,389.3,247.7,238.5,41.6,125.6,1.1,498.4,4.2 -Birla Corporation Ltd.,BIRLACORPN,500335,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,313.2","1,997",288.9,12.64%,143.5,95.4,77.1,18.8,58.4,7.6,153.1,19.9 -Blue Dart Express Ltd.,BLUEDART,526612,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"1,329.7","1,101.8",222.7,16.82%,110.6,19.5,97.9,24.8,73.1,30.8,292.4,123.2 -Blue Star Ltd.,BLUESTARCO,500067,CONSUMER DURABLES,CONSUMER ELECTRONICS,"1,903.4","1,767.7",122.7,6.49%,23,17.6,95,24.3,70.7,3.6,437.7,21.3 -Bombay Burmah Trading Corporation Ltd.,BBTC,501425,FOOD BEVERAGES & TOBACCO,TEA & COFFEE,"4,643.5","3,664.7",859.2,18.99%,74.7,154.6,697.1,212.6,122,17.5,"-1,499.5",-214.8 -Bosch Ltd.,BOSCHLTD,500530,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"4,284.3","3,638.8",491.3,11.90%,101.3,12.2,"1,317",318.1,999.8,339,"2,126.9",721 -Brigade Enterprises Ltd.,BRIGADE,532929,REALTY,REALTY,"1,407.9","1,041.8",324.8,23.77%,75.7,110,180.3,67.8,133.5,5.8,298.2,12.9 -Britannia Industries Ltd.,BRITANNIA,500825,FMCG,PACKAGED FOODS,"4,485.2","3,560.5",872.4,19.68%,71.7,53.4,799.7,212.1,587.6,24.4,"2,536.2",105.3 -CCL Products India Ltd.,CCL,519600,FOOD BEVERAGES & TOBACCO,TEA & COFFEE,608.3,497.7,109.9,18.09%,22.6,18.4,69.7,8.8,60.9,4.6,279.9,21 -Crisil Ltd.,CRISIL,500092,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,771.8,544.2,191.7,26.05%,26.5,0.8,200.3,48.3,152,20.8,606.3,82.9 -Zydus Lifesciences Ltd.,ZYDUSLIFE,532321,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"4,422.8","3,222.7","1,146.1",26.23%,184.2,8.7,"1,007.2",226.4,800.7,7.9,"2,807.1",27.7 -Can Fin Homes Ltd.,CANFINHOME,511196,BANKING AND FINANCE,HOUSING FINANCE,871,49.7,749.2,86.01%,2.8,548.4,198,39.9,158.1,11.9,658.8,49.5 -Canara Bank,CANBK,532483,BANKING AND FINANCE,BANKS,"33,891.2","8,250.3","7,706.6",28.24%,0,"17,934.3","5,098","1,420.6","3,86",20.9,"13,968.4",77 -Carborundum Universal Ltd.,CARBORUNIV,513375,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"1,166",978.8,167.5,14.61%,45.9,4.9,136.4,43.7,101.9,5.4,461.3,24.3 -Castrol India Ltd.,CASTROLIND,500870,OIL & GAS,OIL MARKETING & DISTRIBUTION,"1,203.2",914.4,268.6,22.70%,22.9,2.4,263.5,69.1,194.4,2,815.5,8.2 -Ceat Ltd.,CEATLTD,500878,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"3,063.8","2,597.2",456.1,14.94%,124.5,71.7,270.4,68.3,208,51.4,521.7,129 -Central Bank of India,CENTRALBK,532885,BANKING AND FINANCE,BANKS,"8,438.5","2,565.4","1,535.4",20.81%,0,"4,337.7",567.2,-41.5,622,0.7,"2,181.4",2.5 -Century Plyboards (India) Ltd.,CENTURYPLY,532548,FOREST MATERIALS,FOREST PRODUCTS,"1,011.4",852.5,144.3,14.47%,23.4,6.1,129.4,32.2,96.9,4.4,380.7,17.1 -Cera Sanitaryware Ltd.,CERA,532443,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,476.2,387.2,76.5,16.49%,8.9,1.4,77.2,19.8,56.9,43.8,232.4,178.7 -Chambal Fertilisers & Chemicals Ltd.,CHAMBLFERT,500085,FERTILIZERS,FERTILIZERS,"5,467.3","4,770.5",615,11.42%,78.4,45.8,572.6,200.2,381,9.2,"1,137.7",27.3 -Cholamandalam Investment & Finance Company Ltd.,CHOLAFIN,511243,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"4,695.2",987.6,"3,235.1",69.99%,38.5,"2,204.2","1,065",288.8,772.9,9.4,"3,022.8",36.7 -Cipla Ltd.,CIPLA,500087,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"6,854.5","4,944.4","1,733.8",25.96%,290,25.8,"1,594.2",438.4,"1,130.9",14,"3,449.1",42.7 -City Union Bank Ltd.,CUB,532210,BANKING AND FINANCE,BANKS,"1,486.1",333.9,386.6,29.65%,0,765.6,330.6,50,280.6,3.8,943.8,12.7 -Coal India Ltd.,COALINDIA,533278,METALS & MINING,COAL,"34,760.3","24,639.4","8,137",24.83%,"1,178.2",182.5,"8,760.2","2,036.5","6,799.8",11,"28,059.6",45.5 -Colgate-Palmolive (India) Ltd.,COLPAL,500830,FMCG,PERSONAL PRODUCTS,"1,492.1",989,482.1,32.77%,44.3,1.1,457.8,117.8,340.1,12.5,"1,173.2",43.1 -Container Corporation of India Ltd.,CONCOR,531344,COMMERCIAL SERVICES & SUPPLIES,WAREHOUSING AND LOGISTICS,"2,299.8","1,648.4",546.5,24.90%,153.1,16.5,481.8,119,367.4,6,"1,186.2",19.5 -Coromandel International Ltd.,COROMANDEL,506395,FERTILIZERS,FERTILIZERS,"7,032.9","5,929.4","1,058.7",15.15%,54,46.2,"1,003.3",245,756.9,25.7,"2,024.2",68.8 -Crompton Greaves Consumer Electricals Ltd.,CROMPTON,539876,CONSUMER DURABLES,HOUSEHOLD APPLIANCES,"1,797.2","1,607.8",174.5,9.79%,32.1,21.5,135.8,34.9,97.2,1.5,432,6.7 -Cummins India Ltd.,CUMMINSIND,500480,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"2,011.3","1,575.4",346.2,18.02%,38.3,6.8,390.9,99.6,329.1,11.9,"1,445.5",52.1 -Cyient Ltd.,CYIENT,532175,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,792","1,452.7",325.8,18.32%,65.8,27,240.3,56.7,178.3,16.3,665.6,60.1 -DCM Shriram Ltd.,DCMSHRIRAM,523367,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"2,73","2,593.9",114.1,4.21%,74,14.7,47.5,15.2,32.2,2.1,617.6,39.4 -DLF Ltd.,DLF,532868,REALTY,REALTY,"1,476.4",885.3,462.4,34.31%,37,90.2,464,112.2,622.8,2.5,"2,239",9 -Dabur India Ltd.,DABUR,500096,FMCG,PERSONAL PRODUCTS,"3,320.2","2,543",660.9,20.63%,98.3,28.1,650.8,144.3,515,2.9,"1,755.7",9.9 -Delta Corp Ltd.,DELTACORP,532848,COMMERCIAL SERVICES & SUPPLIES,MISC. COMMERCIAL SERVICES,282.6,170.5,100.1,36.99%,16.9,2.7,92.4,23,69.4,2.6,273.3,10.2 -Divi's Laboratories Ltd.,DIVISLAB,532488,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,995","1,43",479,25.09%,95,1,469,121,348,13.1,"1,331.8",50.3 -Dr. Lal Pathlabs Ltd.,LALPATHLAB,539524,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,619.4,423.5,177.8,29.57%,35.9,7.8,152.2,41.5,109.3,13.2,301.4,36.1 -Dr. Reddy's Laboratories Ltd.,DRREDDY,500124,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"7,217.6","4,888.8","2,008.3",29.09%,375.5,35.3,"1,912.5",434.5,"1,482.2",89.1,"5,091.2",305.2 -EID Parry (India) Ltd.,EIDPARRY,500125,FOOD BEVERAGES & TOBACCO,OTHER FOOD PRODUCTS,"9,210.3","8,002","1,057.5",11.67%,101.2,74.2,"1,032.8",246.8,452.3,25.5,991,55.8 -Eicher Motors Ltd.,EICHERMOT,505200,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"4,388.3","3,027.4","1,087.2",26.42%,142.5,12.7,"1,205.7",291.1,"1,016.2",37.1,"3,581",130.8 -Emami Ltd.,EMAMILTD,531162,FMCG,PERSONAL PRODUCTS,876,631.2,233.7,27.02%,46.1,2.2,196.4,15.8,178.5,4.1,697.8,16 -Endurance Technologies Ltd.,ENDURANCE,540153,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,560.5","2,226.7",318.3,12.51%,118.4,9.8,205.6,51.1,154.6,11,562.8,40 -Engineers India Ltd.,ENGINERSIN,532178,COMMERCIAL SERVICES & SUPPLIES,CONSULTING SERVICES,833.6,691.3,98.5,12.47%,8.3,0.4,133.6,32.2,127.5,2.3,472.7,8.4 -Escorts Kubota Ltd.,ESCORTS,500495,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"2,154.4","1,798.6",260.7,12.66%,40.8,3.1,311.9,79.7,223.3,20.6,910.5,82.4 -Exide Industries Ltd.,EXIDEIND,500086,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"4,408.9","3,872.4",499.1,11.42%,141.5,29.7,365.3,95.2,269.4,3.2,872.7,10.3 -Federal Bank Ltd.,FEDERALBNK,500469,BANKING AND FINANCE,BANKS,"6,548.2","1,603.8","1,400.3",24.18%,0,"3,544.1","1,342.7",342.6,994.1,4.3,"3,671.4",15.6 -Finolex Cables Ltd.,FINCABLES,500144,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,229.3","1,041.3",146.1,12.30%,10.8,0.4,176.7,52.3,154.2,10.1,643.9,42.1 -Finolex Industries Ltd.,FINPIPE,500940,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,944.5,780.2,103,11.66%,27.4,12.5,124.5,35.4,98,1.6,459.3,7.4 -Firstsource Solutions Ltd.,FSL,532809,SOFTWARE & SERVICES,BPO/KPO,"1,556.9","1,311.2",228.8,14.86%,65.4,26.1,154.3,27.8,126.5,1.9,551.7,7.9 -GAIL (India) Ltd.,GAIL,532155,UTILITIES,UTILITIES,"33,191","29,405.5","3,580.2",10.85%,837.3,199.6,"2,748.7",696.3,"2,444.1",3.7,"5,283.8",8 -GlaxoSmithKline Pharmaceuticals Ltd.,GLAXO,500660,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,985.2,667.5,289.5,30.25%,18.1,0.4,299.2,81.7,217.5,12.8,647.8,38.2 -Glenmark Pharmaceuticals Ltd.,GLENMARK,532296,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"3,209.1","2,745.1",462.3,14.41%,141.5,121.5,-124.4,55.9,-81.9,-2.9,-196.3,-7 -Godrej Consumer Products Ltd.,GODREJCP,532424,FMCG,PERSONAL PRODUCTS,"3,667.9","2,897.8",704.2,19.55%,60.9,77.3,619.4,186.6,432.8,4.2,"1,750.1",17.1 -Godrej Industries Ltd.,GODREJIND,500164,DIVERSIFIED,DIVERSIFIED,"4,256.9","3,672.1",265.5,6.74%,89.3,333.1,162.4,75.9,87.3,2.6,880,26.1 -Godrej Properties Ltd.,GODREJPROP,533150,REALTY,REALTY,605.1,404.7,-61.7,-17.98%,7.4,48,145.1,38.8,66.8,2.4,662.6,23.8 -Granules India Ltd.,GRANULES,532482,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,191",976.5,213,17.90%,52.5,26,136,33.9,102.1,4.2,393.9,16.3 -Great Eastern Shipping Company Ltd.,GESHIP,500620,TRANSPORTATION,SHIPPING,"1,461.5",585.6,643.4,52.35%,186.7,77.1,611.9,17.3,594.7,41.6,"2,520.1",176.5 -Gujarat Alkalies & Chemicals Ltd.,GUJALKALI,530001,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"1,042.3",926.1,45.2,4.65%,95.2,10.8,10.2,-0.1,-18.4,-2.5,82.7,11.3 -Gujarat Gas Ltd.,GUJGASLTD,539336,UTILITIES,UTILITIES,"4,019.3","3,494.5",496.6,12.44%,117.9,7.8,399.1,102.9,296.2,4.3,"1,254.3",18.2 -Gujarat Narmada Valley Fertilizers & Chemicals Ltd.,GNFC,500670,FERTILIZERS,FERTILIZERS,"2,232","1,911",169,8.12%,78,1,242,64,182,11.7,932,60.1 -Gujarat Pipavav Port Ltd.,GPPL,533248,TRANSPORTATION,MARINE PORT & SERVICES,270.4,102,150.6,59.64%,28.8,2.2,141.1,53.4,92.3,1.9,341.8,7.1 -Gujarat State Fertilizer & Chemicals Ltd.,GSFC,500690,FERTILIZERS,FERTILIZERS,"3,313.2","2,881.4",237.3,7.61%,45.7,1.6,387,78.1,308.9,7.8,"1,056.2",26.5 -Gujarat State Petronet Ltd.,GSPL,532702,UTILITIES,UTILITIES,"4,455.9","3,497.2",913.7,20.72%,165,14.5,779.2,198.7,454.6,8.1,"1,522",27 -HCL Technologies Ltd.,HCLTECH,532281,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"27,037","20,743","5,929",22.23%,"1,01",156,"5,128","1,295","3,832",14.2,"15,445",56.9 -HDFC Bank Ltd.,HDFCBANK,500180,BANKING AND FINANCE,BANKS,"107,566.6","42,037.6","24,279.1",32.36%,0,"41,249.9","20,967.4","3,655","16,811.4",22.2,"54,474.6",71.8 -Havells India Ltd.,HAVELLS,517354,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"3,952.8","3,527",373.4,9.57%,81.2,9.3,335.3,86.2,249.1,4,"1,177.7",18.8 -Hero MotoCorp Ltd.,HEROMOTOCO,500182,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"9,741.2","8,173.5","1,359.5",14.26%,187.1,25,"1,355.6",353.1,"1,006.3",50.3,"3,247.6",162.5 -HFCL Ltd.,HFCL,500183,TELECOMMUNICATIONS EQUIPMENT,TELECOM CABLES,"1,128.7",978.9,132.6,11.93%,21.4,34.8,93.5,24,69.4,0.5,305.5,2.1 -Hindalco Industries Ltd.,HINDALCO,500440,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"54,632","48,557","5,612",10.36%,"1,843","1,034","3,231","1,035","2,196",9.9,"8,423",37.9 -Hindustan Copper Ltd.,HINDCOPPER,513599,METALS & MINING,COPPER,392.6,260.2,121.2,31.77%,45.6,4.1,82.6,21.9,60.7,0.6,320.5,3.3 -Hindustan Petroleum Corporation Ltd.,HINDPETRO,500104,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"96,093.4","87,512","8,24",8.61%,"1,247.3",590,"6,744.1","1,616","5,827",41.1,"16,645",117.3 -Hindustan Unilever Ltd.,HINDUNILVR,500696,FMCG,PERSONAL PRODUCTS,"15,806","11,826","3,797",24.30%,297,88,"3,59",931,"2,656",11.3,"10,284",43.8 -Hindustan Zinc Ltd.,HINDZINC,500188,METALS & MINING,ZINC,"7,014","3,652","3,139",46.22%,825,232,"2,305",576,"1,729",4.1,"8,432",20 -Housing and Urban Development Corporation Ltd.,HUDCO,540530,BANKING AND FINANCE,HOUSING FINANCE,"1,880.8",82.7,"1,809.6",97.04%,2.4,"1,216.8",606.4,154.7,451.6,2.3,"1,790.7",8.9 -ITC Ltd.,ITC,500875,FOOD BEVERAGES & TOBACCO,CIGARETTES-TOBACCO PRODUCTS,"18,439.3","11,320.2","6,454.2",36.31%,453,9.9,"6,656.2","1,700.3","4,898.1",3.9,"20,185.1",16.2 -ICICI Bank Ltd.,ICICIBANK,532174,BANKING AND FINANCE,BANKS,"57,292.3","23,911","15,473.2",39.74%,0,"17,908","14,824.2","3,808.8","11,805.6",15.6,"41,086.8",58.7 -ICICI Prudential Life Insurance Company Ltd.,ICICIPRULI,540133,BANKING AND FINANCE,LIFE INSURANCE,"17,958.1","17,612.3",-229.6,-1.32%,0,0,340.2,32.5,243.9,1.7,906.9,6.3 -IDBI Bank Ltd.,IDBI,500116,BANKING AND FINANCE,BANKS,"7,063.7","1,922.3","2,175.3",36.02%,0,"2,966.1","2,396.9","1,003.7","1,385.4",1.3,"4,776.3",4.4 -IDFC First Bank Ltd.,IDFCFIRSTB,539437,BANKING AND FINANCE,BANKS,"8,765.8","3,849","1,511.2",20.54%,0,"3,405.6",982.8,236,746.9,1.1,"2,911.1",4.3 -IDFC Ltd.,IDFC,532659,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),36.7,6,30.6,83.56%,0,0,30.6,6.6,223.5,1.4,"4,147.1",25.9 -IRB Infrastructure Developers Ltd.,IRB,532947,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,874.5",950.4,794.6,45.54%,232.7,434.6,256.9,85.8,95.7,0.2,501,0.8 -ITI Ltd.,ITI,523610,TELECOMMUNICATIONS EQUIPMENT,TELECOM EQUIPMENT,256.1,299.3,-52.8,-21.42%,13.3,69.3,-125.8,0,-126,-1.3,-388.4,-4 -Vodafone Idea Ltd.,IDEA,532822,TELECOM SERVICES,TELECOM SERVICES,"10,750.8","6,433.5","4,282.8",39.97%,"5,667.3","6,569","-7,919",817.7,"-8,737.9",-1.8,"-30,986.8",-6.4 -India Cements Ltd.,INDIACEM,530005,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,272.4","1,26",4.4,0.35%,55,60.4,-103,-17.4,-80.1,-2.6,-261.1,-8.4 -Indiabulls Housing Finance Ltd.,IBULHSGFIN,535789,BANKING AND FINANCE,HOUSING FINANCE,"2,242.3",190.6,"1,779.2",79.88%,22.9,"1,349.8",421.6,123.6,298,6.5,"1,146",24.3 -Indian Bank,INDIANB,532814,BANKING AND FINANCE,BANKS,"15,929.4","3,599.1","4,327.7",31.44%,0,"8,002.6","2,776.7",768.6,"2,068.5",16.6,"6,893.3",55.3 -Indian Hotels Company Ltd.,INDHOTEL,500850,HOTELS RESTAURANTS & TOURISM,HOTELS,"1,480.9","1,078.4",354.8,24.75%,111.2,59,232.2,72.3,166.9,1.2,"1,100.3",7.7 -Indian Oil Corporation Ltd.,IOC,530965,OIL & GAS,OIL MARKETING & DISTRIBUTION,"179,752.1","156,013.1","23,328.4",13.01%,"3,609.6","2,135","18,090.2","4,699.7","13,114.3",9.5,"38,614.3",27.3 -Indian Overseas Bank,IOB,532388,BANKING AND FINANCE,BANKS,"6,941.5","1,785.1","1,679.8",28.84%,0,"3,476.6",635.5,8.3,627.2,0.3,"2,341.9",1.2 -Indraprastha Gas Ltd.,IGL,532514,UTILITIES,UTILITIES,"3,520.2","2,801.6",656.9,18.99%,102.2,2.5,613.9,151.4,552.7,7.9,"1,806.2",25.8 -IndusInd Bank Ltd.,INDUSINDBK,532187,BANKING AND FINANCE,BANKS,"13,529.7","3,449.9","3,908.7",34.75%,0,"6,171.1","2,934.9",732.9,"2,202.2",28.4,"8,333.7",107.2 -Info Edge (India) Ltd.,NAUKRI,532777,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,792,421.2,204.7,32.70%,25.9,8.2,382.8,68.7,205.1,15.9,-25.6,-2 -InterGlobe Aviation Ltd.,INDIGO,539448,TRANSPORTATION,AIRLINES,"15,502.9","12,743.6","2,200.3",14.72%,"1,549","1,021.3",189.1,0.2,188.9,4.9,"5,621.3",145.7 -Ipca Laboratories Ltd.,IPCALAB,524494,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,072.5","1,712.7",321.3,15.80%,90.3,44.1,225.4,87.9,145.1,5.7,492.2,19.4 -J B Chemicals & Pharmaceuticals Ltd.,JBCHEPHARM,506943,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,889.4,638.2,243.5,27.62%,32.2,10.4,208.7,58.1,150.6,9.7,486.6,31.4 -JK Cement Ltd.,JKCEMENT,532644,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,782.1","2,285.8",467,16.96%,137.1,115,244.2,65.7,178.1,23.1,444,57.5 -JK Lakshmi Cement Ltd.,JKLAKSHMI,500380,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,588.5","1,357.3",217.3,13.80%,56.6,33.6,141,45.1,92.7,7.9,357.6,30.4 -JM Financial Ltd.,JMFINANCIL,523405,DIVERSIFIED,HOLDING COMPANIES,"1,214",407.9,662.6,55.34%,13.2,388.1,277.9,72.4,194.9,2,608.1,6.4 -JSW Energy Ltd.,JSWENERGY,533148,UTILITIES,ELECTRIC UTILITIES,"3,387.4","1,379","1,880.4",57.69%,408.7,513.7,"1,085.9",235.1,850.2,5.2,"1,591.7",9.7 -JSW Steel Ltd.,JSWSTEEL,500228,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"44,821","36,698","7,886",17.69%,"2,019","2,084","4,609","1,812","2,76",11.4,"9,252",38.1 -Jindal Stainless Ltd.,JSL,532508,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"9,829","8,566.5","1,230.6",12.56%,221.9,155.6,985.7,229.1,774.3,9.4,"2,600.2",31.6 -Jindal Steel & Power Ltd.,JINDALSTEL,532286,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"12,282","9,964.5","2,285.7",18.66%,603.7,329.4,"1,384.5",-5.8,"1,387.8",13.8,"4,056",40.4 -Jubilant Foodworks Ltd.,JUBLFOOD,533155,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,"1,375.7","1,091.4",277.2,20.25%,141.9,56.8,85.5,23.3,97.2,1.5,235,3.6 -Just Dial Ltd.,JUSTDIAL,535648,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,318.5,211.8,48.8,18.71%,12.2,2.4,92.1,20.3,71.8,8.4,314.1,36.9 -Jyothy Labs Ltd.,JYOTHYLAB,532926,FMCG,PERSONAL PRODUCTS,745.6,597,135.4,18.48%,12.3,1.2,135.1,31.1,104.2,2.8,326.9,8.9 -KRBL Ltd.,KRBL,530813,FMCG,PACKAGED FOODS,"1,246.5","1,018.9",194.5,16.03%,19.9,0.8,206.8,53.6,153.3,6.5,671.4,29.3 -Kajaria Ceramics Ltd.,KAJARIACER,500233,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"1,129.9",941.9,179.7,16.02%,36.1,4.3,147.7,36.6,108,6.8,397.8,25 -Kalpataru Projects International Ltd.,KPIL,522287,UTILITIES,ELECTRIC UTILITIES,"4,53","4,148",370,8.19%,113,137,132,42,89,5.5,478,29.9 -Kansai Nerolac Paints Ltd.,KANSAINER,500165,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"1,978.6","1,683.3",273.2,13.97%,47.4,7.6,240.3,64.8,177.2,2.2,"1,118.8",13.8 -Karur Vysya Bank Ltd.,KARURVYSYA,590003,BANKING AND FINANCE,BANKS,"2,336",616.4,637.9,31.94%,0,"1,081.7",511.5,133.1,378.4,4.7,"1,364.2",17 -KEC International Ltd.,KEC,532714,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"4,514.9","4,224.7",274.3,6.10%,46.5,177.8,65.8,9.9,55.8,2.2,187.9,7.3 -Kotak Mahindra Bank Ltd.,KOTAKBANK,500247,BANKING AND FINANCE,BANKS,"21,559.5","9,681","6,343",46.24%,0,"5,535.5","5,888.3","1,465.5","4,461",22.4,"17,172.7",86.4 -L&T Finance Holdings Ltd.,L&TFH,533519,DIVERSIFIED,HOLDING COMPANIES,"3,482.1",935.3,"1,882.4",58.57%,28.3,"1,324.9",797.4,203.2,595.1,2.4,"2,080.8",8.4 -L&T Technology Services Ltd.,LTTS,540115,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,427.7","1,910.9",475.6,19.93%,68.1,12.6,436.1,120.2,315.4,29.8,"1,239.7",117.5 -LIC Housing Finance Ltd.,LICHSGFIN,500253,BANKING AND FINANCE,HOUSING FINANCE,"6,765.9",250.6,"6,095.7",90.10%,13.2,"4,599.9","1,483",291.2,"1,193.5",21.7,"4,164.5",75.7 -Lakshmi Machine Works Ltd.,LAXMIMACH,500252,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"1,355.5","1,184.5",136,10.30%,23.6,0,147.4,32.3,115.1,107.8,416,389.5 -Laurus Labs Ltd.,LAURUSLABS,540222,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,226.2","1,036.6",187.9,15.34%,93.4,42.4,53.9,14.6,37,0.7,367.8,6.8 -Lupin Ltd.,LUPIN,500257,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"5,079","4,120.8",917.8,18.21%,247.8,80.6,629.7,134.3,489.5,10.8,"1,331.2",29.2 -MMTC Ltd.,MMTC,513377,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,-167.2,-180.1,-30.4,14.42%,0.8,1.1,12.1,1.5,52,0.3,174.1,1.2 -MRF Ltd.,MRF,500290,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"6,287.8","5,060.2","1,156.9",18.61%,351.5,85.5,790.6,203.9,586.7,1383.3,"1,690.9",3988 -Mahanagar Gas Ltd.,MGL,539957,UTILITIES,UTILITIES,"1,772.7","1,250.1",478.9,27.70%,65.8,2.5,454.3,115.8,338.5,34.3,"1,147.8",116.2 -Mahindra & Mahindra Financial Services Ltd.,M&MFIN,532720,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"3,863.5","1,077.5","2,109.3",55.03%,67.1,"1,703.4",369.1,96,281.1,2.3,"1,982.5",16 -Mahindra & Mahindra Ltd.,M&M,500520,AUTOMOBILES & AUTO COMPONENTS,CARS & UTILITY VEHICLES,"35,027.2","28,705.9","5,729.6",16.64%,"1,138.6","1,835.2","3,347.5","1,083.7","2,347.8",21.1,"11,169.4",100.2 -Mahindra Holidays & Resorts India Ltd.,MHRIL,533088,HOTELS RESTAURANTS & TOURISM,HOTELS,672.2,519.3,136,20.76%,83.8,33.3,35.8,14,21.3,1.1,66,3.3 -Manappuram Finance Ltd.,MANAPPURAM,531213,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"2,174",555.6,"1,481.3",68.68%,62.5,689.4,746.7,186.1,558.4,6.6,"1,859.8",22 -Mangalore Refinery And Petrochemicals Ltd.,MRPL,500109,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"22,904.7","20,705.6","2,138.2",9.36%,296,311.2,"1,592",546.2,"1,051.7",6,"3,784.9",21.6 -Marico Ltd.,MARICO,531642,FMCG,PERSONAL PRODUCTS,"2,514","1,979",497,20.07%,39,20,476,116,353,2.7,"1,41",10.9 -Maruti Suzuki India Ltd.,MARUTI,532500,AUTOMOBILES & AUTO COMPONENTS,CARS & UTILITY VEHICLES,"37,902.1","32,282.5","4,790.3",12.92%,794.4,35.1,"4,790.1","1,083.8","3,764.3",124.6,"11,351.8",375.9 -Max Financial Services Ltd.,MFSL,500271,BANKING AND FINANCE,LIFE INSURANCE,"10,189.1","10,024.6",143.9,1.42%,0.8,9.4,158.2,-12.1,147.9,4.3,506.4,14.7 -UNO Minda Ltd.,UNOMINDA,532539,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"3,630.2","3,219.8",401.6,11.09%,125.4,27.2,257.9,73.3,225,3.9,742.4,13 -Motilal Oswal Financial Services Ltd.,MOTILALOFS,532892,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,"1,650.7",724.1,904.5,55.18%,17.3,241.1,657.6,124.2,531.2,35.9,"1,449.3",97.8 -MphasiS Ltd.,MPHASIS,526299,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"3,325.5","2,680.9",595.6,18.18%,89,34,521.7,129.7,391.9,20.8,"1,605.6",85.1 -Muthoot Finance Ltd.,MUTHOOTFIN,533398,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"3,631.9",723.4,"2,801.6",77.69%,22.2,"1,335","1,470.2",374.9,"1,059.6",26.4,"3,982.9",99.2 -Natco Pharma Ltd.,NATCOPHARM,524816,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,060.8",573.4,458,44.41%,43.6,4.2,439.6,70.6,369,20.6,"1,127.4",63 -NBCC (India) Ltd.,NBCC,534309,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"2,129.1","1,957.7",95.5,4.65%,1.3,0,104.6,22.9,79.6,0.4,332.2,1.8 -NCC Ltd.,NCC,500294,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"4,746.4","4,415.9",303.7,6.44%,53.2,153.5,123.8,38.8,77.3,1.2,599.4,9.5 -NHPC Ltd.,NHPC,533098,UTILITIES,ELECTRIC UTILITIES,"3,113.8","1,173.9","1,757.4",59.95%,294.9,104.8,"1,618.3",-75,"1,545.8",1.5,"3,897.8",3.9 -Coforge Ltd.,COFORGE,532541,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,285.1","1,935.3",340.9,14.98%,77.2,31.9,240.7,52.8,187.9,29.6,696.2,113.2 -NLC India Ltd.,NLCINDIA,513683,UTILITIES,ELECTRIC UTILITIES,"3,234","2,143",834.6,28.03%,455.1,213.9,"1,700.6",614.7,"1,084.7",7.8,"1,912.3",13.8 -NTPC Ltd.,NTPC,532555,UTILITIES,ELECTRIC UTILITIES,"45,384.6","32,303.2","12,680.2",28.19%,"4,037.7","2,920.5","6,342.9","2,019.7","4,614.6",4.8,"19,125.2",19.7 -Narayana Hrudayalaya Ltd.,NH,539551,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,323.6",997.1,308.1,23.61%,55.3,22.9,248.4,21.7,226.6,11.2,737.5,36.1 -National Aluminium Company Ltd.,NATIONALUM,532234,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"3,112","2,646.9",396.5,13.03%,186.2,4,275,68.7,187.3,1,"1,272.4",6.9 -Navin Fluorine International Ltd.,NAVINFLUOR,532504,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,494.9,373.4,98.3,20.84%,24.2,20,77.2,16.6,60.6,12.2,365,73.7 -Oberoi Realty Ltd.,OBEROIRLTY,533273,REALTY,REALTY,"1,243.8",579.2,638.2,52.42%,11.3,56.5,596.8,142.1,456.8,12.6,"1,961.3",53.9 -Oil And Natural Gas Corporation Ltd.,ONGC,500312,OIL & GAS,EXPLORATION & PRODUCTION,"149,388.5","118,618.4","28,255.3",19.24%,"6,698.1","2,603.3","21,564.9","5,633.6","13,734.1",10.9,"43,072.5",34.2 -Oil India Ltd.,OIL,533106,OIL & GAS,EXPLORATION & PRODUCTION,"9,200.1","5,293.3","3,523.2",39.96%,499,278.9,762,67.6,420.7,3.9,"5,874.5",54.2 -Oracle Financial Services Software Ltd.,OFSS,532466,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,509.6",886.4,558.1,38.64%,19,8,596.2,178.8,417.4,48.2,"1,835.1",211.9 -PI Industries Ltd.,PIIND,523642,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"2,163.8","1,565.5",551.4,26.05%,80.3,7.8,510.2,31.7,480.5,31.7,"1,495.8",98.4 -PNB Housing Finance Ltd.,PNBHOUSING,540173,BANKING AND FINANCE,HOUSING FINANCE,"1,779.4",158.8,"1,574.1",88.54%,11.3,"1,057.3",507.1,124.1,383,14.8,"1,278.7",49.3 -PNC Infratech Ltd.,PNCINFRA,539150,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,932.4","1,511.6",399.8,20.92%,40.9,161.3,218.6,70.7,147.9,5.8,614.3,23.9 -PVR INOX Ltd.,PVRINOX,532689,RETAILING,SPECIALTY RETAIL,"2,023.7","1,293.1",706.8,35.34%,308.6,200.3,221.7,55.5,166.3,17,-232.5,-23.7 -Page Industries Ltd.,PAGEIND,532827,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,"1,126.8",891.6,233.5,20.76%,24.6,11.2,199.4,49.1,150.3,134.7,510.7,457.9 -Persistent Systems Ltd.,PERSISTENT,533179,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,449","2,006.5",405.2,16.80%,74.4,12.3,355.8,92.5,263.3,35,981.5,127.6 -Petronet LNG Ltd.,PETRONET,532522,OIL & GAS,OIL MARKETING & DISTRIBUTION,"12,686.2","11,317.9","1,214.7",9.69%,194.8,74.7,"1,098.8",283.9,855.7,5.7,"3,490.3",23.3 -Pfizer Ltd.,PFIZER,500680,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,611.3,392.6,182.6,31.75%,15.4,2.7,200.5,51.6,149,32.6,522.8,114.3 -Phoenix Mills Ltd.,PHOENIXLTD,503100,REALTY,REALTY,906.6,361.2,506,57.82%,65.9,96.5,375.2,71.4,252.6,14.2,923.6,51.7 -Pidilite Industries Ltd.,PIDILITIND,500331,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"3,107.6","2,396.3",679.7,22.10%,75.2,13.1,623,163.1,450.1,8.8,"1,505.5",29.6 -Power Finance Corporation Ltd.,PFC,532810,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"22,403.7",315.4,"22,941.9",102.46%,12.7,"14,313.1","8,628.8","2,000.6","4,833.1",14.7,"17,946.4",54.4 -Power Grid Corporation of India Ltd.,POWERGRID,532898,UTILITIES,ELECTRIC UTILITIES,"11,530.4","1,358.7","9,908.4",87.94%,"3,277","2,341.3","4,393.4",573.7,"3,781.4",4.1,"15,344.4",16.5 -Prestige Estates Projects Ltd.,PRESTIGE,ASM,REALTY,REALTY,"3,256","1,643.9",592.5,26.49%,174.1,263.9,"1,174.1",256.4,850.9,21.2,"1,714",42.8 -Prism Johnson Ltd.,PRSMJOHNSN,500338,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,846","1,745.4",92.4,5.03%,95.2,43.5,210,30.4,182.7,3.6,154.2,3.1 -Procter & Gamble Hygiene & Healthcare Ltd.,PGHH,500459,FMCG,PERSONAL PRODUCTS,"1,154.1",853.5,284.9,25.03%,14.3,1.9,284.5,73.8,210.7,64.9,734.4,226.3 -Punjab National Bank,PNB,532461,BANKING AND FINANCE,BANKS,"29,857","6,798.1","6,239.1",23.23%,0,"16,819.8","2,778.3","1,013.8","1,990.2",1.8,"5,904.8",5.4 -Quess Corp Ltd.,QUESS,539978,SOFTWARE & SERVICES,BPO/KPO,"4,763.5","4,584.8",163.6,3.44%,69.7,28.1,79.3,8.3,71.9,4.8,240.9,16.2 -RBL Bank Ltd.,RBLBANK,540065,BANKING AND FINANCE,BANKS,"3,720.6","1,422.6",765.4,25.45%,0,"1,532.6",125,-206.1,331.1,5.5,"1,173.9",19.5 -Radico Khaitan Ltd.,RADICO,532497,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,925.7,803.8,121.2,13.10%,26.1,12.5,83.3,21.4,64.8,4.8,237,17.7 -Rain Industries Ltd.,RAIN,500339,CHEMICALS & PETROCHEMICALS,PETROCHEMICALS,"4,208.9","3,794.3",366,8.80%,192.5,241.7,-19.5,46.2,-90.2,-2.7,270.4,8 -Rajesh Exports Ltd.,RAJESHEXPO,531500,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"38,079.4","38,015.8",50.1,0.13%,10.7,0,53,7.7,45.3,1.5,"1,142.2",38.7 -Rallis India Ltd.,RALLIS,500355,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,837,699,133,15.99%,26,3,110,28,82,4.2,98.4,5.2 -Rashtriya Chemicals & Fertilizers Ltd.,RCF,524230,FERTILIZERS,FERTILIZERS,"4,222.1","4,049.3",105.9,2.55%,56.1,44,72.8,21.1,51,0.9,523.6,9.5 -Redington Ltd.,REDINGTON,532805,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,"22,296.6","21,738.7",481.4,2.17%,43.7,105.8,408.3,96.7,303.5,3.9,"1,242",15.9 -Relaxo Footwears Ltd.,RELAXO,530517,RETAILING,FOOTWEAR,725.9,623.8,91.5,12.79%,36.9,4.7,60.4,16.2,44.2,1.8,193.9,7.8 -Reliance Industries Ltd.,RELIANCE,500325,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"238,797","193,988","40,968",17.44%,"12,585","5,731","26,493","6,673","17,394",25.7,"68,496",101.2 -REC Ltd.,RECLTD,532955,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"11,701.3",275.1,"12,180.5",104.21%,6.1,"7,349.8","4,837.6","1,047.7","3,789.9",14.4,"12,738.6",48.4 -SJVN Ltd.,SJVN,533206,UTILITIES,ELECTRIC UTILITIES,951.6,172.2,706.2,80.40%,101.9,124.2,567.7,129.2,439.6,1.1,"1,016",2.6 -SKF India Ltd.,SKFINDIA,500472,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,"1,145.5","1,003.7",121.5,10.80%,19.3,0.5,122,31.7,90,18.2,484,97.9 -SRF Ltd.,SRF,503806,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"3,206.5","2,551.2",626.2,19.71%,161.2,79.3,414.8,114,300.8,10.2,"1,733.4",58.5 -Sanofi India Ltd.,SANOFI,500674,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,726.4,506.1,208.5,29.17%,9.9,0.3,210.1,57.9,152.1,66.1,596.3,259.3 -Schaeffler India Ltd.,SCHAEFFLER,505790,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,879.2","1,506.3",342,18.50%,55.6,1.6,315.7,80.7,235,15,922.6,59 -Shree Cements Ltd.,SHREECEM,500387,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"4,932.1","3,914.1",886,18.46%,411.7,67,539.2,92.6,446.6,123.8,"1,826.8",506.3 -Shriram Finance Ltd.,SHRIRAMFIN,511218,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"8,893","1,409.4","6,334.3",71.30%,141.4,"3,798","2,404.2",614.9,"1,786.1",47.6,"6,575.4",175.2 -Siemens Ltd.,SIEMENS,500550,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"5,953.2","5,107.5",700.2,12.06%,78.6,4.9,762.2,190.5,571.3,16.1,"1,960.9",55.1 -Sobha Ltd.,SOBHA,532784,REALTY,REALTY,773.6,665.8,75.4,10.18%,19.3,63.9,24.7,9.7,14.9,1.6,107.4,11.3 -Solar Industries India Ltd.,SOLARINDS,532725,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"1,355.2","1,011.3",336.1,24.95%,33.7,24.9,285.3,75.5,200.1,22.1,808.2,89.3 -Sonata Software Ltd.,SONATSOFTW,532221,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,935.8","1,715.2",197.3,10.32%,33.3,20.7,166.5,42.3,124.2,9,475.7,34.3 -State Bank of India,SBIN,500112,BANKING AND FINANCE,BANKS,"144,256.1","58,597.6","22,703.3",21.14%,0,"62,955.2","21,935.7","5,552.5","17,196.2",18,"69,304.1",77.7 -Steel Authority of India (SAIL) Ltd.,SAIL,500113,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"29,858.2","25,836.7","3,875.4",13.04%,"1,326.6",605.2,"1,674.7",464.2,"1,305.6",3.2,"3,219.5",7.8 -Sun Pharma Advanced Research Company Ltd.,SPARC,532872,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,29.7,112.7,-91.5,-431.87%,3.2,0.3,-86.4,0,-86.4,-2.7,-253.6,-7.8 -Sun Pharmaceutical Industries Ltd.,SUNPHARMA,524715,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"12,486","9,013","3,179.4",26.08%,632.8,49.3,"2,790.9",390.1,"2,375.5",9.9,"8,548.5",35.6 -Sun TV Network Ltd.,SUNTV,532733,MEDIA,BROADCASTING & CABLE TV,"1,160.2",320.6,727.8,69.42%,218.8,1.7,619.1,154.4,464.7,11.8,"1,861.8",47.2 -Sundram Fasteners Ltd.,SUNDRMFAST,500403,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,429.1","1,191.1",230.7,16.23%,54.5,7.4,176.2,43.1,131.9,6.3,502.9,23.9 -Sunteck Realty Ltd.,SUNTECK,512179,REALTY,REALTY,36.2,39.1,-14.1,-56.70%,2.2,15.8,-20.9,-6.4,-13.9,-1,-46.5,-3.3 -Supreme Industries Ltd.,SUPREMEIND,509930,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,"2,321.4","1,952.5",356.2,15.43%,71.9,1.6,295.4,76.3,243.2,19.1,"1,028.2",80.9 -Suzlon Energy Ltd.,SUZLON,ASM,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"1,428.7","1,196.4",225,15.83%,51.2,43.7,102.4,0.1,102.3,0.1,561.4,0.4 -Syngene International Ltd.,SYNGENE,539268,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,931.7,656,254.1,27.92%,104.6,13,150.7,34.2,116.5,2.9,498.3,12.4 -TTK Prestige Ltd.,TTKPRESTIG,517506,CONSUMER DURABLES,HOUSEWARE,747.2,648.6,80.8,11.08%,15.9,3.1,79.5,20.5,59.3,4.3,224.3,16.2 -TV18 Broadcast Ltd.,TV18BRDCST,532800,MEDIA,BROADCASTING & CABLE TV,"1,989","1,992.2",-198.1,-11.04%,50.1,33.8,-87.1,-6.5,-28.9,-0.2,92.2,0.5 -TVS Motor Company Ltd.,TVSMOTOR,532343,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"9,983.8","8,576.9","1,355.9",13.65%,237.1,483.3,686.4,259.8,386.3,8.1,"1,457.6",30.7 -Tata Consultancy Services Ltd.,TCS,532540,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"60,698","43,946","15,746",26.38%,"1,263",159,"15,33","3,95","11,342",31,"44,654",122 -Tata Elxsi Ltd.,TATAELXSI,500408,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,912.8,618.2,263.5,29.89%,25,5.8,263.9,63.8,200,32.1,785.1,126.1 -Tata Consumer Products Ltd.,TATACONSUM,500800,FMCG,PACKAGED FOODS,"3,823.6","3,196.7",537.1,14.38%,93.9,27.6,490.9,131.7,338.2,3.6,"1,275.2",13.7 -Tata Motors Limited (DVR),TATAMTRDVR,570001,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,,,,,,,,,,,, -Tata Motors Ltd.,TATAMOTORS,500570,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"106,759","91,361.3","13,766.9",13.10%,"6,636.4","2,651.7","5,985.9","2,202.8","3,764",9.8,"15,332.3",40 -Tata Power Company Ltd.,TATAPOWER,500400,UTILITIES,ELECTRIC UTILITIES,"16,029.5","12,647","3,091",19.64%,925.9,"1,181.8",979.2,213.3,875.5,2.7,"3,570.8",11.2 -Tata Steel Ltd.,TATASTEEL,500470,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"55,910.2","51,414.1","4,267.8",7.66%,"2,479.8","1,959.4","-6,842.1",-228,"-6,196.2",-5.1,"-6,081.3",-5 -Tech Mahindra Ltd.,TECHM,532755,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"13,128.1","11,941.1",922.8,7.17%,465.7,97.5,623.8,110,493.9,5.6,"3,600.7",40.9 -The Ramco Cements Ltd.,RAMCOCEM,500260,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,352.1","1,935",405.6,17.33%,162.8,116.5,137.8,37,72,3.1,348.9,14.8 -Thermax Ltd.,THERMAX,500411,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,368.3","2,097.8",204.6,8.89%,33,19.8,217.7,58.9,157.7,14,498.8,44.3 -Timken India Ltd.,TIMKEN,522113,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,692.1,546.5,135.5,19.87%,21.1,0.9,123.6,30.6,93,12.4,358.3,47.6 -Titan Company Ltd.,TITAN,500114,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"12,653","11,118","1,411",11.26%,144,140,"1,251",336,915,10.3,"3,302",37.1 -Torrent Pharmaceuticals Ltd.,TORNTPHARM,500420,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,686","1,835",825,31.02%,201,91,559,173,386,11.4,"1,334",39.4 -Torrent Power Ltd.,TORNTPOWER,532779,UTILITIES,ELECTRIC UTILITIES,"7,069.1","5,739.5","1,221.4",17.55%,341.7,247.2,740.7,198.1,525.9,10.9,"2,176.8",45.3 -Trent Ltd.,TRENT,500251,RETAILING,DEPARTMENT STORES,"3,062.5","2,525.8",456.6,15.31%,152.2,95.5,288.9,86.3,234.7,6.6,629.4,17.7 -Trident Ltd.,TRIDENT,521064,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,812","1,557.3",240.3,13.37%,89.4,35,130.4,40.1,90.7,0.2,458.1,0.9 -UPL Ltd.,UPL,512070,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"10,275","8,807","1,325",13.03%,657,871,-185,-96,-189,-2.5,"1,856",24.7 -UltraTech Cement Ltd.,ULTRACEMCO,532538,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"16,179.3","13,461.2","2,550.9",15.93%,797.8,233.9,"1,686.2",409.4,"1,281.5",44.5,"5,694.1",197.2 -Union Bank of India,UNIONBANK,532477,BANKING AND FINANCE,BANKS,"28,952.5","6,189.3","7,265",29.38%,0,"15,498.2","5,492.3","1,944","3,571.8",5.1,"11,918.9",16.1 -United Breweries Ltd.,UBL,532478,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,"1,902.1","1,705.8",184.3,9.75%,50.9,1.4,144,36.9,107.3,4.1,251.3,9.5 -United Spirits Ltd.,MCDOWELL-N,532432,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,"6,776.6","6,269.8",466.7,6.93%,65.3,26.2,446,106.3,339.3,4.8,"1,133",15.6 -V-Guard Industries Ltd.,VGUARD,532953,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,147.9","1,041.3",92.5,8.16%,19.8,9.3,77.5,18.6,59,1.4,215.2,5 -Vardhman Textiles Ltd.,VTL,502986,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,487","2,192.1",205.4,8.57%,103.7,22,169.2,41.7,134.3,4.7,531.9,18.7 -Varun Beverages Ltd.,VBL,540180,FOOD BEVERAGES & TOBACCO,NON-ALCOHOLIC BEVERAGES,"3,889","2,988.4",882.1,22.79%,170.8,62.5,667.3,152.9,501.1,3.9,"1,998.7",15.4 -Vinati Organics Ltd.,VINATIORGA,524200,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,464.4,337.3,110.8,24.73%,13.7,0.3,113,28.9,84.2,8.2,408.2,39.7 -Voltas Ltd.,VOLTAS,500575,CONSUMER DURABLES,CONSUMER ELECTRONICS,"2,363.7","2,222.5",70.3,3.06%,11.7,11.4,118.1,49.3,36.7,1.1,199.5,6 -ZF Commercial Vehicle Control Systems India Ltd.,ZFCVINDIA,533023,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,015.8",846.2,145.5,14.67%,27.1,1.3,141.2,35.5,105.7,55.7,392,206.7 -Welspun Corp Ltd.,WELCORP,ASM,METALS & MINING,IRON & STEEL PRODUCTS,"4,161.4","3,659.9",399.5,9.84%,85.7,75,340.8,79,384.7,14.7,809.2,30.9 -Welspun Living Ltd.,WELSPUNLIV,514162,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,542.4","2,151.1",358,14.27%,98.5,33.8,258.9,58.7,196.7,2,526.1,5.4 -Whirlpool of India Ltd.,WHIRLPOOL,500238,CONSUMER DURABLES,CONSUMER ELECTRONICS,"1,555.5","1,448.4",73.2,4.81%,49.2,5.6,52.3,14.1,36.6,2.9,198.8,15.7 -Wipro Ltd.,WIPRO,507685,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"23,255.7","18,543.2","3,972.7",17.64%,897,303.3,"3,512.2",841.9,"2,646.3",5.1,"11,643.8",22.3 -Zee Entertainment Enterprises Ltd.,ZEEL,505537,MEDIA,BROADCASTING & CABLE TV,"2,509.6","2,105",332.8,13.65%,77.2,23.4,184.2,54.4,123,1.3,-102.2,-1.1 -eClerx Services Ltd.,ECLERX,532927,SOFTWARE & SERVICES,BPO/KPO,735.9,517,204.7,28.37%,30.3,6.1,182.4,46.3,136,28.2,506,105 -Sterlite Technologies Ltd.,STLTECH,532374,TELECOMMUNICATIONS EQUIPMENT,TELECOM CABLES,"1,497","1,281",213,14.26%,85,95,36,12,34,0.9,203,5.1 -HEG Ltd.,HEG,509631,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,642.2,512.3,101.9,16.58%,38.5,8.5,82.9,21.7,96,24.9,439.5,113.9 -SBI Life Insurance Company Ltd.,SBILIFE,540719,BANKING AND FINANCE,LIFE INSURANCE,"28,816.2","28,183.8",609.9,2.12%,0,0,621.5,43.9,380.2,3.8,"1,842.2",18.4 -General Insurance Corporation of India,GICRE,540755,BANKING AND FINANCE,GENERAL INSURANCE,"13,465.9","11,574","1,464.6",11.20%,0,0,"1,855.4",243.7,"1,689",15.2,"6,628",37.8 -Tube Investments of India Ltd.,TIINDIA,540762,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,005.4","1,718.2",251.4,12.76%,34.6,7.7,244.8,63.4,181.4,9.4,717.5,37.1 -Honeywell Automation India Ltd.,HONAUT,517174,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,144.3",965.9,138.3,12.52%,13.8,0.7,163.9,42,121.9,137.8,443.4,503.9 -Indian Energy Exchange Ltd.,IEX,540750,BANKING AND FINANCE,EXCHANGE,133,16.6,92,84.73%,5.1,0.7,110.6,27.9,86.5,1,327.8,3.7 -ICICI Lombard General Insurance Company Ltd.,ICICIGI,540716,BANKING AND FINANCE,GENERAL INSURANCE,"5,271.1","4,612.4",743.5,14.16%,0,0,763.6,186.4,577.3,11.8,"1,757.1",35.8 -Aster DM Healthcare Ltd.,ASTERDM,540975,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"3,325.2","2,939.4",377.3,11.38%,227.2,101.9,2.1,10.2,-30.8,-0.6,284.3,5.7 -Central Depository Services (India) Ltd.,CDSL,CDSL,OTHERS,INVESTMENT COMPANIES,230.1,77.9,129.4,62.40%,6.5,0,145.6,35.8,108.9,10.4,320.2,30.6 -Graphite India Ltd.,GRAPHITE,509488,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,884,823,-30,-3.78%,19,4,992,190,804,41.1,856,43.9 -Grasim Industries Ltd.,GRASIM,500300,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"30,505.3","25,995.9","4,224.8",13.98%,"1,245.2",397.8,"2,866.4",837.7,"1,163.8",17.7,"6,624.9",100.6 -KNR Constructions Ltd.,KNRCON,532942,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"1,043.8",806.9,231.6,22.30%,39.2,20.6,177.1,34.6,147.4,5.2,537.5,19.1 -Aditya Birla Capital Ltd.,ABCAPITAL,540691,DIVERSIFIED,HOLDING COMPANIES,"7,730.4","4,550.1","2,821.9",36.55%,48,"1,827",956.8,284.1,705,2.7,"5,231.9",20.1 -Dixon Technologies (India) Ltd.,DIXON,540699,CONSUMER DURABLES,CONSUMER ELECTRONICS,"4,943.9","4,744.3",198.9,4.02%,36.4,17.1,146.1,35.2,107.3,19,308.7,51.8 -Cholamandalam Financial Holdings Ltd.,CHOLAHLDNG,504973,DIVERSIFIED,HOLDING COMPANIES,"6,372.2","2,495.1","3,404.8",54.05%,52.1,"2,209.4","1,215.8",324.6,420.9,22.4,"1,532.3",81.6 -Cochin Shipyard Ltd.,COCHINSHIP,540678,TRANSPORTATION,MARINE PORT & SERVICES,"1,100.4",820.5,191.2,18.90%,18.9,9.6,251.4,69.9,181.5,13.8,429.9,32.7 -Bharat Dynamics Ltd.,BDL,541143,GENERAL INDUSTRIALS,DEFENCE,694.1,481.8,134,21.77%,17.4,0.8,194.1,47,147.1,8,425.4,23.2 -Lux Industries Ltd.,LUXIND,539542,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,643.6,584.2,55,8.61%,5.9,5.4,48,12.1,37.1,12.3,103.1,32.9 -Zensar Technologies Ltd.,ZENSARTECH,504067,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,277.1","1,009.9",230.9,18.61%,36.6,5.7,224.9,51,173.9,7.7,525.8,23.2 -PCBL Ltd.,PCBL,506590,CHEMICALS & PETROCHEMICALS,CARBON BLACK,"1,489.4","1,248.6",238.1,16.02%,48.2,21,171.6,48.8,122.6,3.2,431.6,11.4 -Zydus Wellness Ltd.,ZYDUSWELL,531335,FMCG,PACKAGED FOODS,444,423.1,16.8,3.82%,5.8,6.5,8.6,2.7,5.9,0.9,281.2,44.2 -Linde India Ltd.,LINDEINDIA,523457,GENERAL INDUSTRIALS,INDUSTRIAL GASES,729.9,537.7,173.6,24.41%,49.7,1.2,141.3,34.6,108.7,12.8,417.9,49 -FDC Ltd.,FDC,531599,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,513.6,409.9,76.4,15.71%,9.9,1.1,92.7,22.9,69.8,4.2,251.2,15.4 -The New India Assurance Company Ltd.,NIACL,540769,BANKING AND FINANCE,GENERAL INSURANCE,"10,571","10,773.4",-246.5,-2.33%,0,0,-242,-46.7,-176.1,-1.1,947,5.7 -Sundaram Finance Ltd.,SUNDARMFIN,590071,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"1,710.6",322.5,"1,332.1",77.98%,43.6,820.3,470.6,142.8,365.4,33.2,"1,506.7",135.6 -TeamLease Services Ltd.,TEAMLEASE,539658,COMMERCIAL SERVICES & SUPPLIES,MISC. COMMERCIAL SERVICES,"2,285.6","2,240.8",31.8,1.40%,12.9,2.5,29.4,1.8,27.3,16.3,106.6,63.5 -Galaxy Surfactants Ltd.,GALAXYSURF,540935,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,985.8,858.2,124.9,12.70%,24.7,5.4,97.5,20.1,77.4,21.8,349.3,98.5 -Bandhan Bank Ltd.,BANDHANBNK,541153,BANKING AND FINANCE,BANKS,"5,032.2","1,400.2","1,583.4",35.25%,0,"2,048.6",947.2,226.1,721.2,4.5,"2,541.1",15.8 -ICICI Securities Ltd.,ISEC,541179,BANKING AND FINANCE,CAPITAL MARKETS,"1,249",433.5,810.2,64.87%,25.8,215.1,569.4,145.7,423.6,13.1,"1,238.1",38.3 -V-Mart Retail Ltd.,VMART,534976,RETAILING,DEPARTMENT STORES,551.4,548.8,0.7,0.12%,53.2,35.9,-86.4,-22.3,-64.1,-32.4,-103.1,-52.1 -Nippon Life India Asset Management Ltd.,NAM-INDIA,540767,BANKING AND FINANCE,ASSET MANAGEMENT COS.,475.4,156.1,241.4,60.73%,7.2,1.7,310.4,66.1,244.4,3.9,883.3,14.1 -Grindwell Norton Ltd.,GRINDWELL,506076,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,690,536,131.4,19.69%,16.9,1.8,135.3,33.1,101.9,9.2,378.3,34.2 -HDFC Life Insurance Company Ltd.,HDFCLIFE,540777,BANKING AND FINANCE,LIFE INSURANCE,"23,276.6","23,659.3",-508.1,-2.20%,0,0,-373.1,-657.5,378.2,1.8,"1,472.8",6.9 -Elgi Equipments Ltd.,ELGIEQUIP,522074,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,817.8,663.4,142.7,17.71%,18.7,6.6,129.2,38.8,91.3,2.9,401.9,12.7 -Hindustan Aeronautics Ltd.,HAL,541154,GENERAL INDUSTRIALS,DEFENCE,"6,105.1","4,108.1","1,527.6",27.11%,349.6,0.3,"1,647",414.8,"1,236.7",18.5,"6,037.3",90.3 -BSE Ltd.,BSE,BSE,BANKING AND FINANCE,EXCHANGE,367,172.8,189.2,52.26%,22.7,8.5,163,63.6,120.5,8.8,706,52.1 -Rites Ltd.,RITES,541556,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,608.8,444.5,137.8,23.67%,14.1,1.4,148.8,40.1,101.2,4.2,488.1,20.3 -Fortis Healthcare Ltd.,FORTIS,532843,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,783.5","1,439.8",330.2,18.65%,84.1,31.8,231.4,48.8,173.7,2.3,547.6,7.3 -Varroc Engineering Ltd.,VARROC,541578,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,893.5","1,692.6",194.3,10.30%,84.9,50.3,65.9,18.2,54.2,3.5,146.5,9.6 -Adani Green Energy Ltd.,ADANIGREEN,ASM,UTILITIES,ELECTRIC UTILITIES,"2,589",521,"1,699",76.53%,474,"1,165",413,119,372,2.2,"1,305",8.2 -VIP Industries Ltd.,VIPIND,507880,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,548.7,493.2,52.9,9.68%,23.8,12.4,19.3,6,13.3,0.9,110.9,7.8 -CreditAccess Grameen Ltd.,CREDITACC,541770,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"1,247.6",248.8,902.3,72.36%,12.3,423.9,466.8,119.7,347,21.8,"1,204.2",75.7 -CESC Ltd.,CESC,500084,UTILITIES,ELECTRIC UTILITIES,"4,414","3,706",646,14.84%,303,305,461,98,348,2.6,"1,447",10.9 -Jamna Auto Industries Ltd.,JAMNAAUTO,520051,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,608.7,528.2,79.1,13.03%,10.9,0.8,68.7,18.6,50.1,2.4,189.3,4.7 -Suprajit Engineering Ltd.,SUPRAJIT,532509,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,727.6,639.1,69.8,9.85%,25.7,13.6,49.2,14.5,34.8,2.5,146.9,10.6 -JK Paper Ltd.,JKPAPER,532162,COMMERCIAL SERVICES & SUPPLIES,PAPER & PAPER PRODUCTS,"1,708.8","1,242.8",407.3,24.68%,83.5,42,340.6,34.9,302.4,17.9,"1,220.6",72.1 -Bank of Maharashtra,MAHABANK,532525,BANKING AND FINANCE,BANKS,"5,735.5","1,179.4","1,920.5",37.90%,0,"2,635.7",935.7,16,919.8,1.3,"3,420.8",4.8 -Aavas Financiers Ltd.,AAVAS,541988,BANKING AND FINANCE,HOUSING FINANCE,497.6,123.5,367.8,74.03%,7.6,203.6,157.4,35.7,121.7,15.4,465.4,58.8 -HDFC Asset Management Company Ltd.,HDFCAMC,541729,BANKING AND FINANCE,ASSET MANAGEMENT COS.,765.4,162,481.1,74.81%,13,2.3,588.1,151.6,436.5,20.4,"1,659.3",77.7 -KEI Industries Ltd.,KEI,517569,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,954.2","1,742.7",203.9,10.47%,15.6,7.5,188.4,48.2,140.2,15.5,528.3,58.5 -Orient Electric Ltd.,ORIENTELEC,541301,CONSUMER DURABLES,CONSUMER ELECTRONICS,570.3,546.2,20.7,3.65%,14.2,5.2,23.4,4.9,18.4,0.9,95.3,4.5 -Deepak Nitrite Ltd.,DEEPAKNTR,506401,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"1,795.1","1,475.8",302.3,17.00%,39.4,2.7,277.2,72.1,205.1,15,797.9,58.5 -Fine Organic Industries Ltd.,FINEORG,541557,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,557.6,409.4,131.1,24.25%,14.4,0.7,133.1,28.9,103.4,33.7,458.8,149.6 -LTIMindtree Ltd.,LTIM,540005,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"9,048.6","7,274.1","1,631.3",18.32%,208.2,47,"1,519.3",357,"1,161.8",39.3,"4,427.5",149.6 -Dalmia Bharat Ltd.,DALBHARAT,542216,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"3,234","2,56",589,18.70%,401,101,172,48,118,6.3,"1,041",54.8 -Godfrey Phillips India Ltd.,GODFRYPHLP,500163,FOOD BEVERAGES & TOBACCO,CIGARETTES-TOBACCO PRODUCTS,"1,412.5","1,151",223.6,16.27%,36.5,6.6,218.5,55.5,202.1,38.9,802.9,154.4 -Vaibhav Global Ltd.,VAIBHAVGBL,532156,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,708.4,641.5,63.5,9.01%,22.6,2.9,41.4,12.4,29.4,1.8,121.3,7.3 -Abbott India Ltd.,ABBOTINDIA,500488,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,549.7","1,113.3",380.9,25.49%,17.8,3.1,415.4,102.5,312.9,147.3,"1,081.4",508.9 -Adani Total Gas Ltd.,ATGL,ASM,UTILITIES,UTILITIES,"1,104.8",815.7,279.9,25.55%,37.6,27.3,224.2,57.2,172.7,1.6,571,5.2 -Nestle India Ltd.,NESTLEIND,500790,FMCG,PACKAGED FOODS,"5,070.1","3,811.9","1,224.9",24.32%,111.2,31.4,"1,222",313.9,908.1,94.2,"2,971.1",308.2 -Bayer Cropscience Ltd.,BAYERCROP,506285,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"1,633.3","1,312.3",304.9,18.85%,11.6,3.7,305.7,82.8,222.9,49.6,844.4,188.1 -Amber Enterprises India Ltd.,AMBER,540902,CONSUMER DURABLES,CONSUMER ELECTRONICS,939.8,867.5,59.6,6.43%,45.2,36.6,-9.5,-3.8,-6.9,-2.1,156.8,46.5 -Rail Vikas Nigam Ltd.,RVNL,542649,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"5,210.3","4,616",298.3,6.07%,6.2,132.7,455.4,85.2,394.3,1.9,"1,478.8",7.1 -Metropolis Healthcare Ltd.,METROPOLIS,542650,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,309.7,233.7,74.8,24.25%,22.2,5.7,48.1,12.5,35.5,6.9,133.4,26 -Polycab India Ltd.,POLYCAB,542652,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"4,253","3,608.8",608.9,14.44%,60.3,26.8,557.2,127.4,425.6,28.4,"1,607.2",107.1 -Multi Commodity Exchange of India Ltd.,MCX,534091,BANKING AND FINANCE,EXCHANGE,184,193.8,-28.7,-17.38%,6.6,0.1,-16.4,1.6,-19.1,-3.7,44.8,8.8 -IIFL Finance Ltd.,IIFL,532636,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,"2,533.7",788.3,"1,600.8",64.66%,43.3,932.1,683.5,158,474.3,12.4,"1,690.7",44.4 -Ratnamani Metals & Tubes Ltd.,RATNAMANI,520111,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"1,141.9",886.3,244.9,21.65%,23.6,10.8,221.1,56.8,163.9,23.4,622.6,88.8 -RHI Magnesita India Ltd.,RHIM,534076,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,989.7,839,147.9,14.98%,44.2,8.5,97.9,26.3,71.3,3.5,-502.2,-24.3 -Birlasoft Ltd.,BSOFT,532400,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,325.4","1,102.7",207.1,15.81%,21.5,5.7,195.5,50.4,145.1,5.2,378.4,13.7 -EIH Ltd.,EIHOTEL,500840,HOTELS RESTAURANTS & TOURISM,HOTELS,552.5,387.6,142.9,26.94%,33.2,5.6,126.1,36.2,93.1,1.5,424.1,6.8 -Affle (India) Ltd.,AFFLE,542752,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,441.2,344.1,87.2,20.22%,18.4,5.5,73.2,6.4,66.8,5,264.3,19.8 -Westlife Foodworld Ltd.,WESTLIFE,505533,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,618,516.5,98.2,15.98%,43.9,27.4,30.2,7.8,22.4,1.4,107.7,6.9 -IndiaMART InterMESH Ltd.,INDIAMART,542726,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,329.3,214.7,80,27.15%,8,2.3,104.3,23.9,69.4,11.4,321.1,53.6 -Infosys Ltd.,INFY,500209,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"39,626","29,554","9,44",24.21%,"1,166",138,"8,768","2,553","6,212",15,"24,871",60.1 -Sterling and Wilson Renewable Energy Ltd.,SWSOLAR,542760,COMMERCIAL SERVICES & SUPPLIES,CONSULTING SERVICES,776.7,758,1.5,0.19%,4.3,64.3,-50,4.6,-54.2,-2.9,-668.4,-35.2 -ABB India Ltd.,ABB,500002,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,846","2,330.7",438.5,15.84%,30.3,0.9,484.2,122.2,362.9,17.1,"1,208.7",57 -Poly Medicure Ltd.,POLYMED,531768,HEALTHCARE EQUIPMENT & SUPPLIES,HEALTHCARE SUPPLIES,351.4,253.1,84.2,24.97%,16,2.2,80.9,18.8,62.2,6.5,233.7,24.4 -GMM Pfaudler Ltd.,GMMPFAUDLR,505255,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,946,795.5,142,15.15%,32.2,21.5,96.8,26.5,71.1,15.8,183.2,40.8 -Gujarat Fluorochemicals Ltd.,FLUOROCHEM,542812,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,960.3,783.7,163.1,17.23%,67.5,34.2,74.8,22.1,52.7,4.8,915.2,83.3 -360 One Wam Ltd.,360ONE,542772,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,617.1,235.6,317.8,57.31%,13.7,139.9,226.8,40.8,186,5.2,696.8,19.5 -Tata Communications Ltd.,TATACOMM,500483,TELECOM SERVICES,OTHER TELECOM SERVICES,"4,897.9","3,857.1","1,015.5",20.84%,605.1,137.4,298.3,77.9,220.7,7.7,"1,322.3",46.4 -Alkyl Amines Chemicals Ltd.,ALKYLAMINE,506767,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,354.5,303.9,48.3,13.71%,12.5,1.7,36.4,9.2,27.2,5.3,171.3,33.5 -CSB Bank Ltd.,CSBBANK,542867,BANKING AND FINANCE,BANKS,835.8,317.5,174.6,25.41%,0,343.6,178,44.8,133.2,7.7,577.7,33.3 -Indian Railway Catering & Tourism Corporation Ltd.,IRCTC,542830,DIVERSIFIED CONSUMER SERVICES,TRAVEL SUPPORT SERVICES,"1,042.4",628.8,366.6,36.83%,14,4.4,395.2,100.5,294.7,3.7,"1,061.2",13.3 -Sumitomo Chemical India Ltd.,SUMICHEM,542920,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,928,715.5,187.9,20.80%,15.8,1.2,195.5,52,143.4,2.9,367.7,7.4 -Century Textiles & Industries Ltd.,CENTURYTEX,500040,COMMERCIAL SERVICES & SUPPLIES,PAPER & PAPER PRODUCTS,"1,114.9","1,069.2",33.8,3.07%,59.2,17,-30.5,-3.3,-30.4,-2.8,117.7,10.5 -SBI Cards and Payment Services Ltd.,SBICARD,543066,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"4,221.4","2,018.8","1,327",32.47%,46.8,604.9,809.4,206.4,603,6.4,"2,302.2",24.3 -Hitachi Energy India Ltd.,POWERINDIA,543187,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"1,228.2","1,162.6",65.3,5.32%,22.5,10.7,32.4,7.6,24.7,5.8,82.5,19.5 -Suven Pharmaceuticals Ltd.,SUVENPHAR,543064,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,250.9,133.1,98,42.40%,11.9,0.5,105.4,25.8,79.6,3.1,431.8,17 -Tata Chemicals Ltd.,TATACHEM,500770,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"4,083","3,179",819,20.49%,234,145,627,120,428,16.8,"2,06",80.8 -Aarti Drugs Ltd.,AARTIDRUGS,524348,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,642.2,565.1,76.4,11.92%,12.6,8.2,56.3,16.7,39.6,4.3,180.2,19.6 -Gujarat Ambuja Exports Ltd.,GAEL,524226,FMCG,EDIBLE OILS,"1,157.7","1,012.2",103.3,9.26%,30.5,5.9,109.1,26.3,82.8,3.6,305.1,13.3 -Polyplex Corporation Ltd.,POLYPLEX,524051,COMMERCIAL SERVICES & SUPPLIES,CONTAINERS & PACKAGING,"1,595.7","1,451.5",120.6,7.67%,75.1,9.9,59.1,10.9,27.9,8.9,71.1,22.6 -Chalet Hotels Ltd.,CHALET,542399,HOTELS RESTAURANTS & TOURISM,HOTELS,318.2,188.6,126,40.04%,35,50.1,44.5,8,36.4,1.8,266.7,13 -Adani Enterprises Ltd.,ADANIENT,512599,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,"23,066","20,087.2","2,430.1",10.79%,757,"1,342.8",791,397.8,227.8,2,"2,444.3",21.4 -YES Bank Ltd.,YESBANK,532648,BANKING AND FINANCE,BANKS,"7,980.6","2,377.1",810,12.06%,0,"4,793.6",304.4,75.7,228.6,0.1,836.6,0.3 -EPL Ltd.,EPL,500135,COMMERCIAL SERVICES & SUPPLIES,CONTAINERS & PACKAGING,"1,011.2",820.6,181,18.07%,83.6,30.6,76.4,25.4,50.5,1.6,251.9,7.9 -Network18 Media & Investments Ltd.,NETWORK18,532798,MEDIA,BROADCASTING & CABLE TV,"2,052.2","2,083.8",-218.3,-11.70%,56.8,66.2,-154.5,-6.5,-61,-0.6,-144.2,-1.4 -CIE Automotive India Ltd.,CIEINDIA,532756,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,299.4","1,934",345.4,15.15%,78.3,31,256.1,69.1,375.4,9.9,298.4,7.9 -Vedanta Ltd.,VEDL,500295,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"39,585","27,466","11,479",29.47%,"2,642","2,523","8,177","9,092","-1,783",-4.8,"5,202",14 -Rossari Biotech Ltd.,ROSSARI,543213,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,484.8,419.9,63.6,13.15%,15.1,5,44.8,11.9,32.9,6,116.8,21.2 -KPIT Technologies Ltd.,KPITTECH,542651,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,208.6",959.2,239.9,20.01%,48.1,13.6,187.7,46.3,140.9,5.2,486.9,18 -Intellect Design Arena Ltd.,INTELLECT,538835,SOFTWARE & SERVICES,IT SOFTWARE PRODUCTS,631.7,497.2,121.9,19.69%,33.7,0.8,96.5,25.7,70.4,5.2,316.6,23.2 -Balaji Amines Ltd.,BALAMINES,530999,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,387.3,326.8,53.8,14.13%,10.8,1.8,48,11.6,34.7,10.7,197.3,60.9 -UTI Asset Management Company Ltd.,UTIAMC,543238,BANKING AND FINANCE,ASSET MANAGEMENT COS.,405.6,172.5,231.5,57.30%,10.4,2.8,219.8,37,182.8,14.4,562.9,44.3 -Mazagon Dock Shipbuilders Ltd.,MAZDOCK,543237,TRANSPORTATION,SHIPPING,"2,079.2","1,651.1",176.6,9.66%,20.2,1.3,406.6,102.8,332.9,16.5,"1,327.6",65.8 -Computer Age Management Services Ltd.,CAMS,543232,BANKING AND FINANCE,CAPITAL MARKETS,284.7,153,122.1,44.39%,17.4,2,112.4,28.6,84.5,17.2,309.2,62.9 -Happiest Minds Technologies Ltd.,HAPPSTMNDS,543227,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,428.8,324,82.6,20.32%,14.6,11.2,79.1,20.7,58.5,3.9,232,15.6 -Triveni Turbine Ltd.,TRITURBINE,533655,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,402.3,313.4,74.3,19.17%,5.1,0.6,83.2,19,64.2,2,233.1,7.3 -Angel One Ltd.,ANGELONE,ASM,BANKING AND FINANCE,CAPITAL MARKETS,"1,049.3",602.6,443.4,42.31%,11.2,26.4,407.2,102.7,304.5,36.3,"1,020.2",121.7 -Tanla Platforms Ltd.,TANLA,532790,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,014.9",811.8,196.8,19.51%,22.6,1.8,178.7,36.2,142.5,10.6,514.7,38.3 -Max Healthcare Institute Ltd.,MAXHEALTH,543220,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,408.6",975.8,387.4,28.42%,57.9,8.5,366.4,89.7,276.7,2.9,990.1,10.2 -Asahi India Glass Ltd.,ASAHIINDIA,515030,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,122.6",934,185.6,16.58%,43,34.4,111.3,30.2,86.9,3.6,343.5,14.1 -Prince Pipes & Fittings Ltd.,PRINCEPIPE,542907,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,660.4,562.3,94.2,14.35%,22.5,0.7,92.8,22.2,70.6,5.2,219.8,19.9 -Route Mobile Ltd.,ROUTE,543228,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,018.3",886.5,128.1,12.63%,21.4,6.5,103.8,15.5,88.8,14.2,365.3,58.3 -KPR Mill Ltd.,KPRMILL,532889,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,533","1,212.9",298,19.72%,46,18.1,256,54.2,201.8,5.9,788.8,23.1 -Infibeam Avenues Ltd.,INFIBEAM,539807,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,792.6,719.7,70.2,8.89%,17.1,0.5,55.2,14.7,41,0.1,142.2,0.5 -Restaurant Brands Asia Ltd.,RBA,543248,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,628.2,568.7,56.2,9.00%,78.6,31.5,-50.7,0,-46,-0.9,-220.3,-4.5 -Larsen & Toubro Ltd.,LT,500510,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"52,157","45,392.1","5,632",11.04%,909.9,864,"4,991.1","1,135.5","3,222.6",22.9,"12,255.3",89.2 -Gland Pharma Ltd.,GLAND,543245,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,426.6","1,049.3",324.1,23.60%,81.3,6,289.9,95.8,194.1,11.8,698.8,42.4 -Macrotech Developers Ltd.,LODHA,543287,REALTY,REALTY,"1,755.1","1,333.5",416.1,23.78%,29.3,123.1,269.2,62.4,201.9,2.1,"1,529.2",15.9 -Poonawalla Fincorp Ltd.,POONAWALLA,524000,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),745.3,178.9,531.7,71.98%,14.7,215.5,"1,124.6",270,860.2,11.2,"1,466.4",19.1 -The Fertilisers and Chemicals Travancore Ltd.,FACT,590024,FERTILIZERS,FERTILIZERS,"1,713.6","1,530.8",132.4,7.96%,5.3,61.2,105.2,0,105.2,1.6,508.4,7.9 -Home First Finance Company India Ltd.,HOMEFIRST,543259,BANKING AND FINANCE,HOUSING FINANCE,278,53.7,211.6,77.43%,2.8,117,96.4,22.1,74.3,8.4,266.2,30.2 -CG Power and Industrial Solutions Ltd.,CGPOWER,500093,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,019","1,692.9",308.6,15.42%,22.9,0.4,329.9,86.2,242.3,1.6,"1,1",7.2 -Laxmi Organic Industries Ltd.,LXCHEM,543277,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,660.5,613.3,38.9,5.97%,27.5,2.1,17.5,6.8,10.7,0.4,100.6,3.8 -Anupam Rasayan India Ltd.,ANURAS,543275,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,395.6,284.7,107.5,27.41%,19.8,20.4,70.7,22,40.7,3.8,178.9,16.6 -Kalyan Jewellers India Ltd.,KALYANKJIL,ASM,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"4,427.7","4,100.9",313.7,7.11%,66.9,81.7,178.1,43.3,135.2,1.3,497.9,4.8 -Jubilant Pharmova Ltd.,JUBLPHARMA,530019,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,690.2","1,438.5",241.8,14.39%,96.6,66.1,89,35.9,62.5,3.9,-44.6,-2.8 -Indigo Paints Ltd.,INDIGOPNTS,543258,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,273.4,228.7,41.8,15.45%,10,0.5,34.3,8.2,26.1,5.5,132.4,27.8 -Indian Railway Finance Corporation Ltd.,IRFC,543257,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"6,767.5",33.5,"6,732.4",99.50%,2.1,"5,181.5","1,549.9",0,"1,549.9",1.2,"6,067.6",4.6 -Mastek Ltd.,MASTEK,523704,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,770.4,642.5,123,16.07%,20.9,12.6,90.3,25,62.8,20.5,269.7,88 -Equitas Small Finance Bank Ltd.,EQUITASBNK,543243,BANKING AND FINANCE,BANKS,"1,540.4",616.8,330.2,24.30%,0,593.4,267,68.9,198.1,1.8,749.5,6.7 -Tata Teleservices (Maharashtra) Ltd.,TTML,532371,TELECOM SERVICES,TELECOM SERVICES,288.6,159.3,127.5,44.45%,36.3,403.2,-310.2,0,-310.2,-1.6,"-1,168.3",-6 -Praj Industries Ltd.,PRAJIND,522205,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,893.3,798.4,84,9.52%,9.1,1,84.8,22.4,62.4,3.4,271.4,14.8 -Nazara Technologies Ltd.,NAZARA,543280,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,309.5,269.4,26.7,8.98%,15.1,2.7,21.2,-1.3,19.8,3,60,9.1 -Jubilant Ingrevia Ltd.,JUBLINGREA,543271,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,028.5",902.3,117.7,11.54%,33.9,12.5,79.8,22.4,57.5,3.6,258.9,16.4 -Sona BLW Precision Forgings Ltd.,SONACOMS,543300,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,796.9,567.5,223.3,28.24%,53.4,6,164.1,40.1,123.8,2.1,462.8,7.9 -Chemplast Sanmar Ltd.,CHEMPLASTS,543336,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,025",941.8,46,4.65%,35.3,38.6,9.2,-16.8,26.1,1.6,35.3,2.2 -Aptus Value Housing Finance India Ltd.,APTUS,543335,BANKING AND FINANCE,HOUSING FINANCE,344.5,50.6,277.5,83.18%,2.6,96.1,189.6,41.5,148,3,551.1,11.1 -Clean Science & Technology Ltd.,CLEAN,543318,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,187.1,106.3,74.8,41.32%,11.1,0.3,69.5,17.3,52.2,4.9,275.5,25.9 -Medplus Health Services Ltd.,MEDPLUS,543427,HEALTHCARE EQUIPMENT & SUPPLIES,HEALTHCARE SUPPLIES,"1,419","1,323.5",85.1,6.04%,55.5,23.5,16.4,1.9,14.6,1.2,58.3,4.9 -Nuvoco Vistas Corporation Ltd.,NUVOCO,543334,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,578.9","2,243",329.9,12.82%,225.6,139.9,-29.6,-31.1,1.5,0,141.8,4 -Star Health and Allied Insurance Company Ltd.,STARHEALTH,543412,BANKING AND FINANCE,GENERAL INSURANCE,"3,463.2","3,295.8",165.7,4.79%,0,0,167.1,41.8,125.3,2.1,725.4,12.4 -Go Fashion (India) Ltd.,GOCOLORS,543401,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,192.8,132.2,56.6,29.98%,25.8,8.9,25.8,5.7,20,3.7,85.4,15.8 -PB Fintech Ltd.,POLICYBZR,543390,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,909.1,900.7,-89.1,-10.98%,22.3,7.2,-21.1,-0.3,-20.2,-0.5,-127.9,-2.8 -FSN E-Commerce Ventures Ltd.,NYKAA,543384,SOFTWARE & SERVICES,INTERNET & CATALOGUE RETAIL,"1,515.6","1,426.4",80.6,5.35%,54.6,21.3,13.3,4,5.8,0,19.8,0.1 -Krishna Institute of Medical Sciences Ltd.,KIMS,543308,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,655.4,475.2,177.3,27.17%,32.6,8.9,138.6,37.3,92,11.5,342.1,42.7 -Zomato Ltd.,ZOMATO,543320,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"3,06","2,895",-47,-1.65%,128,16,21,-15,36,0,-496.8,-0.6 -Brightcom Group Ltd.,BCG,532368,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,690.5","1,172.3",518,30.65%,72.3,0.1,445.8,124.3,321.5,1.6,"1,415.2",7 -Shyam Metalics and Energy Ltd.,SHYAMMETL,543299,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"2,978.9","2,633.6",307.1,10.44%,176.5,35.4,133.4,-348.6,484.1,18.9,"1,049.9",41.2 -G R Infraprojects Ltd.,GRINFRA,543317,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,909.2","1,415.7",467.1,24.81%,61.7,144.6,287.1,69.9,217.2,22.5,"1,240.3",128.3 -RattanIndia Enterprises Ltd.,RTNINDIA,534597,UTILITIES,ELECTRIC UTILITIES,"1,618.1","1,392.8",1.5,0.11%,4.3,28.8,142.2,1.7,140.9,1,147.6,1.1 -Borosil Renewables Ltd.,BORORENEW,502219,CONSUMER DURABLES,HOUSEWARE,406.3,369.2,32.5,8.09%,31,9.6,28.9,-1.1,25.1,1.9,32.1,2.5 -HLE Glascoat Ltd.,HLEGLAS,522215,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,227.8,198,26.5,11.79%,6.1,5.8,16.1,5.3,10,1.6,54.4,8 -Tata Investment Corporation Ltd.,TATAINVEST,501301,DIVERSIFIED,HOLDING COMPANIES,125,10.1,113.8,91.88%,0.2,4.7,110.1,-1.3,124.4,24.6,326.1,64.4 -Sapphire Foods India Ltd.,SAPPHIRE,543397,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,650.1,527.5,115.1,17.91%,76.8,24.5,21.4,6.2,15.3,2.4,208.5,32.7 -Devyani International Ltd.,DEVYANI,543330,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,826,665,154.4,18.84%,86.3,41.7,19,-16.8,33.4,0.3,177.5,1.5 -Vijaya Diagnostic Centre Ltd.,VIJAYA,543350,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,145.6,81.5,57.4,41.31%,13.7,5.9,44.6,11,33.3,3.3,103.4,10.1 -C.E. Info Systems Ltd.,MAPMYINDIA,543425,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,99.3,50.1,41,44.98%,3.7,0.7,44.7,11.1,33,6.1,122.9,22.7 -Latent View Analytics Ltd.,LATENTVIEW,543398,SOFTWARE & SERVICES,DATA PROCESSING SERVICES,172.7,124.9,30.8,19.78%,2.3,0.8,44.7,10.6,34,1.7,153.6,7.5 -Metro Brands Ltd.,METROBRAND,543426,RETAILING,FOOTWEAR,571.9,400.3,155.4,27.96%,57.2,19.7,94.7,27.5,66.7,2.5,340,12.5 -Easy Trip Planners Ltd.,EASEMYTRIP,543272,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,144.6,76.9,64.8,45.71%,1,2,64.7,17.7,47.2,0.3,146,0.8 -Shree Renuka Sugars Ltd.,RENUKA,532670,FOOD BEVERAGES & TOBACCO,SUGAR,"2,564.7","2,491",63.7,2.49%,64.1,216.8,-207.2,-1.6,-204.9,-1,-286,-1.3 -One97 Communications Ltd.,PAYTM,543396,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"2,662.5","2,749.6",-231,-9.17%,180.1,7,-279.9,12.7,-290.5,-5,"-1,207.9",-19 -MTAR Technologies Ltd.,MTARTECH,543270,GENERAL INDUSTRIALS,DEFENCE,167.7,130.7,36.1,21.64%,5.8,5.5,25.7,5.2,20.5,6.7,103.3,33.6 -Capri Global Capital Ltd.,CGCL,531595,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),557.4,229.3,304.8,54.70%,23.1,195.8,86,20.8,65.2,3.2,231.2,11.2 -GMR Airports Infrastructure Ltd.,GMRINFRA,ASM,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"2,185","1,336.8",726.7,35.22%,373,695.8,-252,54.9,-91,-0.1,-370.9,-0.6 -Triveni Engineering & Industries Ltd.,TRIVENI,532356,FOOD BEVERAGES & TOBACCO,SUGAR,"1,629.7","1,554.5",62.9,3.89%,25.8,10.2,39.3,10.1,29.1,1.3,434.3,19.8 -Delhivery Ltd.,DELHIVERY,543529,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"2,043","1,957.3",-15.6,-0.80%,171.2,19.6,-105.2,-2.1,-102.9,-1.4,-546.7,-7.5 -Life Insurance Corporation of India,LICI,543526,BANKING AND FINANCE,LIFE INSURANCE,"202,394.9","193,612.5","8,445",4.18%,0,0,"8,696.5","1,083.9","8,030.3",12.7,"37,204.8",58.8 -Campus Activewear Ltd.,CAMPUS,543523,RETAILING,FOOTWEAR,259.1,234.2,24.5,9.46%,18.1,6.5,0.4,0.1,0.3,0,103.1,3.4 -Motherson Sumi Wiring India Ltd.,MSUMI,543498,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,110.2","1,856.5",248.1,11.79%,36.4,7.4,210,54.1,155.9,0.3,523.6,1.2 -Olectra Greentech Ltd.,OLECTRA,532439,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,310.3,266.6,40.5,13.20%,8.8,9.7,25.2,8,18.6,2.2,78.5,9.6 -Patanjali Foods Ltd.,PATANJALI,500368,FMCG,EDIBLE OILS,"7,845.8","7,426.6",395.3,5.05%,60.1,24,335.1,80.5,254.5,7,875.2,24.2 -Raymond Ltd.,RAYMOND,500330,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,320.7","1,938.8",314.6,13.96%,65.4,89.3,204.2,50.7,159.8,24,"1,514.2",227.5 -Swan Energy Ltd.,SWANENERGY,503310,REALTY,REALTY,"1,230.1",966.3,257,21.01%,27.1,58.3,178.4,12.8,84.6,6.7,308.4,11.7 -Samvardhana Motherson International Ltd.,MOTHERSON,517334,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"23,639.2","21,585","1,888.8",8.05%,867.4,487.9,449.5,229.2,201.6,0.3,"1,910.3",2.8 -Vedant Fashions Ltd.,MANYAVAR,543463,RETAILING,SPECIALTY RETAIL,233.4,125.5,92.8,42.51%,32.5,10.7,64.8,16.1,48.7,2,399.9,16.5 -Adani Wilmar Ltd.,AWL,543458,FMCG,EDIBLE OILS,"12,331.2","12,123.5",143.7,1.17%,95.7,220.2,-161.8,-31.5,-130.7,-1,130.1,1 -Mahindra Lifespace Developers Ltd.,MAHLIFE,532313,REALTY,REALTY,25.7,52.7,-34.9,-196.45%,3.1,0.2,-30.3,-10.8,-18.9,-1.2,10.5,0.7 -Tejas Networks Ltd.,TEJASNET,540595,TELECOM SERVICES,OTHER TELECOM SERVICES,413.9,383,13,3.28%,41.7,7,-17.7,-5.1,-12.6,-0.7,-61.3,-3.5 -Aether Industries Ltd.,AETHER,543534,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,178.3,118.2,46,28.00%,9.7,1.6,48.7,12.1,36.7,2.8,139.1,10.5 -JBM Auto Ltd.,JBMA,ASM,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,238.8","1,091.3",139.7,11.35%,41.2,47.9,58.3,11.3,44.2,3.7,136.8,11.6 -Deepak Fertilisers & Petrochemicals Corporation Ltd.,DEEPAKFERT,500645,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"2,443.2","2,138.1",286.1,11.80%,81.2,107.1,116.8,53.3,60.1,4.8,674.5,53.4 -Sharda Cropchem Ltd.,SHARDACROP,538666,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,604.3,559.6,21.2,3.65%,74,4.6,-33.8,-6.3,-27.6,-3.1,191,21.2 -Shoppers Stop Ltd.,SHOPERSTOP,532638,RETAILING,DEPARTMENT STORES,"1,049.7",878.2,160.9,15.49%,108.2,54.9,3.5,0.8,2.7,0.2,94.2,8.6 -BEML Ltd.,BEML,500048,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,924,855.3,61.5,6.70%,15.8,10.8,42.2,-9.6,51.8,12.4,200.8,48.2 -Lemon Tree Hotels Ltd.,LEMONTREE,541233,HOTELS RESTAURANTS & TOURISM,HOTELS,230.1,125.3,101.9,44.84%,22.6,47.3,34.8,8.6,22.6,0.3,130.1,1.6 -Rainbow Childrens Medicare Ltd.,RAINBOW,543524,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,340.5,215.1,117.6,35.34%,26.8,13.3,85.2,22.1,62.9,6.2,215.4,21.2 -UCO Bank,UCOBANK,532505,BANKING AND FINANCE,BANKS,"5,865.6","1,581.5",981.9,18.81%,0,"3,302.3",639.8,238.1,403.5,0.3,"1,84",1.5 -Piramal Pharma Ltd.,PPLPHARMA,543635,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,960.6","1,645.7",265.6,13.90%,184.5,109.9,20.4,34.5,5,0,-133.6,-1 -KSB Ltd.,KSB,500249,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,572.2,493.4,70.3,12.47%,12.3,2,64.5,17.1,50.1,14.4,209.7,60.3 -Data Patterns (India) Ltd.,DATAPATTNS,543428,GENERAL INDUSTRIALS,DEFENCE,119.2,67.5,40.8,37.63%,3.1,2.3,46.3,12.5,33.8,6,148.3,26.5 -Global Health Ltd.,MEDANTA,543654,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,864.7,631.1,212.9,25.22%,42.9,20.1,170.6,45.4,125.2,4.7,408.9,15.2 -Aarti Industries Ltd.,AARTIIND,524208,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,454","1,221.2",232.8,16.01%,93,58.2,81.6,-9.1,90.7,2.5,446.2,12.3 -BLS International Services Ltd.,BLS,540073,DIVERSIFIED CONSUMER SERVICES,TRAVEL SUPPORT SERVICES,416.4,321,86.7,21.27%,7.3,1,87.2,5.2,78.7,1.9,267.6,6.5 -Archean Chemical Industries Ltd.,ACI,543657,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,301.7,195,95.5,32.86%,17.5,1.9,87.3,21.3,66,5.4,394.4,32.1 -Adani Power Ltd.,ADANIPOWER,ASM,UTILITIES,ELECTRIC UTILITIES,"14,935.7","7,819.2","5,171.4",39.81%,"1,004.5",888.4,"5,223.6","-1,370.6","6,594.2",16.5,"20,604.8",53.4 -Craftsman Automation Ltd.,CRAFTSMAN,543276,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,183.8",941.6,237.5,20.14%,66.8,41.6,133.8,29.6,94.5,44.1,298.3,141.2 -NMDC Ltd.,NMDC,526371,METALS & MINING,MINING,"4,335","2,823.6","1,190.4",29.66%,88.8,18.6,"1,404.1",379,"1,026.2",3.5,"5,862.2",20 -Epigral Ltd.,EPIGRAL,543332,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,479.1,370.2,107.9,22.57%,31.5,21.3,56.1,17.9,38,9.1,223.4,53.8 -Apar Industries Ltd.,APARINDS,532259,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"3,944.7","3,576.2",349.8,8.91%,28.2,103.1,237.3,62.9,173.9,45.4,783.9,204.8 -Bikaji Foods International Ltd.,BIKAJI,543653,FMCG,PACKAGED FOODS,614.7,521,87.7,14.41%,15.6,2.9,75.2,15.4,61.2,2.5,173.6,6.9 -Five-Star Business Finance Ltd.,FIVESTAR,543663,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),522.4,133.2,375,72.28%,5.7,105.9,267,67.6,199.4,6.8,703,24.1 -Ingersoll-Rand (India) Ltd.,INGERRAND,500210,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,282.8,210.7,65.7,23.76%,4.6,0.6,67,17.2,49.7,15.8,218.5,69.2 -KFIN Technologies Ltd.,KFINTECH,543720,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,215.3,115.3,93.7,44.82%,12.6,3.2,84.2,22.3,61.4,3.6,215.1,12.6 -Piramal Enterprises Ltd.,PEL,500302,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"2,205.2","1,320.1","1,117.9",50.97%,38.3,"1,038.9",-11.8,10.7,48.2,2,"3,906.5",173.9 -NMDC Steel Ltd.,NSLNISP,543768,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,290.3,349.6,-72.2,-26.04%,74.5,40.8,-174.7,-43.6,-131.1,-0.5,, -Eris Lifesciences Ltd.,ERIS,540596,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,508.8,324.2,181.1,35.85%,42.1,16.3,126.2,3.9,123.4,9.1,385.6,28.3 -Mankind Pharma Ltd.,MANKIND,543904,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,768.1","2,025.5",682.6,25.21%,96.5,8.6,637.5,129.8,501,12.5,"1,564.8",39.1 -Kaynes Technology India Ltd.,KAYNES,ASM,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,369.8,312.1,48.8,13.52%,6.5,11.8,39.4,7.1,32.3,5.5,143.2,24.6 -Safari Industries (India) Ltd.,SAFARI,523025,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,372.9,306.6,63.5,17.15%,12.2,2.2,51.9,12.1,39.8,16.7,162.3,68.2 -Saregama India Ltd.,SAREGAMA,532163,MEDIA,MOVIES & ENTERTAINMENT,185.6,111.5,60.9,35.32%,8.2,0.2,65.6,17.6,48.1,2.5,193.4,10 -Syrma SGS Technology Ltd.,SYRMA,543573,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,720.6,662.7,49,6.88%,11.6,8,37,6.4,28.3,1.6,132.4,7.5 -Jindal Saw Ltd.,JINDALSAW,ASM,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"5,488.9","4,662",804.2,14.71%,142.5,188.7,495.6,139.6,375.7,11.8,"1,135.8",35.5 -Godawari Power & Ispat Ltd.,GPIL,532734,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"1,314.2",929.6,361.4,28.00%,34.8,10.2,339.6,86.1,256.9,20.6,785.5,63 -Gillette India Ltd.,GILLETTE,507815,FMCG,PERSONAL PRODUCTS,676.2,530.8,136.7,20.48%,20.1,0.1,125.2,32.5,92.7,28.4,361.6,111 -Symphony Ltd.,SYMPHONY,517385,CONSUMER DURABLES,CONSUMER ELECTRONICS,286,234,41,14.91%,7,2,43,8,35,5.1,114,16.5 -Glenmark Life Sciences Ltd.,GLS,543322,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,600.7,428.3,167.1,28.06%,13.1,0.4,158.9,40.2,118.7,9.7,505.5,41.3 -Usha Martin Ltd.,USHAMART,517146,METALS & MINING,IRON & STEEL PRODUCTS,806,640.4,144.3,18.39%,18,6.4,141.2,35,109.5,3.6,399.4,13.1 -Ircon International Ltd.,IRCON,541956,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"3,136.3","2,771.2",215.7,7.22%,27.1,36.9,301.2,77.6,250.7,2.7,884.6,9.4 -Ujjivan Small Finance Bank Ltd.,UJJIVANSFB,542904,BANKING AND FINANCE,BANKS,"1,579.8",528.6,483.4,34.75%,0,567.8,436.4,108.7,327.7,1.7,"1,254.5",6.4 -Procter & Gamble Health Ltd.,PGHL,500126,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,311,216.3,88.7,29.08%,6.5,0.2,88,22.5,65.6,39.5,231.4,139.4 -Allcargo Logistics Ltd.,ALLCARGO,532749,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"3,336.3","3,188.8",118,3.57%,106.7,36.7,14.2,1.3,21.8,0.9,361.9,14.7 -Sheela Foam Ltd.,SFL,540203,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,637.6,547,66.2,10.80%,21.9,8.6,60.2,15.6,44,4.5,192.4,17.7 -Alok Industries Ltd.,ALOKINDS,521070,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,369.3","1,323.1",35.9,2.64%,78.6,142.2,-174.6,0,-174.8,-0.3,-948.4,-1.9 -Minda Corporation Ltd.,MINDACORP,538962,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,197.9","1,064.5",131.3,10.98%,41.4,14.9,77,18.7,58.8,2.5,278.2,11.6 -Concord Biotech Ltd.,CONCORDBIO,543960,PHARMACEUTICALS & BIOTECHNOLOGY,BIOTECHNOLOGY,270.5,143.2,119.2,45.43%,13.3,0.8,113.2,28.7,81,7.7,, \ No newline at end of file diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/data/sampleFileForUpload.txt b/sdk/ai/ai-projects/samples/v1-beta/javascript/data/sampleFileForUpload.txt deleted file mode 100644 index ab553b3304c1..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/data/sampleFileForUpload.txt +++ /dev/null @@ -1 +0,0 @@ -The word 'apple' uses the code 442345, while the word 'banana' uses the code 673457. diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/package.json b/sdk/ai/ai-projects/samples/v1-beta/javascript/package.json deleted file mode 100644 index 91d7b63210a0..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "@azure-samples/ai-projects-js-beta", - "private": true, - "version": "1.0.0", - "description": "Azure AI Projects client library samples for JavaScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/ai/ai-projects" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects", - "dependencies": { - "@azure/ai-projects": "next", - "dotenv": "latest", - "@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.28", - "@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.7", - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/instrumentation": "0.53.0", - "@opentelemetry/sdk-trace-node": "^1.9.0", - "@azure/core-util": "^1.9.0", - "@azure/identity": "^4.3.0" - } -} diff --git a/sdk/ai/ai-projects/samples/v1-beta/javascript/sample.env b/sdk/ai/ai-projects/samples/v1-beta/javascript/sample.env deleted file mode 100644 index 0d9bbe518d6f..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/javascript/sample.env +++ /dev/null @@ -1,3 +0,0 @@ -AZURE_AI_PROJECTS_CONNECTION_STRING="" - -APPLICATIONINSIGHTS_CONNECTION_STRING="" diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/README.md b/sdk/ai/ai-projects/samples/v1-beta/typescript/README.md deleted file mode 100644 index 589cee582e69..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/README.md +++ /dev/null @@ -1,118 +0,0 @@ ---- -page_type: sample -languages: - - typescript -products: - - azure -urlFragment: ai-projects-typescript-beta ---- - -# Azure AI Projects client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for Azure AI Projects in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| [agents\codeInterpreterWithStreaming.ts][agents_codeinterpreterwithstreaming] | demonstrates how to use agent operations with code interpreter. | -| [agents\agentCreateWithTracingConsole.ts][agents_agentcreatewithtracingconsole] | Create Agent and instrument using open telemetry. | -| [agents\agentsAzureAiSearch.ts][agents_agentsazureaisearch] | demonstrates how to use agent operations with the Azure AI Search tool. | -| [agents\agentsBasics.ts][agents_agentsbasics] | demonstrates how to use basic agent operations. | -| [agents\agentsBingGrounding.ts][agents_agentsbinggrounding] | demonstrates how to use agent operations with the Grounding with Bing Search tool. | -| [agents\agentsBingGroundingWithStreaming.ts][agents_agentsbinggroundingwithstreaming] | demonstrates how to use agent operations with the Grounding with Bing Search tool using streaming. | -| [agents\agentsWithFunctionTool.ts][agents_agentswithfunctiontool] | demonstrates how to use basic agent operations using function tool. | -| [agents\agentsWithToolset.ts][agents_agentswithtoolset] | demonstrates how to use agent operations with toolset. | -| [agents\batchVectorStoreWithFiles.ts][agents_batchvectorstorewithfiles] | demonstrates how to create the batch vector store with the list of files. | -| [agents\batchVectorStoreWithFilesAndPolling.ts][agents_batchvectorstorewithfilesandpolling] | demonstrates how to create the batch vector store with the list of files using polling operation. | -| [agents\codeInterpreter.ts][agents_codeinterpreter] | demonstrates how to use agent operations with code interpreter. | -| [agents\fileSearch.ts][agents_filesearch] | This sample demonstrates how to use agent operations with file searching. | -| [agents\files.ts][agents_files] | demonstrates how to use basic files agent operations. | -| [agents\filesWithLocalUpload.ts][agents_fileswithlocalupload] | demonstrates how to use basic files agent operations with local file upload. | -| [agents\filesWithPolling.ts][agents_fileswithpolling] | demonstrates how to upload a file and poll for its status. | -| [agents\messages.ts][agents_messages] | demonstrates how to use basic message agent operations. | -| [agents\runSteps.ts][agents_runsteps] | demonstrates how to use basic run agent operations. | -| [agents\streaming.ts][agents_streaming] | demonstrates how to use agent operations in streaming. | -| [agents\threads.ts][agents_threads] | demonstrates how to use basic thread agent operations. | -| [agents\vectorStoreWithFiles.ts][agents_vectorstorewithfiles] | demonstrates how to create the vector store with the list of files. | -| [agents\vectorStoreWithFilesAndPolling.ts][agents_vectorstorewithfilesandpolling] | demonstrates how to create the vector store with the list of files using polling operation. | -| [agents\vectorStores.ts][agents_vectorstores] | demonstrates how to create the vector store. | -| [agents\vectorStoresWithPolling.ts][agents_vectorstoreswithpolling] | demonstrates how to create the vector store using polling operation. | -| [connections\connectionsBasics.ts][connections_connectionsbasics] | Given an AIProjectClient, this sample demonstrates how to enumerate the properties of all connections, get the properties of a default connection, and get the properties of a connection by its name. | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/agents\codeInterpreterWithStreaming.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx dev-tool run vendored cross-env AZURE_AI_PROJECTS_CONNECTION_STRING="" node dist/agents\codeInterpreterWithStreaming.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[agents_codeinterpreterwithstreaming]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreterWithStreaming.ts -[agents_agentcreatewithtracingconsole]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentCreateWithTracingConsole.ts -[agents_agentsazureaisearch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsAzureAiSearch.ts -[agents_agentsbasics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBasics.ts -[agents_agentsbinggrounding]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGrounding.ts -[agents_agentsbinggroundingwithstreaming]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGroundingWithStreaming.ts -[agents_agentswithfunctiontool]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithFunctionTool.ts -[agents_agentswithtoolset]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithToolset.ts -[agents_batchvectorstorewithfiles]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFiles.ts -[agents_batchvectorstorewithfilesandpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFilesAndPolling.ts -[agents_codeinterpreter]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreter.ts -[agents_filesearch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/fileSearch.ts -[agents_files]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/files.ts -[agents_fileswithlocalupload]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithLocalUpload.ts -[agents_fileswithpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithPolling.ts -[agents_messages]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/messages.ts -[agents_runsteps]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/runSteps.ts -[agents_streaming]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/streaming.ts -[agents_threads]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/threads.ts -[agents_vectorstorewithfiles]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFiles.ts -[agents_vectorstorewithfilesandpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFilesAndPolling.ts -[agents_vectorstores]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStores.ts -[agents_vectorstoreswithpolling]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoresWithPolling.ts -[connections_connectionsbasics]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/ai/ai-projects/samples/v1-beta/typescript/src/connections/connectionsBasics.ts - -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/package.json b/sdk/ai/ai-projects/samples/v1-beta/typescript/package.json deleted file mode 100644 index 580bbca38132..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@azure-samples/ai-projects-ts-beta", - "private": true, - "version": "1.0.0", - "description": "Azure AI Projects client library samples for TypeScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/ai/ai-projects" - }, - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-projects", - "dependencies": { - "@azure/ai-projects": "next", - "dotenv": "latest", - "@azure/monitor-opentelemetry-exporter": "^1.0.0-beta.28", - "@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.7", - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/instrumentation": "0.53.0", - "@opentelemetry/sdk-trace-node": "^1.9.0", - "@azure/core-util": "^1.9.0", - "@azure/identity": "^4.3.0" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.6.2", - "rimraf": "latest" - } -} diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/sample.env b/sdk/ai/ai-projects/samples/v1-beta/typescript/sample.env deleted file mode 100644 index 0d9bbe518d6f..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/sample.env +++ /dev/null @@ -1,3 +0,0 @@ -AZURE_AI_PROJECTS_CONNECTION_STRING="" - -APPLICATIONINSIGHTS_CONNECTION_STRING="" diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentCreateWithTracingConsole.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentCreateWithTracingConsole.ts deleted file mode 100644 index 57e4dcb4d285..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentCreateWithTracingConsole.ts +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * Demonstrates How to instrument and get tracing using open telemetry. - * - * @summary Create Agent and instrument using open telemetry. - */ - -import { AzureMonitorTraceExporter } from "@azure/monitor-opentelemetry-exporter"; -import { createAzureSdkInstrumentation } from "@azure/opentelemetry-instrumentation-azure-sdk"; -import { context, trace } from "@opentelemetry/api"; -import { registerInstrumentations } from "@opentelemetry/instrumentation"; -import { - ConsoleSpanExporter, - NodeTracerProvider, - SimpleSpanProcessor, -} from "@opentelemetry/sdk-trace-node"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const provider = new NodeTracerProvider(); -provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter())); -provider.register(); - -registerInstrumentations({ - instrumentations: [createAzureSdkInstrumentation()], -}); - -import { AIProjectsClient } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; -let appInsightsConnectionString = process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"]; - -export async function main(): Promise { - const tracer = trace.getTracer("Agents Sample", "1.0.0"); - - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - if (!appInsightsConnectionString) { - appInsightsConnectionString = await client.telemetry.getConnectionString(); - } - - if (appInsightsConnectionString) { - const exporter = new AzureMonitorTraceExporter({ - connectionString: appInsightsConnectionString, - }); - provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); - } - - await tracer.startActiveSpan("main", async (span) => { - client.telemetry.updateSettings({ enableContentRecording: true }); - - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - tracingOptions: { tracingContext: context.active() }, - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - const thread = await client.agents.createThread(); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Hello, tell me a joke", - }); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - console.log(`Created Run, Run ID: ${run.id}`); - - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - } - - await client.agents.deleteAgent(agent.id); - - console.log(`Deleted agent`); - - await client.agents.listMessages(thread.id); - - span.end(); - }); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsAzureAiSearch.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsAzureAiSearch.ts deleted file mode 100644 index 0579c0fd0ea8..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsAzureAiSearch.ts +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with the Azure AI Search tool from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with the Azure AI Search tool. - */ - -import type { MessageContentOutput, MessageTextContentOutput } from "@azure/ai-projects"; -import { AIProjectsClient, isOutputOfType, ToolUtility } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const connectionName = process.env["AZURE_AI_SEARCH_CONNECTION_NAME"] || ""; - const connection = await client.connections.getConnection(connectionName); - - // Initialize Azure AI Search tool - const azureAISearchTool = ToolUtility.createAzureAISearchTool(connection.id, connection.name); - - // Create agent with the Azure AI search tool - const agent = await client.agents.createAgent("gpt-4-0125-preview", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [azureAISearchTool.definition], - toolResources: azureAISearchTool.resources, - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Hello, send an email with the datetime and weather information in New York", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run in thread with tools - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the assistant when done - client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage: MessageContentOutput = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBasics.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBasics.ts deleted file mode 100644 index 3bbc3cb1019b..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBasics.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic agent operations. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - client.agents.deleteAgent(agent.id); - - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGrounding.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGrounding.ts deleted file mode 100644 index d5057c2fdb5b..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGrounding.ts +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with the Grounding with Bing Search tool - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with the Grounding with Bing Search tool. - */ - -import type { MessageContentOutput, MessageTextContentOutput } from "@azure/ai-projects"; -import { - AIProjectsClient, - ToolUtility, - connectionToolType, - isOutputOfType, -} from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const bingConnection = await client.connections.getConnection( - process.env["BING_CONNECTION_NAME"] || "", - ); - const connectionId = bingConnection.id; - - // Initialize agent bing tool with the connection id - const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - connectionId, - ]); - - // Create agent with the bing tool and process assistant run - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "How does wikipedia explain Euler's Identity?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run in thread with tools - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the assistant when done - client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage: MessageContentOutput = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGroundingWithStreaming.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGroundingWithStreaming.ts deleted file mode 100644 index 345bf626cb46..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsBingGroundingWithStreaming.ts +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with the Grounding with Bing Search tool - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with the Grounding with Bing Search tool using streaming. - */ - -import type { - MessageContentOutput, - MessageDeltaChunk, - MessageDeltaTextContent, - MessageTextContentOutput, - ThreadRunOutput, -} from "@azure/ai-projects"; -import { - AIProjectsClient, - DoneEvent, - ErrorEvent, - MessageStreamEvent, - RunStreamEvent, - ToolUtility, - connectionToolType, - isOutputOfType, -} from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - // Create an Azure AI Client from a connection string, copied from your AI Foundry project. - // At the moment, it should be in the format ";;;" - // Customer needs to login to Azure subscription via Azure CLI and set the environment variables - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const bingConnection = await client.connections.getConnection( - process.env["BING_CONNECTION_NAME"] || "", - ); - const connectionId = bingConnection.id; - - const bingTool = ToolUtility.createConnectionTool(connectionToolType.BingGrounding, [ - connectionId, - ]); - - // Create agent with the bing tool and process assistant run - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [bingTool.definition], - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread for communication - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message to thread - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "How does wikipedia explain Euler's Identity?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create and process agent run with streaming in thread with tools - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - // Delete the assistant when done - client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - - // Fetch and log all messages - const messages = await client.agents.listMessages(thread.id); - console.log(`Messages:`); - const agentMessage: MessageContentOutput = messages.data[0].content[0]; - if (isOutputOfType(agentMessage, "text")) { - const textContent = agentMessage as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithFunctionTool.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithFunctionTool.ts deleted file mode 100644 index 38200f55d9a5..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithFunctionTool.ts +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/* eslint-disable @typescript-eslint/no-unsafe-function-type - */ - -/** - * This sample demonstrates how to use basic agent operations with function tool from the Azure Agents service. - * - * @summary demonstrates how to use basic agent operations using function tool. - * - */ - -import type { - FunctionToolDefinition, - FunctionToolDefinitionOutput, - MessageContentOutput, - MessageImageFileContentOutput, - MessageTextContentOutput, - RequiredToolCallOutput, - SubmitToolOutputsActionOutput, - ToolOutput, -} from "@azure/ai-projects"; -import { AIProjectsClient, ToolUtility, isOutputOfType } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const agents = client.agents; - class FunctionToolExecutor { - private functionTools: { func: Function; definition: FunctionToolDefinition }[]; - - constructor() { - this.functionTools = [ - { - func: this.getUserFavoriteCity, - ...ToolUtility.createFunctionTool({ - name: "getUserFavoriteCity", - description: "Gets the user's favorite city.", - parameters: {}, - }), - }, - { - func: this.getCityNickname, - ...ToolUtility.createFunctionTool({ - name: "getCityNickname", - description: "Gets the nickname of a city, e.g. 'LA' for 'Los Angeles, CA'.", - parameters: { - type: "object", - properties: { - location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, - }, - }, - }), - }, - { - func: this.getWeather, - ...ToolUtility.createFunctionTool({ - name: "getWeather", - description: "Gets the weather for a location.", - parameters: { - type: "object", - properties: { - location: { type: "string", description: "The city and state, e.g. Seattle, Wa" }, - unit: { type: "string", enum: ["c", "f"] }, - }, - }, - }), - }, - ]; - } - - private getUserFavoriteCity(): {} { - return { location: "Seattle, WA" }; - } - - private getCityNickname(_location: string): {} { - return { nickname: "The Emerald City" }; - } - - private getWeather(_location: string, unit: string): {} { - return { weather: unit === "f" ? "72f" : "22c" }; - } - - public invokeTool( - toolCall: RequiredToolCallOutput & FunctionToolDefinitionOutput, - ): ToolOutput | undefined { - console.log(`Function tool call - ${toolCall.function.name}`); - const args = []; - if (toolCall.function.parameters) { - try { - const params = JSON.parse(toolCall.function.parameters); - for (const key in params) { - if (Object.prototype.hasOwnProperty.call(params, key)) { - args.push(params[key]); - } - } - } catch (error) { - console.error(`Failed to parse parameters: ${toolCall.function.parameters}`, error); - return undefined; - } - } - const result = this.functionTools - .find((tool) => tool.definition.function.name === toolCall.function.name) - ?.func(...args); - return result - ? { - toolCallId: toolCall.id, - output: JSON.stringify(result), - } - : undefined; - } - - public getFunctionDefinitions(): FunctionToolDefinition[] { - return this.functionTools.map((tool) => { - return tool.definition; - }); - } - } - - const functionToolExecutor = new FunctionToolExecutor(); - const functionTools = functionToolExecutor.getFunctionDefinitions(); - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: - "You are a weather bot. Use the provided functions to help answer questions. Customize your responses to the user's preferences as much as possible and use friendly nicknames for cities whenever possible.", - tools: functionTools, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "What's the weather like in my favorite city?", - }); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await agents.createRun(thread.id, agent.id); - console.log(`Created Run, Run ID: ${run.id}`); - - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - if (run.status === "requires_action" && run.requiredAction) { - console.log(`Run requires action - ${run.requiredAction}`); - if ( - isOutputOfType(run.requiredAction, "submit_tool_outputs") - ) { - const submitToolOutputsActionOutput = run.requiredAction as SubmitToolOutputsActionOutput; - const toolCalls = submitToolOutputsActionOutput.submitToolOutputs.toolCalls; - const toolResponses = []; - for (const toolCall of toolCalls) { - if (isOutputOfType(toolCall, "function")) { - const toolResponse = functionToolExecutor.invokeTool(toolCall); - if (toolResponse) { - toolResponses.push(toolResponse); - } - } - } - if (toolResponses.length > 0) { - run = await agents.submitToolOutputsToRun(thread.id, run.id, toolResponses); - console.log(`Submitted tool response - ${run.status}`); - } - } - } - } - - console.log(`Run status - ${run.status}, run ID: ${run.id}`); - const messages = await agents.listMessages(thread.id); - messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content: MessageContentOutput) => { - if (isOutputOfType(content, "text")) { - const textContent = content as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content as MessageImageFileContentOutput; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - // Delete agent - agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithToolset.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithToolset.ts deleted file mode 100644 index 89375aa07149..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/agentsWithToolset.ts +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with toolset and iteration in streaming - * from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with toolset. - */ - -import { AIProjectsClient, ToolSet } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; - -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file for code interpreter tool - const filePath1 = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const fileStream1 = fs.createReadStream(filePath1); - const codeInterpreterFile = await client.agents.uploadFile(fileStream1, "assistants", { - fileName: "myLocalFile", - }); - - console.log(`Uploaded local file, file ID : ${codeInterpreterFile.id}`); - - // Upload file for file search tool - const filePath2 = path.resolve(__dirname, "../data/sampleFileForUpload.txt"); - const fileStream2 = fs.createReadStream(filePath2); - const fileSearchFile = await client.agents.uploadFile(fileStream2, "assistants", { - fileName: "sampleFileForUpload.txt", - }); - console.log(`Uploaded file, file ID: ${fileSearchFile.id}`); - - // Create vector store for file search tool - const vectorStore = await client.agents - .createVectorStoreAndPoll({ - fileIds: [fileSearchFile.id], - }) - .pollUntilDone(); - - // Create tool set - const toolSet = new ToolSet(); - toolSet.addFileSearchTool([vectorStore.id]); - toolSet.addCodeInterpreterTool([codeInterpreterFile.id]); - - // Create agent with tool set - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: toolSet.toolDefinitions, - toolResources: toolSet.toolResources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create threads, messages, and runs to interact with agent as desired - - // Delete agent - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFiles.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFiles.ts deleted file mode 100644 index 9fbda36fcdc4..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFiles.ts +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the batch vector store with the list of files. - * - * @summary demonstrates how to create the batch vector store with the list of files. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload first file - const file1Content = "Hello, Vector Store!"; - const readable1 = new Readable(); - readable1.push(file1Content); - readable1.push(null); // end the stream - const file1 = await client.agents.uploadFile(readable1, "assistants", { - fileName: "vectorFile1.txt", - }); - console.log(`Uploaded file1, file ID: ${file1.id}`); - - // Create and upload second file - const file2Content = "This is another file for the Vector Store!"; - const readable2 = new Readable(); - readable2.push(file2Content); - readable2.push(null); // end the stream - const file2 = await client.agents.uploadFile(readable2, "assistants", { - fileName: "vectorFile2.txt", - }); - console.log(`Uploaded file2, file ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await client.agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await client.agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // List vector store files in the batch - const vectorStoreFiles = await client.agents.listVectorStoreFileBatchFiles( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `List of vector store files in the batch: ${vectorStoreFiles.data.map((f) => f.id).join(", ")}`, - ); - - // Delete files - await client.agents.deleteFile(file1.id); - console.log(`Deleted file1, file ID: ${file1.id}`); - await client.agents.deleteFile(file2.id); - console.log(`Deleted file2, file ID: ${file2.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFilesAndPolling.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFilesAndPolling.ts deleted file mode 100644 index 7940fe1aa9b0..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/batchVectorStoreWithFilesAndPolling.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the batch vector store with the list of files using polling operation. - * - * @summary demonstrates how to create the batch vector store with the list of files using polling operation. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload first file - const file1Content = "Hello, Vector Store!"; - const readable1 = new Readable(); - readable1.push(file1Content); - readable1.push(null); // end the stream - const file1 = await client.agents.uploadFile(readable1, "assistants", { - fileName: "vectorFile1.txt", - }); - console.log(`Uploaded file1, file ID: ${file1.id}`); - - // Create and upload second file - const file2Content = "This is another file for the Vector Store!"; - const readable2 = new Readable(); - readable2.push(file2Content); - readable2.push(null); // end the stream - const file2 = await client.agents.uploadFile(readable2, "assistants", { - fileName: "vectorFile2.txt", - }); - console.log(`Uploaded file2, file ID: ${file2.id}`); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create vector store file batch - const vectorStoreFileBatchOptions = { - fileIds: [file1.id, file2.id], - pollingOptions: { abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreFileBatchAndPoll( - vectorStore.id, - vectorStoreFileBatchOptions, - ); - const vectorStoreFileBatch = await poller.pollUntilDone(); - console.log( - `Created vector store file batch with status ${vectorStoreFileBatch.status}, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await client.agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // Delete files - await client.agents.deleteFile(file1.id); - console.log(`Deleted file1, file ID: ${file1.id}`); - await client.agents.deleteFile(file2.id); - console.log(`Deleted file2, file ID: ${file2.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreter.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreter.ts deleted file mode 100644 index 1cd4579376b2..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreter.ts +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with code interpreter from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with code interpreter. - */ - -import type { MessageImageFileContentOutput, MessageTextContentOutput } from "@azure/ai-projects"; -import { AIProjectsClient, isOutputOfType, ToolUtility } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file and wait for it to be processed - const filePath = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "localFile", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Create code interpreter tool - const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]); - - // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment - const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create a thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create a message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create a bar chart in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provide the file to me?", - }); - - console.log(`Created message, message ID: ${message.id}`); - - // Create and execute a run - let run = await client.agents.createRun(thread.id, agent.id); - while (run.status === "queued" || run.status === "in_progress") { - await delay(1000); - run = await client.agents.getRun(thread.id, run.id); - } - if (run.status === "failed") { - // Check if you got "Rate limit is exceeded.", then you want to get more quota - console.log(`Run failed: ${run.lastError}`); - } - console.log(`Run finished with status: ${run.status}`); - - // Delete the original file from the agent to free up space (note: this does not delete your version of the file) - await client.agents.deleteFile(localFile.id); - console.log(`Deleted file, file ID: ${localFile.id}`); - - // Print the messages from the agent - const messages = await client.agents.listMessages(thread.id); - console.log("Messages:", messages); - - // Get most recent message from the assistant - const assistantMessage = messages.data.find((msg) => msg.role === "assistant"); - if (assistantMessage) { - const textContent = assistantMessage.content.find((content) => - isOutputOfType(content, "text"), - ) as MessageTextContentOutput; - if (textContent) { - console.log(`Last message: ${textContent.text.value}`); - } - } - - // Save the newly created file - console.log(`Saving new files...`); - const imageFile = (messages.data[0].content[0] as MessageImageFileContentOutput).imageFile; - console.log(`Image file ID : ${imageFile}`); - const imageFileName = path.resolve( - __dirname, - "../data/" + (await client.agents.getFile(imageFile.fileId)).filename + "ImageFile.png", - ); - - const fileContent = await ( - await client.agents.getFileContent(imageFile.fileId).asNodeStream() - ).body; - if (fileContent) { - const chunks: Buffer[] = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); - } else { - console.error("Failed to retrieve file content: fileContent is undefined"); - } - console.log(`Saved image file to: ${imageFileName}`); - - // Iterate through messages and print details for each annotation - console.log(`Message Details:`); - messages.data.forEach((m) => { - console.log(`File Paths:`); - console.log(`Type: ${m.content[0].type}`); - if (isOutputOfType(m.content[0], "text")) { - const textContent = m.content[0] as MessageTextContentOutput; - console.log(`Text: ${textContent.text.value}`); - } - console.log(`File ID: ${m.id}`); - console.log(`Start Index: ${messages.firstId}`); - console.log(`End Index: ${messages.lastId}`); - }); - - // Delete the agent once done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreterWithStreaming.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreterWithStreaming.ts deleted file mode 100644 index 07e9fb628ad1..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/codeInterpreterWithStreaming.ts +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with code interpreter from the Azure Agents service. - * - * @summary demonstrates how to use agent operations with code interpreter. - */ - -import type { - MessageDeltaChunk, - MessageDeltaTextContent, - MessageImageFileContentOutput, - MessageTextContentOutput, - ThreadRunOutput, -} from "@azure/ai-projects"; -import { - AIProjectsClient, - DoneEvent, - ErrorEvent, - isOutputOfType, - MessageStreamEvent, - RunStreamEvent, - ToolUtility, -} from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file and wait for it to be processed - const filePath = path.resolve(__dirname, "../data/nifty500QuarterlyResults.csv"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "myLocalFile", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Create code interpreter tool - const codeInterpreterTool = ToolUtility.createCodeInterpreterTool([localFile.id]); - - // Notice that CodeInterpreter must be enabled in the agent creation, otherwise the agent will not be able to see the file attachment - const agent = await client.agents.createAgent("gpt-4o-mini", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [codeInterpreterTool.definition], - toolResources: codeInterpreterTool.resources, - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create a thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create a message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: - "Could you please create a bar chart in the TRANSPORTATION sector for the operating profit from the uploaded CSV file and provide the file to me?", - }); - - console.log(`Created message, message ID: ${message.id}`); - - // Create and execute a run - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - // Delete the original file from the agent to free up space (note: this does not delete your version of the file) - await client.agents.deleteFile(localFile.id); - console.log(`Deleted file, file ID : ${localFile.id}`); - - // Print the messages from the agent - const messages = await client.agents.listMessages(thread.id); - console.log("Messages:", messages); - - // Get most recent message from the assistant - const assistantMessage = messages.data.find((msg) => msg.role === "assistant"); - if (assistantMessage) { - const textContent = assistantMessage.content.find((content) => - isOutputOfType(content, "text"), - ) as MessageTextContentOutput; - if (textContent) { - console.log(`Last message: ${textContent.text.value}`); - } - } - - // Save the newly created file - console.log(`Saving new files...`); - const imageFileOutput = messages.data[0].content[0] as MessageImageFileContentOutput; - const imageFile = imageFileOutput.imageFile.fileId; - const imageFileName = path.resolve( - __dirname, - "../data/" + (await client.agents.getFile(imageFile)).filename + "ImageFile.png", - ); - console.log(`Image file name : ${imageFileName}`); - - const fileContent = await (await client.agents.getFileContent(imageFile).asNodeStream()).body; - if (fileContent) { - const chunks: Buffer[] = []; - for await (const chunk of fileContent) { - chunks.push(Buffer.from(chunk)); - } - const buffer = Buffer.concat(chunks); - fs.writeFileSync(imageFileName, buffer); - } else { - console.error("Failed to retrieve file content: fileContent is undefined"); - } - console.log(`Saved image file to: ${imageFileName}`); - - // Iterate through messages and print details for each annotation - console.log(`Message Details:`); - messages.data.forEach((m) => { - console.log(`File Paths:`); - console.log(`Type: ${m.content[0].type}`); - if (isOutputOfType(m.content[0], "text")) { - const textContent = m.content[0] as MessageTextContentOutput; - console.log(`Text: ${textContent.text.value}`); - } - console.log(`File ID: ${m.id}`); - console.log(`Start Index: ${messages.firstId}`); - console.log(`End Index: ${messages.lastId}`); - }); - - // Delete the agent once done - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/fileSearch.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/fileSearch.ts deleted file mode 100644 index 2017065cfc29..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/fileSearch.ts +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations with file searching from the Azure Agents service. - * - * @summary This sample demonstrates how to use agent operations with file searching. - */ - -import type { - MessageContentOutput, - MessageImageFileContentOutput, - MessageTextContentOutput, -} from "@azure/ai-projects"; -import { AIProjectsClient, isOutputOfType, ToolUtility } from "@azure/ai-projects"; -import { delay } from "@azure/core-util"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload file - const filePath = path.resolve(__dirname, "../data/sampleFileForUpload.txt"); - const localFileStream = fs.createReadStream(filePath); - const file = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "sampleFileForUpload.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store - const vectorStore = await client.agents.createVectorStore({ - fileIds: [file.id], - name: "myVectorStore", - }); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Initialize file search tool - const fileSearchTool = ToolUtility.createFileSearchTool([vectorStore.id]); - - // Create agent with files - const agent = await client.agents.createAgent("gpt-4o", { - name: "SDK Test Agent - Retrieval", - instructions: "You are helpful agent that can help fetch data from files you know about.", - tools: [fileSearchTool.definition], - toolResources: fileSearchTool.resources, - }); - console.log(`Created agent, agent ID : ${agent.id}`); - - // Create thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "Can you give me the documented codes for 'banana' and 'orange'?", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - while (["queued", "in_progress"].includes(run.status)) { - await delay(500); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - } - - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - const messages = await client.agents.listMessages(thread.id); - messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content: MessageContentOutput) => { - if (isOutputOfType(content, "text")) { - const textContent = content as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content as MessageImageFileContentOutput; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - - // Delete agent - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/files.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/files.ts deleted file mode 100644 index 2e2bebdadd22..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/files.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic files agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic files agent operations. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create and upload file - const fileContent = "Hello, World!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { fileName: "myFile.txt" }); - console.log(`Uploaded file, file ID : ${file.id}`); - - // List uploaded files - const files = await client.agents.listFiles(); - - console.log(`List of files : ${files.data[0].filename}`); - - // Retrieve file - const _file = await client.agents.getFile(file.id); - - console.log(`Retrieved file, file ID : ${_file.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - - console.log(`Deleted file, file ID : ${file.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithLocalUpload.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithLocalUpload.ts deleted file mode 100644 index eb85a19e6fd1..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithLocalUpload.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic files agent operations with local file upload from the Azure Agents service. - * - * @summary demonstrates how to use basic files agent operations with local file upload. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import path from "node:path"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Upload local file - const filePath = path.resolve(__dirname, "../data/localFile.txt"); - const localFileStream = fs.createReadStream(filePath); - const localFile = await client.agents.uploadFile(localFileStream, "assistants", { - fileName: "myLocalFile.txt", - }); - - console.log(`Uploaded local file, file ID : ${localFile.id}`); - - // Retrieve local file - const retrievedLocalFile = await client.agents.getFile(localFile.id); - - console.log(`Retrieved local file, file ID : ${retrievedLocalFile.id}`); - - // Delete local file - await client.agents.deleteFile(localFile.id); - - console.log(`Deleted local file, file ID : ${localFile.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithPolling.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithPolling.ts deleted file mode 100644 index 61edd4c73c47..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/filesWithPolling.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to upload a file and poll for its status. - * - * @summary demonstrates how to upload a file and poll for its status. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create file content - const fileContent = "Hello, World!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - - // Upload file and poll - const poller = client.agents.uploadFileAndPoll(readable, "assistants", { - fileName: "myPollingFile", - }); - const file = await poller.pollUntilDone(); - console.log(`Uploaded file with status ${file.status}, file ID : ${file.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID ${file.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/messages.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/messages.ts deleted file mode 100644 index f290d20bf059..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/messages.ts +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic message agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic message agent operations. - */ - -import type { MessageTextContentOutput } from "@azure/ai-projects"; -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - const thread = await client.agents.createThread(); - - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - const messages = await client.agents.listMessages(thread.id); - console.log( - `Message ${message.id} contents: ${(messages.data[0].content[0] as MessageTextContentOutput).text.value}`, - ); - - const updatedMessage = await client.agents.updateMessage(thread.id, message.id, { - metadata: { introduction: "true" }, - }); - console.log(`Updated message metadata - introduction: ${updatedMessage.metadata?.introduction}`); - - await client.agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID : ${thread.id}`); - - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID : ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/runSteps.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/runSteps.ts deleted file mode 100644 index c646de76d259..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/runSteps.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic run agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic run agent operations. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create agent - const agent = await client.agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await client.agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await client.agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await client.agents.createRun(thread.id, agent.id); - console.log(`Created run, run ID: ${run.id}`); - - // Wait for run to complete - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await new Promise((resolve) => setTimeout(resolve, 1000)); - run = await client.agents.getRun(thread.id, run.id); - console.log(`Run status: ${run.status}`); - } - - // List run steps - const runSteps = await client.agents.listRunSteps(thread.id, run.id); - console.log(`Listed run steps, run ID: ${run.id}`); - - // Get specific run step - const stepId = runSteps.data[0].id; - const step = await client.agents.getRunStep(thread.id, run.id, stepId); - console.log(`Retrieved run step, step ID: ${step.id}`); - - // Clean up - await client.agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - await client.agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/streaming.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/streaming.ts deleted file mode 100644 index 0d947bdf759a..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/streaming.ts +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use agent operations in streaming from the Azure Agents service. - * - * @summary demonstrates how to use agent operations in streaming. - */ - -import type { - MessageDeltaChunk, - MessageDeltaTextContent, - ThreadRunOutput, -} from "@azure/ai-projects"; -import { - AIProjectsClient, - DoneEvent, - ErrorEvent, - MessageStreamEvent, - RunStreamEvent, -} from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const agent = await client.agents.createAgent("gpt-4-1106-preview", { - name: "my-assistant", - instructions: "You are helpful agent", - }); - - console.log(`Created agent, agent ID : ${agent.id}`); - - const thread = await client.agents.createThread(); - - console.log(`Created thread, thread ID : ${agent.id}`); - - await client.agents.createMessage(thread.id, { role: "user", content: "Hello, tell me a joke" }); - - console.log(`Created message, thread ID : ${agent.id}`); - - const streamEventMessages = await client.agents.createRun(thread.id, agent.id).stream(); - - for await (const eventMessage of streamEventMessages) { - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`ThreadRun status: ${(eventMessage.data as ThreadRunOutput).status}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - { - const messageDelta = eventMessage.data as MessageDeltaChunk; - messageDelta.delta.content.forEach((contentPart) => { - if (contentPart.type === "text") { - const textContent = contentPart as MessageDeltaTextContent; - const textValue = textContent.text?.value || "No text"; - console.log(`Text delta received:: ${textValue}`); - } - }); - } - break; - - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - case ErrorEvent.Error: - console.log(`An error occurred. Data ${eventMessage.data}`); - break; - case DoneEvent.Done: - console.log("Stream completed."); - break; - } - } - - await client.agents.deleteAgent(agent.id); - console.log(`Delete agent, agent ID : ${agent.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/threads.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/threads.ts deleted file mode 100644 index d60b7f7e9ce8..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/threads.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to use basic thread agent operations from the Azure Agents service. - * - * @summary demonstrates how to use basic thread agent operations. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - const thread = await client.agents.createThread(); - - console.log(`Created thread, thread ID : ${thread.id}`); - - const _thread = await client.agents.getThread(thread.id); - - console.log(`Retrieved thread, thread ID : ${_thread.id}`); - - client.agents.deleteThread(thread.id); - - console.log(`Deleted thread, thread ID : ${_thread.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFiles.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFiles.ts deleted file mode 100644 index 22461dee10dd..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFiles.ts +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store with the list of files. - * - * @summary demonstrates how to create the vector store with the list of files. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload file - const fileContent = "Hello, Vector Store!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { - fileName: "vectorFile.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await client.agents.createVectorStoreFile(vectorStore.id, { - fileId: file.id, - }); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Retrieve vector store file - const _vectorStoreFile = await client.agents.getVectorStoreFile( - vectorStore.id, - vectorStoreFile.id, - ); - console.log(`Retrieved vector store file, vector store file ID: ${_vectorStoreFile.id}`); - - // List vector store files - const vectorStoreFiles = await client.agents.listVectorStoreFiles(vectorStore.id); - console.log(`List of vector store files: ${vectorStoreFiles.data.map((f) => f.id).join(", ")}`); - - // Delete vector store file - await client.agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFilesAndPolling.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFilesAndPolling.ts deleted file mode 100644 index 9b6bb00d3710..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoreWithFilesAndPolling.ts +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store with the list of files using polling operation. - * - * @summary demonstrates how to create the vector store with the list of files using polling operation. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; -import { Readable } from "stream"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create vector store - const vectorStore = await client.agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Create and upload file - const fileContent = "Hello, Vector Store!"; - const readable = new Readable(); - readable.push(fileContent); - readable.push(null); // end the stream - const file = await client.agents.uploadFile(readable, "assistants", { - fileName: "vectorFile.txt", - }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create vector store file - const vectorStoreFileOptions = { - fileId: file.id, - pollingOptions: { sleepIntervalInMs: 2000, abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreFileAndPoll(vectorStore.id, vectorStoreFileOptions); - const vectorStoreFile = await poller.pollUntilDone(); - console.log( - `Created vector store file with status ${vectorStoreFile.status}, vector store file ID: ${vectorStoreFile.id}`, - ); - - // Delete file - await client.agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - - // Delete vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStores.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStores.ts deleted file mode 100644 index 1854a1ba10b4..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStores.ts +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store. - * - * @summary demonstrates how to create the vector store. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Create a vector store - const vectorStore = await client.agents.createVectorStore({ name: "myVectorStore" }); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // List vector stores - const vectorStores = await client.agents.listVectorStores(); - console.log("List of vector stores:", vectorStores); - - // Modify the vector store - const updatedVectorStore = await client.agents.modifyVectorStore(vectorStore.id, { - name: "updatedVectorStore", - }); - console.log(`Updated vector store, vector store ID: ${updatedVectorStore.id}`); - - // Get a specific vector store - const retrievedVectorStore = await client.agents.getVectorStore(vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${retrievedVectorStore.id}`); - - // Delete the vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoresWithPolling.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoresWithPolling.ts deleted file mode 100644 index 73fa25d23f60..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/agents/vectorStoresWithPolling.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to create the vector store using polling operation. - * - * @summary demonstrates how to create the vector store using polling operation. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Set up abort controller (optional) - // Polling can then be stopped using abortController.abort() - const abortController = new AbortController(); - - // Create a vector store - const vectorStoreOptions = { - name: "myVectorStore", - pollingOptions: { sleepIntervalInMs: 2000, abortSignal: abortController.signal }, - }; - const poller = client.agents.createVectorStoreAndPoll(vectorStoreOptions); - const vectorStore = await poller.pollUntilDone(); - console.log( - `Created vector store with status ${vectorStore.status}, vector store ID: ${vectorStore.id}`, - ); - - // Get a specific vector store - const retrievedVectorStore = await client.agents.getVectorStore(vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${retrievedVectorStore.id}`); - - // Delete the vector store - await client.agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/connections/connectionsBasics.ts b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/connections/connectionsBasics.ts deleted file mode 100644 index 8dbf3d60c60d..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/connections/connectionsBasics.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * This sample demonstrates how to how to use basic connections operations. - * - * @summary Given an AIProjectClient, this sample demonstrates how to enumerate the properties of all connections, - * get the properties of a default connection, and get the properties of a connection by its name. - */ - -import { AIProjectsClient } from "@azure/ai-projects"; -import { DefaultAzureCredential } from "@azure/identity"; - -import * as dotenv from "dotenv"; -dotenv.config(); - -const connectionString = - process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - -export async function main(): Promise { - const client = AIProjectsClient.fromConnectionString( - connectionString || "", - new DefaultAzureCredential(), - ); - - // Get the properties of the specified machine learning workspace - const workspace = await client.connections.getWorkspace(); - console.log(`Retrieved workspace, workspace name: ${workspace.name}`); - - // List the details of all the connections - const connections = await client.connections.listConnections(); - console.log(`Retrieved ${connections.length} connections`); - - // Get the details of a connection, without credentials - const connectionName = connections[0].name; - const connection = await client.connections.getConnection(connectionName); - console.log(`Retrieved connection, connection name: ${connection.name}`); - - // Get the details of a connection, including credentials (if available) - const connectionWithSecrets = await client.connections.getConnectionWithSecrets(connectionName); - console.log(`Retrieved connection with secrets, connection name: ${connectionWithSecrets.name}`); -} - -main().catch((err) => { - console.error("The sample encountered an error:", err); -}); diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/localFile.txt b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/localFile.txt deleted file mode 100644 index 8ab686eafeb1..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/localFile.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/nifty500QuarterlyResults.csv b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/nifty500QuarterlyResults.csv deleted file mode 100644 index e02068e09042..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/nifty500QuarterlyResults.csv +++ /dev/null @@ -1,502 +0,0 @@ -name,NSE_code,BSE_code,sector,industry,revenue,operating_expenses,operating_profit,operating_profit_margin,depreciation,interest,profit_before_tax,tax,net_profit,EPS,profit_TTM,EPS_TTM -3M India Ltd.,3MINDIA,523395,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"1,057",847.4,192.1,18.48%,12.9,0.7,195.9,49.8,146.1,129.7,535.9,475.7 -ACC Ltd.,ACC,500410,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"4,644.8","3,885.4",549.3,12.39%,212.8,28.9,517.7,131.5,387.9,20.7,"1,202.7",64 -AIA Engineering Ltd.,AIAENG,532683,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,"1,357.1",912.7,382.1,29.51%,24.5,7.4,412.5,88.4,323.1,34.3,"1,216.1",128.9 -APL Apollo Tubes Ltd.,APLAPOLLO,533758,METALS & MINING,IRON & STEEL PRODUCTS,"4,65","4,305.4",325,7.02%,41.3,26.6,276.7,73.8,202.9,7.3,767.5,27.7 -Au Small Finance Bank Ltd.,AUBANK,540611,BANKING AND FINANCE,BANKS,"2,956.5","1,026.7",647.7,25.59%,0,"1,282.1",533.4,131.5,401.8,6,"1,606.2",24 -Adani Ports & Special Economic Zone Ltd.,ADANIPORTS,532921,TRANSPORTATION,MARINE PORT & SERVICES,"6,951.9","2,982.4","3,664",55.13%,974.5,520.1,"2,474.9",759,"1,747.8",8.1,"6,337",29.3 -Adani Energy Solutions Ltd.,ADANIENSOL,ASM,UTILITIES,ELECTRIC UTILITIES,"3,766.5","2,169.3","1,504.6",40.95%,432.1,640.8,369.9,84.9,275.9,2.5,"1,315.1",11.8 -Aditya Birla Fashion and Retail Ltd.,ABFRL,535755,RETAILING,DEPARTMENT STORES,"3,272.2","2,903.6",322.9,10.01%,388.8,208.4,-228.6,-28.2,-179.2,-1.9,-491.7,-5.2 -Aegis Logistics Ltd.,AEGISCHEM,500003,OIL & GAS,OIL MARKETING & DISTRIBUTION,"1,279.3","1,026.5",208.3,16.87%,34.1,26.6,192,42,127,3.6,509,14.5 -Ajanta Pharma Ltd.,AJANTPHARM,532331,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,049.8",737.8,290.7,28.26%,33.7,2.3,275.9,80.6,195.3,15.5,660.2,52.3 -Alembic Pharmaceuticals Ltd.,APLLTD,533573,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,605.1","1,386.7",208.2,13.06%,67.6,15.7,135.1,-1.9,136.6,7,531.7,27 -Alkem Laboratories Ltd.,ALKEM,539523,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"3,503.4","2,693.4",746.7,21.71%,73.9,30.3,648,33.1,620.5,51.9,"1,432.9",119.9 -Amara Raja Energy & Mobility Ltd.,ARE&M,500008,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,988.6","2,556.9",402.5,13.60%,115.7,6.2,309.8,83.5,226.3,13.2,779.8,45.7 -Ambuja Cements Ltd.,AMBUJACEM,500425,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"7,9","6,122.1","1,301.8",17.54%,380.9,61.2,"1,335.7",352.5,793,4,"2,777.9",14 -Apollo Hospitals Enterprise Ltd.,APOLLOHOSP,508869,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"4,869.1","4,219.4",627.5,12.95%,163.4,111.3,376.9,130.2,232.9,16.2,697.5,48.5 -Apollo Tyres Ltd.,APOLLOTYRE,500877,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"6,304.9","5,119.8","1,159.8",18.47%,360.3,132.8,679.9,205.8,474.3,7.5,"1,590.7",25 -Ashok Leyland Ltd.,ASHOKLEY,500477,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"11,463","9,558.6","1,870.4",16.37%,226.6,715.1,924.4,358,526,1.8,"2,141.5",7.3 -Asian Paints Ltd.,ASIANPAINT,500820,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"8,643.8","6,762.3","1,716.2",20.24%,208.7,50.9,"1,621.8",418.6,"1,205.4",12.6,"5,062.6",52.8 -Astral Ltd.,ASTRAL,532830,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,"1,376.4","1,142.9",220.1,16.15%,48.7,8,176.8,45.1,131.2,4.9,549.7,20.4 -Atul Ltd.,ATUL,500027,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,215.8","1,038.5",155.2,13.00%,54,1.9,121.5,32.5,90.3,30.6,392.3,132.9 -Aurobindo Pharma Ltd.,AUROPHARMA,524804,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"7,406.4","5,846","1,373.4",19.02%,417.5,68.2,"1,074.7",323.7,757.2,12.8,"2,325.5",39.7 -Avanti Feeds Ltd.,AVANTIFEED,512573,FOOD BEVERAGES & TOBACCO,OTHER FOOD PRODUCTS,"1,312","1,184.5",94,7.35%,14.3,0.2,113,30.5,74.2,5.5,336.4,24.7 -Avenue Supermarts Ltd.,DMART,540376,RETAILING,DEPARTMENT STORES,"12,661.3","11,619.4","1,005",7.96%,174.4,15.6,851.9,228.6,623.6,9.6,"2,332.1",35.8 -Axis Bank Ltd.,AXISBANK,532215,BANKING AND FINANCE,BANKS,"33,122.2","9,207.3","9,166",33.43%,0,"14,749","8,313.8","2,096.1","6,204.1",20.1,"13,121",42.6 -Bajaj Auto Ltd.,BAJAJ-AUTO,532977,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"11,206.8","8,708.1","2,130.1",19.65%,91.8,6.5,"2,400.4",564,"2,02",71.4,"6,841.6",241.8 -Bajaj Finance Ltd.,BAJFINANCE,500034,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"13,381.8","2,851.5","9,449.7",70.63%,158.5,"4,537.1","4,757.6","1,207","3,550.8",58.7,"13,118.5",216.7 -Bajaj Finserv Ltd.,BAJAJFINSV,532978,DIVERSIFIED,HOLDING COMPANIES,"26,022.7","14,992.2","9,949.9",38.24%,208.8,"4,449.1","5,292","1,536.5","1,929",12.1,"7,422.6",46.6 -Bajaj Holdings & Investment Ltd.,BAJAJHLDNG,500490,DIVERSIFIED,HOLDING COMPANIES,240.1,33.5,191.2,85.08%,8.4,0.2,197.9,73.9,"1,491.2",134,"5,545.1",498.3 -Balkrishna Industries Ltd.,BALKRISIND,502355,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"2,360.3","1,720.5",532.7,23.64%,160.4,23.9,455.5,108.1,347.4,18,"1,047.5",54.2 -Balrampur Chini Mills Ltd.,BALRAMCHIN,500038,FOOD BEVERAGES & TOBACCO,SUGAR,"1,649","1,374.6",164.9,10.71%,41.2,17.2,215.9,56.6,166.3,8.2,540.5,26.8 -Bank of Baroda,BANKBARODA,532134,BANKING AND FINANCE,BANKS,"35,766","8,430.4","9,807.9",33.52%,0,"17,527.7","6,022.8","1,679.7","4,458.4",8.5,"18,602.9",35.9 -Bank of India,BANKINDIA,532149,BANKING AND FINANCE,BANKS,"16,779.4","3,704.9","3,818.8",25.35%,0,"9,255.7","2,977.4","1,488.6","1,498.5",3.6,"5,388.7",13.1 -Bata India Ltd.,BATAINDIA,500043,RETAILING,FOOTWEAR,834.6,637.5,181.7,22.18%,81.7,28.4,46.1,12.1,34,2.6,289.7,22.5 -Berger Paints (India) Ltd.,BERGEPAINT,509480,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"2,782.6","2,293.7",473.6,17.12%,82.9,21.1,385,96.7,291.6,2.5,"1,032.6",8.9 -Bharat Electronics Ltd.,BEL,500049,GENERAL INDUSTRIALS,DEFENCE,"4,146.1","2,994.9","1,014.2",25.30%,108.3,1.5,"1,041.5",260.7,789.4,1.1,"3,323",4.5 -Bharat Forge Ltd.,BHARATFORG,500493,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"3,826.7","3,152.8",621.4,16.47%,211.3,124.3,336.1,121.8,227.2,4.9,783.7,16.8 -Bharat Heavy Electricals Ltd.,BHEL,500103,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"5,305.4","5,513",-387.7,-7.56%,59.9,180.4,-447.9,-197.9,-238.1,-0.7,71.3,0.2 -Bharat Petroleum Corporation Ltd.,BPCL,500547,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"103,72","90,103.9","12,940.5",12.56%,"1,605.3",973.2,"10,755.7","2,812.2","8,243.5",38.7,"27,505.3",129.2 -Bharti Airtel Ltd.,BHARTIARTL,532454,TELECOM SERVICES,TELECOM SERVICES,"37,374.2","17,530.1","19,513.7",52.68%,"9,734.3","5,185.8","3,353.7","1,846.5","1,340.7",2.4,"7,547",13.2 -Indus Towers Ltd.,INDUSTOWER,534816,TELECOM SERVICES,OTHER TELECOM SERVICES,"7,229.7","3,498.8","3,633.7",50.95%,"1,525.6",458.6,"1,746.7",452,"1,294.7",4.8,"3,333.5",12.4 -Biocon Ltd.,BIOCON,532523,PHARMACEUTICALS & BIOTECHNOLOGY,BIOTECHNOLOGY,"3,620.2","2,720.7",741.6,21.42%,389.3,247.7,238.5,41.6,125.6,1.1,498.4,4.2 -Birla Corporation Ltd.,BIRLACORPN,500335,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,313.2","1,997",288.9,12.64%,143.5,95.4,77.1,18.8,58.4,7.6,153.1,19.9 -Blue Dart Express Ltd.,BLUEDART,526612,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"1,329.7","1,101.8",222.7,16.82%,110.6,19.5,97.9,24.8,73.1,30.8,292.4,123.2 -Blue Star Ltd.,BLUESTARCO,500067,CONSUMER DURABLES,CONSUMER ELECTRONICS,"1,903.4","1,767.7",122.7,6.49%,23,17.6,95,24.3,70.7,3.6,437.7,21.3 -Bombay Burmah Trading Corporation Ltd.,BBTC,501425,FOOD BEVERAGES & TOBACCO,TEA & COFFEE,"4,643.5","3,664.7",859.2,18.99%,74.7,154.6,697.1,212.6,122,17.5,"-1,499.5",-214.8 -Bosch Ltd.,BOSCHLTD,500530,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"4,284.3","3,638.8",491.3,11.90%,101.3,12.2,"1,317",318.1,999.8,339,"2,126.9",721 -Brigade Enterprises Ltd.,BRIGADE,532929,REALTY,REALTY,"1,407.9","1,041.8",324.8,23.77%,75.7,110,180.3,67.8,133.5,5.8,298.2,12.9 -Britannia Industries Ltd.,BRITANNIA,500825,FMCG,PACKAGED FOODS,"4,485.2","3,560.5",872.4,19.68%,71.7,53.4,799.7,212.1,587.6,24.4,"2,536.2",105.3 -CCL Products India Ltd.,CCL,519600,FOOD BEVERAGES & TOBACCO,TEA & COFFEE,608.3,497.7,109.9,18.09%,22.6,18.4,69.7,8.8,60.9,4.6,279.9,21 -Crisil Ltd.,CRISIL,500092,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,771.8,544.2,191.7,26.05%,26.5,0.8,200.3,48.3,152,20.8,606.3,82.9 -Zydus Lifesciences Ltd.,ZYDUSLIFE,532321,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"4,422.8","3,222.7","1,146.1",26.23%,184.2,8.7,"1,007.2",226.4,800.7,7.9,"2,807.1",27.7 -Can Fin Homes Ltd.,CANFINHOME,511196,BANKING AND FINANCE,HOUSING FINANCE,871,49.7,749.2,86.01%,2.8,548.4,198,39.9,158.1,11.9,658.8,49.5 -Canara Bank,CANBK,532483,BANKING AND FINANCE,BANKS,"33,891.2","8,250.3","7,706.6",28.24%,0,"17,934.3","5,098","1,420.6","3,86",20.9,"13,968.4",77 -Carborundum Universal Ltd.,CARBORUNIV,513375,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"1,166",978.8,167.5,14.61%,45.9,4.9,136.4,43.7,101.9,5.4,461.3,24.3 -Castrol India Ltd.,CASTROLIND,500870,OIL & GAS,OIL MARKETING & DISTRIBUTION,"1,203.2",914.4,268.6,22.70%,22.9,2.4,263.5,69.1,194.4,2,815.5,8.2 -Ceat Ltd.,CEATLTD,500878,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"3,063.8","2,597.2",456.1,14.94%,124.5,71.7,270.4,68.3,208,51.4,521.7,129 -Central Bank of India,CENTRALBK,532885,BANKING AND FINANCE,BANKS,"8,438.5","2,565.4","1,535.4",20.81%,0,"4,337.7",567.2,-41.5,622,0.7,"2,181.4",2.5 -Century Plyboards (India) Ltd.,CENTURYPLY,532548,FOREST MATERIALS,FOREST PRODUCTS,"1,011.4",852.5,144.3,14.47%,23.4,6.1,129.4,32.2,96.9,4.4,380.7,17.1 -Cera Sanitaryware Ltd.,CERA,532443,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,476.2,387.2,76.5,16.49%,8.9,1.4,77.2,19.8,56.9,43.8,232.4,178.7 -Chambal Fertilisers & Chemicals Ltd.,CHAMBLFERT,500085,FERTILIZERS,FERTILIZERS,"5,467.3","4,770.5",615,11.42%,78.4,45.8,572.6,200.2,381,9.2,"1,137.7",27.3 -Cholamandalam Investment & Finance Company Ltd.,CHOLAFIN,511243,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"4,695.2",987.6,"3,235.1",69.99%,38.5,"2,204.2","1,065",288.8,772.9,9.4,"3,022.8",36.7 -Cipla Ltd.,CIPLA,500087,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"6,854.5","4,944.4","1,733.8",25.96%,290,25.8,"1,594.2",438.4,"1,130.9",14,"3,449.1",42.7 -City Union Bank Ltd.,CUB,532210,BANKING AND FINANCE,BANKS,"1,486.1",333.9,386.6,29.65%,0,765.6,330.6,50,280.6,3.8,943.8,12.7 -Coal India Ltd.,COALINDIA,533278,METALS & MINING,COAL,"34,760.3","24,639.4","8,137",24.83%,"1,178.2",182.5,"8,760.2","2,036.5","6,799.8",11,"28,059.6",45.5 -Colgate-Palmolive (India) Ltd.,COLPAL,500830,FMCG,PERSONAL PRODUCTS,"1,492.1",989,482.1,32.77%,44.3,1.1,457.8,117.8,340.1,12.5,"1,173.2",43.1 -Container Corporation of India Ltd.,CONCOR,531344,COMMERCIAL SERVICES & SUPPLIES,WAREHOUSING AND LOGISTICS,"2,299.8","1,648.4",546.5,24.90%,153.1,16.5,481.8,119,367.4,6,"1,186.2",19.5 -Coromandel International Ltd.,COROMANDEL,506395,FERTILIZERS,FERTILIZERS,"7,032.9","5,929.4","1,058.7",15.15%,54,46.2,"1,003.3",245,756.9,25.7,"2,024.2",68.8 -Crompton Greaves Consumer Electricals Ltd.,CROMPTON,539876,CONSUMER DURABLES,HOUSEHOLD APPLIANCES,"1,797.2","1,607.8",174.5,9.79%,32.1,21.5,135.8,34.9,97.2,1.5,432,6.7 -Cummins India Ltd.,CUMMINSIND,500480,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"2,011.3","1,575.4",346.2,18.02%,38.3,6.8,390.9,99.6,329.1,11.9,"1,445.5",52.1 -Cyient Ltd.,CYIENT,532175,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,792","1,452.7",325.8,18.32%,65.8,27,240.3,56.7,178.3,16.3,665.6,60.1 -DCM Shriram Ltd.,DCMSHRIRAM,523367,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"2,73","2,593.9",114.1,4.21%,74,14.7,47.5,15.2,32.2,2.1,617.6,39.4 -DLF Ltd.,DLF,532868,REALTY,REALTY,"1,476.4",885.3,462.4,34.31%,37,90.2,464,112.2,622.8,2.5,"2,239",9 -Dabur India Ltd.,DABUR,500096,FMCG,PERSONAL PRODUCTS,"3,320.2","2,543",660.9,20.63%,98.3,28.1,650.8,144.3,515,2.9,"1,755.7",9.9 -Delta Corp Ltd.,DELTACORP,532848,COMMERCIAL SERVICES & SUPPLIES,MISC. COMMERCIAL SERVICES,282.6,170.5,100.1,36.99%,16.9,2.7,92.4,23,69.4,2.6,273.3,10.2 -Divi's Laboratories Ltd.,DIVISLAB,532488,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,995","1,43",479,25.09%,95,1,469,121,348,13.1,"1,331.8",50.3 -Dr. Lal Pathlabs Ltd.,LALPATHLAB,539524,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,619.4,423.5,177.8,29.57%,35.9,7.8,152.2,41.5,109.3,13.2,301.4,36.1 -Dr. Reddy's Laboratories Ltd.,DRREDDY,500124,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"7,217.6","4,888.8","2,008.3",29.09%,375.5,35.3,"1,912.5",434.5,"1,482.2",89.1,"5,091.2",305.2 -EID Parry (India) Ltd.,EIDPARRY,500125,FOOD BEVERAGES & TOBACCO,OTHER FOOD PRODUCTS,"9,210.3","8,002","1,057.5",11.67%,101.2,74.2,"1,032.8",246.8,452.3,25.5,991,55.8 -Eicher Motors Ltd.,EICHERMOT,505200,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"4,388.3","3,027.4","1,087.2",26.42%,142.5,12.7,"1,205.7",291.1,"1,016.2",37.1,"3,581",130.8 -Emami Ltd.,EMAMILTD,531162,FMCG,PERSONAL PRODUCTS,876,631.2,233.7,27.02%,46.1,2.2,196.4,15.8,178.5,4.1,697.8,16 -Endurance Technologies Ltd.,ENDURANCE,540153,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,560.5","2,226.7",318.3,12.51%,118.4,9.8,205.6,51.1,154.6,11,562.8,40 -Engineers India Ltd.,ENGINERSIN,532178,COMMERCIAL SERVICES & SUPPLIES,CONSULTING SERVICES,833.6,691.3,98.5,12.47%,8.3,0.4,133.6,32.2,127.5,2.3,472.7,8.4 -Escorts Kubota Ltd.,ESCORTS,500495,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"2,154.4","1,798.6",260.7,12.66%,40.8,3.1,311.9,79.7,223.3,20.6,910.5,82.4 -Exide Industries Ltd.,EXIDEIND,500086,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"4,408.9","3,872.4",499.1,11.42%,141.5,29.7,365.3,95.2,269.4,3.2,872.7,10.3 -Federal Bank Ltd.,FEDERALBNK,500469,BANKING AND FINANCE,BANKS,"6,548.2","1,603.8","1,400.3",24.18%,0,"3,544.1","1,342.7",342.6,994.1,4.3,"3,671.4",15.6 -Finolex Cables Ltd.,FINCABLES,500144,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,229.3","1,041.3",146.1,12.30%,10.8,0.4,176.7,52.3,154.2,10.1,643.9,42.1 -Finolex Industries Ltd.,FINPIPE,500940,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,944.5,780.2,103,11.66%,27.4,12.5,124.5,35.4,98,1.6,459.3,7.4 -Firstsource Solutions Ltd.,FSL,532809,SOFTWARE & SERVICES,BPO/KPO,"1,556.9","1,311.2",228.8,14.86%,65.4,26.1,154.3,27.8,126.5,1.9,551.7,7.9 -GAIL (India) Ltd.,GAIL,532155,UTILITIES,UTILITIES,"33,191","29,405.5","3,580.2",10.85%,837.3,199.6,"2,748.7",696.3,"2,444.1",3.7,"5,283.8",8 -GlaxoSmithKline Pharmaceuticals Ltd.,GLAXO,500660,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,985.2,667.5,289.5,30.25%,18.1,0.4,299.2,81.7,217.5,12.8,647.8,38.2 -Glenmark Pharmaceuticals Ltd.,GLENMARK,532296,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"3,209.1","2,745.1",462.3,14.41%,141.5,121.5,-124.4,55.9,-81.9,-2.9,-196.3,-7 -Godrej Consumer Products Ltd.,GODREJCP,532424,FMCG,PERSONAL PRODUCTS,"3,667.9","2,897.8",704.2,19.55%,60.9,77.3,619.4,186.6,432.8,4.2,"1,750.1",17.1 -Godrej Industries Ltd.,GODREJIND,500164,DIVERSIFIED,DIVERSIFIED,"4,256.9","3,672.1",265.5,6.74%,89.3,333.1,162.4,75.9,87.3,2.6,880,26.1 -Godrej Properties Ltd.,GODREJPROP,533150,REALTY,REALTY,605.1,404.7,-61.7,-17.98%,7.4,48,145.1,38.8,66.8,2.4,662.6,23.8 -Granules India Ltd.,GRANULES,532482,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,191",976.5,213,17.90%,52.5,26,136,33.9,102.1,4.2,393.9,16.3 -Great Eastern Shipping Company Ltd.,GESHIP,500620,TRANSPORTATION,SHIPPING,"1,461.5",585.6,643.4,52.35%,186.7,77.1,611.9,17.3,594.7,41.6,"2,520.1",176.5 -Gujarat Alkalies & Chemicals Ltd.,GUJALKALI,530001,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"1,042.3",926.1,45.2,4.65%,95.2,10.8,10.2,-0.1,-18.4,-2.5,82.7,11.3 -Gujarat Gas Ltd.,GUJGASLTD,539336,UTILITIES,UTILITIES,"4,019.3","3,494.5",496.6,12.44%,117.9,7.8,399.1,102.9,296.2,4.3,"1,254.3",18.2 -Gujarat Narmada Valley Fertilizers & Chemicals Ltd.,GNFC,500670,FERTILIZERS,FERTILIZERS,"2,232","1,911",169,8.12%,78,1,242,64,182,11.7,932,60.1 -Gujarat Pipavav Port Ltd.,GPPL,533248,TRANSPORTATION,MARINE PORT & SERVICES,270.4,102,150.6,59.64%,28.8,2.2,141.1,53.4,92.3,1.9,341.8,7.1 -Gujarat State Fertilizer & Chemicals Ltd.,GSFC,500690,FERTILIZERS,FERTILIZERS,"3,313.2","2,881.4",237.3,7.61%,45.7,1.6,387,78.1,308.9,7.8,"1,056.2",26.5 -Gujarat State Petronet Ltd.,GSPL,532702,UTILITIES,UTILITIES,"4,455.9","3,497.2",913.7,20.72%,165,14.5,779.2,198.7,454.6,8.1,"1,522",27 -HCL Technologies Ltd.,HCLTECH,532281,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"27,037","20,743","5,929",22.23%,"1,01",156,"5,128","1,295","3,832",14.2,"15,445",56.9 -HDFC Bank Ltd.,HDFCBANK,500180,BANKING AND FINANCE,BANKS,"107,566.6","42,037.6","24,279.1",32.36%,0,"41,249.9","20,967.4","3,655","16,811.4",22.2,"54,474.6",71.8 -Havells India Ltd.,HAVELLS,517354,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"3,952.8","3,527",373.4,9.57%,81.2,9.3,335.3,86.2,249.1,4,"1,177.7",18.8 -Hero MotoCorp Ltd.,HEROMOTOCO,500182,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"9,741.2","8,173.5","1,359.5",14.26%,187.1,25,"1,355.6",353.1,"1,006.3",50.3,"3,247.6",162.5 -HFCL Ltd.,HFCL,500183,TELECOMMUNICATIONS EQUIPMENT,TELECOM CABLES,"1,128.7",978.9,132.6,11.93%,21.4,34.8,93.5,24,69.4,0.5,305.5,2.1 -Hindalco Industries Ltd.,HINDALCO,500440,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"54,632","48,557","5,612",10.36%,"1,843","1,034","3,231","1,035","2,196",9.9,"8,423",37.9 -Hindustan Copper Ltd.,HINDCOPPER,513599,METALS & MINING,COPPER,392.6,260.2,121.2,31.77%,45.6,4.1,82.6,21.9,60.7,0.6,320.5,3.3 -Hindustan Petroleum Corporation Ltd.,HINDPETRO,500104,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"96,093.4","87,512","8,24",8.61%,"1,247.3",590,"6,744.1","1,616","5,827",41.1,"16,645",117.3 -Hindustan Unilever Ltd.,HINDUNILVR,500696,FMCG,PERSONAL PRODUCTS,"15,806","11,826","3,797",24.30%,297,88,"3,59",931,"2,656",11.3,"10,284",43.8 -Hindustan Zinc Ltd.,HINDZINC,500188,METALS & MINING,ZINC,"7,014","3,652","3,139",46.22%,825,232,"2,305",576,"1,729",4.1,"8,432",20 -Housing and Urban Development Corporation Ltd.,HUDCO,540530,BANKING AND FINANCE,HOUSING FINANCE,"1,880.8",82.7,"1,809.6",97.04%,2.4,"1,216.8",606.4,154.7,451.6,2.3,"1,790.7",8.9 -ITC Ltd.,ITC,500875,FOOD BEVERAGES & TOBACCO,CIGARETTES-TOBACCO PRODUCTS,"18,439.3","11,320.2","6,454.2",36.31%,453,9.9,"6,656.2","1,700.3","4,898.1",3.9,"20,185.1",16.2 -ICICI Bank Ltd.,ICICIBANK,532174,BANKING AND FINANCE,BANKS,"57,292.3","23,911","15,473.2",39.74%,0,"17,908","14,824.2","3,808.8","11,805.6",15.6,"41,086.8",58.7 -ICICI Prudential Life Insurance Company Ltd.,ICICIPRULI,540133,BANKING AND FINANCE,LIFE INSURANCE,"17,958.1","17,612.3",-229.6,-1.32%,0,0,340.2,32.5,243.9,1.7,906.9,6.3 -IDBI Bank Ltd.,IDBI,500116,BANKING AND FINANCE,BANKS,"7,063.7","1,922.3","2,175.3",36.02%,0,"2,966.1","2,396.9","1,003.7","1,385.4",1.3,"4,776.3",4.4 -IDFC First Bank Ltd.,IDFCFIRSTB,539437,BANKING AND FINANCE,BANKS,"8,765.8","3,849","1,511.2",20.54%,0,"3,405.6",982.8,236,746.9,1.1,"2,911.1",4.3 -IDFC Ltd.,IDFC,532659,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),36.7,6,30.6,83.56%,0,0,30.6,6.6,223.5,1.4,"4,147.1",25.9 -IRB Infrastructure Developers Ltd.,IRB,532947,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,874.5",950.4,794.6,45.54%,232.7,434.6,256.9,85.8,95.7,0.2,501,0.8 -ITI Ltd.,ITI,523610,TELECOMMUNICATIONS EQUIPMENT,TELECOM EQUIPMENT,256.1,299.3,-52.8,-21.42%,13.3,69.3,-125.8,0,-126,-1.3,-388.4,-4 -Vodafone Idea Ltd.,IDEA,532822,TELECOM SERVICES,TELECOM SERVICES,"10,750.8","6,433.5","4,282.8",39.97%,"5,667.3","6,569","-7,919",817.7,"-8,737.9",-1.8,"-30,986.8",-6.4 -India Cements Ltd.,INDIACEM,530005,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,272.4","1,26",4.4,0.35%,55,60.4,-103,-17.4,-80.1,-2.6,-261.1,-8.4 -Indiabulls Housing Finance Ltd.,IBULHSGFIN,535789,BANKING AND FINANCE,HOUSING FINANCE,"2,242.3",190.6,"1,779.2",79.88%,22.9,"1,349.8",421.6,123.6,298,6.5,"1,146",24.3 -Indian Bank,INDIANB,532814,BANKING AND FINANCE,BANKS,"15,929.4","3,599.1","4,327.7",31.44%,0,"8,002.6","2,776.7",768.6,"2,068.5",16.6,"6,893.3",55.3 -Indian Hotels Company Ltd.,INDHOTEL,500850,HOTELS RESTAURANTS & TOURISM,HOTELS,"1,480.9","1,078.4",354.8,24.75%,111.2,59,232.2,72.3,166.9,1.2,"1,100.3",7.7 -Indian Oil Corporation Ltd.,IOC,530965,OIL & GAS,OIL MARKETING & DISTRIBUTION,"179,752.1","156,013.1","23,328.4",13.01%,"3,609.6","2,135","18,090.2","4,699.7","13,114.3",9.5,"38,614.3",27.3 -Indian Overseas Bank,IOB,532388,BANKING AND FINANCE,BANKS,"6,941.5","1,785.1","1,679.8",28.84%,0,"3,476.6",635.5,8.3,627.2,0.3,"2,341.9",1.2 -Indraprastha Gas Ltd.,IGL,532514,UTILITIES,UTILITIES,"3,520.2","2,801.6",656.9,18.99%,102.2,2.5,613.9,151.4,552.7,7.9,"1,806.2",25.8 -IndusInd Bank Ltd.,INDUSINDBK,532187,BANKING AND FINANCE,BANKS,"13,529.7","3,449.9","3,908.7",34.75%,0,"6,171.1","2,934.9",732.9,"2,202.2",28.4,"8,333.7",107.2 -Info Edge (India) Ltd.,NAUKRI,532777,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,792,421.2,204.7,32.70%,25.9,8.2,382.8,68.7,205.1,15.9,-25.6,-2 -InterGlobe Aviation Ltd.,INDIGO,539448,TRANSPORTATION,AIRLINES,"15,502.9","12,743.6","2,200.3",14.72%,"1,549","1,021.3",189.1,0.2,188.9,4.9,"5,621.3",145.7 -Ipca Laboratories Ltd.,IPCALAB,524494,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,072.5","1,712.7",321.3,15.80%,90.3,44.1,225.4,87.9,145.1,5.7,492.2,19.4 -J B Chemicals & Pharmaceuticals Ltd.,JBCHEPHARM,506943,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,889.4,638.2,243.5,27.62%,32.2,10.4,208.7,58.1,150.6,9.7,486.6,31.4 -JK Cement Ltd.,JKCEMENT,532644,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,782.1","2,285.8",467,16.96%,137.1,115,244.2,65.7,178.1,23.1,444,57.5 -JK Lakshmi Cement Ltd.,JKLAKSHMI,500380,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,588.5","1,357.3",217.3,13.80%,56.6,33.6,141,45.1,92.7,7.9,357.6,30.4 -JM Financial Ltd.,JMFINANCIL,523405,DIVERSIFIED,HOLDING COMPANIES,"1,214",407.9,662.6,55.34%,13.2,388.1,277.9,72.4,194.9,2,608.1,6.4 -JSW Energy Ltd.,JSWENERGY,533148,UTILITIES,ELECTRIC UTILITIES,"3,387.4","1,379","1,880.4",57.69%,408.7,513.7,"1,085.9",235.1,850.2,5.2,"1,591.7",9.7 -JSW Steel Ltd.,JSWSTEEL,500228,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"44,821","36,698","7,886",17.69%,"2,019","2,084","4,609","1,812","2,76",11.4,"9,252",38.1 -Jindal Stainless Ltd.,JSL,532508,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"9,829","8,566.5","1,230.6",12.56%,221.9,155.6,985.7,229.1,774.3,9.4,"2,600.2",31.6 -Jindal Steel & Power Ltd.,JINDALSTEL,532286,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"12,282","9,964.5","2,285.7",18.66%,603.7,329.4,"1,384.5",-5.8,"1,387.8",13.8,"4,056",40.4 -Jubilant Foodworks Ltd.,JUBLFOOD,533155,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,"1,375.7","1,091.4",277.2,20.25%,141.9,56.8,85.5,23.3,97.2,1.5,235,3.6 -Just Dial Ltd.,JUSTDIAL,535648,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,318.5,211.8,48.8,18.71%,12.2,2.4,92.1,20.3,71.8,8.4,314.1,36.9 -Jyothy Labs Ltd.,JYOTHYLAB,532926,FMCG,PERSONAL PRODUCTS,745.6,597,135.4,18.48%,12.3,1.2,135.1,31.1,104.2,2.8,326.9,8.9 -KRBL Ltd.,KRBL,530813,FMCG,PACKAGED FOODS,"1,246.5","1,018.9",194.5,16.03%,19.9,0.8,206.8,53.6,153.3,6.5,671.4,29.3 -Kajaria Ceramics Ltd.,KAJARIACER,500233,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"1,129.9",941.9,179.7,16.02%,36.1,4.3,147.7,36.6,108,6.8,397.8,25 -Kalpataru Projects International Ltd.,KPIL,522287,UTILITIES,ELECTRIC UTILITIES,"4,53","4,148",370,8.19%,113,137,132,42,89,5.5,478,29.9 -Kansai Nerolac Paints Ltd.,KANSAINER,500165,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,"1,978.6","1,683.3",273.2,13.97%,47.4,7.6,240.3,64.8,177.2,2.2,"1,118.8",13.8 -Karur Vysya Bank Ltd.,KARURVYSYA,590003,BANKING AND FINANCE,BANKS,"2,336",616.4,637.9,31.94%,0,"1,081.7",511.5,133.1,378.4,4.7,"1,364.2",17 -KEC International Ltd.,KEC,532714,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"4,514.9","4,224.7",274.3,6.10%,46.5,177.8,65.8,9.9,55.8,2.2,187.9,7.3 -Kotak Mahindra Bank Ltd.,KOTAKBANK,500247,BANKING AND FINANCE,BANKS,"21,559.5","9,681","6,343",46.24%,0,"5,535.5","5,888.3","1,465.5","4,461",22.4,"17,172.7",86.4 -L&T Finance Holdings Ltd.,L&TFH,533519,DIVERSIFIED,HOLDING COMPANIES,"3,482.1",935.3,"1,882.4",58.57%,28.3,"1,324.9",797.4,203.2,595.1,2.4,"2,080.8",8.4 -L&T Technology Services Ltd.,LTTS,540115,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,427.7","1,910.9",475.6,19.93%,68.1,12.6,436.1,120.2,315.4,29.8,"1,239.7",117.5 -LIC Housing Finance Ltd.,LICHSGFIN,500253,BANKING AND FINANCE,HOUSING FINANCE,"6,765.9",250.6,"6,095.7",90.10%,13.2,"4,599.9","1,483",291.2,"1,193.5",21.7,"4,164.5",75.7 -Lakshmi Machine Works Ltd.,LAXMIMACH,500252,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,"1,355.5","1,184.5",136,10.30%,23.6,0,147.4,32.3,115.1,107.8,416,389.5 -Laurus Labs Ltd.,LAURUSLABS,540222,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,226.2","1,036.6",187.9,15.34%,93.4,42.4,53.9,14.6,37,0.7,367.8,6.8 -Lupin Ltd.,LUPIN,500257,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"5,079","4,120.8",917.8,18.21%,247.8,80.6,629.7,134.3,489.5,10.8,"1,331.2",29.2 -MMTC Ltd.,MMTC,513377,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,-167.2,-180.1,-30.4,14.42%,0.8,1.1,12.1,1.5,52,0.3,174.1,1.2 -MRF Ltd.,MRF,500290,AUTOMOBILES & AUTO COMPONENTS,AUTO TYRES & RUBBER PRODUCTS,"6,287.8","5,060.2","1,156.9",18.61%,351.5,85.5,790.6,203.9,586.7,1383.3,"1,690.9",3988 -Mahanagar Gas Ltd.,MGL,539957,UTILITIES,UTILITIES,"1,772.7","1,250.1",478.9,27.70%,65.8,2.5,454.3,115.8,338.5,34.3,"1,147.8",116.2 -Mahindra & Mahindra Financial Services Ltd.,M&MFIN,532720,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"3,863.5","1,077.5","2,109.3",55.03%,67.1,"1,703.4",369.1,96,281.1,2.3,"1,982.5",16 -Mahindra & Mahindra Ltd.,M&M,500520,AUTOMOBILES & AUTO COMPONENTS,CARS & UTILITY VEHICLES,"35,027.2","28,705.9","5,729.6",16.64%,"1,138.6","1,835.2","3,347.5","1,083.7","2,347.8",21.1,"11,169.4",100.2 -Mahindra Holidays & Resorts India Ltd.,MHRIL,533088,HOTELS RESTAURANTS & TOURISM,HOTELS,672.2,519.3,136,20.76%,83.8,33.3,35.8,14,21.3,1.1,66,3.3 -Manappuram Finance Ltd.,MANAPPURAM,531213,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"2,174",555.6,"1,481.3",68.68%,62.5,689.4,746.7,186.1,558.4,6.6,"1,859.8",22 -Mangalore Refinery And Petrochemicals Ltd.,MRPL,500109,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"22,904.7","20,705.6","2,138.2",9.36%,296,311.2,"1,592",546.2,"1,051.7",6,"3,784.9",21.6 -Marico Ltd.,MARICO,531642,FMCG,PERSONAL PRODUCTS,"2,514","1,979",497,20.07%,39,20,476,116,353,2.7,"1,41",10.9 -Maruti Suzuki India Ltd.,MARUTI,532500,AUTOMOBILES & AUTO COMPONENTS,CARS & UTILITY VEHICLES,"37,902.1","32,282.5","4,790.3",12.92%,794.4,35.1,"4,790.1","1,083.8","3,764.3",124.6,"11,351.8",375.9 -Max Financial Services Ltd.,MFSL,500271,BANKING AND FINANCE,LIFE INSURANCE,"10,189.1","10,024.6",143.9,1.42%,0.8,9.4,158.2,-12.1,147.9,4.3,506.4,14.7 -UNO Minda Ltd.,UNOMINDA,532539,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"3,630.2","3,219.8",401.6,11.09%,125.4,27.2,257.9,73.3,225,3.9,742.4,13 -Motilal Oswal Financial Services Ltd.,MOTILALOFS,532892,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,"1,650.7",724.1,904.5,55.18%,17.3,241.1,657.6,124.2,531.2,35.9,"1,449.3",97.8 -MphasiS Ltd.,MPHASIS,526299,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"3,325.5","2,680.9",595.6,18.18%,89,34,521.7,129.7,391.9,20.8,"1,605.6",85.1 -Muthoot Finance Ltd.,MUTHOOTFIN,533398,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"3,631.9",723.4,"2,801.6",77.69%,22.2,"1,335","1,470.2",374.9,"1,059.6",26.4,"3,982.9",99.2 -Natco Pharma Ltd.,NATCOPHARM,524816,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,060.8",573.4,458,44.41%,43.6,4.2,439.6,70.6,369,20.6,"1,127.4",63 -NBCC (India) Ltd.,NBCC,534309,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"2,129.1","1,957.7",95.5,4.65%,1.3,0,104.6,22.9,79.6,0.4,332.2,1.8 -NCC Ltd.,NCC,500294,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"4,746.4","4,415.9",303.7,6.44%,53.2,153.5,123.8,38.8,77.3,1.2,599.4,9.5 -NHPC Ltd.,NHPC,533098,UTILITIES,ELECTRIC UTILITIES,"3,113.8","1,173.9","1,757.4",59.95%,294.9,104.8,"1,618.3",-75,"1,545.8",1.5,"3,897.8",3.9 -Coforge Ltd.,COFORGE,532541,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,285.1","1,935.3",340.9,14.98%,77.2,31.9,240.7,52.8,187.9,29.6,696.2,113.2 -NLC India Ltd.,NLCINDIA,513683,UTILITIES,ELECTRIC UTILITIES,"3,234","2,143",834.6,28.03%,455.1,213.9,"1,700.6",614.7,"1,084.7",7.8,"1,912.3",13.8 -NTPC Ltd.,NTPC,532555,UTILITIES,ELECTRIC UTILITIES,"45,384.6","32,303.2","12,680.2",28.19%,"4,037.7","2,920.5","6,342.9","2,019.7","4,614.6",4.8,"19,125.2",19.7 -Narayana Hrudayalaya Ltd.,NH,539551,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,323.6",997.1,308.1,23.61%,55.3,22.9,248.4,21.7,226.6,11.2,737.5,36.1 -National Aluminium Company Ltd.,NATIONALUM,532234,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"3,112","2,646.9",396.5,13.03%,186.2,4,275,68.7,187.3,1,"1,272.4",6.9 -Navin Fluorine International Ltd.,NAVINFLUOR,532504,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,494.9,373.4,98.3,20.84%,24.2,20,77.2,16.6,60.6,12.2,365,73.7 -Oberoi Realty Ltd.,OBEROIRLTY,533273,REALTY,REALTY,"1,243.8",579.2,638.2,52.42%,11.3,56.5,596.8,142.1,456.8,12.6,"1,961.3",53.9 -Oil And Natural Gas Corporation Ltd.,ONGC,500312,OIL & GAS,EXPLORATION & PRODUCTION,"149,388.5","118,618.4","28,255.3",19.24%,"6,698.1","2,603.3","21,564.9","5,633.6","13,734.1",10.9,"43,072.5",34.2 -Oil India Ltd.,OIL,533106,OIL & GAS,EXPLORATION & PRODUCTION,"9,200.1","5,293.3","3,523.2",39.96%,499,278.9,762,67.6,420.7,3.9,"5,874.5",54.2 -Oracle Financial Services Software Ltd.,OFSS,532466,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,509.6",886.4,558.1,38.64%,19,8,596.2,178.8,417.4,48.2,"1,835.1",211.9 -PI Industries Ltd.,PIIND,523642,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"2,163.8","1,565.5",551.4,26.05%,80.3,7.8,510.2,31.7,480.5,31.7,"1,495.8",98.4 -PNB Housing Finance Ltd.,PNBHOUSING,540173,BANKING AND FINANCE,HOUSING FINANCE,"1,779.4",158.8,"1,574.1",88.54%,11.3,"1,057.3",507.1,124.1,383,14.8,"1,278.7",49.3 -PNC Infratech Ltd.,PNCINFRA,539150,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,932.4","1,511.6",399.8,20.92%,40.9,161.3,218.6,70.7,147.9,5.8,614.3,23.9 -PVR INOX Ltd.,PVRINOX,532689,RETAILING,SPECIALTY RETAIL,"2,023.7","1,293.1",706.8,35.34%,308.6,200.3,221.7,55.5,166.3,17,-232.5,-23.7 -Page Industries Ltd.,PAGEIND,532827,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,"1,126.8",891.6,233.5,20.76%,24.6,11.2,199.4,49.1,150.3,134.7,510.7,457.9 -Persistent Systems Ltd.,PERSISTENT,533179,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"2,449","2,006.5",405.2,16.80%,74.4,12.3,355.8,92.5,263.3,35,981.5,127.6 -Petronet LNG Ltd.,PETRONET,532522,OIL & GAS,OIL MARKETING & DISTRIBUTION,"12,686.2","11,317.9","1,214.7",9.69%,194.8,74.7,"1,098.8",283.9,855.7,5.7,"3,490.3",23.3 -Pfizer Ltd.,PFIZER,500680,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,611.3,392.6,182.6,31.75%,15.4,2.7,200.5,51.6,149,32.6,522.8,114.3 -Phoenix Mills Ltd.,PHOENIXLTD,503100,REALTY,REALTY,906.6,361.2,506,57.82%,65.9,96.5,375.2,71.4,252.6,14.2,923.6,51.7 -Pidilite Industries Ltd.,PIDILITIND,500331,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"3,107.6","2,396.3",679.7,22.10%,75.2,13.1,623,163.1,450.1,8.8,"1,505.5",29.6 -Power Finance Corporation Ltd.,PFC,532810,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"22,403.7",315.4,"22,941.9",102.46%,12.7,"14,313.1","8,628.8","2,000.6","4,833.1",14.7,"17,946.4",54.4 -Power Grid Corporation of India Ltd.,POWERGRID,532898,UTILITIES,ELECTRIC UTILITIES,"11,530.4","1,358.7","9,908.4",87.94%,"3,277","2,341.3","4,393.4",573.7,"3,781.4",4.1,"15,344.4",16.5 -Prestige Estates Projects Ltd.,PRESTIGE,ASM,REALTY,REALTY,"3,256","1,643.9",592.5,26.49%,174.1,263.9,"1,174.1",256.4,850.9,21.2,"1,714",42.8 -Prism Johnson Ltd.,PRSMJOHNSN,500338,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"1,846","1,745.4",92.4,5.03%,95.2,43.5,210,30.4,182.7,3.6,154.2,3.1 -Procter & Gamble Hygiene & Healthcare Ltd.,PGHH,500459,FMCG,PERSONAL PRODUCTS,"1,154.1",853.5,284.9,25.03%,14.3,1.9,284.5,73.8,210.7,64.9,734.4,226.3 -Punjab National Bank,PNB,532461,BANKING AND FINANCE,BANKS,"29,857","6,798.1","6,239.1",23.23%,0,"16,819.8","2,778.3","1,013.8","1,990.2",1.8,"5,904.8",5.4 -Quess Corp Ltd.,QUESS,539978,SOFTWARE & SERVICES,BPO/KPO,"4,763.5","4,584.8",163.6,3.44%,69.7,28.1,79.3,8.3,71.9,4.8,240.9,16.2 -RBL Bank Ltd.,RBLBANK,540065,BANKING AND FINANCE,BANKS,"3,720.6","1,422.6",765.4,25.45%,0,"1,532.6",125,-206.1,331.1,5.5,"1,173.9",19.5 -Radico Khaitan Ltd.,RADICO,532497,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,925.7,803.8,121.2,13.10%,26.1,12.5,83.3,21.4,64.8,4.8,237,17.7 -Rain Industries Ltd.,RAIN,500339,CHEMICALS & PETROCHEMICALS,PETROCHEMICALS,"4,208.9","3,794.3",366,8.80%,192.5,241.7,-19.5,46.2,-90.2,-2.7,270.4,8 -Rajesh Exports Ltd.,RAJESHEXPO,531500,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"38,079.4","38,015.8",50.1,0.13%,10.7,0,53,7.7,45.3,1.5,"1,142.2",38.7 -Rallis India Ltd.,RALLIS,500355,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,837,699,133,15.99%,26,3,110,28,82,4.2,98.4,5.2 -Rashtriya Chemicals & Fertilizers Ltd.,RCF,524230,FERTILIZERS,FERTILIZERS,"4,222.1","4,049.3",105.9,2.55%,56.1,44,72.8,21.1,51,0.9,523.6,9.5 -Redington Ltd.,REDINGTON,532805,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,"22,296.6","21,738.7",481.4,2.17%,43.7,105.8,408.3,96.7,303.5,3.9,"1,242",15.9 -Relaxo Footwears Ltd.,RELAXO,530517,RETAILING,FOOTWEAR,725.9,623.8,91.5,12.79%,36.9,4.7,60.4,16.2,44.2,1.8,193.9,7.8 -Reliance Industries Ltd.,RELIANCE,500325,OIL & GAS,REFINERIES/PETRO-PRODUCTS,"238,797","193,988","40,968",17.44%,"12,585","5,731","26,493","6,673","17,394",25.7,"68,496",101.2 -REC Ltd.,RECLTD,532955,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"11,701.3",275.1,"12,180.5",104.21%,6.1,"7,349.8","4,837.6","1,047.7","3,789.9",14.4,"12,738.6",48.4 -SJVN Ltd.,SJVN,533206,UTILITIES,ELECTRIC UTILITIES,951.6,172.2,706.2,80.40%,101.9,124.2,567.7,129.2,439.6,1.1,"1,016",2.6 -SKF India Ltd.,SKFINDIA,500472,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,"1,145.5","1,003.7",121.5,10.80%,19.3,0.5,122,31.7,90,18.2,484,97.9 -SRF Ltd.,SRF,503806,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"3,206.5","2,551.2",626.2,19.71%,161.2,79.3,414.8,114,300.8,10.2,"1,733.4",58.5 -Sanofi India Ltd.,SANOFI,500674,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,726.4,506.1,208.5,29.17%,9.9,0.3,210.1,57.9,152.1,66.1,596.3,259.3 -Schaeffler India Ltd.,SCHAEFFLER,505790,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,879.2","1,506.3",342,18.50%,55.6,1.6,315.7,80.7,235,15,922.6,59 -Shree Cements Ltd.,SHREECEM,500387,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"4,932.1","3,914.1",886,18.46%,411.7,67,539.2,92.6,446.6,123.8,"1,826.8",506.3 -Shriram Finance Ltd.,SHRIRAMFIN,511218,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"8,893","1,409.4","6,334.3",71.30%,141.4,"3,798","2,404.2",614.9,"1,786.1",47.6,"6,575.4",175.2 -Siemens Ltd.,SIEMENS,500550,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"5,953.2","5,107.5",700.2,12.06%,78.6,4.9,762.2,190.5,571.3,16.1,"1,960.9",55.1 -Sobha Ltd.,SOBHA,532784,REALTY,REALTY,773.6,665.8,75.4,10.18%,19.3,63.9,24.7,9.7,14.9,1.6,107.4,11.3 -Solar Industries India Ltd.,SOLARINDS,532725,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"1,355.2","1,011.3",336.1,24.95%,33.7,24.9,285.3,75.5,200.1,22.1,808.2,89.3 -Sonata Software Ltd.,SONATSOFTW,532221,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,935.8","1,715.2",197.3,10.32%,33.3,20.7,166.5,42.3,124.2,9,475.7,34.3 -State Bank of India,SBIN,500112,BANKING AND FINANCE,BANKS,"144,256.1","58,597.6","22,703.3",21.14%,0,"62,955.2","21,935.7","5,552.5","17,196.2",18,"69,304.1",77.7 -Steel Authority of India (SAIL) Ltd.,SAIL,500113,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"29,858.2","25,836.7","3,875.4",13.04%,"1,326.6",605.2,"1,674.7",464.2,"1,305.6",3.2,"3,219.5",7.8 -Sun Pharma Advanced Research Company Ltd.,SPARC,532872,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,29.7,112.7,-91.5,-431.87%,3.2,0.3,-86.4,0,-86.4,-2.7,-253.6,-7.8 -Sun Pharmaceutical Industries Ltd.,SUNPHARMA,524715,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"12,486","9,013","3,179.4",26.08%,632.8,49.3,"2,790.9",390.1,"2,375.5",9.9,"8,548.5",35.6 -Sun TV Network Ltd.,SUNTV,532733,MEDIA,BROADCASTING & CABLE TV,"1,160.2",320.6,727.8,69.42%,218.8,1.7,619.1,154.4,464.7,11.8,"1,861.8",47.2 -Sundram Fasteners Ltd.,SUNDRMFAST,500403,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,429.1","1,191.1",230.7,16.23%,54.5,7.4,176.2,43.1,131.9,6.3,502.9,23.9 -Sunteck Realty Ltd.,SUNTECK,512179,REALTY,REALTY,36.2,39.1,-14.1,-56.70%,2.2,15.8,-20.9,-6.4,-13.9,-1,-46.5,-3.3 -Supreme Industries Ltd.,SUPREMEIND,509930,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,"2,321.4","1,952.5",356.2,15.43%,71.9,1.6,295.4,76.3,243.2,19.1,"1,028.2",80.9 -Suzlon Energy Ltd.,SUZLON,ASM,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"1,428.7","1,196.4",225,15.83%,51.2,43.7,102.4,0.1,102.3,0.1,561.4,0.4 -Syngene International Ltd.,SYNGENE,539268,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,931.7,656,254.1,27.92%,104.6,13,150.7,34.2,116.5,2.9,498.3,12.4 -TTK Prestige Ltd.,TTKPRESTIG,517506,CONSUMER DURABLES,HOUSEWARE,747.2,648.6,80.8,11.08%,15.9,3.1,79.5,20.5,59.3,4.3,224.3,16.2 -TV18 Broadcast Ltd.,TV18BRDCST,532800,MEDIA,BROADCASTING & CABLE TV,"1,989","1,992.2",-198.1,-11.04%,50.1,33.8,-87.1,-6.5,-28.9,-0.2,92.2,0.5 -TVS Motor Company Ltd.,TVSMOTOR,532343,AUTOMOBILES & AUTO COMPONENTS,2/3 WHEELERS,"9,983.8","8,576.9","1,355.9",13.65%,237.1,483.3,686.4,259.8,386.3,8.1,"1,457.6",30.7 -Tata Consultancy Services Ltd.,TCS,532540,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"60,698","43,946","15,746",26.38%,"1,263",159,"15,33","3,95","11,342",31,"44,654",122 -Tata Elxsi Ltd.,TATAELXSI,500408,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,912.8,618.2,263.5,29.89%,25,5.8,263.9,63.8,200,32.1,785.1,126.1 -Tata Consumer Products Ltd.,TATACONSUM,500800,FMCG,PACKAGED FOODS,"3,823.6","3,196.7",537.1,14.38%,93.9,27.6,490.9,131.7,338.2,3.6,"1,275.2",13.7 -Tata Motors Limited (DVR),TATAMTRDVR,570001,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,,,,,,,,,,,, -Tata Motors Ltd.,TATAMOTORS,500570,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,"106,759","91,361.3","13,766.9",13.10%,"6,636.4","2,651.7","5,985.9","2,202.8","3,764",9.8,"15,332.3",40 -Tata Power Company Ltd.,TATAPOWER,500400,UTILITIES,ELECTRIC UTILITIES,"16,029.5","12,647","3,091",19.64%,925.9,"1,181.8",979.2,213.3,875.5,2.7,"3,570.8",11.2 -Tata Steel Ltd.,TATASTEEL,500470,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"55,910.2","51,414.1","4,267.8",7.66%,"2,479.8","1,959.4","-6,842.1",-228,"-6,196.2",-5.1,"-6,081.3",-5 -Tech Mahindra Ltd.,TECHM,532755,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"13,128.1","11,941.1",922.8,7.17%,465.7,97.5,623.8,110,493.9,5.6,"3,600.7",40.9 -The Ramco Cements Ltd.,RAMCOCEM,500260,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,352.1","1,935",405.6,17.33%,162.8,116.5,137.8,37,72,3.1,348.9,14.8 -Thermax Ltd.,THERMAX,500411,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,368.3","2,097.8",204.6,8.89%,33,19.8,217.7,58.9,157.7,14,498.8,44.3 -Timken India Ltd.,TIMKEN,522113,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,692.1,546.5,135.5,19.87%,21.1,0.9,123.6,30.6,93,12.4,358.3,47.6 -Titan Company Ltd.,TITAN,500114,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"12,653","11,118","1,411",11.26%,144,140,"1,251",336,915,10.3,"3,302",37.1 -Torrent Pharmaceuticals Ltd.,TORNTPHARM,500420,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,686","1,835",825,31.02%,201,91,559,173,386,11.4,"1,334",39.4 -Torrent Power Ltd.,TORNTPOWER,532779,UTILITIES,ELECTRIC UTILITIES,"7,069.1","5,739.5","1,221.4",17.55%,341.7,247.2,740.7,198.1,525.9,10.9,"2,176.8",45.3 -Trent Ltd.,TRENT,500251,RETAILING,DEPARTMENT STORES,"3,062.5","2,525.8",456.6,15.31%,152.2,95.5,288.9,86.3,234.7,6.6,629.4,17.7 -Trident Ltd.,TRIDENT,521064,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,812","1,557.3",240.3,13.37%,89.4,35,130.4,40.1,90.7,0.2,458.1,0.9 -UPL Ltd.,UPL,512070,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"10,275","8,807","1,325",13.03%,657,871,-185,-96,-189,-2.5,"1,856",24.7 -UltraTech Cement Ltd.,ULTRACEMCO,532538,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"16,179.3","13,461.2","2,550.9",15.93%,797.8,233.9,"1,686.2",409.4,"1,281.5",44.5,"5,694.1",197.2 -Union Bank of India,UNIONBANK,532477,BANKING AND FINANCE,BANKS,"28,952.5","6,189.3","7,265",29.38%,0,"15,498.2","5,492.3","1,944","3,571.8",5.1,"11,918.9",16.1 -United Breweries Ltd.,UBL,532478,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,"1,902.1","1,705.8",184.3,9.75%,50.9,1.4,144,36.9,107.3,4.1,251.3,9.5 -United Spirits Ltd.,MCDOWELL-N,532432,FOOD BEVERAGES & TOBACCO,BREWERIES & DISTILLERIES,"6,776.6","6,269.8",466.7,6.93%,65.3,26.2,446,106.3,339.3,4.8,"1,133",15.6 -V-Guard Industries Ltd.,VGUARD,532953,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,147.9","1,041.3",92.5,8.16%,19.8,9.3,77.5,18.6,59,1.4,215.2,5 -Vardhman Textiles Ltd.,VTL,502986,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,487","2,192.1",205.4,8.57%,103.7,22,169.2,41.7,134.3,4.7,531.9,18.7 -Varun Beverages Ltd.,VBL,540180,FOOD BEVERAGES & TOBACCO,NON-ALCOHOLIC BEVERAGES,"3,889","2,988.4",882.1,22.79%,170.8,62.5,667.3,152.9,501.1,3.9,"1,998.7",15.4 -Vinati Organics Ltd.,VINATIORGA,524200,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,464.4,337.3,110.8,24.73%,13.7,0.3,113,28.9,84.2,8.2,408.2,39.7 -Voltas Ltd.,VOLTAS,500575,CONSUMER DURABLES,CONSUMER ELECTRONICS,"2,363.7","2,222.5",70.3,3.06%,11.7,11.4,118.1,49.3,36.7,1.1,199.5,6 -ZF Commercial Vehicle Control Systems India Ltd.,ZFCVINDIA,533023,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,015.8",846.2,145.5,14.67%,27.1,1.3,141.2,35.5,105.7,55.7,392,206.7 -Welspun Corp Ltd.,WELCORP,ASM,METALS & MINING,IRON & STEEL PRODUCTS,"4,161.4","3,659.9",399.5,9.84%,85.7,75,340.8,79,384.7,14.7,809.2,30.9 -Welspun Living Ltd.,WELSPUNLIV,514162,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,542.4","2,151.1",358,14.27%,98.5,33.8,258.9,58.7,196.7,2,526.1,5.4 -Whirlpool of India Ltd.,WHIRLPOOL,500238,CONSUMER DURABLES,CONSUMER ELECTRONICS,"1,555.5","1,448.4",73.2,4.81%,49.2,5.6,52.3,14.1,36.6,2.9,198.8,15.7 -Wipro Ltd.,WIPRO,507685,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"23,255.7","18,543.2","3,972.7",17.64%,897,303.3,"3,512.2",841.9,"2,646.3",5.1,"11,643.8",22.3 -Zee Entertainment Enterprises Ltd.,ZEEL,505537,MEDIA,BROADCASTING & CABLE TV,"2,509.6","2,105",332.8,13.65%,77.2,23.4,184.2,54.4,123,1.3,-102.2,-1.1 -eClerx Services Ltd.,ECLERX,532927,SOFTWARE & SERVICES,BPO/KPO,735.9,517,204.7,28.37%,30.3,6.1,182.4,46.3,136,28.2,506,105 -Sterlite Technologies Ltd.,STLTECH,532374,TELECOMMUNICATIONS EQUIPMENT,TELECOM CABLES,"1,497","1,281",213,14.26%,85,95,36,12,34,0.9,203,5.1 -HEG Ltd.,HEG,509631,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,642.2,512.3,101.9,16.58%,38.5,8.5,82.9,21.7,96,24.9,439.5,113.9 -SBI Life Insurance Company Ltd.,SBILIFE,540719,BANKING AND FINANCE,LIFE INSURANCE,"28,816.2","28,183.8",609.9,2.12%,0,0,621.5,43.9,380.2,3.8,"1,842.2",18.4 -General Insurance Corporation of India,GICRE,540755,BANKING AND FINANCE,GENERAL INSURANCE,"13,465.9","11,574","1,464.6",11.20%,0,0,"1,855.4",243.7,"1,689",15.2,"6,628",37.8 -Tube Investments of India Ltd.,TIINDIA,540762,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,005.4","1,718.2",251.4,12.76%,34.6,7.7,244.8,63.4,181.4,9.4,717.5,37.1 -Honeywell Automation India Ltd.,HONAUT,517174,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,144.3",965.9,138.3,12.52%,13.8,0.7,163.9,42,121.9,137.8,443.4,503.9 -Indian Energy Exchange Ltd.,IEX,540750,BANKING AND FINANCE,EXCHANGE,133,16.6,92,84.73%,5.1,0.7,110.6,27.9,86.5,1,327.8,3.7 -ICICI Lombard General Insurance Company Ltd.,ICICIGI,540716,BANKING AND FINANCE,GENERAL INSURANCE,"5,271.1","4,612.4",743.5,14.16%,0,0,763.6,186.4,577.3,11.8,"1,757.1",35.8 -Aster DM Healthcare Ltd.,ASTERDM,540975,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"3,325.2","2,939.4",377.3,11.38%,227.2,101.9,2.1,10.2,-30.8,-0.6,284.3,5.7 -Central Depository Services (India) Ltd.,CDSL,CDSL,OTHERS,INVESTMENT COMPANIES,230.1,77.9,129.4,62.40%,6.5,0,145.6,35.8,108.9,10.4,320.2,30.6 -Graphite India Ltd.,GRAPHITE,509488,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,884,823,-30,-3.78%,19,4,992,190,804,41.1,856,43.9 -Grasim Industries Ltd.,GRASIM,500300,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"30,505.3","25,995.9","4,224.8",13.98%,"1,245.2",397.8,"2,866.4",837.7,"1,163.8",17.7,"6,624.9",100.6 -KNR Constructions Ltd.,KNRCON,532942,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"1,043.8",806.9,231.6,22.30%,39.2,20.6,177.1,34.6,147.4,5.2,537.5,19.1 -Aditya Birla Capital Ltd.,ABCAPITAL,540691,DIVERSIFIED,HOLDING COMPANIES,"7,730.4","4,550.1","2,821.9",36.55%,48,"1,827",956.8,284.1,705,2.7,"5,231.9",20.1 -Dixon Technologies (India) Ltd.,DIXON,540699,CONSUMER DURABLES,CONSUMER ELECTRONICS,"4,943.9","4,744.3",198.9,4.02%,36.4,17.1,146.1,35.2,107.3,19,308.7,51.8 -Cholamandalam Financial Holdings Ltd.,CHOLAHLDNG,504973,DIVERSIFIED,HOLDING COMPANIES,"6,372.2","2,495.1","3,404.8",54.05%,52.1,"2,209.4","1,215.8",324.6,420.9,22.4,"1,532.3",81.6 -Cochin Shipyard Ltd.,COCHINSHIP,540678,TRANSPORTATION,MARINE PORT & SERVICES,"1,100.4",820.5,191.2,18.90%,18.9,9.6,251.4,69.9,181.5,13.8,429.9,32.7 -Bharat Dynamics Ltd.,BDL,541143,GENERAL INDUSTRIALS,DEFENCE,694.1,481.8,134,21.77%,17.4,0.8,194.1,47,147.1,8,425.4,23.2 -Lux Industries Ltd.,LUXIND,539542,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,643.6,584.2,55,8.61%,5.9,5.4,48,12.1,37.1,12.3,103.1,32.9 -Zensar Technologies Ltd.,ZENSARTECH,504067,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,277.1","1,009.9",230.9,18.61%,36.6,5.7,224.9,51,173.9,7.7,525.8,23.2 -PCBL Ltd.,PCBL,506590,CHEMICALS & PETROCHEMICALS,CARBON BLACK,"1,489.4","1,248.6",238.1,16.02%,48.2,21,171.6,48.8,122.6,3.2,431.6,11.4 -Zydus Wellness Ltd.,ZYDUSWELL,531335,FMCG,PACKAGED FOODS,444,423.1,16.8,3.82%,5.8,6.5,8.6,2.7,5.9,0.9,281.2,44.2 -Linde India Ltd.,LINDEINDIA,523457,GENERAL INDUSTRIALS,INDUSTRIAL GASES,729.9,537.7,173.6,24.41%,49.7,1.2,141.3,34.6,108.7,12.8,417.9,49 -FDC Ltd.,FDC,531599,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,513.6,409.9,76.4,15.71%,9.9,1.1,92.7,22.9,69.8,4.2,251.2,15.4 -The New India Assurance Company Ltd.,NIACL,540769,BANKING AND FINANCE,GENERAL INSURANCE,"10,571","10,773.4",-246.5,-2.33%,0,0,-242,-46.7,-176.1,-1.1,947,5.7 -Sundaram Finance Ltd.,SUNDARMFIN,590071,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"1,710.6",322.5,"1,332.1",77.98%,43.6,820.3,470.6,142.8,365.4,33.2,"1,506.7",135.6 -TeamLease Services Ltd.,TEAMLEASE,539658,COMMERCIAL SERVICES & SUPPLIES,MISC. COMMERCIAL SERVICES,"2,285.6","2,240.8",31.8,1.40%,12.9,2.5,29.4,1.8,27.3,16.3,106.6,63.5 -Galaxy Surfactants Ltd.,GALAXYSURF,540935,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,985.8,858.2,124.9,12.70%,24.7,5.4,97.5,20.1,77.4,21.8,349.3,98.5 -Bandhan Bank Ltd.,BANDHANBNK,541153,BANKING AND FINANCE,BANKS,"5,032.2","1,400.2","1,583.4",35.25%,0,"2,048.6",947.2,226.1,721.2,4.5,"2,541.1",15.8 -ICICI Securities Ltd.,ISEC,541179,BANKING AND FINANCE,CAPITAL MARKETS,"1,249",433.5,810.2,64.87%,25.8,215.1,569.4,145.7,423.6,13.1,"1,238.1",38.3 -V-Mart Retail Ltd.,VMART,534976,RETAILING,DEPARTMENT STORES,551.4,548.8,0.7,0.12%,53.2,35.9,-86.4,-22.3,-64.1,-32.4,-103.1,-52.1 -Nippon Life India Asset Management Ltd.,NAM-INDIA,540767,BANKING AND FINANCE,ASSET MANAGEMENT COS.,475.4,156.1,241.4,60.73%,7.2,1.7,310.4,66.1,244.4,3.9,883.3,14.1 -Grindwell Norton Ltd.,GRINDWELL,506076,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,690,536,131.4,19.69%,16.9,1.8,135.3,33.1,101.9,9.2,378.3,34.2 -HDFC Life Insurance Company Ltd.,HDFCLIFE,540777,BANKING AND FINANCE,LIFE INSURANCE,"23,276.6","23,659.3",-508.1,-2.20%,0,0,-373.1,-657.5,378.2,1.8,"1,472.8",6.9 -Elgi Equipments Ltd.,ELGIEQUIP,522074,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,817.8,663.4,142.7,17.71%,18.7,6.6,129.2,38.8,91.3,2.9,401.9,12.7 -Hindustan Aeronautics Ltd.,HAL,541154,GENERAL INDUSTRIALS,DEFENCE,"6,105.1","4,108.1","1,527.6",27.11%,349.6,0.3,"1,647",414.8,"1,236.7",18.5,"6,037.3",90.3 -BSE Ltd.,BSE,BSE,BANKING AND FINANCE,EXCHANGE,367,172.8,189.2,52.26%,22.7,8.5,163,63.6,120.5,8.8,706,52.1 -Rites Ltd.,RITES,541556,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,608.8,444.5,137.8,23.67%,14.1,1.4,148.8,40.1,101.2,4.2,488.1,20.3 -Fortis Healthcare Ltd.,FORTIS,532843,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,783.5","1,439.8",330.2,18.65%,84.1,31.8,231.4,48.8,173.7,2.3,547.6,7.3 -Varroc Engineering Ltd.,VARROC,541578,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,893.5","1,692.6",194.3,10.30%,84.9,50.3,65.9,18.2,54.2,3.5,146.5,9.6 -Adani Green Energy Ltd.,ADANIGREEN,ASM,UTILITIES,ELECTRIC UTILITIES,"2,589",521,"1,699",76.53%,474,"1,165",413,119,372,2.2,"1,305",8.2 -VIP Industries Ltd.,VIPIND,507880,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,548.7,493.2,52.9,9.68%,23.8,12.4,19.3,6,13.3,0.9,110.9,7.8 -CreditAccess Grameen Ltd.,CREDITACC,541770,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"1,247.6",248.8,902.3,72.36%,12.3,423.9,466.8,119.7,347,21.8,"1,204.2",75.7 -CESC Ltd.,CESC,500084,UTILITIES,ELECTRIC UTILITIES,"4,414","3,706",646,14.84%,303,305,461,98,348,2.6,"1,447",10.9 -Jamna Auto Industries Ltd.,JAMNAAUTO,520051,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,608.7,528.2,79.1,13.03%,10.9,0.8,68.7,18.6,50.1,2.4,189.3,4.7 -Suprajit Engineering Ltd.,SUPRAJIT,532509,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,727.6,639.1,69.8,9.85%,25.7,13.6,49.2,14.5,34.8,2.5,146.9,10.6 -JK Paper Ltd.,JKPAPER,532162,COMMERCIAL SERVICES & SUPPLIES,PAPER & PAPER PRODUCTS,"1,708.8","1,242.8",407.3,24.68%,83.5,42,340.6,34.9,302.4,17.9,"1,220.6",72.1 -Bank of Maharashtra,MAHABANK,532525,BANKING AND FINANCE,BANKS,"5,735.5","1,179.4","1,920.5",37.90%,0,"2,635.7",935.7,16,919.8,1.3,"3,420.8",4.8 -Aavas Financiers Ltd.,AAVAS,541988,BANKING AND FINANCE,HOUSING FINANCE,497.6,123.5,367.8,74.03%,7.6,203.6,157.4,35.7,121.7,15.4,465.4,58.8 -HDFC Asset Management Company Ltd.,HDFCAMC,541729,BANKING AND FINANCE,ASSET MANAGEMENT COS.,765.4,162,481.1,74.81%,13,2.3,588.1,151.6,436.5,20.4,"1,659.3",77.7 -KEI Industries Ltd.,KEI,517569,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"1,954.2","1,742.7",203.9,10.47%,15.6,7.5,188.4,48.2,140.2,15.5,528.3,58.5 -Orient Electric Ltd.,ORIENTELEC,541301,CONSUMER DURABLES,CONSUMER ELECTRONICS,570.3,546.2,20.7,3.65%,14.2,5.2,23.4,4.9,18.4,0.9,95.3,4.5 -Deepak Nitrite Ltd.,DEEPAKNTR,506401,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"1,795.1","1,475.8",302.3,17.00%,39.4,2.7,277.2,72.1,205.1,15,797.9,58.5 -Fine Organic Industries Ltd.,FINEORG,541557,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,557.6,409.4,131.1,24.25%,14.4,0.7,133.1,28.9,103.4,33.7,458.8,149.6 -LTIMindtree Ltd.,LTIM,540005,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"9,048.6","7,274.1","1,631.3",18.32%,208.2,47,"1,519.3",357,"1,161.8",39.3,"4,427.5",149.6 -Dalmia Bharat Ltd.,DALBHARAT,542216,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"3,234","2,56",589,18.70%,401,101,172,48,118,6.3,"1,041",54.8 -Godfrey Phillips India Ltd.,GODFRYPHLP,500163,FOOD BEVERAGES & TOBACCO,CIGARETTES-TOBACCO PRODUCTS,"1,412.5","1,151",223.6,16.27%,36.5,6.6,218.5,55.5,202.1,38.9,802.9,154.4 -Vaibhav Global Ltd.,VAIBHAVGBL,532156,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,708.4,641.5,63.5,9.01%,22.6,2.9,41.4,12.4,29.4,1.8,121.3,7.3 -Abbott India Ltd.,ABBOTINDIA,500488,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,549.7","1,113.3",380.9,25.49%,17.8,3.1,415.4,102.5,312.9,147.3,"1,081.4",508.9 -Adani Total Gas Ltd.,ATGL,ASM,UTILITIES,UTILITIES,"1,104.8",815.7,279.9,25.55%,37.6,27.3,224.2,57.2,172.7,1.6,571,5.2 -Nestle India Ltd.,NESTLEIND,500790,FMCG,PACKAGED FOODS,"5,070.1","3,811.9","1,224.9",24.32%,111.2,31.4,"1,222",313.9,908.1,94.2,"2,971.1",308.2 -Bayer Cropscience Ltd.,BAYERCROP,506285,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,"1,633.3","1,312.3",304.9,18.85%,11.6,3.7,305.7,82.8,222.9,49.6,844.4,188.1 -Amber Enterprises India Ltd.,AMBER,540902,CONSUMER DURABLES,CONSUMER ELECTRONICS,939.8,867.5,59.6,6.43%,45.2,36.6,-9.5,-3.8,-6.9,-2.1,156.8,46.5 -Rail Vikas Nigam Ltd.,RVNL,542649,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"5,210.3","4,616",298.3,6.07%,6.2,132.7,455.4,85.2,394.3,1.9,"1,478.8",7.1 -Metropolis Healthcare Ltd.,METROPOLIS,542650,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,309.7,233.7,74.8,24.25%,22.2,5.7,48.1,12.5,35.5,6.9,133.4,26 -Polycab India Ltd.,POLYCAB,542652,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"4,253","3,608.8",608.9,14.44%,60.3,26.8,557.2,127.4,425.6,28.4,"1,607.2",107.1 -Multi Commodity Exchange of India Ltd.,MCX,534091,BANKING AND FINANCE,EXCHANGE,184,193.8,-28.7,-17.38%,6.6,0.1,-16.4,1.6,-19.1,-3.7,44.8,8.8 -IIFL Finance Ltd.,IIFL,532636,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,"2,533.7",788.3,"1,600.8",64.66%,43.3,932.1,683.5,158,474.3,12.4,"1,690.7",44.4 -Ratnamani Metals & Tubes Ltd.,RATNAMANI,520111,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"1,141.9",886.3,244.9,21.65%,23.6,10.8,221.1,56.8,163.9,23.4,622.6,88.8 -RHI Magnesita India Ltd.,RHIM,534076,GENERAL INDUSTRIALS,OTHER INDUSTRIAL GOODS,989.7,839,147.9,14.98%,44.2,8.5,97.9,26.3,71.3,3.5,-502.2,-24.3 -Birlasoft Ltd.,BSOFT,532400,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,325.4","1,102.7",207.1,15.81%,21.5,5.7,195.5,50.4,145.1,5.2,378.4,13.7 -EIH Ltd.,EIHOTEL,500840,HOTELS RESTAURANTS & TOURISM,HOTELS,552.5,387.6,142.9,26.94%,33.2,5.6,126.1,36.2,93.1,1.5,424.1,6.8 -Affle (India) Ltd.,AFFLE,542752,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,441.2,344.1,87.2,20.22%,18.4,5.5,73.2,6.4,66.8,5,264.3,19.8 -Westlife Foodworld Ltd.,WESTLIFE,505533,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,618,516.5,98.2,15.98%,43.9,27.4,30.2,7.8,22.4,1.4,107.7,6.9 -IndiaMART InterMESH Ltd.,INDIAMART,542726,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,329.3,214.7,80,27.15%,8,2.3,104.3,23.9,69.4,11.4,321.1,53.6 -Infosys Ltd.,INFY,500209,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"39,626","29,554","9,44",24.21%,"1,166",138,"8,768","2,553","6,212",15,"24,871",60.1 -Sterling and Wilson Renewable Energy Ltd.,SWSOLAR,542760,COMMERCIAL SERVICES & SUPPLIES,CONSULTING SERVICES,776.7,758,1.5,0.19%,4.3,64.3,-50,4.6,-54.2,-2.9,-668.4,-35.2 -ABB India Ltd.,ABB,500002,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,846","2,330.7",438.5,15.84%,30.3,0.9,484.2,122.2,362.9,17.1,"1,208.7",57 -Poly Medicure Ltd.,POLYMED,531768,HEALTHCARE EQUIPMENT & SUPPLIES,HEALTHCARE SUPPLIES,351.4,253.1,84.2,24.97%,16,2.2,80.9,18.8,62.2,6.5,233.7,24.4 -GMM Pfaudler Ltd.,GMMPFAUDLR,505255,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,946,795.5,142,15.15%,32.2,21.5,96.8,26.5,71.1,15.8,183.2,40.8 -Gujarat Fluorochemicals Ltd.,FLUOROCHEM,542812,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,960.3,783.7,163.1,17.23%,67.5,34.2,74.8,22.1,52.7,4.8,915.2,83.3 -360 One Wam Ltd.,360ONE,542772,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,617.1,235.6,317.8,57.31%,13.7,139.9,226.8,40.8,186,5.2,696.8,19.5 -Tata Communications Ltd.,TATACOMM,500483,TELECOM SERVICES,OTHER TELECOM SERVICES,"4,897.9","3,857.1","1,015.5",20.84%,605.1,137.4,298.3,77.9,220.7,7.7,"1,322.3",46.4 -Alkyl Amines Chemicals Ltd.,ALKYLAMINE,506767,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,354.5,303.9,48.3,13.71%,12.5,1.7,36.4,9.2,27.2,5.3,171.3,33.5 -CSB Bank Ltd.,CSBBANK,542867,BANKING AND FINANCE,BANKS,835.8,317.5,174.6,25.41%,0,343.6,178,44.8,133.2,7.7,577.7,33.3 -Indian Railway Catering & Tourism Corporation Ltd.,IRCTC,542830,DIVERSIFIED CONSUMER SERVICES,TRAVEL SUPPORT SERVICES,"1,042.4",628.8,366.6,36.83%,14,4.4,395.2,100.5,294.7,3.7,"1,061.2",13.3 -Sumitomo Chemical India Ltd.,SUMICHEM,542920,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,928,715.5,187.9,20.80%,15.8,1.2,195.5,52,143.4,2.9,367.7,7.4 -Century Textiles & Industries Ltd.,CENTURYTEX,500040,COMMERCIAL SERVICES & SUPPLIES,PAPER & PAPER PRODUCTS,"1,114.9","1,069.2",33.8,3.07%,59.2,17,-30.5,-3.3,-30.4,-2.8,117.7,10.5 -SBI Cards and Payment Services Ltd.,SBICARD,543066,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"4,221.4","2,018.8","1,327",32.47%,46.8,604.9,809.4,206.4,603,6.4,"2,302.2",24.3 -Hitachi Energy India Ltd.,POWERINDIA,543187,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"1,228.2","1,162.6",65.3,5.32%,22.5,10.7,32.4,7.6,24.7,5.8,82.5,19.5 -Suven Pharmaceuticals Ltd.,SUVENPHAR,543064,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,250.9,133.1,98,42.40%,11.9,0.5,105.4,25.8,79.6,3.1,431.8,17 -Tata Chemicals Ltd.,TATACHEM,500770,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"4,083","3,179",819,20.49%,234,145,627,120,428,16.8,"2,06",80.8 -Aarti Drugs Ltd.,AARTIDRUGS,524348,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,642.2,565.1,76.4,11.92%,12.6,8.2,56.3,16.7,39.6,4.3,180.2,19.6 -Gujarat Ambuja Exports Ltd.,GAEL,524226,FMCG,EDIBLE OILS,"1,157.7","1,012.2",103.3,9.26%,30.5,5.9,109.1,26.3,82.8,3.6,305.1,13.3 -Polyplex Corporation Ltd.,POLYPLEX,524051,COMMERCIAL SERVICES & SUPPLIES,CONTAINERS & PACKAGING,"1,595.7","1,451.5",120.6,7.67%,75.1,9.9,59.1,10.9,27.9,8.9,71.1,22.6 -Chalet Hotels Ltd.,CHALET,542399,HOTELS RESTAURANTS & TOURISM,HOTELS,318.2,188.6,126,40.04%,35,50.1,44.5,8,36.4,1.8,266.7,13 -Adani Enterprises Ltd.,ADANIENT,512599,COMMERCIAL SERVICES & SUPPLIES,COMMODITY TRADING & DISTRIBUTION,"23,066","20,087.2","2,430.1",10.79%,757,"1,342.8",791,397.8,227.8,2,"2,444.3",21.4 -YES Bank Ltd.,YESBANK,532648,BANKING AND FINANCE,BANKS,"7,980.6","2,377.1",810,12.06%,0,"4,793.6",304.4,75.7,228.6,0.1,836.6,0.3 -EPL Ltd.,EPL,500135,COMMERCIAL SERVICES & SUPPLIES,CONTAINERS & PACKAGING,"1,011.2",820.6,181,18.07%,83.6,30.6,76.4,25.4,50.5,1.6,251.9,7.9 -Network18 Media & Investments Ltd.,NETWORK18,532798,MEDIA,BROADCASTING & CABLE TV,"2,052.2","2,083.8",-218.3,-11.70%,56.8,66.2,-154.5,-6.5,-61,-0.6,-144.2,-1.4 -CIE Automotive India Ltd.,CIEINDIA,532756,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,299.4","1,934",345.4,15.15%,78.3,31,256.1,69.1,375.4,9.9,298.4,7.9 -Vedanta Ltd.,VEDL,500295,METALS & MINING,ALUMINIUM AND ALUMINIUM PRODUCTS,"39,585","27,466","11,479",29.47%,"2,642","2,523","8,177","9,092","-1,783",-4.8,"5,202",14 -Rossari Biotech Ltd.,ROSSARI,543213,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,484.8,419.9,63.6,13.15%,15.1,5,44.8,11.9,32.9,6,116.8,21.2 -KPIT Technologies Ltd.,KPITTECH,542651,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,"1,208.6",959.2,239.9,20.01%,48.1,13.6,187.7,46.3,140.9,5.2,486.9,18 -Intellect Design Arena Ltd.,INTELLECT,538835,SOFTWARE & SERVICES,IT SOFTWARE PRODUCTS,631.7,497.2,121.9,19.69%,33.7,0.8,96.5,25.7,70.4,5.2,316.6,23.2 -Balaji Amines Ltd.,BALAMINES,530999,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,387.3,326.8,53.8,14.13%,10.8,1.8,48,11.6,34.7,10.7,197.3,60.9 -UTI Asset Management Company Ltd.,UTIAMC,543238,BANKING AND FINANCE,ASSET MANAGEMENT COS.,405.6,172.5,231.5,57.30%,10.4,2.8,219.8,37,182.8,14.4,562.9,44.3 -Mazagon Dock Shipbuilders Ltd.,MAZDOCK,543237,TRANSPORTATION,SHIPPING,"2,079.2","1,651.1",176.6,9.66%,20.2,1.3,406.6,102.8,332.9,16.5,"1,327.6",65.8 -Computer Age Management Services Ltd.,CAMS,543232,BANKING AND FINANCE,CAPITAL MARKETS,284.7,153,122.1,44.39%,17.4,2,112.4,28.6,84.5,17.2,309.2,62.9 -Happiest Minds Technologies Ltd.,HAPPSTMNDS,543227,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,428.8,324,82.6,20.32%,14.6,11.2,79.1,20.7,58.5,3.9,232,15.6 -Triveni Turbine Ltd.,TRITURBINE,533655,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,402.3,313.4,74.3,19.17%,5.1,0.6,83.2,19,64.2,2,233.1,7.3 -Angel One Ltd.,ANGELONE,ASM,BANKING AND FINANCE,CAPITAL MARKETS,"1,049.3",602.6,443.4,42.31%,11.2,26.4,407.2,102.7,304.5,36.3,"1,020.2",121.7 -Tanla Platforms Ltd.,TANLA,532790,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,014.9",811.8,196.8,19.51%,22.6,1.8,178.7,36.2,142.5,10.6,514.7,38.3 -Max Healthcare Institute Ltd.,MAXHEALTH,543220,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,"1,408.6",975.8,387.4,28.42%,57.9,8.5,366.4,89.7,276.7,2.9,990.1,10.2 -Asahi India Glass Ltd.,ASAHIINDIA,515030,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,122.6",934,185.6,16.58%,43,34.4,111.3,30.2,86.9,3.6,343.5,14.1 -Prince Pipes & Fittings Ltd.,PRINCEPIPE,542907,GENERAL INDUSTRIALS,PLASTIC PRODUCTS,660.4,562.3,94.2,14.35%,22.5,0.7,92.8,22.2,70.6,5.2,219.8,19.9 -Route Mobile Ltd.,ROUTE,543228,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,018.3",886.5,128.1,12.63%,21.4,6.5,103.8,15.5,88.8,14.2,365.3,58.3 -KPR Mill Ltd.,KPRMILL,532889,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,533","1,212.9",298,19.72%,46,18.1,256,54.2,201.8,5.9,788.8,23.1 -Infibeam Avenues Ltd.,INFIBEAM,539807,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,792.6,719.7,70.2,8.89%,17.1,0.5,55.2,14.7,41,0.1,142.2,0.5 -Restaurant Brands Asia Ltd.,RBA,543248,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,628.2,568.7,56.2,9.00%,78.6,31.5,-50.7,0,-46,-0.9,-220.3,-4.5 -Larsen & Toubro Ltd.,LT,500510,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"52,157","45,392.1","5,632",11.04%,909.9,864,"4,991.1","1,135.5","3,222.6",22.9,"12,255.3",89.2 -Gland Pharma Ltd.,GLAND,543245,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,426.6","1,049.3",324.1,23.60%,81.3,6,289.9,95.8,194.1,11.8,698.8,42.4 -Macrotech Developers Ltd.,LODHA,543287,REALTY,REALTY,"1,755.1","1,333.5",416.1,23.78%,29.3,123.1,269.2,62.4,201.9,2.1,"1,529.2",15.9 -Poonawalla Fincorp Ltd.,POONAWALLA,524000,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),745.3,178.9,531.7,71.98%,14.7,215.5,"1,124.6",270,860.2,11.2,"1,466.4",19.1 -The Fertilisers and Chemicals Travancore Ltd.,FACT,590024,FERTILIZERS,FERTILIZERS,"1,713.6","1,530.8",132.4,7.96%,5.3,61.2,105.2,0,105.2,1.6,508.4,7.9 -Home First Finance Company India Ltd.,HOMEFIRST,543259,BANKING AND FINANCE,HOUSING FINANCE,278,53.7,211.6,77.43%,2.8,117,96.4,22.1,74.3,8.4,266.2,30.2 -CG Power and Industrial Solutions Ltd.,CGPOWER,500093,GENERAL INDUSTRIALS,HEAVY ELECTRICAL EQUIPMENT,"2,019","1,692.9",308.6,15.42%,22.9,0.4,329.9,86.2,242.3,1.6,"1,1",7.2 -Laxmi Organic Industries Ltd.,LXCHEM,543277,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,660.5,613.3,38.9,5.97%,27.5,2.1,17.5,6.8,10.7,0.4,100.6,3.8 -Anupam Rasayan India Ltd.,ANURAS,543275,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,395.6,284.7,107.5,27.41%,19.8,20.4,70.7,22,40.7,3.8,178.9,16.6 -Kalyan Jewellers India Ltd.,KALYANKJIL,ASM,TEXTILES APPARELS & ACCESSORIES,GEMS & JEWELLERY,"4,427.7","4,100.9",313.7,7.11%,66.9,81.7,178.1,43.3,135.2,1.3,497.9,4.8 -Jubilant Pharmova Ltd.,JUBLPHARMA,530019,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,690.2","1,438.5",241.8,14.39%,96.6,66.1,89,35.9,62.5,3.9,-44.6,-2.8 -Indigo Paints Ltd.,INDIGOPNTS,543258,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,273.4,228.7,41.8,15.45%,10,0.5,34.3,8.2,26.1,5.5,132.4,27.8 -Indian Railway Finance Corporation Ltd.,IRFC,543257,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"6,767.5",33.5,"6,732.4",99.50%,2.1,"5,181.5","1,549.9",0,"1,549.9",1.2,"6,067.6",4.6 -Mastek Ltd.,MASTEK,523704,SOFTWARE & SERVICES,IT CONSULTING & SOFTWARE,770.4,642.5,123,16.07%,20.9,12.6,90.3,25,62.8,20.5,269.7,88 -Equitas Small Finance Bank Ltd.,EQUITASBNK,543243,BANKING AND FINANCE,BANKS,"1,540.4",616.8,330.2,24.30%,0,593.4,267,68.9,198.1,1.8,749.5,6.7 -Tata Teleservices (Maharashtra) Ltd.,TTML,532371,TELECOM SERVICES,TELECOM SERVICES,288.6,159.3,127.5,44.45%,36.3,403.2,-310.2,0,-310.2,-1.6,"-1,168.3",-6 -Praj Industries Ltd.,PRAJIND,522205,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,893.3,798.4,84,9.52%,9.1,1,84.8,22.4,62.4,3.4,271.4,14.8 -Nazara Technologies Ltd.,NAZARA,543280,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,309.5,269.4,26.7,8.98%,15.1,2.7,21.2,-1.3,19.8,3,60,9.1 -Jubilant Ingrevia Ltd.,JUBLINGREA,543271,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,028.5",902.3,117.7,11.54%,33.9,12.5,79.8,22.4,57.5,3.6,258.9,16.4 -Sona BLW Precision Forgings Ltd.,SONACOMS,543300,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,796.9,567.5,223.3,28.24%,53.4,6,164.1,40.1,123.8,2.1,462.8,7.9 -Chemplast Sanmar Ltd.,CHEMPLASTS,543336,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,025",941.8,46,4.65%,35.3,38.6,9.2,-16.8,26.1,1.6,35.3,2.2 -Aptus Value Housing Finance India Ltd.,APTUS,543335,BANKING AND FINANCE,HOUSING FINANCE,344.5,50.6,277.5,83.18%,2.6,96.1,189.6,41.5,148,3,551.1,11.1 -Clean Science & Technology Ltd.,CLEAN,543318,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,187.1,106.3,74.8,41.32%,11.1,0.3,69.5,17.3,52.2,4.9,275.5,25.9 -Medplus Health Services Ltd.,MEDPLUS,543427,HEALTHCARE EQUIPMENT & SUPPLIES,HEALTHCARE SUPPLIES,"1,419","1,323.5",85.1,6.04%,55.5,23.5,16.4,1.9,14.6,1.2,58.3,4.9 -Nuvoco Vistas Corporation Ltd.,NUVOCO,543334,CEMENT AND CONSTRUCTION,CEMENT & CEMENT PRODUCTS,"2,578.9","2,243",329.9,12.82%,225.6,139.9,-29.6,-31.1,1.5,0,141.8,4 -Star Health and Allied Insurance Company Ltd.,STARHEALTH,543412,BANKING AND FINANCE,GENERAL INSURANCE,"3,463.2","3,295.8",165.7,4.79%,0,0,167.1,41.8,125.3,2.1,725.4,12.4 -Go Fashion (India) Ltd.,GOCOLORS,543401,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,192.8,132.2,56.6,29.98%,25.8,8.9,25.8,5.7,20,3.7,85.4,15.8 -PB Fintech Ltd.,POLICYBZR,543390,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,909.1,900.7,-89.1,-10.98%,22.3,7.2,-21.1,-0.3,-20.2,-0.5,-127.9,-2.8 -FSN E-Commerce Ventures Ltd.,NYKAA,543384,SOFTWARE & SERVICES,INTERNET & CATALOGUE RETAIL,"1,515.6","1,426.4",80.6,5.35%,54.6,21.3,13.3,4,5.8,0,19.8,0.1 -Krishna Institute of Medical Sciences Ltd.,KIMS,543308,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,655.4,475.2,177.3,27.17%,32.6,8.9,138.6,37.3,92,11.5,342.1,42.7 -Zomato Ltd.,ZOMATO,543320,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"3,06","2,895",-47,-1.65%,128,16,21,-15,36,0,-496.8,-0.6 -Brightcom Group Ltd.,BCG,532368,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"1,690.5","1,172.3",518,30.65%,72.3,0.1,445.8,124.3,321.5,1.6,"1,415.2",7 -Shyam Metalics and Energy Ltd.,SHYAMMETL,543299,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"2,978.9","2,633.6",307.1,10.44%,176.5,35.4,133.4,-348.6,484.1,18.9,"1,049.9",41.2 -G R Infraprojects Ltd.,GRINFRA,543317,CEMENT AND CONSTRUCTION,ROADS & HIGHWAYS,"1,909.2","1,415.7",467.1,24.81%,61.7,144.6,287.1,69.9,217.2,22.5,"1,240.3",128.3 -RattanIndia Enterprises Ltd.,RTNINDIA,534597,UTILITIES,ELECTRIC UTILITIES,"1,618.1","1,392.8",1.5,0.11%,4.3,28.8,142.2,1.7,140.9,1,147.6,1.1 -Borosil Renewables Ltd.,BORORENEW,502219,CONSUMER DURABLES,HOUSEWARE,406.3,369.2,32.5,8.09%,31,9.6,28.9,-1.1,25.1,1.9,32.1,2.5 -HLE Glascoat Ltd.,HLEGLAS,522215,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,227.8,198,26.5,11.79%,6.1,5.8,16.1,5.3,10,1.6,54.4,8 -Tata Investment Corporation Ltd.,TATAINVEST,501301,DIVERSIFIED,HOLDING COMPANIES,125,10.1,113.8,91.88%,0.2,4.7,110.1,-1.3,124.4,24.6,326.1,64.4 -Sapphire Foods India Ltd.,SAPPHIRE,543397,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,650.1,527.5,115.1,17.91%,76.8,24.5,21.4,6.2,15.3,2.4,208.5,32.7 -Devyani International Ltd.,DEVYANI,543330,HOTELS RESTAURANTS & TOURISM,RESTAURANTS,826,665,154.4,18.84%,86.3,41.7,19,-16.8,33.4,0.3,177.5,1.5 -Vijaya Diagnostic Centre Ltd.,VIJAYA,543350,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE SERVICES,145.6,81.5,57.4,41.31%,13.7,5.9,44.6,11,33.3,3.3,103.4,10.1 -C.E. Info Systems Ltd.,MAPMYINDIA,543425,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,99.3,50.1,41,44.98%,3.7,0.7,44.7,11.1,33,6.1,122.9,22.7 -Latent View Analytics Ltd.,LATENTVIEW,543398,SOFTWARE & SERVICES,DATA PROCESSING SERVICES,172.7,124.9,30.8,19.78%,2.3,0.8,44.7,10.6,34,1.7,153.6,7.5 -Metro Brands Ltd.,METROBRAND,543426,RETAILING,FOOTWEAR,571.9,400.3,155.4,27.96%,57.2,19.7,94.7,27.5,66.7,2.5,340,12.5 -Easy Trip Planners Ltd.,EASEMYTRIP,543272,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,144.6,76.9,64.8,45.71%,1,2,64.7,17.7,47.2,0.3,146,0.8 -Shree Renuka Sugars Ltd.,RENUKA,532670,FOOD BEVERAGES & TOBACCO,SUGAR,"2,564.7","2,491",63.7,2.49%,64.1,216.8,-207.2,-1.6,-204.9,-1,-286,-1.3 -One97 Communications Ltd.,PAYTM,543396,SOFTWARE & SERVICES,INTERNET SOFTWARE & SERVICES,"2,662.5","2,749.6",-231,-9.17%,180.1,7,-279.9,12.7,-290.5,-5,"-1,207.9",-19 -MTAR Technologies Ltd.,MTARTECH,543270,GENERAL INDUSTRIALS,DEFENCE,167.7,130.7,36.1,21.64%,5.8,5.5,25.7,5.2,20.5,6.7,103.3,33.6 -Capri Global Capital Ltd.,CGCL,531595,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),557.4,229.3,304.8,54.70%,23.1,195.8,86,20.8,65.2,3.2,231.2,11.2 -GMR Airports Infrastructure Ltd.,GMRINFRA,ASM,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"2,185","1,336.8",726.7,35.22%,373,695.8,-252,54.9,-91,-0.1,-370.9,-0.6 -Triveni Engineering & Industries Ltd.,TRIVENI,532356,FOOD BEVERAGES & TOBACCO,SUGAR,"1,629.7","1,554.5",62.9,3.89%,25.8,10.2,39.3,10.1,29.1,1.3,434.3,19.8 -Delhivery Ltd.,DELHIVERY,543529,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"2,043","1,957.3",-15.6,-0.80%,171.2,19.6,-105.2,-2.1,-102.9,-1.4,-546.7,-7.5 -Life Insurance Corporation of India,LICI,543526,BANKING AND FINANCE,LIFE INSURANCE,"202,394.9","193,612.5","8,445",4.18%,0,0,"8,696.5","1,083.9","8,030.3",12.7,"37,204.8",58.8 -Campus Activewear Ltd.,CAMPUS,543523,RETAILING,FOOTWEAR,259.1,234.2,24.5,9.46%,18.1,6.5,0.4,0.1,0.3,0,103.1,3.4 -Motherson Sumi Wiring India Ltd.,MSUMI,543498,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"2,110.2","1,856.5",248.1,11.79%,36.4,7.4,210,54.1,155.9,0.3,523.6,1.2 -Olectra Greentech Ltd.,OLECTRA,532439,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,310.3,266.6,40.5,13.20%,8.8,9.7,25.2,8,18.6,2.2,78.5,9.6 -Patanjali Foods Ltd.,PATANJALI,500368,FMCG,EDIBLE OILS,"7,845.8","7,426.6",395.3,5.05%,60.1,24,335.1,80.5,254.5,7,875.2,24.2 -Raymond Ltd.,RAYMOND,500330,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"2,320.7","1,938.8",314.6,13.96%,65.4,89.3,204.2,50.7,159.8,24,"1,514.2",227.5 -Swan Energy Ltd.,SWANENERGY,503310,REALTY,REALTY,"1,230.1",966.3,257,21.01%,27.1,58.3,178.4,12.8,84.6,6.7,308.4,11.7 -Samvardhana Motherson International Ltd.,MOTHERSON,517334,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"23,639.2","21,585","1,888.8",8.05%,867.4,487.9,449.5,229.2,201.6,0.3,"1,910.3",2.8 -Vedant Fashions Ltd.,MANYAVAR,543463,RETAILING,SPECIALTY RETAIL,233.4,125.5,92.8,42.51%,32.5,10.7,64.8,16.1,48.7,2,399.9,16.5 -Adani Wilmar Ltd.,AWL,543458,FMCG,EDIBLE OILS,"12,331.2","12,123.5",143.7,1.17%,95.7,220.2,-161.8,-31.5,-130.7,-1,130.1,1 -Mahindra Lifespace Developers Ltd.,MAHLIFE,532313,REALTY,REALTY,25.7,52.7,-34.9,-196.45%,3.1,0.2,-30.3,-10.8,-18.9,-1.2,10.5,0.7 -Tejas Networks Ltd.,TEJASNET,540595,TELECOM SERVICES,OTHER TELECOM SERVICES,413.9,383,13,3.28%,41.7,7,-17.7,-5.1,-12.6,-0.7,-61.3,-3.5 -Aether Industries Ltd.,AETHER,543534,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,178.3,118.2,46,28.00%,9.7,1.6,48.7,12.1,36.7,2.8,139.1,10.5 -JBM Auto Ltd.,JBMA,ASM,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,238.8","1,091.3",139.7,11.35%,41.2,47.9,58.3,11.3,44.2,3.7,136.8,11.6 -Deepak Fertilisers & Petrochemicals Corporation Ltd.,DEEPAKFERT,500645,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,"2,443.2","2,138.1",286.1,11.80%,81.2,107.1,116.8,53.3,60.1,4.8,674.5,53.4 -Sharda Cropchem Ltd.,SHARDACROP,538666,CHEMICALS & PETROCHEMICALS,AGROCHEMICALS,604.3,559.6,21.2,3.65%,74,4.6,-33.8,-6.3,-27.6,-3.1,191,21.2 -Shoppers Stop Ltd.,SHOPERSTOP,532638,RETAILING,DEPARTMENT STORES,"1,049.7",878.2,160.9,15.49%,108.2,54.9,3.5,0.8,2.7,0.2,94.2,8.6 -BEML Ltd.,BEML,500048,AUTOMOBILES & AUTO COMPONENTS,COMMERCIAL VEHICLES,924,855.3,61.5,6.70%,15.8,10.8,42.2,-9.6,51.8,12.4,200.8,48.2 -Lemon Tree Hotels Ltd.,LEMONTREE,541233,HOTELS RESTAURANTS & TOURISM,HOTELS,230.1,125.3,101.9,44.84%,22.6,47.3,34.8,8.6,22.6,0.3,130.1,1.6 -Rainbow Childrens Medicare Ltd.,RAINBOW,543524,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,340.5,215.1,117.6,35.34%,26.8,13.3,85.2,22.1,62.9,6.2,215.4,21.2 -UCO Bank,UCOBANK,532505,BANKING AND FINANCE,BANKS,"5,865.6","1,581.5",981.9,18.81%,0,"3,302.3",639.8,238.1,403.5,0.3,"1,84",1.5 -Piramal Pharma Ltd.,PPLPHARMA,543635,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"1,960.6","1,645.7",265.6,13.90%,184.5,109.9,20.4,34.5,5,0,-133.6,-1 -KSB Ltd.,KSB,500249,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,572.2,493.4,70.3,12.47%,12.3,2,64.5,17.1,50.1,14.4,209.7,60.3 -Data Patterns (India) Ltd.,DATAPATTNS,543428,GENERAL INDUSTRIALS,DEFENCE,119.2,67.5,40.8,37.63%,3.1,2.3,46.3,12.5,33.8,6,148.3,26.5 -Global Health Ltd.,MEDANTA,543654,DIVERSIFIED CONSUMER SERVICES,HEALTHCARE FACILITIES,864.7,631.1,212.9,25.22%,42.9,20.1,170.6,45.4,125.2,4.7,408.9,15.2 -Aarti Industries Ltd.,AARTIIND,524208,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,"1,454","1,221.2",232.8,16.01%,93,58.2,81.6,-9.1,90.7,2.5,446.2,12.3 -BLS International Services Ltd.,BLS,540073,DIVERSIFIED CONSUMER SERVICES,TRAVEL SUPPORT SERVICES,416.4,321,86.7,21.27%,7.3,1,87.2,5.2,78.7,1.9,267.6,6.5 -Archean Chemical Industries Ltd.,ACI,543657,CHEMICALS & PETROCHEMICALS,COMMODITY CHEMICALS,301.7,195,95.5,32.86%,17.5,1.9,87.3,21.3,66,5.4,394.4,32.1 -Adani Power Ltd.,ADANIPOWER,ASM,UTILITIES,ELECTRIC UTILITIES,"14,935.7","7,819.2","5,171.4",39.81%,"1,004.5",888.4,"5,223.6","-1,370.6","6,594.2",16.5,"20,604.8",53.4 -Craftsman Automation Ltd.,CRAFTSMAN,543276,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,183.8",941.6,237.5,20.14%,66.8,41.6,133.8,29.6,94.5,44.1,298.3,141.2 -NMDC Ltd.,NMDC,526371,METALS & MINING,MINING,"4,335","2,823.6","1,190.4",29.66%,88.8,18.6,"1,404.1",379,"1,026.2",3.5,"5,862.2",20 -Epigral Ltd.,EPIGRAL,543332,CHEMICALS & PETROCHEMICALS,SPECIALTY CHEMICALS,479.1,370.2,107.9,22.57%,31.5,21.3,56.1,17.9,38,9.1,223.4,53.8 -Apar Industries Ltd.,APARINDS,532259,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,"3,944.7","3,576.2",349.8,8.91%,28.2,103.1,237.3,62.9,173.9,45.4,783.9,204.8 -Bikaji Foods International Ltd.,BIKAJI,543653,FMCG,PACKAGED FOODS,614.7,521,87.7,14.41%,15.6,2.9,75.2,15.4,61.2,2.5,173.6,6.9 -Five-Star Business Finance Ltd.,FIVESTAR,543663,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),522.4,133.2,375,72.28%,5.7,105.9,267,67.6,199.4,6.8,703,24.1 -Ingersoll-Rand (India) Ltd.,INGERRAND,500210,GENERAL INDUSTRIALS,INDUSTRIAL MACHINERY,282.8,210.7,65.7,23.76%,4.6,0.6,67,17.2,49.7,15.8,218.5,69.2 -KFIN Technologies Ltd.,KFINTECH,543720,BANKING AND FINANCE,OTHER FINANCIAL SERVICES,215.3,115.3,93.7,44.82%,12.6,3.2,84.2,22.3,61.4,3.6,215.1,12.6 -Piramal Enterprises Ltd.,PEL,500302,BANKING AND FINANCE,FINANCE (INCLUDING NBFCS),"2,205.2","1,320.1","1,117.9",50.97%,38.3,"1,038.9",-11.8,10.7,48.2,2,"3,906.5",173.9 -NMDC Steel Ltd.,NSLNISP,543768,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,290.3,349.6,-72.2,-26.04%,74.5,40.8,-174.7,-43.6,-131.1,-0.5,, -Eris Lifesciences Ltd.,ERIS,540596,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,508.8,324.2,181.1,35.85%,42.1,16.3,126.2,3.9,123.4,9.1,385.6,28.3 -Mankind Pharma Ltd.,MANKIND,543904,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,"2,768.1","2,025.5",682.6,25.21%,96.5,8.6,637.5,129.8,501,12.5,"1,564.8",39.1 -Kaynes Technology India Ltd.,KAYNES,ASM,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,369.8,312.1,48.8,13.52%,6.5,11.8,39.4,7.1,32.3,5.5,143.2,24.6 -Safari Industries (India) Ltd.,SAFARI,523025,TEXTILES APPARELS & ACCESSORIES,OTHER APPARELS & ACCESSORIES,372.9,306.6,63.5,17.15%,12.2,2.2,51.9,12.1,39.8,16.7,162.3,68.2 -Saregama India Ltd.,SAREGAMA,532163,MEDIA,MOVIES & ENTERTAINMENT,185.6,111.5,60.9,35.32%,8.2,0.2,65.6,17.6,48.1,2.5,193.4,10 -Syrma SGS Technology Ltd.,SYRMA,543573,CONSUMER DURABLES,OTHER ELECTRICAL EQUIPMENT/PRODUCTS,720.6,662.7,49,6.88%,11.6,8,37,6.4,28.3,1.6,132.4,7.5 -Jindal Saw Ltd.,JINDALSAW,ASM,GENERAL INDUSTRIALS,OTHER INDUSTRIAL PRODUCTS,"5,488.9","4,662",804.2,14.71%,142.5,188.7,495.6,139.6,375.7,11.8,"1,135.8",35.5 -Godawari Power & Ispat Ltd.,GPIL,532734,METALS & MINING,IRON & STEEL/INTERM.PRODUCTS,"1,314.2",929.6,361.4,28.00%,34.8,10.2,339.6,86.1,256.9,20.6,785.5,63 -Gillette India Ltd.,GILLETTE,507815,FMCG,PERSONAL PRODUCTS,676.2,530.8,136.7,20.48%,20.1,0.1,125.2,32.5,92.7,28.4,361.6,111 -Symphony Ltd.,SYMPHONY,517385,CONSUMER DURABLES,CONSUMER ELECTRONICS,286,234,41,14.91%,7,2,43,8,35,5.1,114,16.5 -Glenmark Life Sciences Ltd.,GLS,543322,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,600.7,428.3,167.1,28.06%,13.1,0.4,158.9,40.2,118.7,9.7,505.5,41.3 -Usha Martin Ltd.,USHAMART,517146,METALS & MINING,IRON & STEEL PRODUCTS,806,640.4,144.3,18.39%,18,6.4,141.2,35,109.5,3.6,399.4,13.1 -Ircon International Ltd.,IRCON,541956,CEMENT AND CONSTRUCTION,CONSTRUCTION & ENGINEERING,"3,136.3","2,771.2",215.7,7.22%,27.1,36.9,301.2,77.6,250.7,2.7,884.6,9.4 -Ujjivan Small Finance Bank Ltd.,UJJIVANSFB,542904,BANKING AND FINANCE,BANKS,"1,579.8",528.6,483.4,34.75%,0,567.8,436.4,108.7,327.7,1.7,"1,254.5",6.4 -Procter & Gamble Health Ltd.,PGHL,500126,PHARMACEUTICALS & BIOTECHNOLOGY,PHARMACEUTICALS,311,216.3,88.7,29.08%,6.5,0.2,88,22.5,65.6,39.5,231.4,139.4 -Allcargo Logistics Ltd.,ALLCARGO,532749,TRANSPORTATION,TRANSPORTATION - LOGISTICS,"3,336.3","3,188.8",118,3.57%,106.7,36.7,14.2,1.3,21.8,0.9,361.9,14.7 -Sheela Foam Ltd.,SFL,540203,DIVERSIFIED CONSUMER SERVICES,FURNITURE-FURNISHING-PAINTS,637.6,547,66.2,10.80%,21.9,8.6,60.2,15.6,44,4.5,192.4,17.7 -Alok Industries Ltd.,ALOKINDS,521070,TEXTILES APPARELS & ACCESSORIES,TEXTILES,"1,369.3","1,323.1",35.9,2.64%,78.6,142.2,-174.6,0,-174.8,-0.3,-948.4,-1.9 -Minda Corporation Ltd.,MINDACORP,538962,AUTOMOBILES & AUTO COMPONENTS,AUTO PARTS & EQUIPMENT,"1,197.9","1,064.5",131.3,10.98%,41.4,14.9,77,18.7,58.8,2.5,278.2,11.6 -Concord Biotech Ltd.,CONCORDBIO,543960,PHARMACEUTICALS & BIOTECHNOLOGY,BIOTECHNOLOGY,270.5,143.2,119.2,45.43%,13.3,0.8,113.2,28.7,81,7.7,, \ No newline at end of file diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/sampleFileForUpload.txt b/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/sampleFileForUpload.txt deleted file mode 100644 index ab553b3304c1..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/src/data/sampleFileForUpload.txt +++ /dev/null @@ -1 +0,0 @@ -The word 'apple' uses the code 442345, while the word 'banana' uses the code 673457. diff --git a/sdk/ai/ai-projects/samples/v1-beta/typescript/tsconfig.json b/sdk/ai/ai-projects/samples/v1-beta/typescript/tsconfig.json deleted file mode 100644 index 984eed535aa8..000000000000 --- a/sdk/ai/ai-projects/samples/v1-beta/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**/*.ts" - ] -} diff --git a/sdk/ai/ai-projects/src/agents/assistants.ts b/sdk/ai/ai-projects/src/agents/assistants.ts deleted file mode 100644 index 4403f477be76..000000000000 --- a/sdk/ai/ai-projects/src/agents/assistants.ts +++ /dev/null @@ -1,279 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - AgentDeletionStatusOutput, - AgentOutput, - OpenAIPageableListOfAgentOutput, -} from "../customization/outputModels.js"; -import { - validateLimit, - validateMetadata, - validateOrder, - validateVectorStoreDataType, -} from "./inputValidations.js"; -import { TracingUtility } from "../tracing.js"; -import { traceEndCreateOrUpdateAgent, traceStartCreateOrUpdateAgent } from "./assistantsTrace.js"; -import { traceEndAgentGeneric, traceStartAgentGeneric } from "./traceUtility.js"; -import type { - CreateAgentOptionalParams, - DeleteAgentOptionalParams, - GetAgentOptionalParams, - ListAgentsOptionalParams, - UpdateAgentOptionalParams, -} from "./customModels.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import * as ConverterToWire from "../customization/convertModelsToWrite.js"; -import { convertToListQueryParameters } from "../customization/convertParametersToWire.js"; -import { createOpenAIError } from "./openAIError.js"; - -const expectedStatuses = ["200"]; - -enum Tools { - CodeInterpreter = "code_interpreter", - FileSearch = "file_search", - Function = "function", - BingGrounding = "bing_grounding", - MicrosoftFabric = "microsoft_fabric", - SharepointGrounding = "sharepoint_grounding", - AzureAISearch = "azure_ai_search", -} - -/** Creates a new agent. */ -export async function createAgent( - context: Client, - model: string, - options: CreateAgentOptionalParams = {}, -): Promise { - const createOptions: GeneratedParameters.CreateAgentParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...ConverterToWire.convertCreateAgentOptions({ ...options, model }), - }, - }; - - validateCreateAgentParameters(createOptions); - const response = await TracingUtility.withSpan( - "CreateAgent", - createOptions, - async (updatedOptions) => { - const result = await context.path("/assistants").post(updatedOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - traceStartCreateOrUpdateAgent, - traceEndCreateOrUpdateAgent, - ); - return ConvertFromWire.convertAgentOutput(response); -} - -/** Gets a list of agents that were previously created. */ -export async function listAgents( - context: Client, - options: ListAgentsOptionalParams = {}, -): Promise { - const listAgentsOptions: GeneratedParameters.ListAgentsParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: convertToListQueryParameters(options), - }; - - validateListAgentsParameters(listAgentsOptions); - const response = await TracingUtility.withSpan( - "ListAgents", - listAgentsOptions || {}, - async (updateOptions) => { - const result = await context.path("/assistants").get(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - ); - - return ConvertFromWire.convertOpenAIPageableListOfAgentOutput(response); -} - -/** Retrieves an existing agent. */ -export async function getAgent( - context: Client, - assistantId: string, - options: GetAgentOptionalParams = {}, -): Promise { - const getAgentOptions: GeneratedParameters.GetAgentParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateAssistantId(assistantId); - const response = await TracingUtility.withSpan( - "GetAgent", - getAgentOptions, - async (updateOptions) => { - const result = await context - .path("/assistants/{assistantId}", assistantId) - .get(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { agentId: assistantId }, - }), - ); - - return ConvertFromWire.convertAgentOutput(response); -} - -/** Modifies an existing agent. */ -export async function updateAgent( - context: Client, - assistantId: string, - options: UpdateAgentOptionalParams = {}, -): Promise { - const updateAgentOptions: GeneratedParameters.UpdateAgentParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...ConverterToWire.convertUpdateAgentOptions(options), - }, - }; - - validateUpdateAgentParameters(assistantId, updateAgentOptions); - const response = await TracingUtility.withSpan( - "UpdateAgent", - updateAgentOptions, - async (updateOptions) => { - const result = await context - .path("/assistants/{assistantId}", assistantId) - .post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => traceStartCreateOrUpdateAgent(span, updatedOptions, assistantId), - traceEndCreateOrUpdateAgent, - ); - return ConvertFromWire.convertAgentOutput(response); -} - -/** Deletes an agent. */ -export async function deleteAgent( - context: Client, - assistantId: string, - options: DeleteAgentOptionalParams = {}, -): Promise { - const deleteAgentOptions: GeneratedParameters.DeleteAgentParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateAssistantId(assistantId); - const response = await TracingUtility.withSpan( - "DeleteAgent", - deleteAgentOptions, - async (updateOptions) => { - const result = await context - .path("/assistants/{assistantId}", assistantId) - .delete(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - traceStartAgentGeneric, - traceEndAgentGeneric, - ); - return ConvertFromWire.convertAgentDeletionStatusOutput(response); -} - -function validateCreateAgentParameters( - options: GeneratedParameters.CreateAgentParameters | GeneratedParameters.UpdateAgentParameters, -): void { - if (options.body.tools) { - if (options.body.tools.some((value) => !Object.values(Tools).includes(value.type as Tools))) { - throw new Error( - "Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'microsoft_fabric', 'sharepoint_grounding', 'azure_ai_search'", - ); - } - } - if (options.body.tool_resources) { - if (options.body.tool_resources.code_interpreter) { - if ( - options.body.tool_resources.code_interpreter.file_ids && - options.body.tool_resources.code_interpreter.data_sources - ) { - throw new Error("Only file_ids or data_sources can be provided, not both"); - } - if ( - options.body.tool_resources.code_interpreter.file_ids && - options.body.tool_resources.code_interpreter.file_ids.length > 20 - ) { - throw new Error("A maximum of 20 file IDs are allowed"); - } - if (options.body.tool_resources.code_interpreter.data_sources) { - validateVectorStoreDataType(options.body.tool_resources.code_interpreter.data_sources); - } - } - if (options.body.tool_resources.file_search) { - if ( - options.body.tool_resources.file_search.vector_store_ids && - options.body.tool_resources.file_search.vector_store_ids.length > 1 - ) { - throw new Error("Only one vector store ID is allowed"); - } - if (options.body.tool_resources.file_search.vector_stores) { - if (options.body.tool_resources.file_search.vector_stores.length > 1) { - throw new Error("Only one vector store is allowed"); - } - validateVectorStoreDataType( - options.body.tool_resources.file_search.vector_stores[0]?.configuration.data_sources, - ); - } - } - if (options.body.tool_resources.azure_ai_search) { - if ( - options.body.tool_resources.azure_ai_search.indexes && - options.body.tool_resources.azure_ai_search.indexes.length > 1 - ) { - throw new Error("Only one index is allowed"); - } - } - } - if (options.body.temperature && (options.body.temperature < 0 || options.body.temperature > 2)) { - throw new Error("Temperature must be between 0 and 2"); - } - if (options.body.metadata) { - validateMetadata(options.body.metadata); - } -} - -function validateListAgentsParameters(options?: GeneratedParameters.ListAgentsParameters): void { - if (options?.queryParameters?.limit) { - validateLimit(options.queryParameters.limit); - } - if (options?.queryParameters?.order) { - validateOrder(options.queryParameters.order); - } -} - -function validateAssistantId(assistantId: string): void { - if (!assistantId) { - throw new Error("Assistant ID is required"); - } -} - -function validateUpdateAgentParameters( - assistantId: string, - options?: GeneratedParameters.UpdateAgentParameters, -): void { - validateAssistantId(assistantId); - if (options) { - validateCreateAgentParameters(options); - } -} diff --git a/sdk/ai/ai-projects/src/agents/assistantsTrace.ts b/sdk/ai/ai-projects/src/agents/assistantsTrace.ts deleted file mode 100644 index 39f62537b200..000000000000 --- a/sdk/ai/ai-projects/src/agents/assistantsTrace.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AgentOutput } from "../generated/src/outputModels.js"; -import type { TracingAttributeOptions, Span } from "../tracing.js"; -import { TracingUtility, TracingOperationName } from "../tracing.js"; -import type { CreateAgentParameters, UpdateAgentParameters } from "../generated/src/parameters.js"; -import { - addInstructionsEvent, - formatAgentApiResponse, - UpdateWithAgentAttributes, -} from "./traceUtility.js"; - -/** - * Traces the start of creating or updating an agent. - * @param span - The span to trace. - * @param options - The options for creating an agent. - */ -export function traceStartCreateOrUpdateAgent( - span: Span, - options: CreateAgentParameters | UpdateAgentParameters, - agentId?: string, -): void { - const attributes: TracingAttributeOptions = { - operationName: TracingOperationName.CREATE_AGENT, - name: options.body.name ?? undefined, - model: options.body.model, - description: options.body.description ?? undefined, - instructions: options.body.instructions ?? undefined, - topP: options.body.top_p ?? undefined, - temperature: options.body.temperature ?? undefined, - responseFormat: formatAgentApiResponse(options.body.response_format), - }; - if (agentId) { - attributes.operationName = TracingOperationName.CREATE_UPDATE_AGENT; - attributes.agentId = agentId; - } - TracingUtility.setSpanAttributes( - span, - TracingOperationName.CREATE_AGENT, - UpdateWithAgentAttributes(attributes), - ); - addInstructionsEvent(span, options.body); -} - -/** - * Traces the end of creating an agent. - * @param span - The span to trace. - * @param _options - The options for creating an agent. - * @param result - The result of creating an agent. - */ -export async function traceEndCreateOrUpdateAgent( - span: Span, - _options: CreateAgentParameters | UpdateAgentParameters, - result: Promise, -): Promise { - const resolvedResult = await result; - const attributes: TracingAttributeOptions = { - agentId: resolvedResult.id, - }; - TracingUtility.updateSpanAttributes(span, attributes); -} diff --git a/sdk/ai/ai-projects/src/agents/customModels.ts b/sdk/ai/ai-projects/src/agents/customModels.ts deleted file mode 100644 index c2686a1a7e28..000000000000 --- a/sdk/ai/ai-projects/src/agents/customModels.ts +++ /dev/null @@ -1,352 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { OperationOptions, RequestParameters } from "@azure-rest/core-client"; -import type { AbortSignalLike } from "@azure/abort-controller"; -import type { ThreadRunOutput } from "../customization/outputModels.js"; -import type { AgentEventMessageStream } from "./streamingModels.js"; -import type { - AgentThreadCreationOptions, - CreateAgentOptions, - CreateAndRunThreadOptions, - CreateRunOptions, - UpdateAgentOptions, - UpdateAgentThreadOptions, - VectorStoreFileStatusFilter, - VectorStoreOptions, - VectorStoreUpdateOptions, -} from "../customization/models.js"; -import type { - ListMessagesQueryParamProperties, - ListFilesQueryParamProperties, -} from "../customization/parameters.js"; -import type { - CreateVectorStoreFileBatchOptions, - CreateVectorStoreFileOptions, -} from "./vectorStoresModels.js"; - -/** - * Optional request parameters support passing headers, abort signal, etc. - */ -export type OptionalRequestParameters = Pick< - RequestParameters, - "headers" | "timeout" | "abortSignal" | "tracingOptions" ->; - -/** - * Request options for list requests. - */ -export interface ListQueryParameters { - /** - * A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - */ - limit?: number; - - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - */ - order?: "asc" | "desc"; - - /** - * A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. - */ - after?: string; - - /** - * A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. - */ - before?: string; -} - -/** - * Options for configuring polling behavior. - */ -export interface PollingOptions { - /** - * The interval, in milliseconds, to wait between polling attempts. If not specified, a default interval of 1000ms will be used. - */ - sleepIntervalInMs?: number; - - /** - * An AbortSignalLike object (as defined by \@azure/abort-controller) that can be used to cancel the polling operation. - */ - abortSignal?: AbortSignalLike; -} - -/** - * Optional parameters configuring polling behavior. - */ -export interface PollingOptionsParams { - /** Options for configuring polling behavior. */ - pollingOptions?: PollingOptions; -} - -/** - * Agent run response with support to stream. - */ -export type AgentRunResponse = PromiseLike & { - /** - * Function to start streaming the agent event messages. - * @returns A promise that resolves to an AgentEventMessageStream. - */ - stream: () => Promise; -}; - -/** - * Optional parameters for creating and running a thread, excluding the assistantId. - */ -export type CreateRunOptionalParams = Omit & - OperationOptions; - -/** - * Optional parameters for creating and running a thread, excluding the assistantId. - */ -export type CreateAndRunThreadOptionalParams = Omit & - OperationOptions; - -/** - * Optional parameters for listing run queries. - */ -export interface ListRunQueryOptionalParams extends ListQueryParameters, OperationOptions {} - -/** - * Optional parameters for getting a run. - */ -export interface GetRunOptionalParams extends OperationOptions {} - -/** - * Optional parameters for canceling a run. - */ -export interface CancelRunOptionalParams extends OperationOptions {} - -/** - * Optional parameters for submitting tool outputs to a run. - */ -export interface SubmitToolOutputsToRunOptionalParams extends OperationOptions { - /** - * Whether to stream the tool outputs. - */ - stream?: boolean; -} - -/** - * Optional parameters for updating a run. - */ -export interface UpdateRunOptionalParams extends OperationOptions { - /** Metadata to update in the run. */ - metadata?: Record | null; -} - -/** - * Optional parameters for creating an agent thread. - */ -export interface CreateAgentThreadOptionalParams - extends AgentThreadCreationOptions, - OperationOptions {} - -/** - * Optional parameters for getting an agent thread. - */ -export interface GetAgentThreadOptionalParams extends OperationOptions {} - -/** - * Optional parameters for updating an agent thread. - */ -export interface UpdateAgentThreadOptionalParams - extends UpdateAgentThreadOptions, - OperationOptions {} - -/** - * Optional parameters for deleting an agent thread. - */ -export interface DeleteAgentThreadOptionalParams extends OperationOptions {} - -/** - * Optional parameters for getting an run step. - */ -export interface GetRunStepOptionalParams extends OperationOptions {} - -/** - * Optional parameters for listing run steps. - */ -export interface ListRunStepsOptionalParams extends ListQueryParameters, OperationOptions {} - -/** - * Optional parameters for creating a message. - */ -export interface CreateMessageOptionalParams extends OperationOptions {} - -/** - * Optional parameters for updating a message. - */ -export interface UpdateMessageOptionalParams extends OperationOptions { - /** Metadata to update in the message. */ - metadata?: Record | null; -} - -/** - * Optional parameters for listing messages. - */ -export interface ListMessagesOptionalParams - extends ListMessagesQueryParamProperties, - OperationOptions {} - -/** - * Optional parameters creating vector store. - */ -export interface CreateVectorStoreOptionalParams extends VectorStoreOptions, OperationOptions {} - -/** - * Optional parameters for creating vector store with polling. - */ -export interface CreateVectorStoreWithPollingOptionalParams - extends CreateVectorStoreOptionalParams, - PollingOptionsParams {} - -/** - * Optional parameters for listing vector stores. - */ -export interface ListVectorStoresOptionalParams extends ListQueryParameters, OperationOptions {} - -/** - * Optional parameters for updating a vector store. - */ -export interface UpdateVectorStoreOptionalParams - extends VectorStoreUpdateOptions, - OperationOptions {} - -/** - * Optional parameters for deleting a vector store. - */ -export interface DeleteVectorStoreOptionalParams extends OperationOptions {} - -/** - * Optional parameters for getting a vector store. - */ -export interface GetVectorStoreOptionalParams extends OperationOptions {} - -/** - * Optional parameters for listing vector store files. - */ -export interface ListVectorStoreFilesOptionalParams extends ListQueryParameters, OperationOptions {} - -/** - * Optional parameters for creating a vector store file. - */ -export interface CreateVectorStoreFileOptionalParams - extends CreateVectorStoreFileOptions, - OperationOptions {} - -/** - * Optional parameters for getting a vector store file. - */ -export interface GetVectorStoreFileOptionalParams extends OperationOptions {} - -/** - * Optional parameters for deleting a vector store file. - */ -export interface DeleteVectorStoreFileOptionalParams extends OperationOptions {} - -/** - * Optional parameters for creating a vector store file with polling. - */ -export interface CreateVectorStoreFileWithPollingOptionalParams - extends CreateVectorStoreFileOptions, - PollingOptionsParams, - OperationOptions {} - -/** - * Optional parameters for listing vector store file batches. - */ -export interface ListVectorStoreFileBatchFilesOptionalParams - extends ListQueryParameters, - OperationOptions { - /** Filter by file status. */ - filter?: VectorStoreFileStatusFilter; -} - -/** - * Optional parameters for getting a vector store file batch. - */ -export interface GetVectorStoreFileBatchOptionalParams extends OperationOptions {} - -/** - * Optional parameters for canceling a vector store file batch. - */ -export interface CancelVectorStoreFileBatchOptionalParams extends OperationOptions {} - -/** - * Optional parameters for creating a vector store file batch. - */ -export interface CreateVectorStoreFileBatchOptionalParams - extends CreateVectorStoreFileBatchOptions, - OperationOptions {} - -/** - * Optional parameters for creating a vector store file batch with polling. - */ -export interface CreateVectorStoreFileBatchWithPollingOptionalParams - extends CreateVectorStoreFileBatchOptionalParams, - PollingOptionsParams {} - -/** - * Optional parameters for creating agent. - */ -export interface CreateAgentOptionalParams - extends Omit, - OperationOptions {} - -/** - * Optional parameters for updating agent. - */ -export interface UpdateAgentOptionalParams extends UpdateAgentOptions, OperationOptions {} - -/** - * Optional parameters for deleting agent. - */ -export interface DeleteAgentOptionalParams extends OperationOptions {} - -/** - * Optional parameters for getting agent. - */ -export interface GetAgentOptionalParams extends OperationOptions {} - -/** - * Optional parameters for listing agents. - */ -export interface ListAgentsOptionalParams extends ListQueryParameters, OperationOptions {} - -/** - * Optional parameters for listing files. - */ -export interface ListFilesOptionalParams extends ListFilesQueryParamProperties, OperationOptions {} - -/** - * Optional parameters for deleting a file. - */ -export interface DeleteFileOptionalParams extends OperationOptions {} - -/** - * Optional parameters for getting a file. - */ -export interface GetFileOptionalParams extends OperationOptions {} - -/** - * Optional parameters for getting file content. - */ -export interface GetFileContentOptionalParams extends OperationOptions {} - -/** - * Optional parameters for uploading a file. - */ -export interface UploadFileOptionalParams extends OperationOptions { - /** The name of the file. */ - fileName?: string; -} - -/** - * Optional parameters for uploading a file with polling. - */ -export interface UploadFileWithPollingOptionalParams - extends UploadFileOptionalParams, - PollingOptionsParams {} diff --git a/sdk/ai/ai-projects/src/agents/files.ts b/sdk/ai/ai-projects/src/agents/files.ts deleted file mode 100644 index d199a43962db..000000000000 --- a/sdk/ai/ai-projects/src/agents/files.ts +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client, StreamableMethod } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - FileDeletionStatusOutput, - FileListResponseOutput, - OpenAIFileOutput, -} from "../customization/outputModels.js"; -import type { FilePurpose as CustomizedFilePurpose } from "../customization/models.js"; -import type { - DeleteFileOptionalParams, - GetFileContentOptionalParams, - GetFileOptionalParams, - ListFilesOptionalParams, - UploadFileWithPollingOptionalParams, -} from "./customModels.js"; -import { AgentsPoller } from "./poller.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import * as ConvertParameters from "../customization/convertParametersToWire.js"; -import { randomUUID } from "@azure/core-util"; -import { createOpenAIError } from "./openAIError.js"; -import type { PollerLike, PollOperationState } from "@azure/core-lro"; -const expectedStatuses = ["200"]; - -enum FilePurpose { - FineTune = "fine-tune", - FineTuneResults = "fine-tune-results", - Assistants = "assistants", - AssistantsOutput = "assistants_output", - Batch = "batch", - BatchOutput = "batch_output", - Vision = "vision", -} - -/** Gets a list of previously uploaded files. */ -export async function listFiles( - context: Client, - options: ListFilesOptionalParams = {}, -): Promise { - const listOptions: GeneratedParameters.ListFilesParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: ConvertParameters.convertListFilesQueryParamProperties(options), - }; - validateListFilesParameters(listOptions); - const result = await context.path("/files").get(options); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertFileListResponseOutput(result.body); -} - -/** Uploads a file for use by other operations. */ -export async function uploadFile( - context: Client, - content: ReadableStream | NodeJS.ReadableStream, - purpose: CustomizedFilePurpose, - options: UploadFileWithPollingOptionalParams = {}, -): Promise { - const uploadFileOptions: GeneratedParameters.UploadFileParameters = { - ...operationOptionsToRequestParameters(options), - body: [ - { name: "file" as const, body: content, filename: options.fileName ?? randomUUID() }, - { name: "purpose" as const, body: purpose }, - ], - contentType: "multipart/form-data", - }; - const result = await context.path("/files").post(uploadFileOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertOpenAIFileOutput(result.body); -} - -export function uploadFileAndPoll( - context: Client, - content: ReadableStream | NodeJS.ReadableStream, - purpose: CustomizedFilePurpose, - options: UploadFileWithPollingOptionalParams = {}, -): PollerLike, OpenAIFileOutput> { - async function updateUploadFileAndPoll( - currentResult?: OpenAIFileOutput, - ): Promise<{ result: OpenAIFileOutput; completed: boolean }> { - let file: OpenAIFileOutput; - if (!currentResult) { - file = await uploadFile(context, content, purpose, options); - } else { - file = await getFile(context, currentResult.id, options); - } - return { - result: file, - completed: - file.status === "uploaded" || file.status === "processed" || file.status === "deleted", - }; - } - return new AgentsPoller({ - update: updateUploadFileAndPoll, - pollingOptions: options.pollingOptions ?? {}, - }); -} - -/** Delete a previously uploaded file. */ -export async function deleteFile( - context: Client, - fileId: string, - options: DeleteFileOptionalParams = {}, -): Promise { - const deleteOptions: GeneratedParameters.ListFilesParameters = { - ...operationOptionsToRequestParameters(options), - }; - validateFileId(fileId); - const result = await context.path("/files/{fileId}", fileId).delete(deleteOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; -} - -/** Returns information about a specific file. Does not retrieve file content. */ -export async function getFile( - context: Client, - fileId: string, - options: GetFileOptionalParams = {}, -): Promise { - validateFileId(fileId); - const getFileOptions: GeneratedParameters.ListFilesParameters = { - ...operationOptionsToRequestParameters(options), - }; - const result = await context.path("/files/{fileId}", fileId).get(getFileOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertOpenAIFileOutput(result.body); -} - -/** Returns file content. */ -export function getFileContent( - context: Client, - fileId: string, - options: GetFileContentOptionalParams = {}, -): StreamableMethod { - validateFileId(fileId); - const getFileContentOptions: GeneratedParameters.ListFilesParameters = { - ...operationOptionsToRequestParameters(options), - }; - return context.path("/files/{fileId}/content", fileId).get(getFileContentOptions); -} - -function validateListFilesParameters(options?: GeneratedParameters.ListFilesParameters): void { - if (options?.queryParameters?.purpose) { - if (!Object.values(FilePurpose).includes(options?.queryParameters?.purpose as FilePurpose)) { - throw new Error( - "Purpose must be one of 'fine-tune', 'fine-tune-results', 'assistants', 'assistants_output', 'batch', 'batch_output', 'vision'", - ); - } - } -} - -function validateFileId(fileId: string): void { - if (!fileId) { - throw new Error("File ID is required"); - } -} diff --git a/sdk/ai/ai-projects/src/agents/index.ts b/sdk/ai/ai-projects/src/agents/index.ts deleted file mode 100644 index 234c03d48238..000000000000 --- a/sdk/ai/ai-projects/src/agents/index.ts +++ /dev/null @@ -1,489 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { type Client, type StreamableMethod } from "@azure-rest/core-client"; -import type { - FileDeletionStatusOutput, - FileListResponseOutput, - OpenAIFileOutput, -} from "../customization/outputModels.js"; -import type { - OpenAIPageableListOfThreadRunOutput, - ThreadRunOutput, - AgentThreadOutput, - RunStepOutput, - OpenAIPageableListOfRunStepOutput, - ThreadMessageOutput, - ThreadDeletionStatusOutput, - OpenAIPageableListOfThreadMessageOutput, - OpenAIPageableListOfVectorStoreOutput, - VectorStoreOutput, - VectorStoreFileOutput, - VectorStoreDeletionStatusOutput, - VectorStoreFileDeletionStatusOutput, - VectorStoreFileBatchOutput, - OpenAIPageableListOfVectorStoreFileOutput, - AgentDeletionStatusOutput, - AgentOutput, - OpenAIPageableListOfAgentOutput, -} from "../customization/outputModels.js"; -import { createAgent, deleteAgent, getAgent, listAgents, updateAgent } from "./assistants.js"; -import { - deleteFile, - getFile, - getFileContent, - listFiles, - uploadFile, - uploadFileAndPoll, -} from "./files.js"; -import { createThread, deleteThread, getThread, updateThread } from "./threads.js"; -import { - cancelRun, - createRun, - createThreadAndRun, - getRun, - listRuns, - submitToolOutputsToRun, - updateRun, -} from "./runs.js"; -import { createMessage, listMessages, updateMessage } from "./messages.js"; -import type { FilePurpose } from "../customization/models.js"; -import { - createVectorStore, - createVectorStoreAndPoll, - deleteVectorStore, - getVectorStore, - listVectorStores, - modifyVectorStore, -} from "./vectorStores.js"; -import { getRunStep, listRunSteps } from "./runSteps.js"; -import { - createVectorStoreFile, - createVectorStoreFileAndPoll, - deleteVectorStoreFile, - getVectorStoreFile, - listVectorStoreFiles, -} from "./vectorStoresFiles.js"; -import { - cancelVectorStoreFileBatch, - createVectorStoreFileBatch, - createVectorStoreFileBatchAndPoll, - getVectorStoreFileBatch, - listVectorStoreFileBatchFiles, -} from "./vectorStoresFileBatches.js"; -import type { - AgentRunResponse, - CreateRunOptionalParams, - GetRunOptionalParams, - CancelRunOptionalParams, - SubmitToolOutputsToRunOptionalParams, - UpdateRunOptionalParams, - ListRunQueryOptionalParams, - CreateAndRunThreadOptionalParams, - CreateAgentThreadOptionalParams, - GetAgentThreadOptionalParams, - UpdateAgentThreadOptionalParams, - DeleteAgentThreadOptionalParams, - GetRunStepOptionalParams, - ListRunStepsOptionalParams, - CreateMessageOptionalParams, - ListMessagesOptionalParams, - UpdateMessageOptionalParams, - GetVectorStoreOptionalParams, - ListVectorStoresOptionalParams, - UpdateVectorStoreOptionalParams, - DeleteVectorStoreOptionalParams, - CreateVectorStoreOptionalParams, - CreateVectorStoreWithPollingOptionalParams, - CreateVectorStoreFileOptionalParams, - ListVectorStoreFilesOptionalParams, - GetVectorStoreFileOptionalParams, - DeleteVectorStoreFileOptionalParams, - CreateVectorStoreFileWithPollingOptionalParams, - CreateVectorStoreFileBatchOptionalParams, - GetVectorStoreFileBatchOptionalParams, - ListVectorStoreFileBatchFilesOptionalParams, - CreateVectorStoreFileBatchWithPollingOptionalParams, - CreateAgentOptionalParams, - ListAgentsOptionalParams, - GetAgentOptionalParams, - UpdateAgentOptionalParams, - DeleteFileOptionalParams, - GetFileOptionalParams, - GetFileContentOptionalParams, - ListFilesOptionalParams, - UploadFileOptionalParams, - UploadFileWithPollingOptionalParams, - CancelVectorStoreFileBatchOptionalParams, - DeleteAgentOptionalParams, -} from "./customModels.js"; -import type { ThreadMessageOptions, ToolOutput } from "../customization/models.js"; -import type { PollerLike, PollOperationState } from "@azure/core-lro"; - -/** - * Agents Interface Contains operations for creating, listing, updating, and deleting agents, threads, runs, messages, and files. - */ -export interface AgentsOperations { - /** Creates a new agent. */ - createAgent: (model: string, options?: CreateAgentOptionalParams) => Promise; - - /** Gets a list of agents that were previously created. */ - listAgents: (options?: ListAgentsOptionalParams) => Promise; - /** Retrieves an existing agent. */ - getAgent: (assistantId: string, options?: GetAgentOptionalParams) => Promise; - /** Modifies an existing agent. */ - updateAgent: (assistantId: string, options: UpdateAgentOptionalParams) => Promise; - /** Deletes an agent. */ - deleteAgent: ( - assistantId: string, - options?: DeleteAgentOptionalParams, - ) => Promise; - - /** Creates a new thread. Threads contain messages and can be run by agents. */ - createThread: (options?: CreateAgentThreadOptionalParams) => Promise; - /** Gets information about an existing thread. */ - getThread: ( - threadId: string, - options?: GetAgentThreadOptionalParams, - ) => Promise; - /** Modifies an existing thread. */ - updateThread: ( - threadId: string, - options?: UpdateAgentThreadOptionalParams, - ) => Promise; - /** Deletes an existing thread. */ - deleteThread: ( - threadId: string, - options?: DeleteAgentThreadOptionalParams, - ) => Promise; - - /** Creates and starts a new run of the specified thread using the specified agent. */ - createRun: ( - threadId: string, - assistantId: string, - options?: CreateRunOptionalParams, - ) => AgentRunResponse; - - /** Gets a list of runs for a specified thread. */ - listRuns: ( - threadId: string, - options?: ListRunQueryOptionalParams, - ) => Promise; - /** Gets an existing run from an existing thread. */ - getRun: ( - threadId: string, - runId: string, - options?: GetRunOptionalParams, - ) => Promise; - /** Modifies an existing thread run. */ - updateRun: ( - threadId: string, - runId: string, - options?: UpdateRunOptionalParams, - ) => Promise; - /** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */ - submitToolOutputsToRun: ( - threadId: string, - runId: string, - toolOutputs: Array, - options?: SubmitToolOutputsToRunOptionalParams, - ) => AgentRunResponse; - - /** Cancels a run of an in progress thread. */ - cancelRun: ( - threadId: string, - runId: string, - options?: CancelRunOptionalParams, - ) => Promise; - /** Creates a new thread and immediately starts a run of that thread. */ - createThreadAndRun: ( - assistantId: string, - options?: CreateAndRunThreadOptionalParams, - ) => AgentRunResponse; - - /** Creates a new message on a specified thread. */ - createMessage: ( - threadId: string, - messageOptions: ThreadMessageOptions, - options?: CreateMessageOptionalParams, - ) => Promise; - /** Gets a list of messages that exist on a thread. */ - listMessages: ( - threadId: string, - options?: ListMessagesOptionalParams, - ) => Promise; - /** Modifies an existing message on an existing thread. */ - updateMessage: ( - threadId: string, - messageId: string, - options?: UpdateMessageOptionalParams, - ) => Promise; - - /** Gets a list of previously uploaded files. */ - listFiles: (options?: ListFilesOptionalParams) => Promise; - /** Uploads a file for use by other operations. */ - uploadFile: ( - data: ReadableStream | NodeJS.ReadableStream, - purpose: FilePurpose, - options?: UploadFileOptionalParams, - ) => Promise; - - /** Uploads a file for use by other operations. */ - uploadFileAndPoll: ( - data: ReadableStream | NodeJS.ReadableStream, - purpose: FilePurpose, - options?: UploadFileWithPollingOptionalParams, - ) => PollerLike, OpenAIFileOutput>; - /** Delete a previously uploaded file. */ - deleteFile: ( - fileId: string, - options?: DeleteFileOptionalParams, - ) => Promise; - /** Returns information about a specific file. Does not retrieve file content. */ - getFile: (fileId: string, options?: GetFileOptionalParams) => Promise; - /** Returns the content of a specific file. */ - getFileContent: ( - fileId: string, - options?: GetFileContentOptionalParams, - ) => StreamableMethod; - - /** Returns a list of vector stores. */ - listVectorStores: ( - options?: DeleteVectorStoreOptionalParams, - ) => Promise; - /** Creates a vector store. */ - createVectorStore: (options?: CreateVectorStoreOptionalParams) => Promise; - /** Returns the vector store object object matching the specific ID. */ - getVectorStore: ( - vectorStoreId: string, - options?: DeleteVectorStoreOptionalParams, - ) => Promise; - /** The ID of the vector store to modify. */ - modifyVectorStore: ( - vectorStoreId: string, - options?: UpdateVectorStoreOptionalParams, - ) => Promise; - /** Deletes the vector store object matching the specified ID. */ - deleteVectorStore: ( - vectorStoreId: string, - options?: DeleteVectorStoreOptionalParams, - ) => Promise; - - /** Create vector store and poll. */ - createVectorStoreAndPoll: ( - options?: CreateVectorStoreWithPollingOptionalParams, - ) => PollerLike, VectorStoreOutput>; - - /** Create a vector store file by attching a file to a vector store. */ - createVectorStoreFile: ( - vectorStoreId: string, - options?: CreateVectorStoreFileOptionalParams, - ) => Promise; - /** Retrieves a vector store file. */ - getVectorStoreFile: ( - vectorStoreId: string, - fileId: string, - options?: GetVectorStoreFileOptionalParams, - ) => Promise; - /** Returns a list of vector store files. */ - listVectorStoreFiles: ( - vectorStoreId: string, - options?: ListVectorStoreFilesOptionalParams, - ) => Promise; - /** - * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. - * To delete the file, use the delete file endpoint. - */ - deleteVectorStoreFile: ( - vectorStoreId: string, - fileId: string, - options?: DeleteVectorStoreFileOptionalParams, - ) => Promise; - /** Create a vector store file by attaching a file to a vector store and poll. */ - createVectorStoreFileAndPoll: ( - vectorStoreId: string, - options?: CreateVectorStoreFileWithPollingOptionalParams, - ) => PollerLike, VectorStoreFileOutput>; - - /** Create a vector store file batch. */ - createVectorStoreFileBatch: ( - vectorStoreId: string, - options?: CreateVectorStoreFileBatchOptionalParams, - ) => Promise; - /** Retrieve a vector store file batch. */ - getVectorStoreFileBatch: ( - vectorStoreId: string, - batchId: string, - options?: GetVectorStoreFileBatchOptionalParams, - ) => Promise; - /** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */ - cancelVectorStoreFileBatch: ( - vectorStoreId: string, - batchId: string, - options?: CancelVectorStoreFileBatchOptionalParams, - ) => Promise; - /** Returns a list of vector store files in a batch. */ - listVectorStoreFileBatchFiles: ( - vectorStoreId: string, - batchId: string, - options?: ListVectorStoreFileBatchFilesOptionalParams, - ) => Promise; - /** Create a vector store file batch and poll. */ - createVectorStoreFileBatchAndPoll: ( - vectorStoreId: string, - options?: CreateVectorStoreFileBatchWithPollingOptionalParams, - ) => PollerLike, VectorStoreFileBatchOutput>; - - /** Gets a single run step from a thread run. */ - getRunStep: ( - threadId: string, - runId: string, - stepId: string, - options?: GetRunStepOptionalParams, - ) => Promise; - /** Gets a list of run steps from a thread run. */ - listRunSteps: ( - threadId: string, - runId: string, - options?: ListRunQueryOptionalParams, - ) => Promise; -} - -function getAgents(context: Client): AgentsOperations { - return { - createAgent: (model: string, options?: CreateAgentOptionalParams) => - createAgent(context, model, options), - listAgents: (options?: ListAgentsOptionalParams) => listAgents(context, options), - getAgent: (assistantId: string, options?: GetAgentOptionalParams) => - getAgent(context, assistantId, options), - updateAgent: (assistantId: string, options: UpdateAgentOptionalParams) => - updateAgent(context, assistantId, options), - deleteAgent: (assistantId: string, options?: DeleteAgentOptionalParams) => - deleteAgent(context, assistantId, options), - - createThread: (options?: CreateAgentThreadOptionalParams) => createThread(context, options), - getThread: (threadId: string, options?: GetAgentThreadOptionalParams) => - getThread(context, threadId, options), - updateThread: (threadId: string, options?: UpdateAgentThreadOptionalParams) => - updateThread(context, threadId, options), - deleteThread: (threadId: string, options?: DeleteAgentThreadOptionalParams) => - deleteThread(context, threadId, options), - - createRun: (threadId: string, assistantId: string, options?: CreateRunOptionalParams) => - createRun(context, threadId, assistantId, options ?? {}), - listRuns: (threadId: string, options?: ListRunQueryOptionalParams) => - listRuns(context, threadId, options ?? {}), - getRun: (threadId: string, runId: string, options?: GetRunOptionalParams) => - getRun(context, threadId, runId, options), - updateRun: (threadId: string, runId: string, options?: UpdateRunOptionalParams) => - updateRun(context, threadId, runId, options), - submitToolOutputsToRun: ( - threadId: string, - runId: string, - toolOutputs: Array, - options?: SubmitToolOutputsToRunOptionalParams, - ) => submitToolOutputsToRun(context, threadId, runId, toolOutputs, options), - cancelRun: (threadId: string, runId: string, options?: CancelRunOptionalParams) => - cancelRun(context, threadId, runId, options), - createThreadAndRun: (assistantId: string, options?: CreateAndRunThreadOptionalParams) => - createThreadAndRun(context, assistantId, options ?? {}), - - createMessage: ( - threadId: string, - messageOptions: ThreadMessageOptions, - options?: CreateMessageOptionalParams, - ) => createMessage(context, threadId, messageOptions, options), - listMessages: (threadId: string, options?: ListMessagesOptionalParams) => - listMessages(context, threadId, options), - updateMessage: (threadId: string, messageId: string, options?: UpdateMessageOptionalParams) => - updateMessage(context, threadId, messageId, options), - - listFiles: (options?: ListFilesOptionalParams) => listFiles(context, options), - uploadFile: ( - content: ReadableStream | NodeJS.ReadableStream, - purpose: FilePurpose, - options?: UploadFileOptionalParams, - ) => uploadFile(context, content, purpose, options), - uploadFileAndPoll: ( - content: ReadableStream | NodeJS.ReadableStream, - purpose: FilePurpose, - options?: UploadFileWithPollingOptionalParams, - ) => uploadFileAndPoll(context, content, purpose, options), - deleteFile: (fileId: string, options?: DeleteFileOptionalParams) => - deleteFile(context, fileId, options), - getFile: (fileId: string, options?: GetFileOptionalParams) => getFile(context, fileId, options), - getFileContent: (fileId: string, options?: GetFileContentOptionalParams) => - getFileContent(context, fileId, options), - - listVectorStores: (options?: ListVectorStoresOptionalParams) => - listVectorStores(context, options), - createVectorStore: (options?: CreateVectorStoreOptionalParams) => - createVectorStore(context, options), - getVectorStore: (vectorStoreId: string, options?: GetVectorStoreOptionalParams) => - getVectorStore(context, vectorStoreId, options), - modifyVectorStore: (vectorStoreId: string, options?: UpdateVectorStoreOptionalParams) => - modifyVectorStore(context, vectorStoreId, options), - deleteVectorStore: (vectorStoreId: string, options?: DeleteVectorStoreOptionalParams) => - deleteVectorStore(context, vectorStoreId, options), - createVectorStoreAndPoll: (options?: CreateVectorStoreWithPollingOptionalParams) => - createVectorStoreAndPoll(context, options), - - createVectorStoreFile: (vectorStoreId: string, options?: CreateVectorStoreFileOptionalParams) => - createVectorStoreFile(context, vectorStoreId, options), - getVectorStoreFile: ( - vectorStoreId: string, - fileId: string, - options?: GetVectorStoreFileOptionalParams, - ) => getVectorStoreFile(context, vectorStoreId, fileId, options), - listVectorStoreFiles: (vectorStoreId: string, options?: ListVectorStoreFilesOptionalParams) => - listVectorStoreFiles(context, vectorStoreId, options), - deleteVectorStoreFile: ( - vectorStoreId: string, - fileId: string, - options?: DeleteVectorStoreFileOptionalParams, - ) => deleteVectorStoreFile(context, vectorStoreId, fileId, options), - createVectorStoreFileAndPoll: ( - vectorStoreId: string, - options?: CreateVectorStoreFileWithPollingOptionalParams, - ) => createVectorStoreFileAndPoll(context, vectorStoreId, options), - - createVectorStoreFileBatch: ( - vectorStoreId: string, - options?: CreateVectorStoreFileBatchOptionalParams, - ) => createVectorStoreFileBatch(context, vectorStoreId, options), - getVectorStoreFileBatch: ( - vectorStoreId: string, - batchId: string, - options?: GetVectorStoreFileBatchOptionalParams, - ) => getVectorStoreFileBatch(context, vectorStoreId, batchId, options), - cancelVectorStoreFileBatch: ( - vectorStoreId: string, - batchId: string, - options?: CancelVectorStoreFileBatchOptionalParams, - ) => cancelVectorStoreFileBatch(context, vectorStoreId, batchId, options), - listVectorStoreFileBatchFiles: ( - vectorStoreId: string, - batchId: string, - options?: ListVectorStoreFileBatchFilesOptionalParams, - ) => listVectorStoreFileBatchFiles(context, vectorStoreId, batchId, options), - createVectorStoreFileBatchAndPoll: ( - vectorStoreId: string, - options?: CreateVectorStoreFileBatchWithPollingOptionalParams, - ) => createVectorStoreFileBatchAndPoll(context, vectorStoreId, options), - - getRunStep: ( - threadId: string, - runId: string, - stepId: string, - options?: GetRunStepOptionalParams, - ) => getRunStep(context, threadId, runId, stepId, options), - listRunSteps: (threadId: string, runId: string, options?: ListRunStepsOptionalParams) => - listRunSteps(context, threadId, runId, options), - }; -} - -export function getAgentsOperations(context: Client): AgentsOperations { - return { - ...getAgents(context), - }; -} diff --git a/sdk/ai/ai-projects/src/agents/inputOutputs.ts b/sdk/ai/ai-projects/src/agents/inputOutputs.ts deleted file mode 100644 index 64a947f76592..000000000000 --- a/sdk/ai/ai-projects/src/agents/inputOutputs.ts +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export * from "../customization/streamingModels.js"; -export * from "./streamingModels.js"; -export * from "./vectorStoresModels.js"; -export * from "./utils.js"; -export * from "../customization/streamingModels.js"; -export type { - OpenAIPageableListOfThreadRunOutput, - ThreadRunOutput, - AgentThreadOutput, - RunStepOutput, - OpenAIPageableListOfRunStepOutput, - ThreadMessageOutput, - ThreadDeletionStatusOutput, - OpenAIPageableListOfThreadMessageOutput, - OpenAIPageableListOfVectorStoreOutput, - VectorStoreOutput, - VectorStoreFileOutput, - VectorStoreDeletionStatusOutput, - VectorStoreFileDeletionStatusOutput, - VectorStoreFileBatchOutput, - OpenAIPageableListOfVectorStoreFileOutput, - AgentDeletionStatusOutput, - AgentOutput, - OpenAIPageableListOfAgentOutput, - FileDeletionStatusOutput, - FileListResponseOutput, - OpenAIFileOutput, - RequiredActionOutput, - RequiredToolCallOutput, - ToolDefinitionOutputParent, - AgentsApiResponseFormatOptionOutput, - ToolDefinitionOutput, - ToolResourcesOutput, - AgentsApiResponseFormatModeOutput, - AgentsApiResponseFormatOutput, - ApiResponseFormatOutput, - FilePurposeOutput, - FileStateOutput, - RequiredActionOutputParent, - SubmitToolOutputsActionOutput, - RequiredToolCallOutputParent, - RequiredFunctionToolCallOutput, - RunStepErrorOutput, - RunStepStatusOutput, - RunStepDetailsOutput, - RunStepTypeOutput, - RunStepCompletionUsageOutput, - MessageAttachmentOutput, - MessageContentOutput, - MessageIncompleteDetailsOutput, - MessageRoleOutput, - MessageStatusOutput, - IncompleteRunDetailsOutput, - RunErrorOutput, - RunStatusOutput, - AgentsApiToolChoiceOptionOutput, - UpdateToolResourcesOptionsOutput, - TruncationObjectOutput, - RunCompletionUsageOutput, - CodeInterpreterToolDefinitionOutput, - FileSearchToolDefinitionOutput, - FunctionToolDefinitionOutput, - BingGroundingToolDefinitionOutput, - AzureAISearchToolDefinitionOutput, - AzureAISearchResourceOutput, - CodeInterpreterToolResourceOutput, - FileSearchToolResourceOutput, - VectorStoreFileCountOutput, - VectorStoreFileBatchStatusOutput, - VectorStoreChunkingStrategyResponseOutput, - VectorStoreConfigurationOutput, - AgentsNamedToolChoiceOutput, - IndexResourceOutput, - ToolConnectionListOutput, - VectorStoreDataSourceOutput, - FileSearchToolDefinitionDetailsOutput, - VectorStoreConfigurationsOutput, - FunctionDefinitionOutput, - MessageAttachmentToolDefinitionOutput, - MessageContentOutputParent, - MessageTextContentOutput, - MessageImageFileContentOutput, - RequiredFunctionToolCallDetailsOutput, - RunStepDetailsOutputParent, - RunStepMessageCreationDetailsOutput, - RunStepToolCallDetailsOutput, - RunStepErrorCodeOutput, - SubmitToolOutputsDetailsOutput, - MicrosoftFabricToolDefinitionOutput, - SharepointToolDefinitionOutput, - UpdateCodeInterpreterToolResourceOptionsOutput, - UpdateFileSearchToolResourceOptionsOutput, - VectorStoreChunkingStrategyResponseOutputParent, - VectorStoreAutoChunkingStrategyResponseOutput, - VectorStoreStaticChunkingStrategyResponseOutput, - VectorStoreFileErrorOutput, - VectorStoreFileStatusOutput, - VectorStoreExpirationPolicyOutput, - VectorStoreStatusOutput, - AgentsApiToolChoiceOptionModeOutput, - FunctionNameOutput, - AgentsNamedToolChoiceTypeOutput, - MessageImageFileDetailsOutput, - MessageIncompleteDetailsReasonOutput, - MessageTextDetailsOutput, - RunStepMessageCreationReferenceOutput, - RunStepToolCallOutput, - ToolConnectionOutput, - TruncationStrategyOutput, - VectorStoreChunkingStrategyResponseTypeOutput, - VectorStoreDataSourceAssetTypeOutput, - VectorStoreExpirationPolicyAnchorOutput, - VectorStoreFileErrorCodeOutput, - VectorStoreStaticChunkingStrategyOptionsOutput, - FileSearchRankingOptionsOutput, - MessageTextAnnotationOutput, - RunStepToolCallOutputParent, - RunStepCodeInterpreterToolCallOutput, - RunStepFileSearchToolCallOutput, - RunStepBingGroundingToolCallOutput, - RunStepAzureAISearchToolCallOutput, - RunStepSharepointToolCallOutput, - RunStepMicrosoftFabricToolCallOutput, - RunStepFunctionToolCallOutput, - MessageTextAnnotationOutputParent, - MessageTextFileCitationAnnotationOutput, - MessageTextFilePathAnnotationOutput, - RunStepCodeInterpreterToolCallOutputOutputParent, - RunStepCodeInterpreterToolCallDetailsOutput, - RunStepFunctionToolCallDetailsOutput, - MessageTextFileCitationDetailsOutput, - MessageTextFilePathDetailsOutput, - RunStepCodeInterpreterToolCallOutputOutput, - RunStepCodeInterpreterLogOutputOutput, - RunStepCodeInterpreterImageOutputOutput, - RunStepCodeInterpreterImageReferenceOutput, -} from "../customization/outputModels.js"; -export { - ListMessagesQueryParamProperties, - ListFilesQueryParamProperties, -} from "../customization/parameters.js"; -export type { - AgentRunResponse, - CreateRunOptionalParams, - GetRunOptionalParams, - CancelRunOptionalParams, - SubmitToolOutputsToRunOptionalParams, - UpdateRunOptionalParams, - ListRunQueryOptionalParams, - CreateAndRunThreadOptionalParams, - CreateAgentThreadOptionalParams, - GetAgentThreadOptionalParams, - UpdateAgentThreadOptionalParams, - DeleteAgentThreadOptionalParams, - GetRunStepOptionalParams, - ListRunStepsOptionalParams, - CreateMessageOptionalParams, - ListMessagesOptionalParams, - UpdateMessageOptionalParams, - GetVectorStoreOptionalParams, - ListVectorStoresOptionalParams, - UpdateVectorStoreOptionalParams, - DeleteVectorStoreOptionalParams, - CreateVectorStoreOptionalParams, - CreateVectorStoreWithPollingOptionalParams, - CreateVectorStoreFileOptionalParams, - ListVectorStoreFilesOptionalParams, - GetVectorStoreFileOptionalParams, - DeleteVectorStoreFileOptionalParams, - CreateVectorStoreFileWithPollingOptionalParams, - CreateVectorStoreFileBatchOptionalParams, - GetVectorStoreFileBatchOptionalParams, - ListVectorStoreFileBatchFilesOptionalParams, - CreateVectorStoreFileBatchWithPollingOptionalParams, - CreateAgentOptionalParams, - ListAgentsOptionalParams, - GetAgentOptionalParams, - UpdateAgentOptionalParams, - DeleteFileOptionalParams, - GetFileOptionalParams, - GetFileContentOptionalParams, - ListFilesOptionalParams, - UploadFileOptionalParams, - UploadFileWithPollingOptionalParams, - ListQueryParameters, - PollingOptions, - PollingOptionsParams, - CancelVectorStoreFileBatchOptionalParams, - DeleteAgentOptionalParams, -} from "./customModels.js"; - -export { - AzureAISearchToolDefinition, - CodeInterpreterToolDefinition, - FileSearchToolDefinition, - FileSearchToolDefinitionDetails, - FunctionDefinition, - FunctionToolDefinition, - ToolResources, - VectorStoreConfigurations, - VectorStoreDataSource, - ToolDefinition, - ThreadMessageOptions, - ToolOutput, - FilePurpose, - ToolDefinitionParent, - AgentThreadCreationOptions, - CreateAgentOptions, - CreateAndRunThreadOptions, - CreateRunOptions, - UpdateAgentOptions, - UpdateAgentThreadOptions, - VectorStoreFileStatusFilter, - VectorStoreOptions, - VectorStoreUpdateOptions, - AgentsApiResponseFormatMode, - AgentsApiToolChoiceOption, - TruncationObject, - UpdateToolResourcesOptions, - ThreadMessage, - VectorStoreChunkingStrategyRequest, - FileSearchRankingOptions, - AgentsApiToolChoiceOptionMode, - AgentsNamedToolChoice, - AgentsApiResponseFormatOption, - ConnectionType, - ListSortOrder, - MessageAttachment, - MessageContent, - MessageIncompleteDetails, - MessageStatus, - BingGroundingToolDefinition, - MicrosoftFabricToolDefinition, - SharepointToolDefinition, - AzureAISearchResource, - CodeInterpreterToolResource, - FileSearchToolResource, - TruncationStrategy, - UpdateCodeInterpreterToolResourceOptions, - UpdateFileSearchToolResourceOptions, - VectorStoreChunkingStrategyRequestParent, - VectorStoreAutoChunkingStrategyRequest, - VectorStoreStaticChunkingStrategyRequest, - VectorStoreConfiguration, - VectorStoreDataSourceAssetType, - AgentsApiResponseFormat, - ApiResponseFormat, - FunctionName, - AgentsNamedToolChoiceType, - IndexResource, - ToolConnectionList, - MessageAttachmentToolDefinition, - MessageContentParent, - MessageTextContent, - MessageImageFileContent, - MessageRole, - VectorStoreChunkingStrategyRequestType, - VectorStoreExpirationPolicy, - VectorStoreStaticChunkingStrategyOptions, - MessageImageFileDetails, - MessageIncompleteDetailsReason, - MessageTextDetails, - ToolConnection, - VectorStoreExpirationPolicyAnchor, - MessageTextAnnotation, - MessageTextAnnotationParent, - MessageTextFileCitationAnnotation, - MessageTextFilePathAnnotation, - MessageTextFileCitationDetails, - MessageTextFilePathDetails, -} from "../customization/models.js"; diff --git a/sdk/ai/ai-projects/src/agents/inputValidations.ts b/sdk/ai/ai-projects/src/agents/inputValidations.ts deleted file mode 100644 index bc63f015baef..000000000000 --- a/sdk/ai/ai-projects/src/agents/inputValidations.ts +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - ToolDefinition, - UpdateToolResourcesOptions, - VectorStoreDataSource, -} from "../generated/src/models.js"; - -export function validateVectorStoreDataType(data_sources: VectorStoreDataSource[]): void { - if (!data_sources.some((value) => !["uri_asset", "id_asset"].includes(value.type))) { - throw new Error("Vector store data type must be one of 'uri_asset', 'id_asset'"); - } -} - -export function validateThreadId(threadId: string): void { - if (!threadId) { - throw new Error("Thread ID is required"); - } -} - -export function validateRunId(runId: string): void { - if (!runId) { - throw new Error("Run ID is required"); - } -} - -export function validateLimit(limit: number): void { - if (limit < 1 || limit > 100) { - throw new Error("Limit must be between 1 and 100"); - } -} - -export function validateOrder(order: string): void { - if (!["asc", "desc"].includes(order)) { - throw new Error("Order must be 'asc' or 'desc'"); - } -} - -enum Tools { - CodeInterpreter = "code_interpreter", - FileSearch = "file_search", - Function = "function", - BingGrounding = "bing_grounding", - MicrosoftFabric = "microsoft_fabric", - SharepointGrounding = "sharepoint_grounding", - AzureAISearch = "azure_ai_search", -} - -export function validateTools(value: Array): void { - if (value.some((tool) => !Object.values(Tools).includes(tool as unknown as Tools))) { - throw new Error( - "Tool type must be one of 'code_interpreter', 'file_search', 'function', 'bing_grounding', 'microsoft_fabric', 'sharepoint_grounding', 'azure_ai_search'", - ); - } -} - -export function validateMetadata(metadata: Record): void { - if (Object.keys(metadata).length > 16) { - throw new Error("Only 16 key/value pairs are allowed"); - } - if (Object.keys(metadata).some((value) => value.length > 64)) { - throw new Error("Keys must be less than 64 characters"); - } - if (Object.values(metadata).some((value) => value.length > 512)) { - throw new Error("Values must be less than 512 characters"); - } -} - -export function validateToolResources(toolResource: UpdateToolResourcesOptions): void { - if (toolResource.code_interpreter) { - if ( - toolResource.code_interpreter.file_ids && - toolResource.code_interpreter.file_ids.length > 20 - ) { - throw new Error("A maximum of 20 file IDs are allowed"); - } - } - if (toolResource.file_search) { - if ( - toolResource.file_search.vector_store_ids && - toolResource.file_search.vector_store_ids.length > 1 - ) { - throw new Error("Only one vector store ID is allowed"); - } - } - if (toolResource.azure_ai_search) { - if (toolResource.azure_ai_search.indexes && toolResource.azure_ai_search.indexes.length > 1) { - throw new Error("Only one index is allowed"); - } - } -} - -export function validateVectorStoreId(vectorStoreId: string): void { - if (!vectorStoreId) { - throw new Error("Vector store ID is required"); - } -} - -export function validateFileId(fileId: string): void { - if (!fileId) { - throw new Error("File ID is required"); - } -} - -enum FileBatchStatus { - InProgress = "in_progress", - Completed = "completed", - Failed = "failed", - Cancelled = "cancelled", -} - -export function validateFileStatusFilter(filter: string): void { - if (!Object.values(FileBatchStatus).includes(filter as FileBatchStatus)) { - throw new Error( - "File status filter must be one of 'in_progress', 'completed', 'failed', 'cancelled'", - ); - } -} - -enum Messages { - User = "user", - Assistants = "assistant", -} - -export function validateMessages(value: string): void { - if (!Object.values(Messages).includes(value as Messages)) { - throw new Error("Role must be either 'user' or 'assistant'"); - } -} - -enum TruncationStrategy { - Auto = "auto", - LastMessages = "last_messages", -} - -export function validateTruncationStrategy(value: string): void { - if (!Object.values(TruncationStrategy).includes(value as TruncationStrategy)) { - throw new Error("Role must be either 'auto' or 'last_messages'"); - } -} diff --git a/sdk/ai/ai-projects/src/agents/messages.ts b/sdk/ai/ai-projects/src/agents/messages.ts deleted file mode 100644 index 3d9e47cb0eef..000000000000 --- a/sdk/ai/ai-projects/src/agents/messages.ts +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - OpenAIPageableListOfThreadMessageOutput, - ThreadMessageOutput, -} from "../customization/outputModels.js"; -import type { - CreateMessageParameters, - ListMessagesParameters, -} from "../generated/src/parameters.js"; -import { validateMetadata, validateVectorStoreDataType } from "./inputValidations.js"; -import { TracingUtility } from "../tracing.js"; -import { - traceEndCreateMessage, - traceEndListMessages, - traceStartCreateMessage, - traceStartListMessages, -} from "./messagesTrace.js"; -import { traceStartAgentGeneric } from "./traceUtility.js"; -import type { ThreadMessageOptions } from "../customization/models.js"; -import type { - CreateMessageOptionalParams, - ListMessagesOptionalParams, - UpdateMessageOptionalParams, -} from "./customModels.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import { createOpenAIError } from "./openAIError.js"; - -const expectedStatuses = ["200"]; - -/** Creates a new message on a specified thread. */ -export async function createMessage( - context: Client, - threadId: string, - messageOptions: ThreadMessageOptions, - options: CreateMessageOptionalParams = {}, -): Promise { - const createOptions: GeneratedParameters.CreateMessageParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...messageOptions, - }, - }; - - validateThreadId(threadId); - validateCreateMessageParameters(createOptions); - const response = await TracingUtility.withSpan( - "CreateMessage", - createOptions, - async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/messages", threadId) - .post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => traceStartCreateMessage(span, threadId, updatedOptions), - traceEndCreateMessage, - ); - return ConvertFromWire.convertThreadMessageOutput(response); -} - -/** Gets a list of messages that exist on a thread. */ -export async function listMessages( - context: Client, - threadId: string, - options: ListMessagesOptionalParams = {}, -): Promise { - const listOptions: GeneratedParameters.ListMessagesParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: { - ...(options.runId && { run_id: options.runId }), - ...(options.limit && { run_id: options.limit }), - ...(options.order && { run_id: options.order }), - ...(options.after && { run_id: options.after }), - ...(options.before && { run_id: options.before }), - }, - }; - - validateThreadId(threadId); - validateListMessagesParameters(listOptions); - const output = await TracingUtility.withSpan( - "ListMessages", - listOptions, - async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/messages", threadId) - .get(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => traceStartListMessages(span, threadId, updatedOptions), - traceEndListMessages, - ); - - return ConvertFromWire.convertOpenAIPageableListOfThreadMessageOutput(output); -} - -/** Modifies an existing message on an existing thread. */ -export async function updateMessage( - context: Client, - threadId: string, - messageId: string, - options: UpdateMessageOptionalParams = {}, -): Promise { - const updateMessageOptions: GeneratedParameters.UpdateMessageParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...(options.metadata ? { metadata: options.metadata } : {}), - }, - }; - validateThreadId(threadId); - validateMessageId(messageId); - const response = await TracingUtility.withSpan( - "UpdateMessage", - updateMessageOptions, - async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/messages/{messageId}", threadId, messageId) - .post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId, messageId: messageId }, - }), - ); - - return ConvertFromWire.convertThreadMessageOutput(response); -} - -function validateThreadId(threadId: string): void { - if (!threadId) { - throw new Error("Thread ID is required"); - } -} - -function validateMessageId(messageId: string): void { - if (!messageId) { - throw new Error("Message ID is required"); - } -} - -function validateCreateMessageParameters(options: CreateMessageParameters): void { - if (options.body.role && !["user", "assistant"].includes(options.body.role)) { - throw new Error("Role must be either 'user' or 'assistant'"); - } - if (options.body.metadata) { - validateMetadata(options.body.metadata); - } - if (options.body.attachments) { - if ( - options.body.attachments.some((value) => { - value.tools.some((tool) => !["code_interpreter", "file_search"].includes(tool.type)); - }) - ) { - throw new Error("Tool type must be either 'code_interpreter' or 'file_search'"); - } - if (options.body.attachments) { - options.body.attachments.forEach((value) => { - if (value.data_sources) { - validateVectorStoreDataType(value.data_sources); - } - }); - } - } -} - -function validateListMessagesParameters(options?: ListMessagesParameters): void { - if ( - options?.queryParameters?.limit && - (options.queryParameters.limit < 1 || options.queryParameters.limit > 100) - ) { - throw new Error("Limit must be between 1 and 100"); - } - if (options?.queryParameters?.order && !["asc", "desc"].includes(options.queryParameters.order)) { - throw new Error("Order must be either 'asc' or 'desc'"); - } -} diff --git a/sdk/ai/ai-projects/src/agents/messagesTrace.ts b/sdk/ai/ai-projects/src/agents/messagesTrace.ts deleted file mode 100644 index 9614b2e74309..000000000000 --- a/sdk/ai/ai-projects/src/agents/messagesTrace.ts +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - CreateMessageParameters, - ListMessagesParameters, -} from "../generated/src/parameters.js"; -import type { Span } from "../tracing.js"; -import { TracingAttributes, TracingUtility, TracingOperationName } from "../tracing.js"; -import type { - OpenAIPageableListOfThreadMessageOutput, - ThreadMessageOutput as GeneratedThreadMessageOutput, -} from "../generated/src/outputModels.js"; -import { addMessageEvent } from "./traceUtility.js"; -import type { ThreadMessageOutput } from "../customization/outputModels.js"; - -export function traceStartCreateMessage( - span: Span, - threadId: string, - options: CreateMessageParameters, -): void { - TracingUtility.setSpanAttributes(span, TracingOperationName.CREATE_MESSAGE, { - threadId: threadId, - genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM, - }); - addMessageEvent(span, { ...options.body, thread_id: threadId }); -} - -export async function traceEndCreateMessage( - span: Span, - _options: CreateMessageParameters, - result: Promise, -): Promise { - const resolvedResult = await result; - TracingUtility.updateSpanAttributes(span, { messageId: resolvedResult.id }); -} - -export function traceStartListMessages( - span: Span, - threadId: string, - _options: ListMessagesParameters, -): void { - TracingUtility.setSpanAttributes(span, TracingOperationName.LIST_MESSAGES, { - threadId: threadId, - genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM, - }); -} - -export async function traceEndListMessages( - span: Span, - _options: ListMessagesParameters, - result: Promise, -): Promise { - const resolvedResult = await result; - resolvedResult.data?.forEach((message) => { - addMessageEvent(span, message); - }); -} diff --git a/sdk/ai/ai-projects/src/agents/openAIError.ts b/sdk/ai/ai-projects/src/agents/openAIError.ts deleted file mode 100644 index d4d2ea400824..000000000000 --- a/sdk/ai/ai-projects/src/agents/openAIError.ts +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { PathUncheckedResponse } from "@azure-rest/core-client"; -import { createRestError } from "@azure-rest/core-client"; -import type { RestErrorOptions } from "@azure/core-rest-pipeline"; -import { RestError } from "@azure/core-rest-pipeline"; - -interface OpenAIErrorOptions extends RestErrorOptions { - param?: string; - type?: string; -} - -export class OpenAIError extends RestError { - readonly param?: string; - readonly type?: string; - - constructor(message: string, OpenAIErrorOptions: OpenAIErrorOptions = {}) { - super(message, OpenAIErrorOptions); - this.param = OpenAIErrorOptions?.param; - this.type = OpenAIErrorOptions?.type; - } -} - -export function createOpenAIError(response: PathUncheckedResponse): OpenAIError { - const internalError = response.body.error || response.body; - let restError: RestError; - if (typeof internalError === "string") { - restError = createRestError(internalError, response); - } else { - restError = createRestError(response); - } - - return new OpenAIError(restError.message, { - statusCode: restError?.statusCode, - code: restError?.code, - request: restError?.request, - response: restError?.response, - param: internalError?.param, - type: internalError?.type, - }); -} diff --git a/sdk/ai/ai-projects/src/agents/poller.ts b/sdk/ai/ai-projects/src/agents/poller.ts deleted file mode 100644 index 82c53ae10d4f..000000000000 --- a/sdk/ai/ai-projects/src/agents/poller.ts +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { delay } from "@azure/core-util"; -import type { PollOperationState, PollOperation } from "@azure/core-lro"; -import { Poller } from "@azure/core-lro"; -import type { AbortSignalLike } from "@azure/abort-controller"; -import type { PollingOptions } from "./customModels.js"; - -interface PollResult { - status?: string; -} - -interface AgentsPollOperationState extends PollOperationState { - updateInternal: (state?: T) => Promise<{ result: T; completed: boolean }>; - cancelInternal?: (state: T) => Promise; - abortSignal?: AbortSignalLike; - cancelled?: boolean; -} - -interface AgentsPollOperation - extends PollOperation, T> {} - -export class AgentsPoller extends Poller, T> { - sleepIntervalInMs: number = 1000; - - constructor({ - update, - pollingOptions, - cancel, - baseOperation, - onProgress, - }: { - update: (state?: T) => Promise<{ result: T; completed: boolean }>; - pollingOptions?: PollingOptions; - cancel?: (state: T) => Promise; - baseOperation?: AgentsPollOperation; - onProgress?: (state: AgentsPollOperationState) => void; - }) { - let state: AgentsPollOperationState = { - updateInternal: update, - cancelInternal: cancel, - abortSignal: pollingOptions?.abortSignal, - }; - - if (baseOperation) { - state = baseOperation.state; - } - - const operation = makeOperation(state); - super(operation); - - this.sleepIntervalInMs = pollingOptions?.sleepIntervalInMs ?? this.sleepIntervalInMs; - - if (onProgress) { - this.onProgress(onProgress); - } - } - - async delay(): Promise { - await delay(this.sleepIntervalInMs); - } -} - -/** - * Utility function to create a new instance of operation state. - * Recommended to avoid no references are left or manipulated by mistake - */ -function makeOperation( - state: AgentsPollOperationState, -): PollOperation, T> { - return { - state: { - ...state, - }, - update: updateWrapper, - cancel: cancelWrapper, - toString: toString, - }; -} - -async function updateWrapper( - this: AgentsPollOperation, -): Promise, T>> { - if (this.state.abortSignal?.aborted) { - return makeOperation(this.state); - } - const { result, completed } = await this.state.updateInternal(this.state.result); - this.state.result = result; - this.state.isCompleted = completed; - return makeOperation(this.state); -} - -async function cancelWrapper( - this: AgentsPollOperation, -): Promise, T>> { - if (!this.state.result || !this.state.cancelInternal) { - return makeOperation({ - ...this.state, - cancelled: false, - }); - } - const cancelled = await this.state.cancelInternal(this.state.result); - return makeOperation({ - ...this.state, - cancelled: cancelled, - }); -} - -function toString(this: AgentsPollOperation): string { - return JSON.stringify(this.state); -} diff --git a/sdk/ai/ai-projects/src/agents/runSteps.ts b/sdk/ai/ai-projects/src/agents/runSteps.ts deleted file mode 100644 index b6aa0dd1cde6..000000000000 --- a/sdk/ai/ai-projects/src/agents/runSteps.ts +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - OpenAIPageableListOfRunStepOutput, - RunStepOutput, -} from "../customization/outputModels.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConverterFromWire from "../customization/convertOutputModelsFromWire.js"; -import { - validateLimit, - validateOrder, - validateRunId, - validateThreadId, -} from "./inputValidations.js"; -import type { GetRunStepOptionalParams, ListRunStepsOptionalParams } from "./customModels.js"; -import { convertToListQueryParameters } from "../customization/convertParametersToWire.js"; -import { createOpenAIError } from "./openAIError.js"; - -const expectedStatuses = ["200"]; - -/** Gets a single run step from a thread run. */ -export async function getRunStep( - context: Client, - threadId: string, - runId: string, - stepId: string, - options: GetRunStepOptionalParams = {}, -): Promise { - validateThreadId(threadId); - validateRunId(runId); - validateStepId(stepId); - - const getOptions: GeneratedParameters.GetRunParameters = { - ...operationOptionsToRequestParameters(options), - }; - - const result = await context - .path("/threads/{threadId}/runs/{runId}/steps/{stepId}", threadId, runId, stepId) - .get(getOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConverterFromWire.convertRunStepOutput(result.body); -} - -/** Gets a list of run steps from a thread run. */ -export async function listRunSteps( - context: Client, - threadId: string, - runId: string, - options: ListRunStepsOptionalParams = {}, -): Promise { - const listOptions: GeneratedParameters.ListRunStepsParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: convertToListQueryParameters(options), - }; - - validateListRunsParameters(threadId, runId, listOptions); - const result = await context - .path("/threads/{threadId}/runs/{runId}/steps", threadId, runId) - .get(listOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConverterFromWire.convertOpenAIPageableListOfRunStepOutput(result.body); -} - -function validateStepId(stepId: string): void { - if (!stepId) { - throw new Error("Step ID is required"); - } -} - -function validateListRunsParameters( - thread_id: string, - runId: string, - options?: GeneratedParameters.ListRunStepsParameters, -): void { - validateThreadId(thread_id); - validateRunId(runId); - if ( - options?.queryParameters?.limit && - (options.queryParameters.limit < 1 || options.queryParameters.limit > 100) - ) { - throw new Error("Limit must be between 1 and 100"); - } - if (options?.queryParameters?.limit) { - validateLimit(options.queryParameters.limit); - } - if (options?.queryParameters?.order) { - validateOrder(options.queryParameters.order); - } -} diff --git a/sdk/ai/ai-projects/src/agents/runTrace.ts b/sdk/ai/ai-projects/src/agents/runTrace.ts deleted file mode 100644 index dc6c725b2013..000000000000 --- a/sdk/ai/ai-projects/src/agents/runTrace.ts +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - CreateRunParameters, - CreateThreadAndRunParameters, - SubmitToolOutputsToRunParameters, - UpdateRunParameters, -} from "../generated/src/parameters.js"; -import type { ThreadRunOutput } from "../generated/src/outputModels.js"; -import type { TracingAttributeOptions, Span } from "../tracing.js"; -import { TracingUtility, TracingOperationName } from "../tracing.js"; -import { - addInstructionsEvent, - addMessageEvent, - addToolMessagesEvent, - formatAgentApiResponse, - UpdateWithAgentAttributes, -} from "./traceUtility.js"; - -export function traceStartCreateRun( - span: Span, - options: CreateRunParameters | CreateThreadAndRunParameters, - threadId?: string, - operationName: string = TracingOperationName.CREATE_RUN, -): void { - const attributes: TracingAttributeOptions = { - threadId: threadId, - agentId: options.body.assistant_id, - model: options.body.model ?? undefined, - instructions: options.body.instructions ?? undefined, - temperature: options.body.temperature ?? undefined, - topP: options.body.top_p ?? undefined, - maxCompletionTokens: options.body.max_completion_tokens ?? undefined, - maxPromptTokens: options.body.max_prompt_tokens ?? undefined, - responseFormat: formatAgentApiResponse(options.body.response_format), - }; - if ((options as CreateRunParameters).body.additional_instructions) { - attributes.additional_instructions = - (options as CreateRunParameters).body.additional_instructions ?? undefined; - } - TracingUtility.setSpanAttributes(span, operationName, UpdateWithAgentAttributes(attributes)); - setSpanEvents(span, options); -} - -export function traceStartCreateThreadAndRun( - span: Span, - options: CreateThreadAndRunParameters, -): void { - traceStartCreateRun(span, options, undefined, TracingOperationName.CREATE_THREAD_RUN); -} - -export async function traceEndCreateOrUpdateRun( - span: Span, - _options: CreateRunParameters | UpdateRunParameters, - result: Promise, -): Promise { - const resolvedResult = await result; - updateSpanAttributesForRun(span, resolvedResult); -} - -export function traceStartSubmitToolOutputsToRun( - span: Span, - options: SubmitToolOutputsToRunParameters, - threadId: string, - runId: string, -): void { - const attributes: TracingAttributeOptions = { threadId: threadId, runId: runId }; - TracingUtility.setSpanAttributes( - span, - TracingOperationName.SUBMIT_TOOL_OUTPUTS, - UpdateWithAgentAttributes(attributes), - ); - addToolMessagesEvent(span, options.body.tool_outputs); -} - -export async function traceEndSubmitToolOutputsToRun( - span: Span, - _options: SubmitToolOutputsToRunParameters, - result: Promise, -): Promise { - const resolvedResult = await result; - updateSpanAttributesForRun(span, resolvedResult); -} - -function updateSpanAttributesForRun(span: Span, output: ThreadRunOutput): void { - TracingUtility.updateSpanAttributes(span, { - runId: output.id, - runStatus: output.status, - responseModel: output.model, - }); - const usage = output.usage; - if (usage && "completion_tokens" in usage && usage.completion_tokens) { - TracingUtility.updateSpanAttributes(span, { - usageCompletionTokens: usage.completion_tokens, - usagePromptTokens: usage.prompt_tokens, - }); - } -} - -function setSpanEvents(span: Span, options: CreateRunParameters): void { - addInstructionsEvent(span, { ...options.body, agentId: options.body.assistant_id }); - options.body.additional_messages?.forEach((message) => { - addMessageEvent(span, message); - }); -} diff --git a/sdk/ai/ai-projects/src/agents/runs.ts b/sdk/ai/ai-projects/src/agents/runs.ts deleted file mode 100644 index cb7f966056af..000000000000 --- a/sdk/ai/ai-projects/src/agents/runs.ts +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import type * as CustomOutputModels from "../customization/outputModels.js"; -import type * as CustomModels from "../customization/models.js"; -import { - validateLimit, - validateMessages, - validateMetadata, - validateOrder, - validateRunId, - validateThreadId, - validateTools, - validateTruncationStrategy, -} from "./inputValidations.js"; -import { TracingUtility } from "../tracing.js"; -import { - traceEndCreateOrUpdateRun, - traceEndSubmitToolOutputsToRun, - traceStartCreateRun, - traceStartCreateThreadAndRun, - traceStartSubmitToolOutputsToRun, -} from "./runTrace.js"; -import { traceStartAgentGeneric } from "./traceUtility.js"; -import { - createRunStreaming, - createThreadAndRunStreaming, - submitToolOutputsToRunStreaming, -} from "./streaming.js"; -import type { AgentEventMessageStream } from "./streamingModels.js"; -import type { - AgentRunResponse, - CreateRunOptionalParams, - CancelRunOptionalParams, - CreateAndRunThreadOptionalParams, - GetRunOptionalParams, - ListRunQueryOptionalParams, - SubmitToolOutputsToRunOptionalParams, - UpdateRunOptionalParams, -} from "./customModels.js"; -import * as ConverterToWire from "../customization/convertModelsToWrite.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import { convertToListQueryParameters } from "../customization/convertParametersToWire.js"; -import { createOpenAIError } from "./openAIError.js"; - -const expectedStatuses = ["200"]; - -/** Creates and starts a new run of the specified thread using the specified agent. */ -export function createRun( - context: Client, - threadId: string, - assistantId: string, - options: CreateRunOptionalParams, -): AgentRunResponse { - const createRunOptions: GeneratedParameters.CreateRunParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...ConverterToWire.convertCreateRunOptions({ ...options, assistantId }), - stream: false, - }, - }; - validateThreadId(threadId); - validateCreateRunParameters(createRunOptions); - - async function executeCreateRun(): Promise { - const output = await TracingUtility.withSpan( - "CreateRun", - createRunOptions, - async (updateOptions) => { - const result = await context.path("/threads/{threadId}/runs", threadId).post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - const error = createOpenAIError(result); - throw error; - } - return result.body; - }, - (span, updatedOptions) => traceStartCreateRun(span, updatedOptions, threadId), - traceEndCreateOrUpdateRun, - ); - return ConvertFromWire.convertThreadRunOutput(output); - } - - return { - then: function (onFulfilled, onRejected) { - return executeCreateRun().then(onFulfilled, onRejected).catch(onRejected); - }, - async stream(): Promise { - return createRunStreaming(context, threadId, createRunOptions); - }, - }; -} - -/** Gets a list of runs for a specified thread. */ -export async function listRuns( - context: Client, - threadId: string, - options: ListRunQueryOptionalParams = {}, -): Promise { - const listRunOptions: GeneratedParameters.ListRunsParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: convertToListQueryParameters(options), - }; - - validateListRunsParameters(threadId, options); - return TracingUtility.withSpan( - "ListRuns", - listRunOptions || {}, - async (updateOptions) => { - const result = await context.path("/threads/{threadId}/runs", threadId).get(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertOpenAIPageableListOfThreadRunOutput(result.body); - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId }, - }), - ); -} - -/** Gets an existing run from an existing thread. */ -export async function getRun( - context: Client, - threadId: string, - runId: string, - options: GetRunOptionalParams = {}, -): Promise { - validateThreadId(threadId); - validateRunId(runId); - const getRunOptions: GeneratedParameters.GetRunParameters = { - ...operationOptionsToRequestParameters(options), - }; - return TracingUtility.withSpan( - "GetRun", - getRunOptions, - async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/runs/{runId}", threadId, runId) - .get(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertThreadRunOutput(result.body); - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId, runId: runId }, - }), - ); -} - -/** Modifies an existing thread run. */ -export async function updateRun( - context: Client, - threadId: string, - runId: string, - options: UpdateRunOptionalParams = {}, -): Promise { - const updateRunOptions: GeneratedParameters.UpdateRunParameters = { - ...operationOptionsToRequestParameters(options), - body: { - metadata: options?.metadata, - }, - }; - - validateUpdateRunParameters(threadId, runId, updateRunOptions); - const response = await TracingUtility.withSpan( - "UpdateRun", - updateRunOptions, - async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/runs/{runId}", threadId, runId) - .post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId, runId: runId }, - }), - traceEndCreateOrUpdateRun, - ); - - return ConvertFromWire.convertThreadRunOutput(response); -} - -/** Submits outputs from tools as requested by tool calls in a run. Runs that need submitted tool outputs will have a status of 'requires_action' with a required_action.type of 'submit_tool_outputs'. */ -export function submitToolOutputsToRun( - context: Client, - threadId: string, - runId: string, - toolOutputs: Array, - options: SubmitToolOutputsToRunOptionalParams = {}, -): AgentRunResponse { - validateThreadId(threadId); - validateRunId(runId); - const submitToolOutputsOptions: GeneratedParameters.SubmitToolOutputsToRunParameters = { - ...operationOptionsToRequestParameters(options), - body: { - tool_outputs: toolOutputs?.map(ConverterToWire.convertToolOutput), - stream: false, - }, - }; - - async function executeSubmitToolOutputsToRun(): Promise { - const response = await TracingUtility.withSpan( - "SubmitToolOutputsToRun", - submitToolOutputsOptions, - async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/runs/{runId}/submit_tool_outputs", threadId, runId) - .post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartSubmitToolOutputsToRun(span, updatedOptions, threadId, runId), - traceEndSubmitToolOutputsToRun, - ); - return ConvertFromWire.convertThreadRunOutput(response); - } - - return { - then: function (onFulfilled, onrejected) { - return executeSubmitToolOutputsToRun().then(onFulfilled, onrejected).catch(onrejected); - }, - async stream(): Promise { - return submitToolOutputsToRunStreaming(context, threadId, runId, submitToolOutputsOptions); - }, - }; -} - -/** Cancels a run of an in progress thread. */ -export async function cancelRun( - context: Client, - threadId: string, - runId: string, - options: CancelRunOptionalParams = {}, -): Promise { - validateThreadId(threadId); - validateRunId(runId); - const cancelRunOptions: GeneratedParameters.CancelRunParameters = { - ...operationOptionsToRequestParameters(options), - }; - return TracingUtility.withSpan("CancelRun", cancelRunOptions, async (updateOptions) => { - const result = await context - .path("/threads/{threadId}/runs/{runId}/cancel", threadId, runId) - .post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertThreadRunOutput(result.body); - }); -} - -/** Creates a new thread and immediately starts a run of that thread. */ -export function createThreadAndRun( - context: Client, - assistantId: string, - options: CreateAndRunThreadOptionalParams, -): AgentRunResponse { - const createThreadAndRunOptions: GeneratedParameters.CreateThreadAndRunParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...ConverterToWire.convertCreateAndRunThreadOptions({ ...options, assistantId }), - stream: false, - }, - }; - - validateCreateThreadAndRunParameters(createThreadAndRunOptions); - - async function executeCreateThreadAndRun(): Promise { - const response = await TracingUtility.withSpan( - "CreateThreadAndRun", - createThreadAndRunOptions, - async (updateOptions) => { - const result = await context.path("/threads/runs").post(updateOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - - return result.body; - }, - traceStartCreateThreadAndRun, - traceEndCreateOrUpdateRun, - ); - - return ConvertFromWire.convertThreadRunOutput(response); - } - - return { - then: function (onFulfilled, onrejected) { - return executeCreateThreadAndRun().then(onFulfilled, onrejected).catch(onrejected); - }, - async stream(): Promise { - return createThreadAndRunStreaming(context, createThreadAndRunOptions); - }, - }; -} - -function validateListRunsParameters( - thread_id: string, - options?: GeneratedParameters.ListRunsParameters, -): void { - validateThreadId(thread_id); - if ( - options?.queryParameters?.limit && - (options.queryParameters.limit < 1 || options.queryParameters.limit > 100) - ) { - throw new Error("Limit must be between 1 and 100"); - } - if (options?.queryParameters?.limit) { - validateLimit(options.queryParameters.limit); - } - if (options?.queryParameters?.order) { - validateOrder(options.queryParameters.order); - } -} - -function validateUpdateRunParameters( - thread_id: string, - run_id: string, - options?: GeneratedParameters.UpdateRunParameters, -): void { - validateThreadId(thread_id); - validateRunId(run_id); - if (options?.body.metadata) { - validateMetadata(options.body.metadata); - } -} - -function validateCreateRunParameters( - options: - | GeneratedParameters.CreateRunParameters - | GeneratedParameters.CreateThreadAndRunParameters, -): void { - if ("additional_messages" in options.body && options.body.additional_messages) { - options.body.additional_messages.forEach((message) => validateMessages(message.role)); - } - if (options.body.tools) { - validateTools(options.body.tools); - } - if (options.body.temperature && (options.body.temperature < 0 || options.body.temperature > 2)) { - throw new Error("Temperature must be between 0 and 2"); - } - if (options.body.tool_choice && typeof options.body.tool_choice !== "string") { - validateTools([options.body.tool_choice]); - } - if (options.body.truncation_strategy?.type) { - validateTruncationStrategy(options.body.truncation_strategy.type); - } - if (options.body.metadata) { - validateMetadata(options.body.metadata); - } -} - -function validateCreateThreadAndRunParameters( - options: GeneratedParameters.CreateThreadAndRunParameters, -): void { - validateCreateRunParameters(options); - if (options.body.thread?.messages) { - options.body.thread?.messages.forEach((message) => validateMessages(message.role)); - } - if (options.body.tools) { - validateTools(options.body.tools); - } - if (options.body.tool_resources?.code_interpreter) { - if (options.body.tool_resources.code_interpreter) { - if ( - options.body.tool_resources.code_interpreter.file_ids && - options.body.tool_resources.code_interpreter.file_ids.length > 20 - ) { - throw new Error("A maximum of 20 file IDs are allowed"); - } - } - if (options.body.tool_resources.file_search) { - if ( - options.body.tool_resources.file_search.vector_store_ids && - options.body.tool_resources.file_search.vector_store_ids.length > 1 - ) { - throw new Error("Only one vector store ID is allowed"); - } - } - if (options.body.tool_resources.azure_ai_search) { - if ( - options.body.tool_resources.azure_ai_search.indexes && - options.body.tool_resources.azure_ai_search.indexes.length > 1 - ) { - throw new Error("Only one index is allowed"); - } - } - } -} diff --git a/sdk/ai/ai-projects/src/agents/streaming.ts b/sdk/ai/ai-projects/src/agents/streaming.ts deleted file mode 100644 index 129a2b05b1fc..000000000000 --- a/sdk/ai/ai-projects/src/agents/streaming.ts +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client, StreamableMethod } from "@azure-rest/core-client"; -import type { - CreateRunParameters, - CreateThreadAndRunBodyParam, - SubmitToolOutputsToRunParameters, -} from "../generated/src/index.js"; -import { - MessageStreamEvent, - RunStepStreamEvent, - RunStreamEvent, - ThreadStreamEvent, - type AgentEventMessage, - type AgentEventMessageStream, - type AgentEventStreamDataOutput, -} from "./streamingModels.js"; -import type { EventMessage, EventMessageStream } from "@azure/core-sse"; -import { createSseStream } from "@azure/core-sse"; -import { isNodeLike } from "@azure/core-util"; -import type { IncomingMessage } from "http"; -import { - validateMessages, - validateMetadata, - validateRunId, - validateThreadId, - validateToolResources, - validateTools, - validateTruncationStrategy, -} from "./inputValidations.js"; -import { createOpenAIError } from "./openAIError.js"; -import { - convertAgentThreadOutput, - convertMessageDeltaChunkOutput, - convertRunStepDeltaChunk, - convertRunStepOutput, - convertThreadMessageOutput, - convertThreadRunOutput, -} from "../customization/convertOutputModelsFromWire.js"; -import { logger } from "../logger.js"; - -const expectedStatuses = ["200"]; - -const handlers = [ - { events: Object.values(ThreadStreamEvent) as string[], converter: convertAgentThreadOutput }, - { events: Object.values(RunStreamEvent) as string[], converter: convertThreadRunOutput }, - { events: Object.values(RunStepStreamEvent) as string[], converter: convertRunStepOutput }, - { events: Object.values(MessageStreamEvent) as string[], converter: convertThreadMessageOutput }, -]; - -function createAgentStream(stream: EventMessageStream): AgentEventMessageStream { - const asyncIterator = toAsyncIterable(stream); - const asyncDisposable = stream as AsyncDisposable; - return Object.assign(asyncIterator, asyncDisposable); -} - -async function* toAsyncIterable(stream: EventMessageStream): AsyncIterable { - for await (const event of stream) { - const data = deserializeEventData(event); - yield { data: data, event: event.event }; - } -} - -function deserializeEventData(event: EventMessage): AgentEventStreamDataOutput { - try { - const jsonData = JSON.parse(event.data); - switch (event.event) { - case MessageStreamEvent.ThreadMessageDelta: - return convertMessageDeltaChunkOutput(jsonData); - case RunStepStreamEvent.ThreadRunStepDelta: - return convertRunStepDeltaChunk(jsonData); - default: { - for (const { events, converter } of handlers) { - if (events.includes(event.event)) { - return converter(jsonData); - } - } - - return jsonData; - } - } - } catch (ex) { - logger.error(`Failed to parse event data ${event.event} - error: ${ex}`); - return event.data; - } -} - -async function processStream(streamResponse: StreamableMethod): Promise { - const result = isNodeLike - ? await streamResponse.asNodeStream() - : await streamResponse.asBrowserStream(); - - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - if (!result.body) { - throw new Error("No body in response"); - } - - const stream = isNodeLike - ? createSseStream(result.body as IncomingMessage) - : createSseStream(result.body as ReadableStream); - return createAgentStream(stream); -} - -/** Create a run and stream the events */ -export async function createRunStreaming( - context: Client, - threadId: string, - options: CreateRunParameters, -): Promise { - validateThreadId(threadId); - validateCreateThreadAndRunBodyParam(options); - options.body.stream = true; - - return processStream(context.path("/threads/{threadId}/runs", threadId).post(options)); -} - -/** Create a thread and run and stream the events */ -export async function createThreadAndRunStreaming( - context: Client, - options: CreateThreadAndRunBodyParam, -): Promise { - validateCreateThreadAndRunBodyParam(options); - options.body.stream = true; - return processStream(context.path("/threads/runs").post(options)); -} - -export async function submitToolOutputsToRunStreaming( - context: Client, - threadId: string, - runId: string, - options: SubmitToolOutputsToRunParameters, -): Promise { - validateThreadId(threadId); - validateRunId(runId); - options.body.stream = true; - - return processStream( - context - .path("/threads/{threadId}/runs/{runId}/submit_tool_outputs", threadId, runId) - .post(options), - ); -} - -function validateCreateThreadAndRunBodyParam( - options: CreateRunParameters | CreateThreadAndRunBodyParam, -): void { - if ("additional_messages" in options.body && options.body.additional_messages) { - options.body.additional_messages.forEach((message) => validateMessages(message.role)); - } - if ("thread" in options.body && options.body.thread?.messages) { - options.body.thread?.messages.forEach((message) => validateMessages(message.role)); - } - if (options.body.tools) { - validateTools(options.body.tools); - } - if ("tool_resources" in options.body && options?.body.tool_resources) { - validateToolResources(options.body.tool_resources); - } - if (options.body.temperature && (options.body.temperature < 0 || options.body.temperature > 2)) { - throw new Error("Temperature must be between 0 and 2"); - } - if (options.body.tool_choice && typeof options.body.tool_choice !== "string") { - validateTools([options.body.tool_choice]); - } - if (options.body.truncation_strategy?.type) { - validateTruncationStrategy(options.body.truncation_strategy.type); - } - if (options.body.response_format) { - if (!["json", "text"].includes(options.body.response_format as string)) { - throw new Error("Response format must be either 'json' or 'text'"); - } - } - if (options?.body.metadata) { - validateMetadata(options.body.metadata); - } -} diff --git a/sdk/ai/ai-projects/src/agents/streamingModels.ts b/sdk/ai/ai-projects/src/agents/streamingModels.ts deleted file mode 100644 index 7916344eef6c..000000000000 --- a/sdk/ai/ai-projects/src/agents/streamingModels.ts +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { MessageDeltaChunk, RunStepDeltaChunk } from "../customization/streamingModels.js"; -import type { - AgentThreadOutput, - RunStepOutput, - ThreadMessageOutput, - ThreadRunOutput, -} from "../customization/outputModels.js"; - -/** -Each event in a server-sent events stream has an `event` and `data` property: - -``` - event: thread.created - data: {"id": "thread_123", "object": "thread", ...} -``` - - We emit events whenever a new object is created, transitions to a new state, or is being - streamed in parts (deltas). For example, we emit `thread.run.created` when a new run - is created, `thread.run.completed` when a run completes, and so on. When an Agent chooses - to create a message during a run, we emit a `thread.message.created event`, a - `thread.message.in_progress` event, many `thread.message.delta` events, and finally a - `thread.message.completed` event. - - We may add additional events over time, so we recommend handling unknown events gracefully - in your code.**/ -export interface AgentEventMessage { - /** The data of the event. The data can be of type AgentThreadOutput, ThreadRunOutput, RunStepOutput, ThreadMessageOutput, MessageDeltaChunk,RunStepDeltaChunk */ - data: AgentEventStreamDataOutput; - /** The type of the event. */ - event: AgentStreamEventType | string; -} - -/** Represents a stream event data in the agent. */ -export type AgentEventStreamDataOutput = - | AgentThreadOutput - | ThreadRunOutput - | RunStepOutput - | ThreadMessageOutput - | MessageDeltaChunk - | RunStepDeltaChunk - | string; - -/** Thread operation related streaming events */ -export enum ThreadStreamEvent { - /** Event sent when a new thread is created. The data of this event is of type AgentThread */ - ThreadCreated = "thread.created", -} - -/** Run operation related streaming events */ -export enum RunStreamEvent { - /** Event sent when a new run is created. The data of this event is of type ThreadRun */ - ThreadRunCreated = "thread.run.created", - - /** Event sent when a run moves to `queued` status. The data of this event is of type ThreadRun */ - ThreadRunQueued = "thread.run.queued", - - /** Event sent when a run moves to `in_progress` status. The data of this event is of type ThreadRun */ - ThreadRunInProgress = "thread.run.in_progress", - - /** Event sent when a run moves to `requires_action` status. The data of this event is of type ThreadRun */ - ThreadRunRequiresAction = "thread.run.requires_action", - - /** Event sent when a run is completed. The data of this event is of type ThreadRun */ - ThreadRunCompleted = "thread.run.completed", - - /** Event sent when a run fails. The data of this event is of type ThreadRun */ - ThreadRunFailed = "thread.run.failed", - - /** Event sent when a run moves to `cancelling` status. The data of this event is of type ThreadRun */ - ThreadRunCancelling = "thread.run.cancelling", - - /** Event sent when a run is cancelled. The data of this event is of type ThreadRun */ - ThreadRunCancelled = "thread.run.cancelled", - - /** Event sent when a run is expired. The data of this event is of type ThreadRun */ - ThreadRunExpired = "thread.run.expired", -} - -/** Run step operation related streaming events */ -export enum RunStepStreamEvent { - /** Event sent when a new thread run step is created. The data of this event is of type RunStep */ - ThreadRunStepCreated = "thread.run.step.created", - - /** Event sent when a run step moves to `in_progress` status. The data of this event is of type RunStep */ - ThreadRunStepInProgress = "thread.run.step.in_progress", - - /** Event sent when a run step is being streamed. The data of this event is of type RunStepDeltaChunk */ - ThreadRunStepDelta = "thread.run.step.delta", - - /** Event sent when a run step is completed. The data of this event is of type RunStep */ - ThreadRunStepCompleted = "thread.run.step.completed", - - /** Event sent when a run step fails. The data of this event is of type RunStep */ - ThreadRunStepFailed = "thread.run.step.failed", - - /** Event sent when a run step is cancelled. The data of this event is of type RunStep */ - ThreadRunStepCancelled = "thread.run.step.cancelled", - - /** Event sent when a run step is expired. The data of this event is of type RunStep */ - ThreadRunStepExpired = "thread.run.step.expired", -} - -/** Message operation related streaming events */ -export enum MessageStreamEvent { - /** Event sent when a new message is created. The data of this event is of type ThreadMessage */ - ThreadMessageCreated = "thread.message.created", - - /** Event sent when a message moves to `in_progress` status. The data of this event is of type ThreadMessage */ - ThreadMessageInProgress = "thread.message.in_progress", - - /** Event sent when a message is being streamed. The data of this event is of type MessageDeltaChunk */ - ThreadMessageDelta = "thread.message.delta", - - /** Event sent when a message is completed. The data of this event is of type ThreadMessage */ - ThreadMessageCompleted = "thread.message.completed", - - /** Event sent before a message is completed. The data of this event is of type ThreadMessage */ - ThreadMessageIncomplete = "thread.message.incomplete", -} - -/** Terminal event indicating a server side error while streaming. */ -export enum ErrorEvent { - /** Event sent when an error occurs, such as an internal server error or a timeout. */ - Error = "error", -} - -/** Terminal event indicating the successful end of a stream. */ -export enum DoneEvent { - /** Event sent when the stream is done. */ - Done = "done", -} - -/** - Represents the type of an agent stream event. - */ -export type AgentStreamEventType = - | ThreadStreamEvent - | RunStreamEvent - | RunStepStreamEvent - | MessageStreamEvent - | ErrorEvent - | DoneEvent; - -/** Represents a stream of agent event message. */ -export interface AgentEventMessageStream - extends AsyncDisposable, - AsyncIterable {} diff --git a/sdk/ai/ai-projects/src/agents/threads.ts b/sdk/ai/ai-projects/src/agents/threads.ts deleted file mode 100644 index a8f5cb98e255..000000000000 --- a/sdk/ai/ai-projects/src/agents/threads.ts +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConverterToWire from "../customization/convertModelsToWrite.js"; -import * as ConverterFromWire from "../customization/convertOutputModelsFromWire.js"; -import type { - AgentThreadOutput, - ThreadDeletionStatusOutput, -} from "../customization/outputModels.js"; -import { TracingUtility } from "../tracing.js"; -import { traceEndCreateThread, traceStartCreateThread } from "./threadsTrace.js"; -import { - validateMessages, - validateMetadata, - validateThreadId, - validateToolResources, -} from "./inputValidations.js"; -import { traceStartAgentGeneric } from "./traceUtility.js"; -import type { - CreateAgentThreadOptionalParams, - DeleteAgentThreadOptionalParams, - GetAgentThreadOptionalParams, - UpdateAgentThreadOptionalParams, -} from "./customModels.js"; -import { convertThreadDeletionStatusOutput } from "../customization/convertOutputModelsFromWire.js"; -import { createOpenAIError } from "./openAIError.js"; - -const expectedStatuses = ["200"]; - -/** Creates a new thread. Threads contain messages and can be run by agents. */ -export async function createThread( - context: Client, - options: CreateAgentThreadOptionalParams = {}, -): Promise { - const createThreadOptions: GeneratedParameters.CreateThreadParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...ConverterToWire.convertAgentThreadCreationOptions(options), - }, - }; - - validateCreateThreadParameters(createThreadOptions); - const response = await TracingUtility.withSpan( - "CreateThread", - createThreadOptions, - async (updatedOptions) => { - const result = await context.path("/threads").post(updatedOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - traceStartCreateThread, - traceEndCreateThread, - ); - - return ConverterFromWire.convertAgentThreadOutput(response); -} - -/** Gets information about an existing thread. */ -export async function getThread( - context: Client, - threadId: string, - options: GetAgentThreadOptionalParams = {}, -): Promise { - const getThreadOptions: GeneratedParameters.GetThreadParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateThreadId(threadId); - const response = await TracingUtility.withSpan( - "GetThread", - getThreadOptions, - async (updatedOptions) => { - const result = await context.path("/threads/{threadId}", threadId).get(updatedOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId }, - }), - ); - - return ConverterFromWire.convertAgentThreadOutput(response); -} - -/** Modifies an existing thread. */ -export async function updateThread( - context: Client, - threadId: string, - options: UpdateAgentThreadOptionalParams = {}, -): Promise { - const updateThreadOptions: GeneratedParameters.UpdateThreadParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ...ConverterToWire.convertAgentThreadUpdateOptions(options), - }, - }; - - validateUpdateThreadParameters(threadId, updateThreadOptions); - const response = await TracingUtility.withSpan( - "UpdateThread", - updateThreadOptions, - async (updatedOptions) => { - const result = await context.path("/threads/{threadId}", threadId).post(updatedOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId }, - }), - ); - - return ConverterFromWire.convertAgentThreadOutput(response); -} - -/** Deletes an existing thread. */ -export async function deleteThread( - context: Client, - threadId: string, - options: DeleteAgentThreadOptionalParams = {}, -): Promise { - const deleteThreadOptions: GeneratedParameters.DeleteAgentParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateThreadId(threadId); - const response = await TracingUtility.withSpan( - "DeleteThread", - deleteThreadOptions, - async (updatedOptions) => { - const result = await context.path("/threads/{threadId}", threadId).delete(updatedOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return result.body; - }, - (span, updatedOptions) => - traceStartAgentGeneric(span, { - ...updatedOptions, - tracingAttributeOptions: { threadId: threadId }, - }), - ); - - return convertThreadDeletionStatusOutput(response); -} - -function validateCreateThreadParameters( - options?: GeneratedParameters.CreateThreadParameters, -): void { - if (options?.body.messages) { - options.body.messages.forEach((message) => validateMessages(message.role)); - } - if (options?.body.tool_resources) { - validateToolResources(options.body.tool_resources); - } - if (options?.body.metadata) { - validateMetadata(options.body.metadata); - } -} - -function validateUpdateThreadParameters( - threadId: string, - options?: GeneratedParameters.UpdateThreadParameters, -): void { - validateThreadId(threadId); - if (options?.body.tool_resources) { - validateToolResources(options.body.tool_resources); - } - if (options?.body.metadata) { - validateMetadata(options.body.metadata); - } -} diff --git a/sdk/ai/ai-projects/src/agents/threadsTrace.ts b/sdk/ai/ai-projects/src/agents/threadsTrace.ts deleted file mode 100644 index 4f852a3277cd..000000000000 --- a/sdk/ai/ai-projects/src/agents/threadsTrace.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AgentThreadOutput } from "../generated/src/outputModels.js"; -import type { Span } from "../tracing.js"; -import { TracingUtility, TracingOperationName } from "../tracing.js"; -import type { CreateThreadParameters } from "../generated/src/parameters.js"; -import { addMessageEvent, UpdateWithAgentAttributes } from "./traceUtility.js"; - -export function traceStartCreateThread(span: Span, options: CreateThreadParameters): void { - TracingUtility.setSpanAttributes( - span, - TracingOperationName.CREATE_THREAD, - UpdateWithAgentAttributes({}), - ); - setSpanEvents(span, options); -} - -export async function traceEndCreateThread( - span: Span, - _options: CreateThreadParameters, - result: Promise, -): Promise { - const resolvedResult = await result; - TracingUtility.updateSpanAttributes(span, { threadId: resolvedResult.id }); -} - -function setSpanEvents(span: Span, options: CreateThreadParameters): void { - options.body.messages?.forEach((message) => { - addMessageEvent(span, message); - }); -} diff --git a/sdk/ai/ai-projects/src/agents/traceUtility.ts b/sdk/ai/ai-projects/src/agents/traceUtility.ts deleted file mode 100644 index 7166167f4fdf..000000000000 --- a/sdk/ai/ai-projects/src/agents/traceUtility.ts +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - AgentsApiResponseFormat, - AgentsApiResponseFormatOption, - MessageContent, - ThreadMessage, - ThreadMessageOptions, - ToolOutput, -} from "../generated/src/models.js"; -import type { RunStepCompletionUsageOutput } from "../generated/src/outputModels.js"; -import type { OptionsWithTracing, Span, TracingAttributeOptions } from "../tracing.js"; -import { TracingAttributes, TracingUtility } from "../tracing.js"; -import { getTelemetryOptions } from "../telemetry/telemetry.js"; - -export function traceStartAgentGeneric( - span: Span, - options: Options, -): void { - const attributeOptions = options.tracingAttributeOptions || {}; - TracingUtility.setSpanAttributes( - span, - options.tracingAttributeOptions?.operationName || "Agent_Operation", - UpdateWithAgentAttributes(attributeOptions), - ); -} -export function traceEndAgentGeneric( - span: Span, - _options: Options, -): void { - const attributeOptions = {}; - TracingUtility.updateSpanAttributes(span, UpdateWithAgentAttributes(attributeOptions)); -} - -export function UpdateWithAgentAttributes( - attributeOptions: Omit, -): Omit { - attributeOptions.genAiSystem = TracingAttributes.AZ_AI_AGENT_SYSTEM; - return attributeOptions; -} - -/** - * Adds a message event to the span. - * @param span - The span to add the event to. - * @param messageAttributes - The attributes of the message event. - */ -export function addMessageEvent( - span: Span, - messageAttributes: ThreadMessageOptions | ThreadMessage, - usage?: RunStepCompletionUsageOutput, -): void { - const eventBody: Record = {}; - const telemetryOptions = getTelemetryOptions(); - if (telemetryOptions.enableContentRecording) { - eventBody.content = getMessageContent(messageAttributes.content); - } - eventBody.role = messageAttributes.role; - if (messageAttributes.attachments) { - eventBody.attachments = messageAttributes.attachments.map((attachment) => { - return { - id: attachment.file_id, - tools: attachment.tools.map((tool) => tool.type), - }; - }); - } - const threadId = (messageAttributes as ThreadMessage).thread_id; - const agentId = (messageAttributes as ThreadMessage).assistant_id ?? undefined; - const threadRunId = (messageAttributes as ThreadMessage).run_id; - const messageStatus = (messageAttributes as ThreadMessage).status; - const messageId = (messageAttributes as ThreadMessage).id; - const incompleteDetails = (messageAttributes as ThreadMessage).incomplete_details; - if (incompleteDetails) { - eventBody.incomplete_details = incompleteDetails; - } - const usagePromptTokens = usage?.prompt_tokens; - const usageCompletionTokens = usage?.completion_tokens; - const attributes = { - eventContent: JSON.stringify(eventBody), - threadId, - agentId, - threadRunId, - messageStatus, - messageId, - usagePromptTokens, - usageCompletionTokens, - genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM, - }; - TracingUtility.addSpanEvent(span, `gen_ai.${messageAttributes.role}.message`, attributes); -} - -/** - * Adds an instruction event to the span. - * @param span - The span to add the event to. - * @param instructionAttributes - The attributes of the instruction event. - */ -export function addInstructionsEvent( - span: Span, - instructionAttributes: { - instructions?: string | null; - additional_instructions?: string | null; - threadId?: string; - agentId?: string; - }, -): void { - const eventBody: Record = {}; - if (instructionAttributes.instructions || instructionAttributes.additional_instructions) { - eventBody.content = - instructionAttributes.instructions && instructionAttributes.additional_instructions - ? `${instructionAttributes.instructions} ${instructionAttributes.additional_instructions}` - : instructionAttributes.instructions || instructionAttributes.additional_instructions; - } - const attributes = { - eventContent: JSON.stringify(eventBody), - threadId: instructionAttributes.threadId, - agentId: instructionAttributes.agentId, - genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM, - }; - TracingUtility.addSpanEvent(span, "gen_ai.system.message", attributes); -} - -/** - * Formats the agent API response. - * @param responseFormat - The response format option. - * @returns The formatted response as a string, or null/undefined. - */ -export function formatAgentApiResponse( - responseFormat: AgentsApiResponseFormatOption | null | undefined, -): string | undefined { - if ( - typeof responseFormat === "string" || - responseFormat === undefined || - responseFormat === null - ) { - return responseFormat ?? undefined; - } - if ((responseFormat as AgentsApiResponseFormat).type) { - return (responseFormat as AgentsApiResponseFormat).type ?? undefined; - } - return undefined; -} - -/** - * Adds a tool messages event to the span - * @param span - The span to add the event to. - * @param tool_outputs - List of tool oupts - */ -export function addToolMessagesEvent(span: Span, tool_outputs: Array): void { - tool_outputs.forEach((tool_output) => { - const eventBody = { content: tool_output.output, id: tool_output.tool_call_id }; - TracingUtility.addSpanEvent(span, "gen_ai.tool.message", { - eventContent: JSON.stringify(eventBody), - genAiSystem: TracingAttributes.AZ_AI_AGENT_SYSTEM, - }); - }); -} - -function getMessageContent(messageContent: string | MessageContent[]): string | {} { - type MessageContentExtended = MessageContent & { [key: string]: any }; - if (!Array.isArray(messageContent)) { - return messageContent; - } - const contentBody: { [key: string]: any } = {}; - messageContent.forEach((content) => { - const typedContent = content.type; - const { value, annotations } = (content as MessageContentExtended)[typedContent]; - contentBody[typedContent] = { value, annotations }; - }); - return contentBody; -} diff --git a/sdk/ai/ai-projects/src/agents/utils.ts b/sdk/ai/ai-projects/src/agents/utils.ts deleted file mode 100644 index 2abace5e7a32..000000000000 --- a/sdk/ai/ai-projects/src/agents/utils.ts +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - AzureAISearchToolDefinition, - CodeInterpreterToolDefinition, - FileSearchToolDefinition, - FileSearchToolDefinitionDetails, - FunctionDefinition, - FunctionToolDefinition, - RequiredActionOutput, - RequiredToolCallOutput, - ToolDefinition, - ToolDefinitionOutputParent, - ToolResources, - VectorStoreConfigurations, - VectorStoreDataSource, -} from "./inputOutputs.js"; - -/** - * Determines if the given output is of the specified type. - * - * @typeparam T - The type to check against, which extends one of the possible output parent types. - * @param output - The action to check, which can be of type `RequiredActionOutput`, `RequiredToolCallOutput`, or `ToolDefinitionOutputParent`. - * @param type - The type to check the action against. - * @returns A boolean indicating whether the action is of the specified type. - */ -export function isOutputOfType( - output: RequiredActionOutput | RequiredToolCallOutput | ToolDefinitionOutputParent, - type: string, -): output is T { - return output.type === type; -} - -/** Types of connection tools used to configure an agent */ -export enum connectionToolType { - /** Bing grounding search tool */ - BingGrounding = "bing_grounding", - /** Microsoft Fabric tool */ - MicrosoftFabric = "microsoft_fabric", - /** Sharepoint tool */ - SharepointGrounding = "sharepoint_grounding", -} - -const toolMap = { - bing_grounding: "bingGrounding", - microsoft_fabric: "microsoftFabric", - sharepoint_grounding: "sharepointGrounding", -}; - -/** - * Utility class for creating various tools. - */ -export class ToolUtility { - /** - * Creates a connection tool - * - * @param toolType - The type of the connection tool. - * @param connectionIds - A list of the IDs of the connections to use. - * @returns An object containing the definition for the connection tool - */ - static createConnectionTool( - toolType: connectionToolType, - connectionIds: string[], - ): { definition: ToolDefinition } { - return { - definition: { - type: toolType, - [toolMap[toolType]]: { - connections: connectionIds.map((connectionId) => ({ connectionId: connectionId })), - }, - }, - }; - } - - /** - * Creates a file search tool - * - * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. - * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool. - * @param definitionDetails - The input definition information for a file search tool as used to configure an agent. - * - * @returns An object containing the definition and resources for the file search tool - */ - static createFileSearchTool( - vectorStoreIds?: string[], - vectorStores?: Array, - definitionDetails?: FileSearchToolDefinitionDetails, - ): { definition: FileSearchToolDefinition; resources: ToolResources } { - return { - definition: { type: "file_search", fileSearch: definitionDetails }, - resources: { fileSearch: { vectorStoreIds: vectorStoreIds, vectorStores: vectorStores } }, - }; - } - - /** - * Creates a code interpreter tool - * - * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds. - * - * @returns An object containing the definition and resources for the code interpreter tool. - */ - static createCodeInterpreterTool( - fileIds?: string[], - dataSources?: Array, - ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } { - if (fileIds && dataSources) { - throw new Error("Cannot specify both fileIds and dataSources"); - } - - return { - definition: { type: "code_interpreter" }, - resources: { codeInterpreter: { fileIds: fileIds, dataSources: dataSources } }, - }; - } - - /** - * Creates an Azure AI search tool - * - * @param indexConnectionId - The connection ID of the Azure AI search index. - * @param indexName - The name of the Azure AI search index. - * - * @returns An object containing the definition and resources for the Azure AI search tool. - */ - static createAzureAISearchTool( - indexConnectionId: string, - indexName: string, - ): { definition: AzureAISearchToolDefinition; resources: ToolResources } { - return { - definition: { type: "azure_ai_search" }, - resources: { - azureAISearch: { - indexes: [{ indexConnectionId: indexConnectionId, indexName: indexName }], - }, - }, - }; - } - - /** - * Creates a function tool - * - * @param functionDefinition - The function definition to use. - * - * @returns An object containing the definition for the function tool. - */ - static createFunctionTool(functionDefinition: FunctionDefinition): { - definition: FunctionToolDefinition; - } { - return { - definition: { - type: "function", - function: functionDefinition, - }, - }; - } -} - -/** - * Represents a set of tools with their definitions and resources. - */ -export class ToolSet { - /** A list of tool definitions that have been added to the tool set. */ - toolDefinitions: ToolDefinition[] = []; - - /** A collection of resources associated with the tools in the tool set. */ - toolResources: ToolResources = {}; - - /** - * Adds a connection tool to the tool set. - * - * @param toolType - The type of the connection tool. - * @param connectionIds - A list of the IDs of the connections to use. - * - * @returns An object containing the definition for the connection tool - */ - addConnectionTool( - toolType: connectionToolType, - connectionIds: string[], - ): { definition: ToolDefinition } { - const tool = ToolUtility.createConnectionTool(toolType, connectionIds); - this.toolDefinitions.push(tool.definition); - return tool; - } - - /** - * Adds a file search tool to the tool set. - * - * @param vectorStoreIds - The ID of the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. - * @param vectorStores - The list of vector store configuration objects from Azure. This list is limited to one element. The only element of this list contains the list of azure asset IDs used by the search tool. - * @param definitionDetails - The input definition information for a file search tool as used to configure an agent. - * - * @returns An object containing the definition and resources for the file search tool - */ - addFileSearchTool( - vectorStoreIds?: string[], - vectorStores?: Array, - definitionDetails?: FileSearchToolDefinitionDetails, - ): { definition: FileSearchToolDefinition; resources: ToolResources } { - const tool = ToolUtility.createFileSearchTool(vectorStoreIds, vectorStores, definitionDetails); - this.toolDefinitions.push(tool.definition); - this.toolResources = { ...this.toolResources, ...tool.resources }; - return tool; - } - - /** - * Adds a code interpreter tool to the tool set. - * - * @param fileIds - A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files associated with the tool. - * @param dataSources - The data sources to be used. This option is mutually exclusive with fileIds. - * - * @returns An object containing the definition and resources for the code interpreter tool - */ - addCodeInterpreterTool( - fileIds?: string[], - dataSources?: Array, - ): { definition: CodeInterpreterToolDefinition; resources: ToolResources } { - const tool = ToolUtility.createCodeInterpreterTool(fileIds, dataSources); - this.toolDefinitions.push(tool.definition); - this.toolResources = { ...this.toolResources, ...tool.resources }; - return tool; - } - - /** - * Adds an Azure AI search tool to the tool set. - * - * @param indexConnectionId - The connection ID of the Azure AI search index. - * @param indexName - The name of the Azure AI search index. - * - * @returns An object containing the definition and resources for the Azure AI search tool - */ - addAzureAISearchTool( - indexConnectionId: string, - indexName: string, - ): { definition: AzureAISearchToolDefinition; resources: ToolResources } { - const tool = ToolUtility.createAzureAISearchTool(indexConnectionId, indexName); - this.toolDefinitions.push(tool.definition); - this.toolResources = { ...this.toolResources, ...tool.resources }; - return tool; - } -} diff --git a/sdk/ai/ai-projects/src/agents/vectorStores.ts b/sdk/ai/ai-projects/src/agents/vectorStores.ts deleted file mode 100644 index 05b10069bc31..000000000000 --- a/sdk/ai/ai-projects/src/agents/vectorStores.ts +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - ListVectorStoresParameters, - CreateVectorStoreParameters, - ModifyVectorStoreParameters, -} from "../generated/src/parameters.js"; -import type { - OpenAIPageableListOfVectorStoreOutput, - VectorStoreDeletionStatusOutput, - VectorStoreOutput, -} from "../customization/outputModels.js"; -import { AgentsPoller } from "./poller.js"; -import type { CreateVectorStoreWithPollingOptionalParams } from "./customModels.js"; -import { - type CreateVectorStoreOptionalParams, - type DeleteVectorStoreOptionalParams, - type GetVectorStoreOptionalParams, - type ListVectorStoresOptionalParams, - type UpdateVectorStoreOptionalParams, -} from "./customModels.js"; -import { - validateLimit, - validateMetadata, - validateOrder, - validateVectorStoreId, -} from "./inputValidations.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import * as ConvertToWire from "../customization/convertModelsToWrite.js"; -import { convertToListQueryParameters } from "../customization/convertParametersToWire.js"; -import { createOpenAIError } from "./openAIError.js"; -import type { PollerLike, PollOperationState } from "@azure/core-lro"; - -const expectedStatuses = ["200"]; - -/** Returns a list of vector stores. */ -export async function listVectorStores( - context: Client, - options: ListVectorStoresOptionalParams = {}, -): Promise { - const listOptions: GeneratedParameters.ListVectorStoresParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: convertToListQueryParameters(options), - }; - - validateListVectorStoresParameters(listOptions); - const result = await context.path("/vector_stores").get(listOptions); - - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertOpenAIPageableListOfVectorStoreOutput(result.body); -} - -/** Creates a vector store. */ -export async function createVectorStore( - context: Client, - options: CreateVectorStoreOptionalParams = {}, -): Promise { - const createOptions: GeneratedParameters.CreateVectorStoreParameters = { - ...operationOptionsToRequestParameters(options), - body: ConvertToWire.convertVectorStoreOptions(options), - }; - - validateCreateVectorStoreParameters(createOptions); - const result = await context.path("/vector_stores").post(createOptions); - - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreOutput(result.body); -} - -/** Returns the vector store object matching the specified ID. */ -export async function getVectorStore( - context: Client, - vectorStoreId: string, - options: GetVectorStoreOptionalParams = {}, -): Promise { - const getOptions: GeneratedParameters.GetVectorStoreParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateVectorStoreId(vectorStoreId); - const result = await context - .path("/vector_stores/{vectorStoreId}", vectorStoreId) - .get(getOptions); - - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreOutput(result.body); -} - -/** The ID of the vector store to modify. */ -export async function modifyVectorStore( - context: Client, - vectorStoreId: string, - options: UpdateVectorStoreOptionalParams = {}, -): Promise { - const modifyOptions: GeneratedParameters.ModifyVectorStoreParameters = { - ...operationOptionsToRequestParameters(options), - body: ConvertToWire.convertVectorStoreUpdateOptions(options), - }; - - validateVectorStoreId(vectorStoreId); - validateModifyVectorStoreParameters(modifyOptions); - const result = await context - .path("/vector_stores/{vectorStoreId}", vectorStoreId) - .post(modifyOptions); - - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreOutput(result.body); -} - -/** Deletes the vector store object matching the specified ID. */ -export async function deleteVectorStore( - context: Client, - vectorStoreId: string, - options: DeleteVectorStoreOptionalParams = {}, -): Promise { - const deleteOptions: GeneratedParameters.DeleteVectorStoreParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateVectorStoreId(vectorStoreId); - const result = await context - .path("/vector_stores/{vectorStoreId}", vectorStoreId) - .delete(deleteOptions); - - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreDeletionStatusOutput(result.body); -} - -/** - * Creates a vector store and poll. - */ -export function createVectorStoreAndPoll( - context: Client, - options: CreateVectorStoreWithPollingOptionalParams = {}, -): PollerLike, VectorStoreOutput> { - async function updateCreateVectorStorePoll( - currentResult?: VectorStoreOutput, - ): Promise<{ result: VectorStoreOutput; completed: boolean }> { - let vectorStore: VectorStoreOutput; - if (!currentResult) { - vectorStore = await createVectorStore(context, options); - } else { - const getOptions: GetVectorStoreOptionalParams = { - ...operationOptionsToRequestParameters(options), - }; - vectorStore = await getVectorStore(context, currentResult.id, getOptions); - } - return { - result: vectorStore, - completed: vectorStore.status !== "in_progress", - }; - } - - return new AgentsPoller({ - update: updateCreateVectorStorePoll, - pollingOptions: options.pollingOptions, - }); -} - -function validateListVectorStoresParameters(options?: ListVectorStoresParameters): void { - if (options?.queryParameters?.limit) { - validateLimit(options.queryParameters.limit); - } - if (options?.queryParameters?.order) { - validateOrder(options.queryParameters.order); - } -} - -function validateCreateVectorStoreParameters(options?: CreateVectorStoreParameters): void { - if ( - options?.body?.chunking_strategy && - (!options.body.file_ids || options.body.file_ids.length === 0) - ) { - throw new Error("Chunking strategy is only applicable if fileIds is non-empty"); - } - if (options?.body?.metadata) { - validateMetadata(options.body.metadata); - } -} - -function validateModifyVectorStoreParameters(options?: ModifyVectorStoreParameters): void { - if (options?.body?.metadata) { - validateMetadata(options.body.metadata); - } -} diff --git a/sdk/ai/ai-projects/src/agents/vectorStoresFileBatches.ts b/sdk/ai/ai-projects/src/agents/vectorStoresFileBatches.ts deleted file mode 100644 index 831999d6f307..000000000000 --- a/sdk/ai/ai-projects/src/agents/vectorStoresFileBatches.ts +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - OpenAIPageableListOfVectorStoreFileOutput, - VectorStoreFileBatchOutput, -} from "../customization/outputModels.js"; -import { AgentsPoller } from "./poller.js"; -import type { - CancelVectorStoreFileBatchOptionalParams, - CreateVectorStoreFileBatchOptionalParams, - CreateVectorStoreFileBatchWithPollingOptionalParams, - GetVectorStoreFileBatchOptionalParams, - ListVectorStoreFileBatchFilesOptionalParams, -} from "./customModels.js"; -import { - validateFileStatusFilter, - validateLimit, - validateOrder, - validateVectorStoreId, -} from "./inputValidations.js"; -import type { - CreateVectorStoreFileBatchParameters, - ListVectorStoreFileBatchFilesParameters, -} from "../generated/src/parameters.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import * as ConvertParamsToWire from "../customization/convertParametersToWire.js"; -import { createOpenAIError } from "./openAIError.js"; -import type { PollerLike, PollOperationState } from "@azure/core-lro"; - -const expectedStatuses = ["200"]; - -/** Create a vector store file batch. */ -export async function createVectorStoreFileBatch( - context: Client, - vectorStoreId: string, - options: CreateVectorStoreFileBatchOptionalParams = {}, -): Promise { - const createOptions: CreateVectorStoreFileBatchParameters = { - ...operationOptionsToRequestParameters(options), - ...ConvertParamsToWire.convertCreateVectorStoreFileBatchParam({ body: options }), - }; - - validateVectorStoreId(vectorStoreId); - validateCreateVectorStoreFileBatchParameters(createOptions); - const result = await context - .path("/vector_stores/{vectorStoreId}/file_batches", vectorStoreId) - .post(createOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body); -} - -/** Retrieve a vector store file batch. */ -export async function getVectorStoreFileBatch( - context: Client, - vectorStoreId: string, - batchId: string, - options: GetVectorStoreFileBatchOptionalParams = {}, -): Promise { - validateVectorStoreId(vectorStoreId); - const result = await context - .path("/vector_stores/{vectorStoreId}/file_batches/{batchId}", vectorStoreId, batchId) - .get(options); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body); -} - -/** Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. */ -export async function cancelVectorStoreFileBatch( - context: Client, - vectorStoreId: string, - batchId: string, - options: CancelVectorStoreFileBatchOptionalParams = {}, -): Promise { - validateVectorStoreId(vectorStoreId); - const result = await context - .path("/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel", vectorStoreId, batchId) - .post(options); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreFileBatchOutput(result.body); -} - -/** Returns a list of vector store files in a batch. */ -export async function listVectorStoreFileBatchFiles( - context: Client, - vectorStoreId: string, - batchId: string, - options: ListVectorStoreFileBatchFilesOptionalParams = {}, -): Promise { - const listOptions: ListVectorStoreFileBatchFilesParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: ConvertParamsToWire.convertListVectorStoreFileBatchFilesQueryParamProperties( - options, - ) as Record, - }; - - validateVectorStoreId(vectorStoreId); - validateBatchId(batchId); - validateListVectorStoreFileBatchFilesParameters(listOptions); - const result = await context - .path("/vector_stores/{vectorStoreId}/file_batches/{batchId}/files", vectorStoreId, batchId) - .get(listOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertOpenAIPageableListOfVectorStoreFileOutput(result.body); -} - -/** Create a vector store file batch and poll. */ -export function createVectorStoreFileBatchAndPoll( - context: Client, - vectorStoreId: string, - options: CreateVectorStoreFileBatchWithPollingOptionalParams = {}, -): PollerLike, VectorStoreFileBatchOutput> { - async function updateCreateVectorStoreFileBatchPoll( - currentResult?: VectorStoreFileBatchOutput, - ): Promise<{ result: VectorStoreFileBatchOutput; completed: boolean }> { - let vectorStore: VectorStoreFileBatchOutput; - if (!currentResult) { - vectorStore = await createVectorStoreFileBatch(context, vectorStoreId, options); - } else { - vectorStore = await getVectorStoreFileBatch( - context, - vectorStoreId, - currentResult.id, - options, - ); - } - return { - result: vectorStore, - completed: vectorStore.status !== "in_progress", - }; - } - - async function cancelCreateVectorStoreFileBatchPoll( - currentResult: VectorStoreFileBatchOutput, - ): Promise { - const result = await cancelVectorStoreFileBatch(context, vectorStoreId, currentResult.id); - return result.status === "cancelled"; - } - - return new AgentsPoller({ - update: updateCreateVectorStoreFileBatchPoll, - cancel: cancelCreateVectorStoreFileBatchPoll, - pollingOptions: options.pollingOptions, - }); -} - -function validateBatchId(batchId: string): void { - if (!batchId) { - throw new Error("Batch ID is required"); - } -} - -function validateCreateVectorStoreFileBatchParameters( - options?: CreateVectorStoreFileBatchParameters, -): void { - if ( - options?.body?.chunking_strategy && - (!options.body.file_ids || options.body.file_ids.length === 0) - ) { - throw new Error("Chunking strategy is only applicable if fileIds are included"); - } -} - -function validateListVectorStoreFileBatchFilesParameters( - options?: ListVectorStoreFileBatchFilesParameters, -): void { - if (options?.queryParameters?.filter) { - validateFileStatusFilter(options.queryParameters.filter); - } - if (options?.queryParameters?.limit) { - validateLimit(options.queryParameters.limit); - } - if (options?.queryParameters?.order) { - validateOrder(options.queryParameters.order); - } -} diff --git a/sdk/ai/ai-projects/src/agents/vectorStoresFiles.ts b/sdk/ai/ai-projects/src/agents/vectorStoresFiles.ts deleted file mode 100644 index 7d7bd64b7133..000000000000 --- a/sdk/ai/ai-projects/src/agents/vectorStoresFiles.ts +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { - ListVectorStoreFilesParameters, - CreateVectorStoreFileParameters, -} from "../generated/src/parameters.js"; -import type { - OpenAIPageableListOfVectorStoreFileOutput, - VectorStoreFileDeletionStatusOutput, - VectorStoreFileOutput, -} from "../customization/outputModels.js"; -import { AgentsPoller } from "./poller.js"; -import type { - CreateVectorStoreFileOptionalParams, - CreateVectorStoreFileWithPollingOptionalParams, - DeleteVectorStoreFileOptionalParams, - GetVectorStoreFileOptionalParams, - ListVectorStoreFilesOptionalParams, -} from "./customModels.js"; -import { - validateFileId, - validateFileStatusFilter, - validateLimit, - validateOrder, - validateVectorStoreId, -} from "./inputValidations.js"; -import { convertToListQueryParameters } from "../customization/convertParametersToWire.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import * as ConvertFromWire from "../customization/convertOutputModelsFromWire.js"; -import * as ConvertParamsToWire from "../customization/convertParametersToWire.js"; -import { createOpenAIError } from "./openAIError.js"; -import type { PollerLike, PollOperationState } from "@azure/core-lro"; - -const expectedStatuses = ["200"]; - -/** Returns a list of vector store files. */ -export async function listVectorStoreFiles( - context: Client, - vectorStoreId: string, - options: ListVectorStoreFilesOptionalParams = {}, -): Promise { - validateVectorStoreId(vectorStoreId); - - const listOptions: GeneratedParameters.ListVectorStoreFilesParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: convertToListQueryParameters(options), - }; - - validateListVectorStoreFilesParameters(listOptions); - const result = await context - .path("/vector_stores/{vectorStoreId}/files", vectorStoreId) - .get(listOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertOpenAIPageableListOfVectorStoreFileOutput(result.body); -} - -/** Create a vector store file by attaching a file to a vector store. */ -export async function createVectorStoreFile( - context: Client, - vectorStoreId: string, - options: CreateVectorStoreFileOptionalParams = {}, -): Promise { - const createOptions: CreateVectorStoreFileParameters = { - ...operationOptionsToRequestParameters(options), - ...ConvertParamsToWire.convertCreateVectorStoreFileParam({ body: options }), - }; - - validateVectorStoreId(vectorStoreId); - validateCreateVectorStoreFileParameters(createOptions); - const result = await context - .path("/vector_stores/{vectorStoreId}/files", vectorStoreId) - .post(createOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreFileOutput(result.body); -} - -/** Retrieves a vector store file. */ -export async function getVectorStoreFile( - context: Client, - vectorStoreId: string, - fileId: string, - options: GetVectorStoreFileOptionalParams = {}, -): Promise { - const getOptions: GeneratedParameters.GetVectorStoreFileParameters = { - ...operationOptionsToRequestParameters(options), - }; - - validateVectorStoreId(vectorStoreId); - validateFileId(fileId); - const result = await context - .path("/vector_stores/{vectorStoreId}/files/{fileId}", vectorStoreId, fileId) - .get(getOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreFileOutput(result.body); -} - -/** - * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. - * To delete the file, use the delete file endpoint. - */ -export async function deleteVectorStoreFile( - context: Client, - vectorStoreId: string, - fileId: string, - options: DeleteVectorStoreFileOptionalParams = {}, -): Promise { - validateVectorStoreId(vectorStoreId); - validateFileId(fileId); - const deleteOptions: GeneratedParameters.GetVectorStoreFileParameters = { - ...operationOptionsToRequestParameters(options), - }; - const result = await context - .path("/vector_stores/{vectorStoreId}/files/{fileId}", vectorStoreId, fileId) - .delete(deleteOptions); - if (!expectedStatuses.includes(result.status)) { - throw createOpenAIError(result); - } - return ConvertFromWire.convertVectorStoreFileDeletionStatusOutput(result.body); -} - -/** Create a vector store file by attaching a file to a vector store and poll. */ -export function createVectorStoreFileAndPoll( - context: Client, - vectorStoreId: string, - options: CreateVectorStoreFileWithPollingOptionalParams = {}, -): PollerLike, VectorStoreFileOutput> { - async function updateCreateVectorStoreFilePoll( - currentResult?: VectorStoreFileOutput, - ): Promise<{ result: VectorStoreFileOutput; completed: boolean }> { - let vectorStoreFile: VectorStoreFileOutput; - if (!currentResult) { - vectorStoreFile = await createVectorStoreFile(context, vectorStoreId, options); - } else { - vectorStoreFile = await getVectorStoreFile(context, vectorStoreId, currentResult.id, options); - } - return { - result: vectorStoreFile, - completed: vectorStoreFile.status !== "in_progress", - }; - } - - return new AgentsPoller({ - update: updateCreateVectorStoreFilePoll, - pollingOptions: options.pollingOptions, - }); -} - -function validateListVectorStoreFilesParameters(options?: ListVectorStoreFilesParameters): void { - if (options?.queryParameters?.filter) { - validateFileStatusFilter(options.queryParameters.filter); - } - if (options?.queryParameters?.limit) { - validateLimit(options.queryParameters.limit); - } - if (options?.queryParameters?.order) { - validateOrder(options.queryParameters.order); - } -} - -function validateCreateVectorStoreFileParameters(options?: CreateVectorStoreFileParameters): void { - if (options?.body?.chunking_strategy && !options.body.file_id) { - throw new Error("Chunking strategy is only applicable if fileId is included"); - } -} diff --git a/sdk/ai/ai-projects/src/agents/vectorStoresModels.ts b/sdk/ai/ai-projects/src/agents/vectorStoresModels.ts deleted file mode 100644 index 03b58c251467..000000000000 --- a/sdk/ai/ai-projects/src/agents/vectorStoresModels.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - VectorStoreChunkingStrategyRequest, - VectorStoreDataSource, - VectorStoreFileStatusFilter, -} from "../customization/models.js"; - -/** Request object for creating a vector store file. */ -export interface CreateVectorStoreFileOptions { - /** A File ID that the vector store should use. Useful for tools like `file_search` that can access files. */ - fileId?: string; - - /** The data sources to be used. This option is mutually exclusive with fileId. */ - dataSources?: Array; - - /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ - chunkingStrategy?: VectorStoreChunkingStrategyRequest; -} - -/** Request object for creating a vector store file batch. */ -export interface CreateVectorStoreFileBatchOptions { - /** A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files. */ - fileIds?: string[]; - - /** The data sources to be used. This option is mutually exclusive with fileId. */ - dataSources?: VectorStoreDataSource[]; - - /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. */ - chunkingStrategy?: VectorStoreChunkingStrategyRequest; -} - -/** Filter by file status. */ -export interface FileStatusFilter { - /** - * Possible values: "in_progress", "completed", "failed", "cancelled" - */ - filter?: VectorStoreFileStatusFilter; -} diff --git a/sdk/ai/ai-projects/src/aiProjectsClient.ts b/sdk/ai/ai-projects/src/aiProjectsClient.ts deleted file mode 100644 index ad6af9c98c00..000000000000 --- a/sdk/ai/ai-projects/src/aiProjectsClient.ts +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import type { Client } from "@azure-rest/core-client"; -import type { TokenCredential } from "@azure/core-auth"; -import type { AgentsOperations } from "./agents/index.js"; -import { getAgentsOperations } from "./agents/index.js"; -import type { ConnectionsOperations } from "./connections/index.js"; -import { getConnectionsOperations } from "./connections/index.js"; -import type { ProjectsClientOptions } from "./generated/src/projectsClient.js"; -import createClient from "./generated/src/projectsClient.js"; -import type { TelemetryOperations } from "./telemetry/index.js"; -import { getTelemetryOperations } from "./telemetry/index.js"; - -/** - * The options for the AIProjectsClient - */ -export interface AIProjectsClientOptions extends ProjectsClientOptions {} - -/** - * The Azure AI Projects client - */ -export class AIProjectsClient { - private _client: Client; - private _connectionClient: Client; - private _telemetryClient: Client; - - /* - * @param endpointParam - The Azure AI Foundry project endpoint, in the form `https://.api.azureml.ms` or `https://..api.azureml.ms`, where is the Azure region where the project is deployed (e.g. westus) and is the GUID of the Enterprise private link. - * @param subscriptionId - The Azure subscription ID. - * @param resourceGroupName - The name of the Azure Resource Group. - * @param projectName - The Azure AI Foundry project name. - * @param options - the parameter for all optional parameters - */ - constructor( - endpointParam: string, - subscriptionId: string, - resourceGroupName: string, - projectName: string, - credential: TokenCredential, - options: AIProjectsClientOptions = {}, - ) { - const connectionEndPoint = `https://management.azure.com/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/${projectName}`; - this._client = createClient( - endpointParam, - subscriptionId, - resourceGroupName, - projectName, - credential, - options, - ); - - this._connectionClient = createClient( - endpointParam, - subscriptionId, - resourceGroupName, - projectName, - credential, - { ...options, endpoint: connectionEndPoint }, - ); - - this._telemetryClient = createClient( - endpointParam, - subscriptionId, - resourceGroupName, - projectName, - credential, - { ...options, apiVersion: "2020-02-02", endpoint: "https://management.azure.com" }, - ); - - this.agents = getAgentsOperations(this._client); - this.connections = getConnectionsOperations(this._connectionClient); - this.telemetry = getTelemetryOperations(this._telemetryClient, this.connections); - } - - /** - * Creates a new instance of AzureAIProjectsClient - * @param connectionString - Connection string with the endpoint, subscriptionId, resourceGroupName, and projectName - * @param credential - The credential to use - * @param options - The parameter for all optional parameters - */ - static fromConnectionString( - connectionString: string, - credential: TokenCredential, - // eslint-disable-next-line @azure/azure-sdk/ts-naming-options - options: AIProjectsClientOptions = {}, - ): AIProjectsClient { - const { endpointParam, subscriptionId, resourceGroupName, projectName } = - AIProjectsClient.praseConnectionString(connectionString); - return new AIProjectsClient( - endpointParam, - subscriptionId, - resourceGroupName, - projectName, - credential, - options, - ); - } - - private static praseConnectionString(connectionString: string): { - endpointParam: string; - subscriptionId: string; - resourceGroupName: string; - projectName: string; - } { - const parts = connectionString.split(";"); - return { - endpointParam: `https://${parts[0]}`, - subscriptionId: parts[1], - resourceGroupName: parts[2], - projectName: parts[3], - }; - } - - /** The operation groups for Agents */ - public readonly agents: AgentsOperations; - - /** The operation groups for connections */ - public readonly connections: ConnectionsOperations; - - /** The operation groups for telemetry */ - public readonly telemetry: TelemetryOperations; -} diff --git a/sdk/ai/ai-projects/src/generated/src/clientDefinitions.ts b/sdk/ai/ai-projects/src/clientDefinitions.ts similarity index 98% rename from sdk/ai/ai-projects/src/generated/src/clientDefinitions.ts rename to sdk/ai/ai-projects/src/clientDefinitions.ts index c00785ae2a6e..a3be28db973c 100644 --- a/sdk/ai/ai-projects/src/generated/src/clientDefinitions.ts +++ b/sdk/ai/ai-projects/src/clientDefinitions.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { CreateAgentParameters, ListAgentsParameters, GetAgentParameters, @@ -56,7 +56,7 @@ import { ListScheduleParameters, DisableScheduleParameters, } from "./parameters.js"; -import { +import type { CreateAgent200Response, CreateAgentDefaultResponse, ListAgents200Response, @@ -164,7 +164,7 @@ import { DisableSchedule204Response, DisableScheduleDefaultResponse, } from "./responses.js"; -import { Client, StreamableMethod } from "@azure-rest/core-client"; +import type { Client, StreamableMethod } from "@azure-rest/core-client"; export interface CreateAgent { /** Creates a new agent. */ @@ -535,8 +535,8 @@ export interface DisableSchedule { export interface Routes { /** Resource for '/assistants' has methods for the following verbs: post, get */ (path: "/assistants"): CreateAgent; - /** Resource for '/assistants/\{assistantId\}' has methods for the following verbs: get, post, delete */ - (path: "/assistants/{assistantId}", assistantId: string): GetAgent; + /** Resource for '/assistants/\{agentId\}' has methods for the following verbs: get, post, delete */ + (path: "/assistants/{agentId}", agentId: string): GetAgent; /** Resource for '/threads' has methods for the following verbs: post */ (path: "/threads"): CreateThread; /** Resource for '/threads/\{threadId\}' has methods for the following verbs: get, post, delete */ diff --git a/sdk/ai/ai-projects/src/connections/connections.ts b/sdk/ai/ai-projects/src/connections/connections.ts deleted file mode 100644 index 53ea38da39ca..000000000000 --- a/sdk/ai/ai-projects/src/connections/connections.ts +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import { createRestError, operationOptionsToRequestParameters } from "@azure-rest/core-client"; -import type { GetConnectionResponseOutput } from "./inputOutput.js"; -import type { - GetWorkspaceParameters, - GetConnectionParameters, - GetConnectionWithSecretsParameters, - ListConnectionsParameters, -} from "../customization/parameters.js"; -import type { - GetConnectionOptionalParams, - GetConnectionWithSecretsOptionalParams, - GetWorkspaceOptionalParams, - ListConnectionsOptionalParams, -} from "./customModels.js"; -import type { GetWorkspaceResponseOutput } from "../customization/outputModels.js"; - -const expectedStatuses = ["200"]; - -/** Gets the properties of the specified machine learning workspace. */ -export async function getWorkspace( - context: Client, - options: GetWorkspaceOptionalParams = {}, -): Promise { - const getOptions: GetWorkspaceParameters = { - ...operationOptionsToRequestParameters(options), - }; - const result = await context.path("/").get(getOptions); - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - return result.body; -} - -/** List the details of all the connections (not including their credentials) */ -export async function listConnections( - context: Client, - options: ListConnectionsOptionalParams = {}, -): Promise> { - const listOptions: ListConnectionsParameters = { - ...operationOptionsToRequestParameters(options), - queryParameters: { - ...(options.includeAll && { includeAll: options.includeAll }), - ...(options.category && { category: options.category }), - ...(options.target && { target: options.target }), - }, - }; - const result = await context.path("/connections").get(listOptions); - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - return result.body.value; -} - -/** Get the details of a single connection, without credentials. */ -export async function getConnection( - context: Client, - connectionName: string, - options: GetConnectionOptionalParams = {}, -): Promise { - const getOptions: GetConnectionParameters = { - ...operationOptionsToRequestParameters(options), - }; - const result = await context - .path("/connections/{connectionName}", connectionName) - .get(getOptions); - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - return result.body; -} - -/** Get the details of a single connection, including credentials (if available). */ -export async function getConnectionWithSecrets( - context: Client, - connectionName: string, - options: GetConnectionWithSecretsOptionalParams = {}, -): Promise { - const getOptions: GetConnectionWithSecretsParameters = { - ...operationOptionsToRequestParameters(options), - body: { - ignored: "", - }, - }; - const result = await context - .path("/connections/{connectionName}/listsecrets", connectionName) - .post(getOptions); - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - return result.body; -} diff --git a/sdk/ai/ai-projects/src/connections/customModels.ts b/sdk/ai/ai-projects/src/connections/customModels.ts deleted file mode 100644 index 0c29ea92d723..000000000000 --- a/sdk/ai/ai-projects/src/connections/customModels.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { OperationOptions } from "@azure-rest/core-client"; -import type { ListConnectionsQueryParamProperties } from "../customization/parameters.js"; -import type { GetConnectionResponseOutput } from "../customization/outputModels.js"; - -/** Get workspace optional parameters. */ -export interface GetWorkspaceOptionalParams extends OperationOptions {} - -/** List connections optional parameters. */ -export interface ListConnectionsOptionalParams - extends ListConnectionsQueryParamProperties, - OperationOptions {} - -/** Get connection optional parameters. */ -export interface GetConnectionOptionalParams extends OperationOptions {} - -/** Get connection with secrets optional parameters. */ -export interface GetConnectionWithSecretsOptionalParams extends OperationOptions {} - -/** - * Connections Interface for managing connections. - */ -export interface ConnectionsOperations { - /** List the details of all the connections (not including their credentials) */ - listConnections: ( - options?: ListConnectionsOptionalParams, - ) => Promise>; - /** Get the details of a single connection, without credentials */ - getConnection: ( - connectionName: string, - options?: GetConnectionOptionalParams, - ) => Promise; - /** Get the details of a single connections, including credentials (if available). */ - getConnectionWithSecrets: ( - connectionName: string, - options?: GetConnectionWithSecretsOptionalParams, - ) => Promise; -} diff --git a/sdk/ai/ai-projects/src/connections/index.ts b/sdk/ai/ai-projects/src/connections/index.ts deleted file mode 100644 index e25191c06250..000000000000 --- a/sdk/ai/ai-projects/src/connections/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; - -import { - getConnection, - getConnectionWithSecrets, - getWorkspace, - listConnections, -} from "./connections.js"; -import type { - ConnectionsOperations, - GetConnectionOptionalParams, - GetConnectionWithSecretsOptionalParams, - GetWorkspaceOptionalParams, - ListConnectionsOptionalParams, -} from "./customModels.js"; -import type { ConnectionsInternalOperations } from "./internalModels.js"; - -export * from "./inputOutput.js"; - -function getConnections(context: Client): ConnectionsInternalOperations { - return { - getWorkspace: (options?: GetWorkspaceOptionalParams) => getWorkspace(context, options), - listConnections: (options?: ListConnectionsOptionalParams) => listConnections(context, options), - getConnection: (connectionName: string, options?: GetConnectionOptionalParams) => - getConnection(context, connectionName, options), - getConnectionWithSecrets: ( - connectionName: string, - options?: GetConnectionWithSecretsOptionalParams, - ) => getConnectionWithSecrets(context, connectionName, options), - }; -} - -/** - * Get the connections operations - * @returns The connections operations - **/ -export function getConnectionsOperations(context: Client): ConnectionsOperations { - return { - ...getConnections(context), - }; -} diff --git a/sdk/ai/ai-projects/src/connections/inputOutput.ts b/sdk/ai/ai-projects/src/connections/inputOutput.ts deleted file mode 100644 index 23a4ba36c76d..000000000000 --- a/sdk/ai/ai-projects/src/connections/inputOutput.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { ListConnectionsQueryParamProperties } from "../customization/parameters.js"; -export { - GetConnectionResponseOutput, - InternalConnectionPropertiesOutput, - InternalConnectionPropertiesOutputParent, - InternalConnectionPropertiesApiKeyAuthOutput, - InternalConnectionPropertiesAADAuthOutput, - InternalConnectionPropertiesSASAuthOutput, - CredentialsApiKeyAuthOutput, - AuthenticationTypeOutput, - ConnectionTypeOutput, - CredentialsSASAuthOutput, -} from "../customization/outputModels.js"; - -export * from "./customModels.js"; diff --git a/sdk/ai/ai-projects/src/connections/internalModels.ts b/sdk/ai/ai-projects/src/connections/internalModels.ts deleted file mode 100644 index a3764c0fa3e6..000000000000 --- a/sdk/ai/ai-projects/src/connections/internalModels.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { GetWorkspaceResponseOutput } from "../customization/outputModels.js"; -import type { ConnectionsOperations, GetWorkspaceOptionalParams } from "./customModels.js"; - -export interface ConnectionsInternalOperations extends ConnectionsOperations { - /** Gets the properties of the specified machine learning workspace. */ - getWorkspace: (options?: GetWorkspaceOptionalParams) => Promise; -} diff --git a/sdk/ai/ai-projects/src/constants.ts b/sdk/ai/ai-projects/src/constants.ts deleted file mode 100644 index caf1bc34d8f6..000000000000 --- a/sdk/ai/ai-projects/src/constants.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** - * Current version of the `@azure/ai-projects` package. - */ -export const SDK_VERSION = `1.0.0-beta.3`; - -/** - * The package name of the `@azure/ai-projects` package. - */ -export const PACKAGE_NAME = "@azure/ai-projects"; diff --git a/sdk/ai/ai-projects/src/customization/convertModelsToWrite.ts b/sdk/ai/ai-projects/src/customization/convertModelsToWrite.ts deleted file mode 100644 index 8c4886287cc3..000000000000 --- a/sdk/ai/ai-projects/src/customization/convertModelsToWrite.ts +++ /dev/null @@ -1,624 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type * as PublicModels from "./models.js"; -import type * as GeneratedModels from "../generated/src/models.js"; - -// Conversion functions -export function convertCreateAgentOptions( - source: PublicModels.CreateAgentOptions, -): GeneratedModels.CreateAgentOptions { - return { - model: source.model, - ...(source.name && { name: source.name }), - ...(source.description && { description: source.description }), - ...(source.instructions && { instructions: source.instructions }), - ...(source.tools && { tools: source.tools.map(convertToolDefinition) }), - ...(source.toolResources && { tool_resources: convertToolResources(source.toolResources) }), - ...(source.temperature !== undefined && { temperature: source.temperature }), - ...(source.topP !== undefined && { top_p: source.topP }), - ...(source.responseFormat && { response_format: source.responseFormat }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -function convertToolResources(source: PublicModels.ToolResources): GeneratedModels.ToolResources { - return { - ...(source.codeInterpreter && { - code_interpreter: convertCodeInterpreterToolResource(source.codeInterpreter), - }), - ...(source.fileSearch && { file_search: convertFileSearchToolResource(source.fileSearch) }), - ...(source.azureAISearch && { - azure_ai_search: convertAzureAISearchResource(source.azureAISearch), - }), - }; -} - -function convertMessageAttachmentToolDefinition( - source: PublicModels.MessageAttachmentToolDefinition, -): GeneratedModels.MessageAttachmentToolDefinition { - switch (source.type) { - case "code_interpreter": - return convertCodeInterpreterToolDefinition( - source as PublicModels.CodeInterpreterToolDefinition, - ); - case "file_search": - return convertFileSearchToolDefinition(source as PublicModels.FileSearchToolDefinition); - default: - throw new Error(`Unknown tool type: ${source}`); - } -} - -function convertToolDefinition( - source: PublicModels.ToolDefinition, -): GeneratedModels.ToolDefinition { - switch (source.type) { - case "code_interpreter": - return convertCodeInterpreterToolDefinition( - source as PublicModels.CodeInterpreterToolDefinition, - ); - case "file_search": - return convertFileSearchToolDefinition(source as PublicModels.FileSearchToolDefinition); - case "function": - return convertFunctionToolDefinition(source as PublicModels.FunctionToolDefinition); - case "bing_grounding": - return convertBingGroundingToolDefinition(source as PublicModels.BingGroundingToolDefinition); - case "microsoft_fabric": - return convertMicrosoftFabricToolDefinition( - source as PublicModels.MicrosoftFabricToolDefinition, - ); - case "sharepoint_grounding": - return convertSharepointToolDefinition(source as PublicModels.SharepointToolDefinition); - case "azure_ai_search": - return convertAzureAISearchToolDefinition(source as PublicModels.AzureAISearchToolDefinition); - default: - throw new Error(`Unknown tool type: ${source.type}`); - } -} - -function convertCodeInterpreterToolDefinition( - source: PublicModels.CodeInterpreterToolDefinition, -): GeneratedModels.CodeInterpreterToolDefinition { - return { - type: source.type, - }; -} - -function convertFileSearchToolDefinition( - source: PublicModels.FileSearchToolDefinition, -): GeneratedModels.FileSearchToolDefinition { - return { - type: source.type, - ...(source.fileSearch && { - file_search: convertFileSearchToolDefinitionDetails(source.fileSearch), - }), - }; -} - -function convertFunctionToolDefinition( - source: PublicModels.FunctionToolDefinition, -): GeneratedModels.FunctionToolDefinition { - return { - type: source.type, - function: convertFunctionDefinition(source.function), - }; -} - -function convertBingGroundingToolDefinition( - source: PublicModels.BingGroundingToolDefinition, -): GeneratedModels.BingGroundingToolDefinition { - return { - type: source.type, - bing_grounding: convertToolConnectionList(source.bingGrounding), - }; -} - -function convertMicrosoftFabricToolDefinition( - source: PublicModels.MicrosoftFabricToolDefinition, -): GeneratedModels.MicrosoftFabricToolDefinition { - return { - type: source.type, - microsoft_fabric: convertToolConnectionList(source.microsoftFabric), - }; -} - -function convertSharepointToolDefinition( - source: PublicModels.SharepointToolDefinition, -): GeneratedModels.SharepointToolDefinition { - return { - type: source.type, - sharepoint_grounding: convertToolConnectionList(source.sharepointGrounding), - }; -} - -function convertAzureAISearchToolDefinition( - source: PublicModels.AzureAISearchToolDefinition, -): GeneratedModels.AzureAISearchToolDefinition { - return { - type: source.type, - }; -} - -function convertFileSearchToolDefinitionDetails( - source: PublicModels.FileSearchToolDefinitionDetails, -): GeneratedModels.FileSearchToolDefinitionDetails { - return { - ...(source.maxNumResults && { max_num_results: source.maxNumResults }), - ...(source.rankingOptions && { - ranking_options: convertFileSearchRankingOptions(source.rankingOptions), - }), - }; -} - -function convertFileSearchRankingOptions( - source: PublicModels.FileSearchRankingOptions, -): GeneratedModels.FileSearchRankingOptions { - return { - ranker: source.ranker, - score_threshold: source.scoreThreshold, - }; -} - -function convertCodeInterpreterToolResource( - source: PublicModels.CodeInterpreterToolResource, -): GeneratedModels.CodeInterpreterToolResource { - return { - file_ids: source.fileIds, - ...(source.dataSources && { - data_sources: source.dataSources.map(convertVectorStoreDataSource), - }), - }; -} - -export function convertVectorStoreDataSource( - source: PublicModels.VectorStoreDataSource, -): GeneratedModels.VectorStoreDataSource { - return { - uri: source.uri, - type: source.type, - }; -} - -function convertFileSearchToolResource( - source: PublicModels.FileSearchToolResource, -): GeneratedModels.FileSearchToolResource { - return { - ...(source.vectorStoreIds && { vector_store_ids: source.vectorStoreIds }), - ...(source.vectorStores && { - vector_stores: source.vectorStores.map(convertVectorStoreConfigurations), - }), - }; -} - -function convertVectorStoreConfigurations( - source: PublicModels.VectorStoreConfigurations, -): GeneratedModels.VectorStoreConfigurations { - return { - name: source.name, - configuration: convertVectorStoreConfiguration(source.configuration), - }; -} - -function convertVectorStoreConfiguration( - source: PublicModels.VectorStoreConfiguration, -): GeneratedModels.VectorStoreConfiguration { - return { - data_sources: source.dataSources.map(convertVectorStoreDataSource), - }; -} - -function convertAzureAISearchResource( - source: PublicModels.AzureAISearchResource, -): GeneratedModels.AzureAISearchResource { - return { - ...(source.indexes && { indexes: source.indexes.map(convertIndexResource) }), - }; -} - -function convertIndexResource(source: PublicModels.IndexResource): GeneratedModels.IndexResource { - return { - index_connection_id: source.indexConnectionId, - index_name: source.indexName, - }; -} - -export function convertUpdateAgentOptions( - source: PublicModels.UpdateAgentOptions, -): GeneratedModels.UpdateAgentOptions { - return { - ...(source.model && { model: source.model }), - ...(source.name && { name: source.name }), - ...(source.description && { description: source.description }), - ...(source.instructions && { instructions: source.instructions }), - ...(source.tools && { tools: source.tools.map(convertToolDefinition) }), - ...(source.toolResources && { tool_resources: convertToolResources(source.toolResources) }), - ...(source.temperature !== undefined && { temperature: source.temperature }), - ...(source.topP !== undefined && { top_p: source.topP }), - ...(source.responseFormat && { response_format: source.responseFormat }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -export function convertAgentThreadCreationOptions( - source: PublicModels.AgentThreadCreationOptions, -): GeneratedModels.AgentThreadCreationOptions { - return { - ...(source.messages && { messages: source.messages.map(convertThreadMessageOptions) }), - ...(source.toolResources && { tool_resources: convertToolResources(source.toolResources) }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -export function convertAgentThreadUpdateOptions( - source: PublicModels.UpdateAgentThreadOptions, -): GeneratedModels.UpdateAgentThreadOptions { - return { - ...(source.toolResources && { tool_resources: convertToolResources(source.toolResources) }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -function convertThreadMessageOptions( - source: PublicModels.ThreadMessageOptions, -): GeneratedModels.ThreadMessageOptions { - return { - role: source.role, - content: source.content, - ...(source.attachments && { attachments: source.attachments.map(convertMessageAttachment) }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -function convertMessageAttachment( - source: PublicModels.MessageAttachment, -): GeneratedModels.MessageAttachment { - return { - file_id: source.fileId, - ...(source.dataSources && { - data_sources: source.dataSources.map(convertVectorStoreDataSource), - }), - ...(source.tools && { tools: source.tools.map(convertMessageAttachmentToolDefinition) }), - }; -} - -export function convertCreateRunOptions( - source: PublicModels.CreateRunOptions, -): GeneratedModels.CreateRunOptions { - return { - assistant_id: source.assistantId, - ...(source.model && { model: source.model }), - ...(source.instructions && { instructions: source.instructions }), - ...(source.additionalInstructions && { - additional_instructions: source.additionalInstructions, - }), - ...(source.additionalMessages && { - additional_messages: source.additionalMessages.map(convertThreadMessage), - }), - ...(source.tools && { tools: source.tools.map(convertToolDefinition) }), - ...(source.stream !== undefined && { stream: source.stream }), - ...(source.temperature !== undefined && { temperature: source.temperature }), - ...(source.topP !== undefined && { top_p: source.topP }), - ...(source.maxPromptTokens !== undefined && { max_prompt_tokens: source.maxPromptTokens }), - ...(source.maxCompletionTokens !== undefined && { - max_completion_tokens: source.maxCompletionTokens, - }), - ...(source.truncationStrategy && { - truncation_strategy: convertTruncationObject(source.truncationStrategy), - }), - ...(source.toolChoice && { tool_choice: source.toolChoice }), - ...(source.responseFormat && { response_format: source.responseFormat }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -function convertTruncationObject( - source: PublicModels.TruncationObject, -): GeneratedModels.TruncationObject { - return { - type: source.type, - ...(source.lastMessages !== undefined && { last_messages: source.lastMessages }), - }; -} - -function convertUpdateToolResourcesOptions( - source: PublicModels.UpdateToolResourcesOptions, -): GeneratedModels.UpdateToolResourcesOptions { - return { - ...(source.codeInterpreter && { - code_interpreter: convertUpdateCodeInterpreterToolResourceOptions(source.codeInterpreter), - }), - ...(source.fileSearch && { - file_search: convertUpdateFileSearchToolResourceOptions(source.fileSearch), - }), - ...(source.azureAISearch && { - azure_ai_search: convertAzureAISearchResource(source.azureAISearch), - }), - }; -} - -function convertUpdateCodeInterpreterToolResourceOptions( - source: PublicModels.UpdateCodeInterpreterToolResourceOptions, -): GeneratedModels.UpdateCodeInterpreterToolResourceOptions { - return { - ...(source.fileIds && { file_ids: source.fileIds }), - }; -} - -function convertUpdateFileSearchToolResourceOptions( - source: PublicModels.UpdateFileSearchToolResourceOptions, -): GeneratedModels.UpdateFileSearchToolResourceOptions { - return { - ...(source.vectorStoreIds && { vector_store_ids: source.vectorStoreIds }), - }; -} - -export function convertToolOutput(source: PublicModels.ToolOutput): GeneratedModels.ToolOutput { - return { - ...(source.toolCallId !== undefined && { tool_call_id: source.toolCallId }), - ...(source.output !== undefined && { output: source.output }), - }; -} - -export function convertCreateAndRunThreadOptions( - source: PublicModels.CreateAndRunThreadOptions, -): GeneratedModels.CreateAndRunThreadOptions { - return { - assistant_id: source.assistantId, - ...(source.thread && { thread: convertAgentThreadCreationOptions(source.thread) }), - ...(source.model && { model: source.model }), - ...(source.instructions && { instructions: source.instructions }), - ...(source.tools && { tools: source.tools.map(convertToolDefinition) }), - ...(source.toolResources && { - tool_resources: convertUpdateToolResourcesOptions(source.toolResources), - }), - ...(source.stream !== undefined && { stream: source.stream }), - ...(source.temperature !== undefined && { temperature: source.temperature }), - ...(source.topP !== undefined && { top_p: source.topP }), - ...(source.maxPromptTokens !== undefined && { max_prompt_tokens: source.maxPromptTokens }), - ...(source.maxCompletionTokens !== undefined && { - max_completion_tokens: source.maxCompletionTokens, - }), - ...(source.truncationStrategy && { - truncation_strategy: convertTruncationObject(source.truncationStrategy), - }), - ...(source.toolChoice && { tool_choice: source.toolChoice }), - ...(source.responseFormat && { response_format: source.responseFormat }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -function convertVectorStoreExpirationPolicy( - source: PublicModels.VectorStoreExpirationPolicy, -): GeneratedModels.VectorStoreExpirationPolicy { - return { - anchor: source.anchor, - days: source.days, - }; -} - -export function convertVectorStoreOptions( - source: PublicModels.VectorStoreOptions, -): GeneratedModels.VectorStoreOptions { - return { - ...(source.fileIds && { file_ids: source.fileIds }), - ...(source.name && { name: source.name }), - ...(source.configuration && { - configuration: convertVectorStoreConfiguration(source.configuration), - }), - ...(source.expiresAfter && { - expires_after: convertVectorStoreExpirationPolicy(source.expiresAfter), - }), - ...(source.chunkingStrategy && { - chunking_strategy: convertVectorStoreChunkingStrategyRequest(source.chunkingStrategy), - }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -export function convertVectorStoreChunkingStrategyRequest( - source: PublicModels.VectorStoreChunkingStrategyRequest, -): GeneratedModels.VectorStoreChunkingStrategyRequest { - switch (source.type) { - case "auto": - return source as GeneratedModels.VectorStoreAutoChunkingStrategyRequest; - case "static": - return convertVectorStoreStaticChunkingStrategyRequest( - source as PublicModels.VectorStoreStaticChunkingStrategyRequest, - ); - default: - throw new Error(`Unknown chunking strategy type: ${source.type}`); - } -} - -function convertVectorStoreStaticChunkingStrategyRequest( - source: PublicModels.VectorStoreStaticChunkingStrategyRequest, -): GeneratedModels.VectorStoreStaticChunkingStrategyRequest { - return { - ...source, - static: convertVectorStoreStaticChunkingStrategyOptions(source.static), - }; -} - -function convertVectorStoreStaticChunkingStrategyOptions( - source: PublicModels.VectorStoreStaticChunkingStrategyOptions, -): GeneratedModels.VectorStoreStaticChunkingStrategyOptions { - return { - max_chunk_size_tokens: source.maxChunkSizeTokens, - chunk_overlap_tokens: source.chunkOverlapTokens, - }; -} - -export function convertVectorStoreUpdateOptions( - source: PublicModels.VectorStoreUpdateOptions, -): GeneratedModels.VectorStoreUpdateOptions { - return { - ...(source.name && { name: source.name }), - ...(source.expiresAfter && { - expires_after: convertVectorStoreExpirationPolicy(source.expiresAfter), - }), - ...(source.metadata && { metadata: source.metadata }), - }; -} - -function convertFunctionDefinition( - source: PublicModels.FunctionDefinition, -): GeneratedModels.FunctionDefinition { - return { - name: source.name, - ...(source.description && { description: source.description }), - parameters: source.parameters, - }; -} - -function convertToolConnectionList( - source: PublicModels.ToolConnectionList, -): GeneratedModels.ToolConnectionList { - return { - ...(source.connections && { connections: source.connections.map(convertToolConnection) }), - }; -} - -function convertToolConnection( - source: PublicModels.ToolConnection, -): GeneratedModels.ToolConnection { - return { - connection_id: source.connectionId, - }; -} - -function convertThreadMessage(source: PublicModels.ThreadMessage): GeneratedModels.ThreadMessage { - return { - id: source.id, - object: source.object, - created_at: source.createdAt, - thread_id: source.threadId, - status: source.status, - incomplete_details: !source.incompleteDetails - ? source.incompleteDetails - : convertMessageIncompleteDetails(source.incompleteDetails), - completed_at: source.completedAt, - incomplete_at: source.incompleteAt, - role: source.role, - content: source.content.map(convertMessageContent), - assistant_id: source.assistantId, - run_id: source.runId, - attachments: !source.attachments - ? source.attachments - : source.attachments?.map(convertMessageAttachment), - metadata: source.metadata, - }; -} - -function convertMessageIncompleteDetails( - source: PublicModels.MessageIncompleteDetails, -): GeneratedModels.MessageIncompleteDetails { - return { - reason: source.reason, - }; -} - -function convertMessageContent( - source: PublicModels.MessageContent, -): GeneratedModels.MessageContent { - switch (source.type) { - case "text": - return convertMessageTextContent(source as PublicModels.MessageTextContent); - case "image_file": - return convertMessageImageFileContent(source as PublicModels.MessageImageFileContent); - default: - throw new Error(`Unknown message content type: ${source.type}`); - } -} - -function convertMessageTextContent( - source: PublicModels.MessageTextContent, -): GeneratedModels.MessageTextContent { - return { - type: "text", - text: convertMessageTextDetails(source.text), - }; -} - -function convertMessageTextDetails( - source: PublicModels.MessageTextDetails, -): GeneratedModels.MessageTextDetails { - return { - value: source.value, - annotations: source.annotations.map(convertMessageTextAnnotation), - }; -} - -function convertMessageTextAnnotation( - source: PublicModels.MessageTextAnnotation, -): GeneratedModels.MessageTextAnnotation { - switch (source.type) { - case "file_citation": - return convertMessageTextFileCitationAnnotation( - source as PublicModels.MessageTextFileCitationAnnotation, - ); - case "file_path": - return convertMessageTextFilePathAnnotation( - source as PublicModels.MessageTextFilePathAnnotation, - ); - default: - throw new Error(`Unknown message text annotation type: ${source.type}`); - } -} - -function convertMessageTextFileCitationAnnotation( - source: PublicModels.MessageTextFileCitationAnnotation, -): GeneratedModels.MessageTextFileCitationAnnotation { - return { - text: source.text, - type: "file_citation", - file_citation: convertMessageTextFileCitationDetails(source.fileCitation), - ...(source.startIndex && { start_index: source.startIndex }), - ...(source.endIndex && { end_index: source.endIndex }), - }; -} - -function convertMessageTextFileCitationDetails( - source: PublicModels.MessageTextFileCitationDetails, -): GeneratedModels.MessageTextFileCitationDetails { - return { - file_id: source.fileId, - quote: source.quote, - }; -} - -function convertMessageTextFilePathAnnotation( - source: PublicModels.MessageTextFilePathAnnotation, -): GeneratedModels.MessageTextFilePathAnnotation { - return { - text: source.text, - type: "file_path", - file_path: convertMessageTextFilePathDetails(source.filePath), - ...(source.startIndex && { start_index: source.startIndex }), - ...(source.endIndex && { end_index: source.endIndex }), - }; -} - -function convertMessageTextFilePathDetails( - source: PublicModels.MessageTextFilePathDetails, -): GeneratedModels.MessageTextFilePathDetails { - return { - file_id: source.fileId, - }; -} - -function convertMessageImageFileContent( - source: PublicModels.MessageImageFileContent, -): GeneratedModels.MessageImageFileContent { - return { - type: "image_file", - image_file: convertMessageImageFileDetails(source.imageFile), - }; -} - -function convertMessageImageFileDetails( - source: PublicModels.MessageImageFileDetails, -): GeneratedModels.MessageImageFileDetails { - return { - file_id: source.fileId, - }; -} diff --git a/sdk/ai/ai-projects/src/customization/convertOutputModelsFromWire.ts b/sdk/ai/ai-projects/src/customization/convertOutputModelsFromWire.ts deleted file mode 100644 index 677651ca6bee..000000000000 --- a/sdk/ai/ai-projects/src/customization/convertOutputModelsFromWire.ts +++ /dev/null @@ -1,1354 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type * as GeneratedModels from "../generated/src/outputModels.js"; -import type * as PublicModels from "./outputModels.js"; -import type * as WireStreamingModels from "./streamingWireModels.js"; -import type * as PublicStreamingModels from "./streamingModels.js"; -import { logger } from "../logger.js"; - -// Conversion functions - -function convertCodeInterpreterToolDefinitionOutput( - input: GeneratedModels.CodeInterpreterToolDefinitionOutput, -): PublicModels.CodeInterpreterToolDefinitionOutput { - return { ...input }; -} - -function convertFileSearchToolDefinitionOutput( - input: GeneratedModels.FileSearchToolDefinitionOutput, -): PublicModels.FileSearchToolDefinitionOutput { - return { - type: "file_search", - fileSearch: input.file_search - ? convertFileSearchToolDefinitionDetailsOutput(input.file_search) - : undefined, - }; -} - -function convertFileSearchToolDefinitionDetailsOutput( - input: GeneratedModels.FileSearchToolDefinitionDetailsOutput, -): PublicModels.FileSearchToolDefinitionDetailsOutput { - return { - maxNumResults: input.max_num_results, - rankingOptions: input.ranking_options - ? convertFileSearchRankingOptionsOutput(input.ranking_options) - : undefined, - }; -} - -function convertFileSearchRankingOptionsOutput( - input: GeneratedModels.FileSearchRankingOptionsOutput, -): PublicModels.FileSearchRankingOptionsOutput { - return { - ranker: input.ranker, - scoreThreshold: input.score_threshold, - }; -} - -function convertFunctionToolDefinitionOutput( - input: GeneratedModels.FunctionToolDefinitionOutput, -): PublicModels.FunctionToolDefinitionOutput { - return { - type: "function", - function: input.function && convertFunctionDefinitionOutput(input.function), - }; -} - -function convertFunctionDefinitionOutput( - input: GeneratedModels.FunctionDefinitionOutput, -): PublicModels.FunctionDefinitionOutput { - return { ...input }; -} - -function convertBingGroundingToolDefinitionOutput( - input: GeneratedModels.BingGroundingToolDefinitionOutput, -): PublicModels.BingGroundingToolDefinitionOutput { - return { - type: "bing_grounding", - bingGrounding: input.bing_grounding && convertToolConnectionListOutput(input.bing_grounding), - }; -} - -function convertToolConnectionListOutput( - input: GeneratedModels.ToolConnectionListOutput, -): PublicModels.ToolConnectionListOutput { - return { - connections: input.connections?.map(convertToolConnectionOutput), - }; -} - -function convertToolConnectionOutput( - input: GeneratedModels.ToolConnectionOutput, -): PublicModels.ToolConnectionOutput { - return { connectionId: input.connection_id }; -} - -function convertMicrosoftFabricToolDefinitionOutput( - input: GeneratedModels.MicrosoftFabricToolDefinitionOutput, -): PublicModels.MicrosoftFabricToolDefinitionOutput { - return { - type: "microsoft_fabric", - microsoftFabric: - input.microsoft_fabric && convertToolConnectionListOutput(input.microsoft_fabric), - }; -} - -function convertSharepointToolDefinitionOutput( - input: GeneratedModels.SharepointToolDefinitionOutput, -): PublicModels.SharepointToolDefinitionOutput { - return { - type: "sharepoint_grounding", - sharepointGrounding: - input.sharepoint_grounding && convertToolConnectionListOutput(input.sharepoint_grounding), - }; -} - -function convertAzureAISearchToolDefinitionOutput( - input: GeneratedModels.AzureAISearchToolDefinitionOutput, -): PublicModels.AzureAISearchToolDefinitionOutput { - return { ...input }; -} - -function convertToolResourcesOutput( - input: GeneratedModels.ToolResourcesOutput, -): PublicModels.ToolResourcesOutput { - return { - codeInterpreter: input.code_interpreter - ? convertCodeInterpreterToolResourceOutput(input.code_interpreter) - : undefined, - fileSearch: input.file_search - ? convertFileSearchToolResourceOutput(input.file_search) - : undefined, - azureAISearch: input.azure_ai_search - ? convertAzureAISearchResourceOutput(input.azure_ai_search) - : undefined, - }; -} - -function convertCodeInterpreterToolResourceOutput( - input: GeneratedModels.CodeInterpreterToolResourceOutput, -): PublicModels.CodeInterpreterToolResourceOutput { - return { - fileIds: input.file_ids, - dataSources: input.data_sources?.map(convertVectorStoreDataSourceOutput), - }; -} - -function convertVectorStoreDataSourceOutput( - input: GeneratedModels.VectorStoreDataSourceOutput, -): PublicModels.VectorStoreDataSourceOutput { - return { ...input }; -} - -function convertFileSearchToolResourceOutput( - input: GeneratedModels.FileSearchToolResourceOutput, -): PublicModels.FileSearchToolResourceOutput { - return { - vectorStoreIds: input.vector_store_ids, - vectorStores: input.vector_stores?.map(convertVectorStoreConfigurationsOutput), - }; -} - -function convertVectorStoreConfigurationsOutput( - input: GeneratedModels.VectorStoreConfigurationsOutput, -): PublicModels.VectorStoreConfigurationsOutput { - return { - name: input.name, - configuration: - input.configuration && convertVectorStoreConfigurationOutput(input.configuration), - }; -} - -function convertVectorStoreConfigurationOutput( - input: GeneratedModels.VectorStoreConfigurationOutput, -): PublicModels.VectorStoreConfigurationOutput { - return { - ...input, - dataSources: input.data_sources?.map(convertVectorStoreDataSourceOutput), - }; -} - -function convertAzureAISearchResourceOutput( - input: GeneratedModels.AzureAISearchResourceOutput, -): PublicModels.AzureAISearchResourceOutput { - return { - indexes: input.indexes?.map(convertIndexResourceOutput), - }; -} - -function convertIndexResourceOutput( - input: GeneratedModels.IndexResourceOutput, -): PublicModels.IndexResourceOutput { - return { indexConnectionId: input.index_connection_id, indexName: input.index_name }; -} - -export function convertAgentOutput(input: GeneratedModels.AgentOutput): PublicModels.AgentOutput { - return { - id: input.id, - object: input.object, - createdAt: new Date(input.created_at), - name: input.name, - description: input.description, - model: input.model, - instructions: input.instructions, - tools: input.tools?.map(convertToolDefinitionOutput), - toolResources: input.tool_resources ? convertToolResourcesOutput(input.tool_resources) : null, - temperature: input.temperature, - topP: input.top_p, - responseFormat: input.response_format - ? convertAgentsApiResponseFormatOptionOutput(input.response_format) - : null, - metadata: input.metadata, - }; -} -function convertToolDefinitionOutput( - tool: GeneratedModels.ToolDefinitionOutput, -): PublicModels.ToolDefinitionOutput { - switch (tool.type) { - case "code_interpreter": - return convertCodeInterpreterToolDefinitionOutput( - tool as GeneratedModels.CodeInterpreterToolDefinitionOutput, - ); - case "file_search": - return convertFileSearchToolDefinitionOutput( - tool as GeneratedModels.FileSearchToolDefinitionOutput, - ); - case "function": - return convertFunctionToolDefinitionOutput( - tool as GeneratedModels.FunctionToolDefinitionOutput, - ); - case "bing_grounding": - return convertBingGroundingToolDefinitionOutput( - tool as GeneratedModels.BingGroundingToolDefinitionOutput, - ); - case "microsoft_fabric": - return convertMicrosoftFabricToolDefinitionOutput( - tool as GeneratedModels.MicrosoftFabricToolDefinitionOutput, - ); - case "sharepoint_grounding": - return convertSharepointToolDefinitionOutput( - tool as GeneratedModels.SharepointToolDefinitionOutput, - ); - case "azure_ai_search": - return convertAzureAISearchToolDefinitionOutput( - tool as GeneratedModels.AzureAISearchToolDefinitionOutput, - ); - default: - return tool; - } -} - -function convertAgentsApiResponseFormatOptionOutput( - input: GeneratedModels.AgentsApiResponseFormatOptionOutput, -): PublicModels.AgentsApiResponseFormatOptionOutput { - return input; -} - -export function convertOpenAIPageableListOfAgentOutput( - input: GeneratedModels.OpenAIPageableListOfAgentOutput, -): PublicModels.OpenAIPageableListOfAgentOutput { - return { - object: input.object, - firstId: input.first_id, - lastId: input.last_id, - hasMore: input.has_more, - data: input.data.map(convertAgentOutput), - }; -} - -export function convertAgentDeletionStatusOutput( - input: GeneratedModels.AgentDeletionStatusOutput, -): PublicModels.AgentDeletionStatusOutput { - return { ...input }; -} - -function convertMessageAttachmentOutput( - input: GeneratedModels.MessageAttachmentOutput, -): PublicModels.MessageAttachmentOutput { - return { - fileId: input.file_id, - dataSources: input.data_sources?.map(convertVectorStoreDataSourceOutput), - tools: input.tools?.map(convertMessageAttachmentToolDefinitionOutput), - }; -} - -function convertMessageAttachmentToolDefinitionOutput( - input: GeneratedModels.MessageAttachmentToolDefinitionOutput, -): PublicModels.MessageAttachmentToolDefinitionOutput { - switch (input.type) { - case "code_interpreter": - return convertCodeInterpreterToolDefinitionOutput( - input as GeneratedModels.CodeInterpreterToolDefinitionOutput, - ); - case "file_search": - return convertFileSearchToolDefinitionOutput( - input as GeneratedModels.FileSearchToolDefinitionOutput, - ); - default: - throw new Error(`Unknown tool type: ${input}`); - } -} - -export function convertAgentThreadOutput( - input: GeneratedModels.AgentThreadOutput, -): PublicModels.AgentThreadOutput { - return { - id: input.id, - object: input.object, - createdAt: new Date(input.created_at), - toolResources: input.tool_resources ? convertToolResourcesOutput(input.tool_resources) : null, - metadata: input.metadata, - }; -} - -export function convertThreadDeletionStatusOutput( - input: GeneratedModels.ThreadDeletionStatusOutput, -): PublicModels.ThreadDeletionStatusOutput { - return { ...input }; -} - -export function convertThreadMessageOutput( - input: GeneratedModels.ThreadMessageOutput, -): PublicModels.ThreadMessageOutput { - return { - id: input.id, - object: input.object, - createdAt: new Date(input.created_at), - threadId: input.thread_id, - status: input.status, - incompleteDetails: input.incomplete_details - ? convertMessageIncompleteDetailsOutput(input.incomplete_details) - : null, - completedAt: input.completed_at ? new Date(input.completed_at) : null, - incompleteAt: input.incomplete_at ? new Date(input.incomplete_at) : null, - role: input.role, - content: input.content?.map(convertMessageContentOutput), - assistantId: input.assistant_id, - runId: input.run_id, - attachments: !input.attachments - ? input.attachments - : input.attachments?.map(convertMessageAttachmentOutput), - metadata: input.metadata, - }; -} - -function convertMessageIncompleteDetailsOutput( - input: GeneratedModels.MessageIncompleteDetailsOutput, -): PublicModels.MessageIncompleteDetailsOutput { - return { ...input }; -} - -function convertMessageContentOutput( - input: GeneratedModels.MessageContentOutput, -): PublicModels.MessageContentOutput { - switch (input.type) { - case "text": - return convertMessageTextContentOutput(input as GeneratedModels.MessageTextContentOutput); - case "image_file": - return convertMessageImageFileContentOutput( - input as GeneratedModels.MessageImageFileContentOutput, - ); - default: - return { ...input }; - } -} - -function convertMessageTextContentOutput( - input: GeneratedModels.MessageTextContentOutput, -): PublicModels.MessageTextContentOutput { - return { - type: input.type, - text: input.text && convertMessageTextDetailsOutput(input.text), - }; -} - -function convertMessageTextDetailsOutput( - input: GeneratedModels.MessageTextDetailsOutput, -): PublicModels.MessageTextDetailsOutput { - return { - value: input.value, - annotations: input.annotations?.map(convertMessageTextAnnotationOutput), - }; -} - -function convertMessageTextAnnotationOutput( - input: GeneratedModels.MessageTextAnnotationOutputParent, -): PublicModels.MessageTextAnnotationOutput { - switch (input.type) { - case "file_citation": - return convertMessageTextFileCitationAnnotationOutput( - input as GeneratedModels.MessageTextFileCitationAnnotationOutput, - ); - case "file_path": - return convertMessageTextFilePathAnnotationOutput( - input as GeneratedModels.MessageTextFilePathAnnotationOutput, - ); - default: - return { ...input }; - } -} - -function convertMessageTextFileCitationAnnotationOutput( - input: GeneratedModels.MessageTextFileCitationAnnotationOutput, -): PublicModels.MessageTextFileCitationAnnotationOutput { - return { - type: input.type, - text: input.text, - fileCitation: - input.file_citation && convertMessageTextFileCitationDetailsOutput(input.file_citation), - }; -} - -function convertMessageTextFileCitationDetailsOutput( - input: GeneratedModels.MessageTextFileCitationDetailsOutput, -): PublicModels.MessageTextFileCitationDetailsOutput { - return { - fileId: input.file_id, - quote: input.quote, - }; -} - -function convertMessageTextFilePathAnnotationOutput( - input: GeneratedModels.MessageTextFilePathAnnotationOutput, -): PublicModels.MessageTextFilePathAnnotationOutput { - return { - type: input.type, - filePath: input.file_path && convertMessageTextFilePathDetailsOutput(input.file_path), - startIndex: input.start_index, - endIndex: input.end_index, - text: input.text, - }; -} - -function convertMessageTextFilePathDetailsOutput( - input: GeneratedModels.MessageTextFilePathDetailsOutput, -): PublicModels.MessageTextFilePathDetailsOutput { - return { fileId: input.file_id }; -} - -function convertMessageImageFileContentOutput( - input: GeneratedModels.MessageImageFileContentOutput, -): PublicModels.MessageImageFileContentOutput { - return { - type: input.type, - imageFile: input.image_file && convertMessageImageFileDetailsOutput(input.image_file), - }; -} - -function convertMessageImageFileDetailsOutput( - input: GeneratedModels.MessageImageFileDetailsOutput, -): PublicModels.MessageImageFileDetailsOutput { - return { fileId: input.file_id }; -} - -export function convertThreadRunOutput( - input: GeneratedModels.ThreadRunOutput, -): PublicModels.ThreadRunOutput { - return { - id: input.id, - object: input.object, - threadId: input.thread_id, - assistantId: input.assistant_id, - status: input.status, - ...(input.required_action && { - requiredAction: convertRequiredActionOutput(input.required_action), - }), - lastError: input.last_error, - model: input.model, - instructions: input.instructions, - tools: input.tools?.map(convertToolDefinitionOutput) ?? [], - createdAt: new Date(input.created_at), - expiresAt: input.expires_at ? new Date(input.expires_at) : null, - startedAt: input.started_at ? new Date(input.started_at) : null, - completedAt: input.completed_at ? new Date(input.completed_at) : null, - cancelledAt: input.cancelled_at ? new Date(input.cancelled_at) : null, - failedAt: input.failed_at ? new Date(input.failed_at) : null, - incompleteDetails: input.incomplete_details, - usage: input.usage ? convertRunStepCompletionUsageOutput(input.usage) : null, - ...(input.temperature && { temperature: input.temperature }), - ...(input.top_p && { topP: input.top_p }), - maxPromptTokens: input.max_prompt_tokens, - maxCompletionTokens: input.max_completion_tokens, - truncationStrategy: input.truncation_strategy - ? convertTruncationObjectOutput(input.truncation_strategy) - : null, - toolChoice: input.tool_choice, - responseFormat: input.response_format, - metadata: input.metadata, - ...(input.tool_resources && { - toolResources: convertToolResourcesOutput(input.tool_resources), - }), - parallelToolCalls: input.parallelToolCalls, - }; -} - -function convertRunCompletionUsageOutput( - input: GeneratedModels.RunCompletionUsageOutput, -): PublicModels.RunCompletionUsageOutput { - return { - completionTokens: input.completion_tokens, - promptTokens: input.prompt_tokens, - totalTokens: input.total_tokens, - }; -} - -function convertRequiredActionOutput( - input: GeneratedModels.RequiredActionOutput, -): PublicModels.RequiredActionOutput { - switch (input.type) { - case "submit_tool_outputs": - return convertSubmitToolOutputsActionOutput( - input as GeneratedModels.SubmitToolOutputsActionOutput, - ); - default: - return { ...input }; - } -} - -function convertSubmitToolOutputsActionOutput( - input: GeneratedModels.SubmitToolOutputsActionOutput, -): PublicModels.SubmitToolOutputsActionOutput { - return { - type: input.type, - submitToolOutputs: - input.submit_tool_outputs && convertSubmitToolOutputsDetailsOutput(input.submit_tool_outputs), - }; -} - -function convertSubmitToolOutputsDetailsOutput( - input: GeneratedModels.SubmitToolOutputsDetailsOutput, -): PublicModels.SubmitToolOutputsDetailsOutput { - return { - toolCalls: input.tool_calls?.map(convertRequiredToolCallOutput), - }; -} - -function convertRequiredToolCallOutput( - input: GeneratedModels.RequiredToolCallOutput, -): PublicModels.RequiredToolCallOutput { - switch (input.type) { - case "function": - return convertRequiredFunctionToolCallOutput( - input as GeneratedModels.RequiredFunctionToolCallOutput, - ); - default: - return { ...input }; - } -} - -function convertRequiredFunctionToolCallOutput( - input: GeneratedModels.RequiredFunctionToolCallOutput, -): PublicModels.RequiredFunctionToolCallOutput { - return { - id: input.id, - type: input.type, - function: input.function && convertRequiredFunctionToolCallDetailsOutput(input.function), - }; -} - -function convertRequiredFunctionToolCallDetailsOutput( - input: GeneratedModels.RequiredFunctionToolCallDetailsOutput, -): PublicModels.RequiredFunctionToolCallDetailsOutput { - return { - name: input.name, - arguments: input.arguments, - }; -} - -function convertTruncationObjectOutput( - input: GeneratedModels.TruncationObjectOutput, -): PublicModels.TruncationObjectOutput { - return { - type: input.type, - lastMessages: input.last_messages, - }; -} - -export function convertOpenAIPageableListOfThreadRunOutput( - input: GeneratedModels.OpenAIPageableListOfThreadRunOutput, -): PublicModels.OpenAIPageableListOfThreadRunOutput { - return { - object: input.object, - firstId: input.first_id, - lastId: input.last_id, - hasMore: input.has_more, - data: input.data?.map(convertThreadRunOutput), - }; -} -export function convertRunStepOutput( - input: GeneratedModels.RunStepOutput, -): PublicModels.RunStepOutput { - return { - id: input.id, - object: input.object, - type: input.type, - assistantId: input.assistant_id, - threadId: input.thread_id, - runId: input.run_id, - status: input.status, - stepDetails: input.step_details && convertRunStepDetailsOutput(input.step_details), - lastError: input.last_error ? convertRunStepErrorOutput(input.last_error) : null, - createdAt: new Date(input.created_at), - expiredAt: input.expired_at ? new Date(input.expired_at) : null, - completedAt: input.completed_at ? new Date(input.completed_at) : null, - failedAt: input.failed_at ? new Date(input.failed_at) : null, - cancelledAt: input.cancelled_at ? new Date(input.cancelled_at) : null, - ...(input.usage && { usage: convertRunCompletionUsageOutput(input.usage) }), - metadata: input.metadata, - }; -} - -function convertRunStepDetailsOutput( - input: GeneratedModels.RunStepDetailsOutput, -): PublicModels.RunStepDetailsOutput { - switch (input.type) { - case "message_creation": - return convertRunStepMessageCreationDetailsOutput( - input as GeneratedModels.RunStepMessageCreationDetailsOutput, - ); - case "tool_call": - return convertRunStepToolCallDetailsOutput( - input as GeneratedModels.RunStepToolCallDetailsOutput, - ); - default: { - throw new Error(`Unknown run step type: ${input.type}`); - } - } -} - -function convertRunStepMessageCreationDetailsOutput( - input: GeneratedModels.RunStepMessageCreationDetailsOutput, -): PublicModels.RunStepMessageCreationDetailsOutput { - return { - type: input.type, - messageCreation: convertRunStepMessageCreationReferenceOutput(input.message_creation), - }; -} - -function convertRunStepMessageCreationReferenceOutput( - input: GeneratedModels.RunStepMessageCreationReferenceOutput, -): PublicModels.RunStepMessageCreationReferenceOutput { - return { - messageId: input.message_id, - }; -} - -function convertRunStepToolCallDetailsOutput( - input: GeneratedModels.RunStepToolCallDetailsOutput, -): PublicModels.RunStepToolCallDetailsOutput { - return { - type: input.type, - toolCalls: input.tool_calls && input.tool_calls.map(convertRunStepToolCallOutput), - }; -} - -function convertRunStepToolCallOutput( - input: GeneratedModels.RunStepToolCallOutput, -): PublicModels.RunStepToolCallOutput { - switch (input.type) { - case "code_interpreter": - return convertRunStepCodeInterpreterToolCallOutput( - input as GeneratedModels.RunStepCodeInterpreterToolCallOutput, - ); - case "file_search": - return convertRunStepFileSearchToolCallOutput( - input as GeneratedModels.RunStepFileSearchToolCallOutput, - ); - case "bing_grounding": - return convertRunStepBingGroundingToolCallOutput( - input as GeneratedModels.RunStepBingGroundingToolCallOutput, - ); - case "azure_ai_search": - return convertRunStepAzureAISearchToolCallOutput( - input as GeneratedModels.RunStepAzureAISearchToolCallOutput, - ); - case "sharepoint_grounding": - return convertRunStepSharepointToolCallOutput( - input as GeneratedModels.RunStepSharepointToolCallOutput, - ); - case "microsoft_fabric": - return convertRunStepMicrosoftFabricToolCallOutput( - input as GeneratedModels.RunStepMicrosoftFabricToolCallOutput, - ); - case "function": - return convertRunStepFunctionToolCallOutput( - input as GeneratedModels.RunStepFunctionToolCallOutput, - ); - default: { - throw new Error(`Unknown run step tool call type: ${input.type}`); - } - } -} - -function convertRunStepCodeInterpreterToolCallOutput( - input: GeneratedModels.RunStepCodeInterpreterToolCallOutput, -): PublicModels.RunStepCodeInterpreterToolCallOutput { - return { - type: input.type, - id: input.id, - codeInterpreter: - input.code_interpreter && - convertRunStepCodeInterpreterToolCallDetailsOutput(input.code_interpreter), - }; -} - -function convertRunStepFileSearchToolCallOutput( - input: GeneratedModels.RunStepFileSearchToolCallOutput, -): PublicModels.RunStepFileSearchToolCallOutput { - return { - type: input.type, - id: input.id, - fileSearch: input.file_search, - }; -} - -function convertRunStepBingGroundingToolCallOutput( - input: GeneratedModels.RunStepBingGroundingToolCallOutput, -): PublicModels.RunStepBingGroundingToolCallOutput { - return { - type: input.type, - id: input.id, - bingGrounding: input.bing_grounding, - }; -} - -function convertRunStepAzureAISearchToolCallOutput( - input: GeneratedModels.RunStepAzureAISearchToolCallOutput, -): PublicModels.RunStepAzureAISearchToolCallOutput { - return { - type: input.type, - id: input.id, - azureAISearch: input.azure_ai_search, - }; -} - -function convertRunStepSharepointToolCallOutput( - input: GeneratedModels.RunStepSharepointToolCallOutput, -): PublicModels.RunStepSharepointToolCallOutput { - return { - type: input.type, - id: input.id, - sharepointGrounding: input.sharepoint_grounding, - }; -} - -function convertRunStepMicrosoftFabricToolCallOutput( - input: GeneratedModels.RunStepMicrosoftFabricToolCallOutput, -): PublicModels.RunStepMicrosoftFabricToolCallOutput { - return { - type: input.type, - id: input.id, - microsoftFabric: input.microsoft_fabric, - }; -} - -function convertRunStepFunctionToolCallOutput( - input: GeneratedModels.RunStepFunctionToolCallOutput, -): PublicModels.RunStepFunctionToolCallOutput { - return { - type: input.type, - id: input.id, - function: convertRunStepFunctionToolCallDetailsOutput(input.function), - }; -} - -function convertRunStepFunctionToolCallDetailsOutput( - input: GeneratedModels.RunStepFunctionToolCallDetailsOutput, -): PublicModels.RunStepFunctionToolCallDetailsOutput { - return { - name: input.name, - arguments: input.arguments, - output: input.output, - }; -} - -function convertRunStepCodeInterpreterToolCallDetailsOutput( - input: GeneratedModels.RunStepCodeInterpreterToolCallDetailsOutput, -): PublicModels.RunStepCodeInterpreterToolCallDetailsOutput { - return { - input: input.input, - outputs: input.outputs && input.outputs.map(convertRunStepCodeInterpreterToolCallOutputOutput), - }; -} - -function convertRunStepCodeInterpreterToolCallOutputOutput( - input: GeneratedModels.RunStepCodeInterpreterToolCallOutputOutput, -): PublicModels.RunStepCodeInterpreterToolCallOutputOutput { - switch (input.type) { - case "logs": - return convertRunStepCodeInterpreterLogOutputOutput( - input as GeneratedModels.RunStepCodeInterpreterLogOutputOutput, - ); - case "image": - return convertRunStepCodeInterpreterImageOutputOutput( - input as GeneratedModels.RunStepCodeInterpreterImageOutputOutput, - ); - default: - return input; - } -} - -function convertRunStepCodeInterpreterLogOutputOutput( - input: GeneratedModels.RunStepCodeInterpreterLogOutputOutput, -): PublicModels.RunStepCodeInterpreterLogOutputOutput { - return { - type: input.type, - logs: input.logs, - }; -} - -function convertRunStepCodeInterpreterImageOutputOutput( - input: GeneratedModels.RunStepCodeInterpreterImageOutputOutput, -): PublicModels.RunStepCodeInterpreterImageOutputOutput { - return { - type: input.type, - image: convertRunStepCodeInterpreterImageReferenceOutput(input.image), - }; -} - -function convertRunStepCodeInterpreterImageReferenceOutput( - input: GeneratedModels.RunStepCodeInterpreterImageReferenceOutput, -): PublicModels.RunStepCodeInterpreterImageReferenceOutput { - return { - fileId: input.file_id, - }; -} - -function convertRunStepErrorOutput( - input: GeneratedModels.RunStepErrorOutput, -): PublicModels.RunStepErrorOutput { - return { - code: input.code, - message: input.message, - }; -} - -function convertRunStepCompletionUsageOutput( - input: GeneratedModels.RunStepCompletionUsageOutput, -): PublicModels.RunStepCompletionUsageOutput { - return { - completionTokens: input.completion_tokens, - promptTokens: input.prompt_tokens, - totalTokens: input.total_tokens, - }; -} - -export function convertOpenAIPageableListOfRunStepOutput( - input: GeneratedModels.OpenAIPageableListOfRunStepOutput, -): PublicModels.OpenAIPageableListOfRunStepOutput { - return { - object: input.object, - firstId: input.first_id, - lastId: input.last_id, - hasMore: input.has_more, - data: input.data?.map(convertRunStepOutput), - }; -} - -export function convertOpenAIPageableListOfThreadMessageOutput( - input: GeneratedModels.OpenAIPageableListOfThreadMessageOutput, -): PublicModels.OpenAIPageableListOfThreadMessageOutput { - return { - object: input.object, - firstId: input.first_id, - lastId: input.last_id, - hasMore: input.has_more, - data: input.data?.map(convertThreadMessageOutput), - }; -} - -export function convertOpenAIPageableListOfVectorStoreOutput( - input: GeneratedModels.OpenAIPageableListOfVectorStoreOutput, -): PublicModels.OpenAIPageableListOfVectorStoreOutput { - return { - object: input.object, - firstId: input.first_id, - lastId: input.last_id, - hasMore: input.has_more, - data: input.data.map(convertVectorStoreOutput), - }; -} - -export function convertVectorStoreOutput( - input: GeneratedModels.VectorStoreOutput, -): PublicModels.VectorStoreOutput { - return { - id: input.id, - object: input.object, - createdAt: new Date(input.created_at), - name: input.name, - usageBytes: input.usage_bytes, - fileCounts: convertVectorStoreFileCountOutput(input.file_counts), - status: input.status, - expiresAfter: input.expires_after - ? convertVectorStoreExpirationPolicyOutput(input.expires_after) - : undefined, - expiresAt: input.expires_at ? new Date(input.expires_at) : null, - lastActiveAt: input.last_active_at ? new Date(input.last_active_at) : null, - metadata: input.metadata, - }; -} - -function convertVectorStoreFileCountOutput( - input: GeneratedModels.VectorStoreFileCountOutput, -): PublicModels.VectorStoreFileCountOutput { - return { - inProgress: input.in_progress, - completed: input.completed, - failed: input.failed, - cancelled: input.cancelled, - total: input.total, - }; -} - -function convertVectorStoreExpirationPolicyOutput( - input: GeneratedModels.VectorStoreExpirationPolicyOutput, -): PublicModels.VectorStoreExpirationPolicyOutput { - return { - anchor: input.anchor, - days: input.days, - }; -} - -export function convertVectorStoreDeletionStatusOutput( - input: GeneratedModels.VectorStoreDeletionStatusOutput, -): PublicModels.VectorStoreDeletionStatusOutput { - return { - id: input.id, - deleted: input.deleted, - object: input.object, - }; -} - -export function convertVectorStoreFileBatchOutput( - input: GeneratedModels.VectorStoreFileBatchOutput, -): PublicModels.VectorStoreFileBatchOutput { - return { - id: input.id, - object: input.object, - createdAt: new Date(input.created_at), - vectorStoreId: input.vector_store_id, - status: input.status, - fileCounts: convertVectorStoreFileCountOutput(input.file_counts), - }; -} - -export function convertOpenAIPageableListOfVectorStoreFileOutput( - input: GeneratedModels.OpenAIPageableListOfVectorStoreFileOutput, -): PublicModels.OpenAIPageableListOfVectorStoreFileOutput { - return { - object: input.object, - firstId: input.first_id, - lastId: input.last_id, - hasMore: input.has_more, - data: input.data.map(convertVectorStoreFileOutput), - }; -} - -export function convertVectorStoreFileOutput( - input: GeneratedModels.VectorStoreFileOutput, -): PublicModels.VectorStoreFileOutput { - return { - id: input.id, - object: input.object, - usageBytes: input.usage_bytes, - createdAt: new Date(input.created_at), - vectorStoreId: input.vector_store_id, - status: input.status, - lastError: input.last_error, - chunkingStrategy: - input.chunking_strategy && - convertVectorStoreChunkingStrategyResponseOutput(input.chunking_strategy), - }; -} - -function convertVectorStoreChunkingStrategyResponseOutput( - input: GeneratedModels.VectorStoreChunkingStrategyResponseOutput, -): PublicModels.VectorStoreChunkingStrategyResponseOutput { - switch (input.type) { - case "auto": - return input as PublicModels.VectorStoreAutoChunkingStrategyResponseOutput; - case "static": - return convertVectorStoreStaticChunkingStrategyResponseOutput( - input as GeneratedModels.VectorStoreStaticChunkingStrategyResponseOutput, - ); - default: - throw new Error(`Unknown chunking strategy type: ${input.type}`); - } -} -function convertVectorStoreStaticChunkingStrategyResponseOutput( - input: GeneratedModels.VectorStoreStaticChunkingStrategyResponseOutput, -): PublicModels.VectorStoreStaticChunkingStrategyResponseOutput { - return { - type: input.type, - static: input.static && convertVectorStoreStaticChunkingStrategyOptionsOutput(input.static), - }; -} - -function convertVectorStoreStaticChunkingStrategyOptionsOutput( - input: GeneratedModels.VectorStoreStaticChunkingStrategyOptionsOutput, -): PublicModels.VectorStoreStaticChunkingStrategyOptionsOutput { - return { - maxChunkSizeTokens: input.max_chunk_size_tokens, - chunkOverlapTokens: input.chunk_overlap_tokens, - }; -} - -export function convertVectorStoreFileDeletionStatusOutput( - input: GeneratedModels.VectorStoreFileDeletionStatusOutput, -): PublicModels.VectorStoreFileDeletionStatusOutput { - return { - id: input.id, - deleted: input.deleted, - object: input.object, - }; -} - -export function convertOpenAIFileOutput( - input: GeneratedModels.OpenAIFileOutput, -): PublicModels.OpenAIFileOutput { - return { - id: input.id, - object: input.object, - bytes: input.bytes, - filename: input.filename, - createdAt: new Date(input.created_at), - purpose: input.purpose, - status: input.status, - statusDetails: input.status_details, - }; -} - -export function convertFileListResponseOutput( - input: GeneratedModels.FileListResponseOutput, -): PublicModels.FileListResponseOutput { - return { - object: input.object, - data: input.data.map(convertOpenAIFileOutput), - }; -} - -function convertMessageDelta( - input: WireStreamingModels.MessageDelta, -): PublicStreamingModels.MessageDelta { - return { - role: input.role, - content: input.content?.map(convertStreamingMessageDeltaContent), - }; -} - -export function convertMessageDeltaChunkOutput( - input: WireStreamingModels.MessageDeltaChunk, -): PublicStreamingModels.MessageDeltaChunk { - return { - id: input.id, - object: input.object, - delta: input.delta && convertMessageDelta(input.delta), - }; -} -function convertStreamingMessageDeltaContent( - input: WireStreamingModels.MessageDeltaContent, -): PublicStreamingModels.MessageDeltaContent { - switch (input.type) { - case "text": - return convertStreamingMessageTextContent( - input as WireStreamingModels.MessageDeltaTextContent, - ); - case "image": - return convertStreamingMessageImageContent( - input as WireStreamingModels.MessageDeltaImageFileContent, - ); - default: - logger.error(`Unknown message content type: ${input.type}`); - return { - index: input.index, - type: input.type, - }; - } -} - -function convertStreamingMessageTextContent( - input: WireStreamingModels.MessageDeltaTextContent, -): PublicStreamingModels.MessageDeltaTextContent { - return { - index: input.index, - type: input.type, - text: input.text && convertStreamingMessageTextDetails(input.text), - }; -} - -function convertStreamingMessageTextDetails( - input: WireStreamingModels.MessageDeltaTextContentObject, -): PublicStreamingModels.MessageDeltaTextContentObject { - return { - value: input.value, - annotations: input.annotations?.map(convertStreamingMessageTextAnnotation), - }; -} - -function convertStreamingMessageTextAnnotation( - input: WireStreamingModels.MessageDeltaTextAnnotation, -): PublicStreamingModels.MessageDeltaTextAnnotation { - switch (input.type) { - case "file_citation": - return convertStreamingMessageTextFileCitationAnnotation( - input as WireStreamingModels.MessageDeltaTextFileCitationAnnotation, - ); - case "file_path": - return convertStreamingMessageTextFilePathAnnotation( - input as WireStreamingModels.MessageDeltaTextFilePathAnnotation, - ); - default: - return input; - } -} - -function convertStreamingMessageTextFileCitationAnnotation( - input: WireStreamingModels.MessageDeltaTextFileCitationAnnotation, -): PublicStreamingModels.MessageDeltaTextFileCitationAnnotation { - return { - index: input.index, - type: input.type, - text: input.text, - fileCitation: - input.file_citation && convertStreamingMessageTextFileCitationDetails(input.file_citation), - startIndex: input.start_index, - endIndex: input.end_index, - }; -} - -function convertStreamingMessageTextFileCitationDetails( - input: WireStreamingModels.MessageDeltaTextFileCitationAnnotationObject, -): PublicStreamingModels.MessageDeltaTextFileCitationAnnotationObject { - return { - fileId: input.file_id, - quote: input.quote, - }; -} - -function convertStreamingMessageTextFilePathAnnotation( - input: WireStreamingModels.MessageDeltaTextFilePathAnnotation, -): PublicStreamingModels.MessageDeltaTextFilePathAnnotation { - return { - index: input.index, - type: input.type, - text: input.text, - filePath: input.file_path && convertStreamingMessageTextFilePathDetails(input.file_path), - startIndex: input.start_index, - endIndex: input.end_index, - }; -} - -function convertStreamingMessageTextFilePathDetails( - input: WireStreamingModels.MessageDeltaTextFilePathAnnotationObject, -): PublicStreamingModels.MessageDeltaTextFilePathAnnotationObject { - return { - fileId: input.file_id, - }; -} - -function convertStreamingMessageImageContent( - input: WireStreamingModels.MessageDeltaImageFileContent, -): PublicStreamingModels.MessageDeltaImageFileContent { - return { - index: input.index, - type: input.type, - imageFile: input.image_file && convertStreamingMessageImageFileDetails(input.image_file), - }; -} - -function convertStreamingMessageImageFileDetails( - input: WireStreamingModels.MessageDeltaImageFileContentObject, -): PublicStreamingModels.MessageDeltaImageFileContentObject { - return { - fileId: input.file_id, - }; -} - -export function convertRunStepDeltaChunk( - input: WireStreamingModels.RunStepDeltaChunk, -): PublicStreamingModels.RunStepDeltaChunk { - return { - id: input.id, - object: input.object, - delta: input.delta && convertRunStepDelta(input.delta), - }; -} -function convertRunStepDelta( - input: WireStreamingModels.RunStepDelta, -): PublicStreamingModels.RunStepDelta { - return { - stepDetails: input.step_details && convertRunStepDetailsDelta(input.step_details), - }; -} - -function convertRunStepDetailsDelta( - input: WireStreamingModels.RunStepDeltaDetail, -): PublicStreamingModels.RunStepDeltaDetail { - switch (input.type) { - case "message_creation": - return convertRunStepMessageCreationDetailsDelta( - input as WireStreamingModels.RunStepDeltaMessageCreation, - ); - case "tool_call": - return convertRunStepToolCallDetailsDelta( - input as WireStreamingModels.RunStepDeltaToolCallObject, - ); - default: - logger.error(`Unknown run step type: ${input.type}`); - return { type: input.type }; - } -} - -function convertRunStepMessageCreationDetailsDelta( - input: WireStreamingModels.RunStepDeltaMessageCreation, -): PublicStreamingModels.RunStepDeltaMessageCreation { - return { - type: input.type, - messageCreation: - input.message_creation && convertRunStepDeltaMessageCreationObject(input.message_creation), - }; -} - -function convertRunStepDeltaMessageCreationObject( - input: WireStreamingModels.RunStepDeltaMessageCreationObject, -): PublicStreamingModels.RunStepDeltaMessageCreationObject { - return { - messageId: input.message_id, - }; -} - -function convertRunStepToolCallDetailsDelta( - input: WireStreamingModels.RunStepDeltaToolCallObject, -): PublicStreamingModels.RunStepDeltaToolCallObject { - return { - type: input.type, - toolCalls: input.tool_calls && input.tool_calls.map(convertRunStepToolCallDelta), - }; -} - -function convertRunStepToolCallDelta( - input: WireStreamingModels.RunStepDeltaToolCall, -): PublicStreamingModels.RunStepDeltaToolCall { - switch (input.type) { - case "code_interpreter": - return convertRunStepCodeInterpreterToolCallDelta( - input as WireStreamingModels.RunStepDeltaCodeInterpreterToolCall, - ); - case "file_search": - return convertRunStepFileSearchToolCallDelta( - input as WireStreamingModels.RunStepDeltaFileSearchToolCall, - ); - case "function": - return convertRunStepFunctionToolCallDelta( - input as WireStreamingModels.RunStepDeltaFunctionToolCall, - ); - default: - logger.error(`Unknown run step tool call type: ${input.type}`); - return { - index: input.index, - id: input.id, - type: input.type, - }; - } -} - -function convertRunStepCodeInterpreterToolCallDelta( - input: WireStreamingModels.RunStepDeltaCodeInterpreterToolCall, -): PublicStreamingModels.RunStepDeltaCodeInterpreterToolCall { - return { - index: input.index, - type: input.type, - id: input.id, - codeInterpreter: - input.code_interpreter && - convertRunStepCodeInterpreterToolCallDetailsDelta(input.code_interpreter), - }; -} - -function convertRunStepCodeInterpreterToolCallDetailsDelta( - input: WireStreamingModels.RunStepDeltaCodeInterpreterDetailItemObject, -): PublicStreamingModels.RunStepDeltaCodeInterpreterDetailItemObject { - return { - input: input.input, - outputs: input.outputs && input.outputs.map(convertRunStepCodeInterpreterToolCallOutputDelta), - }; -} - -function convertRunStepCodeInterpreterToolCallOutputDelta( - input: WireStreamingModels.RunStepDeltaCodeInterpreterOutput, -): PublicStreamingModels.RunStepDeltaCodeInterpreterOutput { - switch (input.type) { - case "logs": - return convertRunStepCodeInterpreterLogOutputDelta( - input as WireStreamingModels.RunStepDeltaCodeInterpreterLogOutput, - ); - case "image": - return convertRunStepCodeInterpreterImageOutputDelta( - input as WireStreamingModels.RunStepDeltaCodeInterpreterImageOutput, - ); - default: - return input; - } -} - -function convertRunStepCodeInterpreterLogOutputDelta( - input: WireStreamingModels.RunStepDeltaCodeInterpreterLogOutput, -): PublicStreamingModels.RunStepDeltaCodeInterpreterLogOutput { - return { - index: input.index, - type: input.type, - logs: input.logs, - }; -} - -function convertRunStepCodeInterpreterImageOutputDelta( - input: WireStreamingModels.RunStepDeltaCodeInterpreterImageOutput, -): PublicStreamingModels.RunStepDeltaCodeInterpreterImageOutput { - return { - index: input.index, - type: input.type, - image: input.image && convertRunStepCodeInterpreterImageReferenceDelta(input.image), - }; -} - -function convertRunStepCodeInterpreterImageReferenceDelta( - input: WireStreamingModels.RunStepDeltaCodeInterpreterImageOutputObject, -): PublicStreamingModels.RunStepDeltaCodeInterpreterImageOutputObject { - return { - fileId: input.file_id, - }; -} - -function convertRunStepFunctionToolCallDelta( - input: WireStreamingModels.RunStepDeltaFunctionToolCall, -): PublicStreamingModels.RunStepDeltaFunctionToolCall { - return { - index: input.index, - type: input.type, - id: input.id, - function: input.function && convertRunStepFunctionToolCallDetailsDelta(input.function), - }; -} - -function convertRunStepFunctionToolCallDetailsDelta( - input: WireStreamingModels.RunStepDeltaFunction, -): PublicStreamingModels.RunStepDeltaFunction { - return { - name: input.name, - arguments: input.arguments, - output: input.output, - }; -} - -function convertRunStepFileSearchToolCallDelta( - input: WireStreamingModels.RunStepDeltaFileSearchToolCall, -): PublicStreamingModels.RunStepDeltaFileSearchToolCall { - return { - index: input.index, - type: input.type, - id: input.id, - fileSearch: input.file_search, - }; -} diff --git a/sdk/ai/ai-projects/src/customization/convertParametersToWire.ts b/sdk/ai/ai-projects/src/customization/convertParametersToWire.ts deleted file mode 100644 index ad64a351d78c..000000000000 --- a/sdk/ai/ai-projects/src/customization/convertParametersToWire.ts +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type * as PublicParameters from "./parameters.js"; -import type * as GeneratedParameters from "../generated/src/parameters.js"; -import { - convertVectorStoreChunkingStrategyRequest, - convertVectorStoreDataSource, -} from "./convertModelsToWrite.js"; - -/** - * Request options for list requests. - */ -interface ListQueryParameters { - limit?: number; - order?: "asc" | "desc"; - after?: string; - before?: string; -} - -export function convertCreateVectorStoreFileBatchParam( - input: PublicParameters.CreateVectorStoreFileBatchBodyParam, -): GeneratedParameters.CreateVectorStoreFileBatchBodyParam { - return { - body: input.body && { - ...(input.body.fileIds && { file_ids: input.body.fileIds }), - ...(input.body.dataSources && { - data_sources: input.body.dataSources.map(convertVectorStoreDataSource), - }), - ...(input.body.chunkingStrategy && { - chunking_strategy: convertVectorStoreChunkingStrategyRequest(input.body.chunkingStrategy), - }), - }, - }; -} - -export function convertCreateVectorStoreFileParam( - input: PublicParameters.CreateVectorStoreFileBodyParam, -): GeneratedParameters.CreateVectorStoreFileBodyParam { - return { - body: input.body && { - ...(input.body.fileId && { file_id: input.body.fileId }), - ...(input.body.dataSources && { - data_sources: input.body.dataSources.map(convertVectorStoreDataSource), - }), - ...(input.body.chunkingStrategy && { - chunking_strategy: convertVectorStoreChunkingStrategyRequest(input.body.chunkingStrategy), - }), - }, - }; -} - -export function convertToListQueryParameters( - options: T, -): ListQueryParameters & Record { - return { - ...(options.limit && { limit: options.limit }), - ...(options.order && { order: options.order }), - ...(options.after && { after: options.after }), - ...(options.before && { before: options.before }), - }; -} - -export function convertListVectorStoreFileBatchFilesQueryParamProperties( - options: PublicParameters.ListVectorStoreFileBatchFilesQueryParamProperties, -): GeneratedParameters.ListVectorStoreFileBatchFilesQueryParamProperties { - return { - ...convertToListQueryParameters(options), - ...(options.filter && { filter: options.filter }), - }; -} - -export function convertListFilesQueryParamProperties( - options: PublicParameters.ListFilesQueryParamProperties, -): GeneratedParameters.ListFilesQueryParamProperties & Record { - return { - ...(options.purpose && { purpose: options.purpose }), - }; -} diff --git a/sdk/ai/ai-projects/src/customization/models.ts b/sdk/ai/ai-projects/src/customization/models.ts deleted file mode 100644 index fa2f4b051964..000000000000 --- a/sdk/ai/ai-projects/src/customization/models.ts +++ /dev/null @@ -1,902 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** The request details to use when creating a new agent. */ -export interface CreateAgentOptions { - /** The ID of the model to use. */ - model: string; - /** The name of the new agent. */ - name?: string | null; - /** The description of the new agent. */ - description?: string | null; - /** The system instructions for the new agent to use. */ - instructions?: string | null; - /** The collection of tools to enable for the new agent. */ - tools?: Array; - /** - * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - */ - toolResources?: ToolResources | null; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - * while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** The response format of the tool calls used by this agent. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** An abstract representation of an input tool definition that an agent can use. */ -export interface ToolDefinitionParent { - type: string; -} - -/** The input definition information for a code interpreter tool as used to configure an agent. */ -export interface CodeInterpreterToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'code_interpreter'. */ - type: "code_interpreter"; -} - -/** The input definition information for a file search tool as used to configure an agent. */ -export interface FileSearchToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'file_search'. */ - type: "file_search"; - /** Options overrides for the file search tool. */ - fileSearch?: FileSearchToolDefinitionDetails; -} - -/** Options overrides for the file search tool. */ -export interface FileSearchToolDefinitionDetails { - /** - * The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. - * - * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. - */ - maxNumResults?: number; - rankingOptions?: FileSearchRankingOptions; -} - -/** Ranking options for file search. */ -export interface FileSearchRankingOptions { - /** File search ranker. */ - ranker: string; - /** Ranker search threshold. */ - scoreThreshold: number; -} - -/** The input definition information for a function tool as used to configure an agent. */ -export interface FunctionToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'function'. */ - type: "function"; - /** The definition of the concrete function that the function tool should call. */ - function: FunctionDefinition; -} - -/** The input definition information for a function. */ -export interface FunctionDefinition { - /** The name of the function to be called. */ - name: string; - /** A description of what the function does, used by the model to choose when and how to call the function. */ - description?: string; - /** The parameters the functions accepts, described as a JSON Schema object. */ - parameters: unknown; -} - -/** The input definition information for a bing grounding search tool as used to configure an agent. */ -export interface BingGroundingToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'bing_grounding'. */ - type: "bing_grounding"; - /** The list of connections used by the bing grounding tool. */ - bingGrounding: ToolConnectionList; -} - -/** A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint_grounding` tools. */ -export interface ToolConnectionList { - /** - * The connections attached to this tool. There can be a maximum of 1 connection - * resource attached to the tool. - */ - connections?: Array; -} - -/** A connection resource. */ -export interface ToolConnection { - /** A connection in a ToolConnectionList attached to this tool. */ - connectionId: string; -} - -/** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ -export interface MicrosoftFabricToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; - /** The list of connections used by the Microsoft Fabric tool. */ - microsoftFabric: ToolConnectionList; -} - -/** The input definition information for a sharepoint tool as used to configure an agent. */ -export interface SharepointToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'sharepoint_grounding'. */ - type: "sharepoint_grounding"; - /** The list of connections used by the SharePoint tool. */ - sharepointGrounding: ToolConnectionList; -} - -/** The input definition information for an Azure AI search tool as used to configure an agent. */ -export interface AzureAISearchToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'azure_ai_search'. */ - type: "azure_ai_search"; -} - -/** - * A set of resources that are used by the agent's tools. The resources are specific to the type of - * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` - * tool requires a list of vector store IDs. - */ -export interface ToolResources { - /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ - codeInterpreter?: CodeInterpreterToolResource; - /** Resources to be used by the `file_search` tool consisting of vector store IDs. */ - fileSearch?: FileSearchToolResource; - /** Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ - azureAISearch?: AzureAISearchResource; -} - -/** A set of resources that are used by the `code_interpreter` tool. */ -export interface CodeInterpreterToolResource { - /** - * A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - */ - fileIds?: string[]; - /** The data sources to be used. This option is mutually exclusive with fileIds. */ - dataSources?: Array; -} - -/** - * The structure, containing Azure asset URI path and the asset type of the file used as a data source - * for the enterprise file search. - */ -export interface VectorStoreDataSource { - /** Asset URI. */ - uri: string; - /** The asset type * */ - type: VectorStoreDataSourceAssetType; -} - -/** A set of resources that are used by the `file_search` tool. */ -export interface FileSearchToolResource { - /** - * The ID of the vector store attached to this agent. There can be a maximum of 1 vector - * store attached to the agent. - */ - vectorStoreIds?: string[]; - /** - * The list of vector store configuration objects from Azure. This list is limited to one - * element. The only element of this list contains - * the list of azure asset IDs used by the search tool. - */ - vectorStores?: Array; -} - -/** The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs. */ -export interface VectorStoreConfigurations { - /** Name */ - name: string; - /** Configurations */ - configuration: VectorStoreConfiguration; -} - -/** - * Vector storage configuration is the list of data sources, used when multiple - * files can be used for the enterprise file search. - */ -export interface VectorStoreConfiguration { - /** Data sources */ - dataSources: Array; -} - -/** A set of index resources used by the `azure_ai_search` tool. */ -export interface AzureAISearchResource { - /** - * The indices attached to this agent. There can be a maximum of 1 index - * resource attached to the agent. - */ - indexes?: Array; -} - -/** A Index resource. */ -export interface IndexResource { - /** An index connection id in an IndexResource attached to this agent. */ - indexConnectionId: string; - /** The name of an index in an IndexResource attached to this agent. */ - indexName: string; -} - -/** - * An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. - * If `text` the model can return text or any value needed. - */ -export interface AgentsApiResponseFormat { - /** - * Must be one of `text` or `json_object`. - * - * Possible values: "text", "json_object" - */ - type?: ApiResponseFormat; -} - -/** The request details to use when modifying an existing agent. */ -export interface UpdateAgentOptions { - /** The ID of the model to use. */ - model?: string; - /** The modified name for the agent to use. */ - name?: string | null; - /** The modified description for the agent to use. */ - description?: string | null; - /** The modified system instructions for the new agent to use. */ - instructions?: string | null; - /** The modified collection of tools to enable for the agent. */ - tools?: Array; - /** - * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, - * the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - */ - toolResources?: ToolResources; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - * while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** The response format of the tool calls used by this agent. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** The details used to create a new agent thread. */ -export interface AgentThreadCreationOptions { - /** The initial messages to associate with the new thread. */ - messages?: Array; - /** - * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - * a list of vector store IDs. - */ - toolResources?: ToolResources | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** A single message within an agent thread, as provided during that thread's creation for its initial state. */ -export interface ThreadMessageOptions { - /** - * The role of the entity that is creating the message. Allowed values include: - * - `user`: Indicates the message is sent by an actual user and should be used in most - * cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the agent. Use this value to insert - * messages from the agent into the - * conversation. - * - * Possible values: "user", "assistant" - */ - role: MessageRole; - /** - * The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via - * a separate call to the create message API. - */ - content: string; - /** A list of files attached to the message, and the tools they should be added to. */ - attachments?: Array | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** This describes to which tools a file has been attached. */ -export interface MessageAttachment { - /** The ID of the file to attach to the message. */ - fileId?: string; - /** Azure asset ID. */ - dataSources?: Array; - /** The tools to add to this file. */ - tools: MessageAttachmentToolDefinition[]; -} - -/** The details used to update an existing agent thread */ -export interface UpdateAgentThreadOptions { - /** - * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the - * type of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires - * a list of vector store IDs - */ - toolResources?: ToolResources | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** A single, existing message within an agent thread. */ -export interface ThreadMessage { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always 'thread.message'. */ - object: "thread.message"; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: number; - /** The ID of the thread that this message belongs to. */ - threadId: string; - /** - * The status of the message. - * - * Possible values: "in_progress", "incomplete", "completed" - */ - status: MessageStatus; - /** On an incomplete message, details about why the message is incomplete. */ - incompleteDetails: MessageIncompleteDetails | null; - /** The Unix timestamp (in seconds) for when the message was completed. */ - completedAt: number | null; - /** The Unix timestamp (in seconds) for when the message was marked as incomplete. */ - incompleteAt: number | null; - /** - * The role associated with the agent thread message. - * - * Possible values: "user", "assistant" - */ - role: MessageRole; - /** The list of content items associated with the agent thread message. */ - content: Array; - /** If applicable, the ID of the agent that authored this message. */ - assistantId: string | null; - /** If applicable, the ID of the run associated with the authoring of this message. */ - runId: string | null; - /** A list of files attached to the message, and the tools they were added to. */ - attachments: Array | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** Information providing additional detail about a message entering an incomplete status. */ -export interface MessageIncompleteDetails { - /** - * The provided reason describing why the message was marked as incomplete. - * - * Possible values: "content_filter", "max_tokens", "run_cancelled", "run_failed", "run_expired" - */ - reason: MessageIncompleteDetailsReason; -} - -/** An abstract representation of a single item of thread message content. */ -export interface MessageContentParent { - type: string; -} - -/** A representation of a textual item of thread message content. */ -export interface MessageTextContent extends MessageContentParent { - /** The object type, which is always 'text'. */ - type: "text"; - /** The text and associated annotations for this thread message content item. */ - text: MessageTextDetails; -} - -/** The text and associated annotations for a single item of agent thread message content. */ -export interface MessageTextDetails { - /** The text data. */ - value: string; - /** A list of annotations associated with this text. */ - annotations: Array; -} - -/** An abstract representation of an annotation to text thread message content. */ -export interface MessageTextAnnotationParent { - /** The textual content associated with this text annotation item. */ - text: string; - type: string; -} - -/** A citation within the message that points to a specific quote from a specific File associated with the agent or the message. Generated when the agent uses the 'file_search' tool to search files. */ -export interface MessageTextFileCitationAnnotation extends MessageTextAnnotationParent { - /** The object type, which is always 'file_citation'. */ - type: "file_citation"; - /** - * A citation within the message that points to a specific quote from a specific file. - * Generated when the agent uses the "file_search" tool to search files. - */ - fileCitation: MessageTextFileCitationDetails; - /** The first text index associated with this text annotation. */ - startIndex?: number; - /** The last text index associated with this text annotation. */ - endIndex?: number; -} - -/** A representation of a file-based text citation, as used in a file-based annotation of text thread message content. */ -export interface MessageTextFileCitationDetails { - /** The ID of the file associated with this citation. */ - fileId: string; - /** The specific quote cited in the associated file. */ - quote: string; -} - -/** A citation within the message that points to a file located at a specific path. */ -export interface MessageTextFilePathAnnotation extends MessageTextAnnotationParent { - /** The object type, which is always 'file_path'. */ - type: "file_path"; - /** A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. */ - filePath: MessageTextFilePathDetails; - /** The first text index associated with this text annotation. */ - startIndex?: number; - /** The last text index associated with this text annotation. */ - endIndex?: number; -} - -/** An encapsulation of an image file ID, as used by message image content. */ -export interface MessageTextFilePathDetails { - /** The ID of the specific file that the citation is from. */ - fileId: string; -} - -/** A representation of image file content in a thread message. */ -export interface MessageImageFileContent extends MessageContentParent { - /** The object type, which is always 'image_file'. */ - type: "image_file"; - /** The image file for this thread message content item. */ - imageFile: MessageImageFileDetails; -} - -/** An image reference, as represented in thread message content. */ -export interface MessageImageFileDetails { - /** The ID for the file associated with this image. */ - fileId: string; -} - -/** The details used when creating a new run of an agent thread. */ -export interface CreateRunOptions { - /** The ID of the agent that should run the thread. */ - assistantId: string; - /** The overridden model name that the agent should use to run the thread. */ - model?: string | null; - /** The overridden system instructions that the agent should use to run the thread. */ - instructions?: string | null; - /** - * Additional instructions to append at the end of the instructions for the run. This is useful for modifying the behavior - * on a per-run basis without overriding other instructions. - */ - additionalInstructions?: string | null; - /** Adds additional messages to the thread before creating the run. */ - additionalMessages?: Array | null; - /** The overridden list of enabled tools that the agent should use to run the thread. */ - tools?: Array; - /** - * If `true`, returns a stream of events that happen during the Run as server-sent events, - * terminating when the Run enters a terminal state with a `data: [DONE]` message. - */ - stream?: boolean; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - * more random, while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model - * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - * comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** - * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - * the run will end with status `incomplete`. See `incomplete_details` for more info. - */ - maxPromptTokens?: number | null; - /** - * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort - * to use only the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of - * completion tokens specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - */ - maxCompletionTokens?: number | null; - /** The strategy to use for dropping messages as the context windows moves forward. */ - truncationStrategy?: TruncationObject | null; - /** Controls whether or not and which tool is called by the model. */ - toolChoice?: AgentsApiToolChoiceOption | null; - /** Specifies the format that the model must output. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** - * Controls for how a thread will be truncated prior to the run. Use this to control the initial - * context window of the run. - */ -export interface TruncationObject { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will - * be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread - * will be dropped to fit the context length of the model, `max_prompt_tokens`. - * - * Possible values: "auto", "last_messages" - */ - type: TruncationStrategy; - /** The number of most recent messages from the thread when constructing the context for the run. */ - lastMessages?: number | null; -} - -/** Specifies a tool the model should use. Use to force the model to call a specific tool. */ -export interface AgentsNamedToolChoice { - /** - * the type of tool. If type is `function`, the function name must be set. - * - * Possible values: "function", "code_interpreter", "file_search", "bing_grounding", "microsoft_fabric", "sharepoint_grounding", "azure_ai_search" - */ - type: AgentsNamedToolChoiceType; - /** The name of the function to call */ - function?: FunctionName; -} - -/** The function name that will be used, if using the `function` tool */ -export interface FunctionName { - /** The name of the function to call */ - name: string; -} - -/** - * Request object. A set of resources that are used by the agent's tools. The resources are specific to the type of tool. - * For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of - * vector store IDs. - */ -export interface UpdateToolResourcesOptions { - /** - * Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - */ - codeInterpreter?: UpdateCodeInterpreterToolResourceOptions; - /** Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. */ - fileSearch?: UpdateFileSearchToolResourceOptions; - /** Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ - azureAISearch?: AzureAISearchResource; -} - -/** Request object to update `code_interpreted` tool resources. */ -export interface UpdateCodeInterpreterToolResourceOptions { - /** A list of file IDs to override the current list of the agent. */ - fileIds?: string[]; -} - -/** Request object to update `file_search` tool resources. */ -export interface UpdateFileSearchToolResourceOptions { - /** A list of vector store IDs to override the current list of the agent. */ - vectorStoreIds?: string[]; -} - -/** The data provided during a tool outputs submission to resolve pending tool calls and allow the model to continue. */ -export interface ToolOutput { - /** The ID of the tool call being resolved, as provided in the tool calls of a required action from a run. */ - toolCallId?: string; - /** The output from the tool to be submitted. */ - output?: string; -} - -/** The details used when creating and immediately running a new agent thread. */ -export interface CreateAndRunThreadOptions { - /** The ID of the agent for which the thread should be created. */ - assistantId: string; - /** The details used to create the new thread. If no thread is provided, an empty one will be created. */ - thread?: AgentThreadCreationOptions; - /** The overridden model that the agent should use to run the thread. */ - model?: string | null; - /** The overridden system instructions the agent should use to run the thread. */ - instructions?: string | null; - /** The overridden list of enabled tools the agent should use to run the thread. */ - tools?: Array | null; - /** Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis */ - toolResources?: UpdateToolResourcesOptions | null; - /** - * If `true`, returns a stream of events that happen during the Run as server-sent events, - * terminating when the Run enters a terminal state with a `data: [DONE]` message. - */ - stream?: boolean; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output - * more random, while lower values like 0.2 will make it more focused and deterministic. - */ - temperature?: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model - * considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens - * comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP?: number | null; - /** - * The maximum number of prompt tokens that may be used over the course of the run. The run will make a best effort to use only - * the number of prompt tokens specified, across multiple turns of the run. If the run exceeds the number of prompt tokens specified, - * the run will end with status `incomplete`. See `incomplete_details` for more info. - */ - maxPromptTokens?: number | null; - /** - * The maximum number of completion tokens that may be used over the course of the run. The run will make a best effort to use only - * the number of completion tokens specified, across multiple turns of the run. If the run exceeds the number of completion tokens - * specified, the run will end with status `incomplete`. See `incomplete_details` for more info. - */ - maxCompletionTokens?: number | null; - /** The strategy to use for dropping messages as the context windows moves forward. */ - truncationStrategy?: TruncationObject | null; - /** Controls whether or not and which tool is called by the model. */ - toolChoice?: AgentsApiToolChoiceOption | null; - /** Specifies the format that the model must output. */ - responseFormat?: AgentsApiResponseFormatOption | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** The expiration policy for a vector store. */ -export interface VectorStoreExpirationPolicy { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. - * - * Possible values: "last_active_at" - */ - anchor: VectorStoreExpirationPolicyAnchor; - /** The anchor timestamp after which the expiration policy applies. */ - days: number; -} - -/** Request object for creating a vector store. */ -export interface VectorStoreOptions { - /** A list of file IDs that the vector store should use. Useful for tools like `file_search` that can access files. */ - fileIds?: string[]; - /** The name of the vector store. */ - name?: string; - /** The vector store configuration, used when vector store is created from Azure asset URIs. */ - configuration?: VectorStoreConfiguration; - /** Details on when this vector store expires */ - expiresAfter?: VectorStoreExpirationPolicy; - /** The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty. */ - chunkingStrategy?: VectorStoreChunkingStrategyRequest; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** An abstract representation of a vector store chunking strategy configuration. */ -export interface VectorStoreChunkingStrategyRequestParent { - type: VectorStoreChunkingStrategyRequestType; -} - -/** The default strategy. This strategy currently uses a max_chunk_size_tokens of 800 and chunk_overlap_tokens of 400. */ -export interface VectorStoreAutoChunkingStrategyRequest - extends VectorStoreChunkingStrategyRequestParent { - /** The object type, which is always 'auto'. */ - type: "auto"; -} - -/** A statically configured chunking strategy. */ -export interface VectorStoreStaticChunkingStrategyRequest - extends VectorStoreChunkingStrategyRequestParent { - /** The object type, which is always 'static'. */ - type: "static"; - /** The options for the static chunking strategy. */ - static: VectorStoreStaticChunkingStrategyOptions; -} - -/** Options to configure a vector store static chunking strategy. */ -export interface VectorStoreStaticChunkingStrategyOptions { - /** The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096. */ - maxChunkSizeTokens: number; - /** - * The number of tokens that overlap between chunks. The default value is 400. - * Note that the overlap must not exceed half of max_chunk_size_tokens. - */ - chunkOverlapTokens: number; -} - -/** Request object for updating a vector store. */ -export interface VectorStoreUpdateOptions { - /** The name of the vector store. */ - name?: string | null; - /** Details on when this vector store expires */ - expiresAfter?: VectorStoreExpirationPolicy | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata?: Record | null; -} - -/** Evaluation Definition */ -export interface Evaluation { - /** Data for evaluation. */ - data: InputData; - /** Display Name for evaluation. It helps to find evaluation easily in AI Foundry. It does not need to be unique. */ - displayName?: string; - /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ - description?: string; - /** Evaluation's tags. Unlike properties, tags are fully mutable. */ - tags?: Record; - /** Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. */ - properties?: Record; - /** Evaluators to be used for the evaluation. */ - evaluators: Record; -} - -/** Abstract data class for input data configuration. */ -export interface InputDataParent { - type: string; -} - -/** Data Source for Application Insights. */ -export interface ApplicationInsightsConfiguration extends InputDataParent { - /** LogAnalytic Workspace resourceID associated with ApplicationInsights */ - resourceId: string; - /** Query to fetch the data. */ - query: string; - /** Service name. */ - serviceName: string; - /** Connection String to connect to ApplicationInsights. */ - connectionString?: string; -} - -/** Dataset as source for evaluation. */ -export interface Dataset extends InputDataParent { - /** Evaluation input data */ - id: string; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData {} - -/** Evaluator Configuration */ -export interface EvaluatorConfiguration { - /** Identifier of the evaluator. */ - id: string; - /** Initialization parameters of the evaluator. */ - initParams?: Record; - /** Data parameters of the evaluator. */ - dataMapping?: Record; -} - -/** Evaluation Schedule Definition */ -export interface EvaluationSchedule { - /** Data for evaluation. */ - data: ApplicationInsightsConfiguration; - /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ - description?: string; - /** Evaluation's tags. Unlike properties, tags are fully mutable. */ - tags?: Record; - /** Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. */ - properties?: Record; - /** Evaluators to be used for the evaluation. */ - evaluators: Record; - /** Trigger for the evaluation. */ - trigger: Trigger; -} - -/** Abstract data class for input data configuration. */ -export interface TriggerParent { - type: string; -} - -/** Recurrence Trigger Definition */ -export interface RecurrenceTrigger extends TriggerParent { - /** - * The frequency to trigger schedule. - * - * Possible values: "Month", "Week", "Day", "Hour", "Minute" - */ - frequency: Frequency; - /** Specifies schedule interval in conjunction with frequency */ - interval: number; - /** The recurrence schedule. */ - schedule?: RecurrenceSchedule; -} - -/** RecurrenceSchedule Definition */ -export interface RecurrenceSchedule { - /** List of hours for the schedule. */ - hours: number[]; - /** List of minutes for the schedule. */ - minutes: number[]; - /** List of days for the schedule. */ - weekDays?: WeekDays[]; - /** List of month days for the schedule */ - monthDays?: number[]; -} - -/** Cron Trigger Definition */ -export interface CronTrigger extends TriggerParent { - /** Cron expression for the trigger. */ - expression: string; -} - -/** An abstract representation of an input tool definition that an agent can use. */ -export type ToolDefinition = - | ToolDefinitionParent - | CodeInterpreterToolDefinition - | FileSearchToolDefinition - | FunctionToolDefinition - | BingGroundingToolDefinition - | MicrosoftFabricToolDefinition - | SharepointToolDefinition - | AzureAISearchToolDefinition; -/** An abstract representation of a single item of thread message content. */ -export type MessageContent = MessageContentParent | MessageTextContent | MessageImageFileContent; -/** An abstract representation of an annotation to text thread message content. */ -export type MessageTextAnnotation = - | MessageTextAnnotationParent - | MessageTextFileCitationAnnotation - | MessageTextFilePathAnnotation; -/** An abstract representation of a vector store chunking strategy configuration. */ -export type VectorStoreChunkingStrategyRequest = - | VectorStoreChunkingStrategyRequestParent - | VectorStoreAutoChunkingStrategyRequest - | VectorStoreStaticChunkingStrategyRequest; -/** Abstract data class for input data configuration. */ -export type InputData = InputDataParent | ApplicationInsightsConfiguration | Dataset; -/** Abstract data class for input data configuration. */ -export type Trigger = TriggerParent | RecurrenceTrigger | CronTrigger; -/** Alias for VectorStoreDataSourceAssetType */ -export type VectorStoreDataSourceAssetType = "uri_asset" | "id_asset"; -/** Alias for AgentsApiResponseFormatMode */ -export type AgentsApiResponseFormatMode = string; -/** Alias for ApiResponseFormat */ -export type ApiResponseFormat = string; -/** Alias for AgentsApiResponseFormatOption */ -export type AgentsApiResponseFormatOption = - | string - | AgentsApiResponseFormatMode - | AgentsApiResponseFormat; -/** Alias for ListSortOrder */ -export type ListSortOrder = "asc" | "desc"; -/** Alias for MessageRole */ -export type MessageRole = string; -/** Alias for MessageAttachmentToolDefinition */ -export type MessageAttachmentToolDefinition = - | CodeInterpreterToolDefinition - | FileSearchToolDefinition; -/** Alias for MessageStatus */ -export type MessageStatus = string; -/** Alias for MessageIncompleteDetailsReason */ -export type MessageIncompleteDetailsReason = string; -/** Alias for TruncationStrategy */ -export type TruncationStrategy = string; -/** Alias for AgentsApiToolChoiceOptionMode */ -export type AgentsApiToolChoiceOptionMode = string; -/** Alias for AgentsNamedToolChoiceType */ -export type AgentsNamedToolChoiceType = string; -/** Alias for AgentsApiToolChoiceOption */ -export type AgentsApiToolChoiceOption = - | string - | AgentsApiToolChoiceOptionMode - | AgentsNamedToolChoice; -/** Alias for FilePurpose */ -export type FilePurpose = string; -/** Alias for VectorStoreExpirationPolicyAnchor */ -export type VectorStoreExpirationPolicyAnchor = string; -/** Alias for VectorStoreChunkingStrategyRequestType */ -export type VectorStoreChunkingStrategyRequestType = string; -/** Alias for VectorStoreFileStatusFilter */ -export type VectorStoreFileStatusFilter = string; -/** The Type (or category) of the connection */ -export type ConnectionType = - | "AzureOpenAI" - | "Serverless" - | "AzureBlob" - | "AIServices" - | "CognitiveSearch"; -/** Alias for Frequency */ -export type Frequency = string; -/** Alias for WeekDays */ -export type WeekDays = string; diff --git a/sdk/ai/ai-projects/src/customization/outputModels.ts b/sdk/ai/ai-projects/src/customization/outputModels.ts deleted file mode 100644 index ad967f541764..000000000000 --- a/sdk/ai/ai-projects/src/customization/outputModels.ts +++ /dev/null @@ -1,1498 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Paged } from "@azure/core-paging"; - -/** An abstract representation of an input tool definition that an agent can use. */ -export interface ToolDefinitionOutputParent { - type: string; -} - -/** The input definition information for a code interpreter tool as used to configure an agent. */ -export interface CodeInterpreterToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'code_interpreter'. */ - type: "code_interpreter"; -} - -/** The input definition information for a file search tool as used to configure an agent. */ -export interface FileSearchToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'file_search'. */ - type: "file_search"; - /** Options overrides for the file search tool. */ - fileSearch?: FileSearchToolDefinitionDetailsOutput; -} - -/** Options overrides for the file search tool. */ -export interface FileSearchToolDefinitionDetailsOutput { - /** - * The maximum number of results the file search tool should output. The default is 20 for gpt-4* models and 5 for gpt-3.5-turbo. This number should be between 1 and 50 inclusive. - * - * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. - */ - maxNumResults?: number; - rankingOptions?: FileSearchRankingOptionsOutput; -} - -/** Ranking options for file search. */ -export interface FileSearchRankingOptionsOutput { - /** File search ranker. */ - ranker: string; - /** Ranker search threshold. */ - scoreThreshold: number; -} - -/** The input definition information for a function tool as used to configure an agent. */ -export interface FunctionToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'function'. */ - type: "function"; - /** The definition of the concrete function that the function tool should call. */ - function: FunctionDefinitionOutput; -} - -/** The input definition information for a function. */ -export interface FunctionDefinitionOutput { - /** The name of the function to be called. */ - name: string; - /** A description of what the function does, used by the model to choose when and how to call the function. */ - description?: string; - /** The parameters the functions accepts, described as a JSON Schema object. */ - parameters: any; -} - -/** The input definition information for a bing grounding search tool as used to configure an agent. */ -export interface BingGroundingToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'bing_grounding'. */ - type: "bing_grounding"; - /** The list of connections used by the bing grounding tool. */ - bingGrounding: ToolConnectionListOutput; -} - -/** A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint_grounding` tools. */ -export interface ToolConnectionListOutput { - /** - * The connections attached to this tool. There can be a maximum of 1 connection - * resource attached to the tool. - */ - connections?: Array; -} - -/** A connection resource. */ -export interface ToolConnectionOutput { - /** A connection in a ToolConnectionList attached to this tool. */ - connectionId: string; -} - -/** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ -export interface MicrosoftFabricToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; - /** The list of connections used by the Microsoft Fabric tool. */ - microsoftFabric: ToolConnectionListOutput; -} - -/** The input definition information for a sharepoint tool as used to configure an agent. */ -export interface SharepointToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'sharepoint_grounding'. */ - type: "sharepoint_grounding"; - /** The list of connections used by the SharePoint tool. */ - sharepointGrounding: ToolConnectionListOutput; -} - -/** The input definition information for an Azure AI search tool as used to configure an agent. */ -export interface AzureAISearchToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'azure_ai_search'. */ - type: "azure_ai_search"; -} - -/** - * A set of resources that are used by the agent's tools. The resources are specific to the type of - * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` - * tool requires a list of vector store IDs. - */ -export interface ToolResourcesOutput { - /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ - codeInterpreter?: CodeInterpreterToolResourceOutput; - /** Resources to be used by the `file_search` tool consisting of vector store IDs. */ - fileSearch?: FileSearchToolResourceOutput; - /** Resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ - azureAISearch?: AzureAISearchResourceOutput; -} - -/** A set of resources that are used by the `code_interpreter` tool. */ -export interface CodeInterpreterToolResourceOutput { - /** - * A list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - */ - fileIds?: string[]; - /** The data sources to be used. This option is mutually exclusive with fileIds. */ - dataSources?: Array; -} - -/** - * The structure, containing Azure asset URI path and the asset type of the file used as a data source - * for the enterprise file search. - */ -export interface VectorStoreDataSourceOutput { - /** Asset URI. */ - uri: string; - /** The asset type * */ - type: VectorStoreDataSourceAssetTypeOutput; -} - -/** A set of resources that are used by the `file_search` tool. */ -export interface FileSearchToolResourceOutput { - /** - * The ID of the vector store attached to this agent. There can be a maximum of 1 vector - * store attached to the agent. - */ - vectorStoreIds?: string[]; - /** - * The list of vector store configuration objects from Azure. This list is limited to one - * element. The only element of this list contains - * the list of azure asset IDs used by the search tool. - */ - vectorStores?: Array; -} - -/** The structure, containing the list of vector storage configurations i.e. the list of azure asset IDs. */ -export interface VectorStoreConfigurationsOutput { - /** Name */ - name: string; - /** Configurations */ - configuration: VectorStoreConfigurationOutput; -} - -/** - * Vector storage configuration is the list of data sources, used when multiple - * files can be used for the enterprise file search. - */ -export interface VectorStoreConfigurationOutput { - /** Data sources */ - dataSources: Array; -} - -/** A set of index resources used by the `azure_ai_search` tool. */ -export interface AzureAISearchResourceOutput { - /** - * The indices attached to this agent. There can be a maximum of 1 index - * resource attached to the agent. - */ - indexes?: Array; -} - -/** A Index resource. */ -export interface IndexResourceOutput { - /** An index connection id in an IndexResource attached to this agent. */ - indexConnectionId: string; - /** The name of an index in an IndexResource attached to this agent. */ - indexName: string; -} - -/** - * An object describing the expected output of the model. If `json_object` only `function` type `tools` are allowed to be passed to the Run. - * If `text` the model can return text or any value needed. - */ -export interface AgentsApiResponseFormatOutput { - /** - * Must be one of `text` or `json_object`. - * - * Possible values: "text", "json_object" - */ - type?: ApiResponseFormatOutput; -} - -/** Represents an agent that can call the model and use tools. */ -export interface AgentOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always assistant. */ - object: "assistant"; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: Date; - /** The name of the agent. */ - name: string | null; - /** The description of the agent. */ - description: string | null; - /** The ID of the model to use. */ - model: string; - /** The system instructions for the agent to use. */ - instructions: string | null; - /** The collection of tools enabled for the agent. */ - tools: Array; - /** - * A set of resources that are used by the agent's tools. The resources are specific to the type of tool. For example, the `code_interpreter` - * tool requires a list of file IDs, while the `file_search` tool requires a list of vector store IDs. - */ - toolResources: ToolResourcesOutput | null; - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, - * while lower values like 0.2 will make it more focused and deterministic. - */ - temperature: number | null; - /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. - * So 0.1 means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - topP: number | null; - /** The response format of the tool calls used by this agent. */ - responseFormat?: AgentsApiResponseFormatOptionOutput | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** The response data for a requested list of items. */ -export interface OpenAIPageableListOfAgentOutput { - /** The object type, which is always list. */ - object: "list"; - /** The requested list of items. */ - data: Array; - /** The first ID represented in this list. */ - firstId: string; - /** The last ID represented in this list. */ - lastId: string; - /** A value indicating whether there are additional values available not captured in this list. */ - hasMore: boolean; -} - -/** The status of an agent deletion operation. */ -export interface AgentDeletionStatusOutput { - /** The ID of the resource specified for deletion. */ - id: string; - /** A value indicating whether deletion was successful. */ - deleted: boolean; - /** The object type, which is always 'assistant.deleted'. */ - object: "assistant.deleted"; -} - -/** This describes to which tools a file has been attached. */ -export interface MessageAttachmentOutput { - /** The ID of the file to attach to the message. */ - fileId?: string; - /** Azure asset ID. */ - dataSources?: Array; - /** The tools to add to this file. */ - tools: MessageAttachmentToolDefinitionOutput[]; -} - -/** Information about a single thread associated with an agent. */ -export interface AgentThreadOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always 'thread'. */ - object: "thread"; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: Date; - /** - * A set of resources that are made available to the agent's tools in this thread. The resources are specific to the type - * of tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list - * of vector store IDs. - */ - toolResources: ToolResourcesOutput | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** The status of a thread deletion operation. */ -export interface ThreadDeletionStatusOutput { - /** The ID of the resource specified for deletion. */ - id: string; - /** A value indicating whether deletion was successful. */ - deleted: boolean; - /** The object type, which is always 'thread.deleted'. */ - object: "thread.deleted"; -} - -/** A single, existing message within an agent thread. */ -export interface ThreadMessageOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always 'thread.message'. */ - object: "thread.message"; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: Date; - /** The ID of the thread that this message belongs to. */ - threadId: string; - /** - * The status of the message. - * - * Possible values: "in_progress", "incomplete", "completed" - */ - status: MessageStatusOutput; - /** On an incomplete message, details about why the message is incomplete. */ - incompleteDetails: MessageIncompleteDetailsOutput | null; - /** The Unix timestamp (in seconds) for when the message was completed. */ - completedAt: Date | null; - /** The Unix timestamp (in seconds) for when the message was marked as incomplete. */ - incompleteAt: Date | null; - /** - * The role associated with the agent thread message. - * - * Possible values: "user", "assistant" - */ - role: MessageRoleOutput; - /** The list of content items associated with the agent thread message. */ - content: Array; - /** If applicable, the ID of the agent that authored this message. */ - assistantId: string | null; - /** If applicable, the ID of the run associated with the authoring of this message. */ - runId: string | null; - /** A list of files attached to the message, and the tools they were added to. */ - attachments: Array | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** Information providing additional detail about a message entering an incomplete status. */ -export interface MessageIncompleteDetailsOutput { - /** - * The provided reason describing why the message was marked as incomplete. - * - * Possible values: "content_filter", "max_tokens", "run_cancelled", "run_failed", "run_expired" - */ - reason: MessageIncompleteDetailsReasonOutput; -} - -/** An abstract representation of a single item of thread message content. */ -export interface MessageContentOutputParent { - type: string; -} - -/** A representation of a textual item of thread message content. */ -export interface MessageTextContentOutput extends MessageContentOutputParent { - /** The object type, which is always 'text'. */ - type: "text"; - /** The text and associated annotations for this thread message content item. */ - text: MessageTextDetailsOutput; -} - -/** The text and associated annotations for a single item of agent thread message content. */ -export interface MessageTextDetailsOutput { - /** The text data. */ - value: string; - /** A list of annotations associated with this text. */ - annotations: Array; -} - -/** An abstract representation of an annotation to text thread message content. */ -export interface MessageTextAnnotationOutputParent { - /** The textual content associated with this text annotation item. */ - text: string; - type: string; -} - -/** A citation within the message that points to a specific quote from a specific File associated with the agent or the message. Generated when the agent uses the 'file_search' tool to search files. */ -export interface MessageTextFileCitationAnnotationOutput extends MessageTextAnnotationOutputParent { - /** The object type, which is always 'file_citation'. */ - type: "file_citation"; - /** - * A citation within the message that points to a specific quote from a specific file. - * Generated when the agent uses the "file_search" tool to search files. - */ - fileCitation: MessageTextFileCitationDetailsOutput; - /** The first text index associated with this text annotation. */ - startIndex?: number; - /** The last text index associated with this text annotation. */ - endIndex?: number; -} - -/** A representation of a file-based text citation, as used in a file-based annotation of text thread message content. */ -export interface MessageTextFileCitationDetailsOutput { - /** The ID of the file associated with this citation. */ - fileId: string; - /** The specific quote cited in the associated file. */ - quote: string; -} - -/** A citation within the message that points to a file located at a specific path. */ -export interface MessageTextFilePathAnnotationOutput extends MessageTextAnnotationOutputParent { - /** The object type, which is always 'file_path'. */ - type: "file_path"; - /** A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. */ - filePath: MessageTextFilePathDetailsOutput; - /** The first text index associated with this text annotation. */ - startIndex?: number; - /** The last text index associated with this text annotation. */ - endIndex?: number; -} - -/** An encapsulation of an image file ID, as used by message image content. */ -export interface MessageTextFilePathDetailsOutput { - /** The ID of the specific file that the citation is from. */ - fileId: string; -} - -/** A representation of image file content in a thread message. */ -export interface MessageImageFileContentOutput extends MessageContentOutputParent { - /** The object type, which is always 'image_file'. */ - type: "image_file"; - /** The image file for this thread message content item. */ - imageFile: MessageImageFileDetailsOutput; -} - -/** An image reference, as represented in thread message content. */ -export interface MessageImageFileDetailsOutput { - /** The ID for the file associated with this image. */ - fileId: string; -} - -/** The response data for a requested list of items. */ -export interface OpenAIPageableListOfThreadMessageOutput { - /** The object type, which is always list. */ - object: "list"; - /** The requested list of items. */ - data: Array; - /** The first ID represented in this list. */ - firstId: string; - /** The last ID represented in this list. */ - lastId: string; - /** A value indicating whether there are additional values available not captured in this list. */ - hasMore: boolean; -} - -/** - * Controls for how a thread will be truncated prior to the run. Use this to control the initial - * context window of the run. - */ -export interface TruncationObjectOutput { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will - * be truncated to the `lastMessages` count most recent messages in the thread. When set to `auto`, messages in the middle of the thread - * will be dropped to fit the context length of the model, `max_prompt_tokens`. - * - * Possible values: "auto", "last_messages" - */ - type: TruncationStrategyOutput; - /** The number of most recent messages from the thread when constructing the context for the run. */ - lastMessages?: number | null; -} - -/** Specifies a tool the model should use. Use to force the model to call a specific tool. */ -export interface AgentsNamedToolChoiceOutput { - /** - * the type of tool. If type is `function`, the function name must be set. - * - * Possible values: "function", "code_interpreter", "file_search", "bing_grounding", "microsoft_fabric", "sharepoint_grounding", "azure_ai_search" - */ - type: AgentsNamedToolChoiceTypeOutput; - /** The name of the function to call */ - function?: FunctionNameOutput; -} - -/** The function name that will be used, if using the `function` tool */ -export interface FunctionNameOutput { - /** The name of the function to call */ - name: string; -} - -/** Data representing a single evaluation run of an agent thread. */ -export interface ThreadRunOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always 'thread.run'. */ - object: "thread.run"; - /** The ID of the thread associated with this run. */ - threadId: string; - /** The ID of the agent associated with the thread this run was performed against. */ - assistantId: string; - /** - * The status of the agent thread run. - * - * Possible values: "queued", "in_progress", "requires_action", "cancelling", "cancelled", "failed", "completed", "expired" - */ - status: RunStatusOutput; - /** The details of the action required for the agent thread run to continue. */ - requiredAction?: RequiredActionOutput | null; - /** The last error, if any, encountered by this agent thread run. */ - lastError: RunErrorOutput | null; - /** The ID of the model to use. */ - model: string; - /** The overridden system instructions used for this agent thread run. */ - instructions: string; - /** The overridden enabled tools used for this agent thread run. */ - tools: Array; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: Date; - /** The Unix timestamp, in seconds, representing when this item expires. */ - expiresAt: Date | null; - /** The Unix timestamp, in seconds, representing when this item was started. */ - startedAt: Date | null; - /** The Unix timestamp, in seconds, representing when this completed. */ - completedAt: Date | null; - /** The Unix timestamp, in seconds, representing when this was cancelled. */ - cancelledAt: Date | null; - /** The Unix timestamp, in seconds, representing when this failed. */ - failedAt: Date | null; - /** Details on why the run is incomplete. Will be `null` if the run is not incomplete. */ - incompleteDetails: IncompleteRunDetailsOutput | null; - /** Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). */ - usage: RunCompletionUsageOutput | null; - /** The sampling temperature used for this run. If not set, defaults to 1. */ - temperature?: number | null; - /** The nucleus sampling value used for this run. If not set, defaults to 1. */ - topP?: number | null; - /** The maximum number of prompt tokens specified to have been used over the course of the run. */ - maxPromptTokens: number | null; - /** The maximum number of completion tokens specified to have been used over the course of the run. */ - maxCompletionTokens: number | null; - /** The strategy to use for dropping messages as the context windows moves forward. */ - truncationStrategy: TruncationObjectOutput | null; - /** Controls whether or not and which tool is called by the model. */ - toolChoice: AgentsApiToolChoiceOptionOutput | null; - /** The response format of the tool calls used in this run. */ - responseFormat: AgentsApiResponseFormatOptionOutput | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; - /** Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis */ - toolResources?: UpdateToolResourcesOptionsOutput | null; - /** Determines if tools can be executed in parallel within the run. */ - parallelToolCalls?: boolean; -} - -/** An abstract representation of a required action for an agent thread run to continue. */ -export interface RequiredActionOutputParent { - type: string; -} - -/** The details for required tool calls that must be submitted for an agent thread run to continue. */ -export interface SubmitToolOutputsActionOutput extends RequiredActionOutputParent { - /** The object type, which is always 'submit_tool_outputs'. */ - type: "submit_tool_outputs"; - /** The details describing tools that should be called to submit tool outputs. */ - submitToolOutputs: SubmitToolOutputsDetailsOutput; -} - -/** The details describing tools that should be called to submit tool outputs. */ -export interface SubmitToolOutputsDetailsOutput { - /** The list of tool calls that must be resolved for the agent thread run to continue. */ - toolCalls: Array; -} - -/** An abstract representation a a tool invocation needed by the model to continue a run. */ -export interface RequiredToolCallOutputParent { - /** The ID of the tool call. This ID must be referenced when submitting tool outputs. */ - id: string; - type: string; -} - -/** A representation of a requested call to a function tool, needed by the model to continue evaluation of a run. */ -export interface RequiredFunctionToolCallOutput extends RequiredToolCallOutputParent { - /** The object type of the required tool call. Always 'function' for function tools. */ - type: "function"; - /** Detailed information about the function to be executed by the tool that includes name and arguments. */ - function: RequiredFunctionToolCallDetailsOutput; -} - -/** The detailed information for a function invocation, as provided by a required action invoking a function tool, that includes the name of and arguments to the function. */ -export interface RequiredFunctionToolCallDetailsOutput { - /** The name of the function. */ - name: string; - /** The arguments to use when invoking the named function, as provided by the model. Arguments are presented as a JSON document that should be validated and parsed for evaluation. */ - arguments: string; -} - -/** The details of an error as encountered by an agent thread run. */ -export interface RunErrorOutput { - /** The status for the error. */ - code: string; - /** The human-readable text associated with the error. */ - message: string; -} - -/** Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). */ -export interface RunCompletionUsageOutput { - /** Number of completion tokens used over the course of the run. */ - completionTokens: number; - /** Number of prompt tokens used over the course of the run. */ - promptTokens: number; - /** Total number of tokens used (prompt + completion). */ - totalTokens: number; -} - -/** - * Request object. A set of resources that are used by the agent's tools. The resources are specific to the type of tool. - * For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` tool requires a list of - * vector store IDs. - */ -export interface UpdateToolResourcesOptionsOutput { - /** - * Overrides the list of file IDs made available to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - */ - codeInterpreter?: UpdateCodeInterpreterToolResourceOptionsOutput; - /** Overrides the vector store attached to this agent. There can be a maximum of 1 vector store attached to the agent. */ - fileSearch?: UpdateFileSearchToolResourceOptionsOutput; - /** Overrides the resources to be used by the `azure_ai_search` tool consisting of index IDs and names. */ - azureAISearch?: AzureAISearchResourceOutput; -} - -/** Request object to update `code_interpreted` tool resources. */ -export interface UpdateCodeInterpreterToolResourceOptionsOutput { - /** A list of file IDs to override the current list of the agent. */ - fileIds?: string[]; -} - -/** Request object to update `file_search` tool resources. */ -export interface UpdateFileSearchToolResourceOptionsOutput { - /** A list of vector store IDs to override the current list of the agent. */ - vectorStoreIds?: string[]; -} - -/** The response data for a requested list of items. */ -export interface OpenAIPageableListOfThreadRunOutput { - /** The object type, which is always list. */ - object: "list"; - /** The requested list of items. */ - data: Array; - /** The first ID represented in this list. */ - firstId: string; - /** The last ID represented in this list. */ - lastId: string; - /** A value indicating whether there are additional values available not captured in this list. */ - hasMore: boolean; -} - -/** Detailed information about a single step of an agent thread run. */ -export interface RunStepOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always 'thread.run.step'. */ - object: "thread.run.step"; - /** - * The type of run step, which can be either message_creation or tool_calls. - * - * Possible values: "message_creation", "tool_calls" - */ - type: RunStepTypeOutput; - /** The ID of the agent associated with the run step. */ - assistantId: string; - /** The ID of the thread that was run. */ - threadId: string; - /** The ID of the run that this run step is a part of. */ - runId: string; - /** - * The status of this run step. - * - * Possible values: "in_progress", "cancelled", "failed", "completed", "expired" - */ - status: RunStepStatusOutput; - /** The details for this run step. */ - stepDetails: RunStepDetailsOutput; - /** If applicable, information about the last error encountered by this run step. */ - lastError: RunStepErrorOutput | null; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: Date; - /** The Unix timestamp, in seconds, representing when this item expired. */ - expiredAt: Date | null; - /** The Unix timestamp, in seconds, representing when this completed. */ - completedAt: Date | null; - /** The Unix timestamp, in seconds, representing when this was cancelled. */ - cancelledAt: Date | null; - /** The Unix timestamp, in seconds, representing when this failed. */ - failedAt: Date | null; - /** Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. */ - usage?: RunStepCompletionUsageOutput | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** An abstract representation of the details for a run step. */ -export interface RunStepDetailsOutputParent { - type: RunStepTypeOutput; -} - -/** The detailed information associated with a message creation run step. */ -export interface RunStepMessageCreationDetailsOutput extends RunStepDetailsOutputParent { - /** The object type, which is always 'message_creation'. */ - type: "message_creation"; - /** Information about the message creation associated with this run step. */ - messageCreation: RunStepMessageCreationReferenceOutput; -} - -/** The details of a message created as a part of a run step. */ -export interface RunStepMessageCreationReferenceOutput { - /** The ID of the message created by this run step. */ - messageId: string; -} - -/** The detailed information associated with a run step calling tools. */ -export interface RunStepToolCallDetailsOutput extends RunStepDetailsOutputParent { - /** The object type, which is always 'tool_calls'. */ - type: "tool_calls"; - /** A list of tool call details for this run step. */ - toolCalls: Array; -} - -/** An abstract representation of a detailed tool call as recorded within a run step for an existing run. */ -export interface RunStepToolCallOutputParent { - /** The ID of the tool call. This ID must be referenced when you submit tool outputs. */ - id: string; - type: string; -} - -/** - * A record of a call to a code interpreter tool, issued by the model in evaluation of a defined tool, that - * represents inputs and outputs consumed and emitted by the code interpreter. - */ -export interface RunStepCodeInterpreterToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'code_interpreter'. */ - type: "code_interpreter"; - /** The details of the tool call to the code interpreter tool. */ - codeInterpreter: RunStepCodeInterpreterToolCallDetailsOutput; -} - -/** The detailed information about a code interpreter invocation by the model. */ -export interface RunStepCodeInterpreterToolCallDetailsOutput { - /** The input provided by the model to the code interpreter tool. */ - input: string; - /** The outputs produced by the code interpreter tool back to the model in response to the tool call. */ - outputs: Array; -} - -/** An abstract representation of an emitted output from a code interpreter tool. */ -export interface RunStepCodeInterpreterToolCallOutputOutputParent { - type: string; -} - -/** A representation of a log output emitted by a code interpreter tool in response to a tool call by the model. */ -export interface RunStepCodeInterpreterLogOutputOutput - extends RunStepCodeInterpreterToolCallOutputOutputParent { - /** The object type, which is always 'logs'. */ - type: "logs"; - /** The serialized log output emitted by the code interpreter. */ - logs: string; -} - -/** A representation of an image output emitted by a code interpreter tool in response to a tool call by the model. */ -export interface RunStepCodeInterpreterImageOutputOutput - extends RunStepCodeInterpreterToolCallOutputOutputParent { - /** The object type, which is always 'image'. */ - type: "image"; - /** Referential information for the image associated with this output. */ - image: RunStepCodeInterpreterImageReferenceOutput; -} - -/** An image reference emitted by a code interpreter tool in response to a tool call by the model. */ -export interface RunStepCodeInterpreterImageReferenceOutput { - /** The ID of the file associated with this image. */ - fileId: string; -} - -/** - * A record of a call to a file search tool, issued by the model in evaluation of a defined tool, that represents - * executed file search. - */ -export interface RunStepFileSearchToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'file_search'. */ - type: "file_search"; - /** Reserved for future use. */ - fileSearch: Record; -} - -/** - * A record of a call to a bing grounding tool, issued by the model in evaluation of a defined tool, that represents - * executed search with bing grounding. - */ -export interface RunStepBingGroundingToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'bing_grounding'. */ - type: "bing_grounding"; - /** Reserved for future use. */ - bingGrounding: Record; -} - -/** - * A record of a call to an Azure AI Search tool, issued by the model in evaluation of a defined tool, that represents - * executed Azure AI search. - */ -export interface RunStepAzureAISearchToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'azure_ai_search'. */ - type: "azure_ai_search"; - /** Reserved for future use. */ - azureAISearch: Record; -} - -/** - * A record of a call to a SharePoint tool, issued by the model in evaluation of a defined tool, that represents - * executed SharePoint actions. - */ -export interface RunStepSharepointToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'sharepoint_grounding'. */ - type: "sharepoint_grounding"; - /** Reserved for future use. */ - sharepointGrounding: Record; -} - -/** - * A record of a call to a Microsoft Fabric tool, issued by the model in evaluation of a defined tool, that represents - * executed Microsoft Fabric operations. - */ -export interface RunStepMicrosoftFabricToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; - /** Reserved for future use. */ - microsoftFabric: Record; -} - -/** - * A record of a call to a function tool, issued by the model in evaluation of a defined tool, that represents the inputs - * and output consumed and emitted by the specified function. - */ -export interface RunStepFunctionToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'function'. */ - type: "function"; - /** The detailed information about the function called by the model. */ - function: RunStepFunctionToolCallDetailsOutput; -} - -/** The detailed information about the function called by the model. */ -export interface RunStepFunctionToolCallDetailsOutput { - /** The name of the function. */ - name: string; - /** The arguments that the model requires are provided to the named function. */ - arguments: string; - /** The output of the function, only populated for function calls that have already have had their outputs submitted. */ - output: string | null; -} - -/** The error information associated with a failed run step. */ -export interface RunStepErrorOutput { - /** - * The error code for this error. - * - * Possible values: "server_error", "rate_limit_exceeded" - */ - code: RunStepErrorCodeOutput; - /** The human-readable text associated with this error. */ - message: string; -} - -/** Usage statistics related to the run step. */ -export interface RunStepCompletionUsageOutput { - /** Number of completion tokens used over the course of the run step. */ - completionTokens: number; - /** Number of prompt tokens used over the course of the run step. */ - promptTokens: number; - /** Total number of tokens used (prompt + completion). */ - totalTokens: number; -} - -/** The response data for a requested list of items. */ -export interface OpenAIPageableListOfRunStepOutput { - /** The object type, which is always list. */ - object: "list"; - /** The requested list of items. */ - data: Array; - /** The first ID represented in this list. */ - firstId: string; - /** The last ID represented in this list. */ - lastId: string; - /** A value indicating whether there are additional values available not captured in this list. */ - hasMore: boolean; -} - -/** The response data from a file list operation. */ -export interface FileListResponseOutput { - /** The object type, which is always 'list'. */ - object: "list"; - /** The files returned for the request. */ - data: Array; -} - -/** Represents an agent that can call the model and use tools. */ -export interface OpenAIFileOutput { - /** The object type, which is always 'file'. */ - object: "file"; - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The size of the file, in bytes. */ - bytes: number; - /** The name of the file. */ - filename: string; - /** The Unix timestamp, in seconds, representing when this object was created. */ - createdAt: Date; - /** - * The intended purpose of a file. - * - * Possible values: "fine-tune", "fine-tune-results", "assistants", "assistants_output", "batch", "batch_output", "vision" - */ - purpose: FilePurposeOutput; - /** - * The state of the file. This field is available in Azure OpenAI only. - * - * Possible values: "uploaded", "pending", "running", "processed", "error", "deleting", "deleted" - */ - status?: FileStateOutput; - /** The error message with details in case processing of this file failed. This field is available in Azure OpenAI only. */ - statusDetails?: string; -} - -/** A status response from a file deletion operation. */ -export interface FileDeletionStatusOutput { - /** The ID of the resource specified for deletion. */ - id: string; - /** A value indicating whether deletion was successful. */ - deleted: boolean; - /** The object type, which is always 'file'. */ - object: "file"; -} - -/** The response data for a requested list of items. */ -export interface OpenAIPageableListOfVectorStoreOutput { - /** The object type, which is always list. */ - object: "list"; - /** The requested list of items. */ - data: Array; - /** The first ID represented in this list. */ - firstId: string; - /** The last ID represented in this list. */ - lastId: string; - /** A value indicating whether there are additional values available not captured in this list. */ - hasMore: boolean; -} - -/** A vector store is a collection of processed files can be used by the `file_search` tool. */ -export interface VectorStoreOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always `vector_store` */ - object: "vector_store"; - /** The Unix timestamp (in seconds) for when the vector store was created. */ - createdAt: Date; - /** The name of the vector store. */ - name: string; - /** The total number of bytes used by the files in the vector store. */ - usageBytes: number; - /** Files count grouped by status processed or being processed by this vector store. */ - fileCounts: VectorStoreFileCountOutput; - /** - * The status of the vector store, which can be either `expired`, `in_progress`, or `completed`. A status of `completed` indicates that the vector store is ready for use. - * - * Possible values: "expired", "in_progress", "completed" - */ - status: VectorStoreStatusOutput; - /** Details on when this vector store expires */ - expiresAfter?: VectorStoreExpirationPolicyOutput; - /** The Unix timestamp (in seconds) for when the vector store will expire. */ - expiresAt?: Date | null; - /** The Unix timestamp (in seconds) for when the vector store was last active. */ - lastActiveAt: Date | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** Counts of files processed or being processed by this vector store grouped by status. */ -export interface VectorStoreFileCountOutput { - /** The number of files that are currently being processed. */ - inProgress: number; - /** The number of files that have been successfully processed. */ - completed: number; - /** The number of files that have failed to process. */ - failed: number; - /** The number of files that were cancelled. */ - cancelled: number; - /** The total number of files. */ - total: number; -} - -/** The expiration policy for a vector store. */ -export interface VectorStoreExpirationPolicyOutput { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: `last_active_at`. - * - * Possible values: "last_active_at" - */ - anchor: VectorStoreExpirationPolicyAnchorOutput; - /** The anchor timestamp after which the expiration policy applies. */ - days: number; -} - -/** Options to configure a vector store static chunking strategy. */ -export interface VectorStoreStaticChunkingStrategyOptionsOutput { - /** The maximum number of tokens in each chunk. The default value is 800. The minimum value is 100 and the maximum value is 4096. */ - maxChunkSizeTokens: number; - /** - * The number of tokens that overlap between chunks. The default value is 400. - * Note that the overlap must not exceed half of max_chunk_size_tokens. - */ - chunkOverlapTokens: number; -} - -/** Response object for deleting a vector store. */ -export interface VectorStoreDeletionStatusOutput { - /** The ID of the resource specified for deletion. */ - id: string; - /** A value indicating whether deletion was successful. */ - deleted: boolean; - /** The object type, which is always 'vector_store.deleted'. */ - object: "vector_store.deleted"; -} - -/** The response data for a requested list of items. */ -export interface OpenAIPageableListOfVectorStoreFileOutput { - /** The object type, which is always list. */ - object: "list"; - /** The requested list of items. */ - data: Array; - /** The first ID represented in this list. */ - firstId: string; - /** The last ID represented in this list. */ - lastId: string; - /** A value indicating whether there are additional values available not captured in this list. */ - hasMore: boolean; -} - -/** Description of a file attached to a vector store. */ -export interface VectorStoreFileOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always `vector_store.file`. */ - object: "vector_store.file"; - /** - * The total vector store usage in bytes. Note that this may be different from the original file - * size. - */ - usageBytes: number; - /** The Unix timestamp (in seconds) for when the vector store file was created. */ - createdAt: Date; - /** The ID of the vector store that the file is attached to. */ - vectorStoreId: string; - /** - * The status of the vector store file, which can be either `in_progress`, `completed`, `cancelled`, or `failed`. The status `completed` indicates that the vector store file is ready for use. - * - * Possible values: "in_progress", "completed", "failed", "cancelled" - */ - status: VectorStoreFileStatusOutput; - /** The last error associated with this vector store file. Will be `null` if there are no errors. */ - lastError: VectorStoreFileErrorOutput | null; - /** The strategy used to chunk the file. */ - chunkingStrategy: VectorStoreChunkingStrategyResponseOutput; -} - -/** Details on the error that may have ocurred while processing a file for this vector store */ -export interface VectorStoreFileErrorOutput { - /** - * One of `server_error` or `rate_limit_exceeded`. - * - * Possible values: "internal_error", "file_not_found", "parsing_error", "unhandled_mime_type" - */ - code: VectorStoreFileErrorCodeOutput; - /** A human-readable description of the error. */ - message: string; -} - -/** An abstract representation of a vector store chunking strategy configuration. */ -export interface VectorStoreChunkingStrategyResponseOutputParent { - type: VectorStoreChunkingStrategyResponseTypeOutput; -} - -/** This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the chunking_strategy concept was introduced in the API. */ -export interface VectorStoreAutoChunkingStrategyResponseOutput - extends VectorStoreChunkingStrategyResponseOutputParent { - /** The object type, which is always 'other'. */ - type: "other"; -} - -/** A statically configured chunking strategy. */ -export interface VectorStoreStaticChunkingStrategyResponseOutput - extends VectorStoreChunkingStrategyResponseOutputParent { - /** The object type, which is always 'static'. */ - type: "static"; - /** The options for the static chunking strategy. */ - static: VectorStoreStaticChunkingStrategyOptionsOutput; -} - -/** Response object for deleting a vector store file relationship. */ -export interface VectorStoreFileDeletionStatusOutput { - /** The ID of the resource specified for deletion. */ - id: string; - /** A value indicating whether deletion was successful. */ - deleted: boolean; - /** The object type, which is always 'vector_store.deleted'. */ - object: "vector_store.file.deleted"; -} - -/** A batch of files attached to a vector store. */ -export interface VectorStoreFileBatchOutput { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always `vector_store.file_batch`. */ - object: "vector_store.files_batch"; - /** The Unix timestamp (in seconds) for when the vector store files batch was created. */ - createdAt: Date; - /** The ID of the vector store that the file is attached to. */ - vectorStoreId: string; - /** - * The status of the vector store files batch, which can be either `in_progress`, `completed`, `cancelled` or `failed`. - * - * Possible values: "in_progress", "completed", "cancelled", "failed" - */ - status: VectorStoreFileBatchStatusOutput; - /** Files count grouped by status processed or being processed by this vector store. */ - fileCounts: VectorStoreFileCountOutput; -} - -/** Response from the Workspace - Get operation */ -export interface GetWorkspaceResponseOutput { - /** A unique identifier for the resource */ - id: string; - /** The name of the resource */ - name: string; - /** The properties of the resource */ - properties: WorkspacePropertiesOutput; -} - -/** workspace properties */ -export interface WorkspacePropertiesOutput { - /** Authentication type of the connection target */ - applicationInsights: string; -} - -/** Response from the list operation */ -export interface ListConnectionsResponseOutput { - /** A list of connection list secrets */ - value: Array; -} - -/** Response from the listSecrets operation */ -export interface GetConnectionResponseOutput { - /** A unique identifier for the connection */ - id: string; - /** The name of the resource */ - name: string; - /** The properties of the resource */ - properties: InternalConnectionPropertiesOutput; -} - -/** Connection properties */ -export interface InternalConnectionPropertiesOutputParent { - /** Category of the connection */ - category: ConnectionTypeOutput; - /** The connection URL to be used for this service */ - target: string; - authType: AuthenticationTypeOutput; -} - -/** Connection properties for connections with API key authentication */ -export interface InternalConnectionPropertiesApiKeyAuthOutput - extends InternalConnectionPropertiesOutputParent { - /** Authentication type of the connection target */ - authType: "ApiKey"; - /** Credentials will only be present for authType=ApiKey */ - credentials: CredentialsApiKeyAuthOutput; -} - -/** The credentials needed for API key authentication */ -export interface CredentialsApiKeyAuthOutput { - /** The API key */ - key: string; -} - -/** Connection properties for connections with AAD authentication (aka `Entra ID passthrough`) */ -export interface InternalConnectionPropertiesAADAuthOutput - extends InternalConnectionPropertiesOutputParent { - /** Authentication type of the connection target */ - authType: "AAD"; -} - -/** Connection properties for connections with SAS authentication */ -export interface InternalConnectionPropertiesSASAuthOutput - extends InternalConnectionPropertiesOutputParent { - /** Authentication type of the connection target */ - authType: "SAS"; - /** Credentials will only be present for authType=ApiKey */ - credentials: CredentialsSASAuthOutput; -} - -/** The credentials needed for Shared Access Signatures (SAS) authentication */ -export interface CredentialsSASAuthOutput { - /** The Shared Access Signatures (SAS) token */ - SAS: string; -} - -/** Response from getting properties of the Application Insights resource */ -export interface GetAppInsightsResponseOutput { - /** A unique identifier for the resource */ - id: string; - /** The name of the resource */ - name: string; - /** The properties of the resource */ - properties: AppInsightsPropertiesOutput; -} - -/** The properties of the Application Insights resource */ -export interface AppInsightsPropertiesOutput { - /** Authentication type of the connection target */ - ConnectionString: string; -} - -/** Evaluation Definition */ -export interface EvaluationOutput { - /** Identifier of the evaluation. */ - readonly id: string; - /** Data for evaluation. */ - data: InputDataOutput; - /** Display Name for evaluation. It helps to find evaluation easily in AI Foundry. It does not need to be unique. */ - displayName?: string; - /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ - description?: string; - /** Metadata containing createdBy and modifiedBy information. */ - readonly systemData?: SystemDataOutput; - /** Status of the evaluation. It is set by service and is read-only. */ - readonly status?: string; - /** Evaluation's tags. Unlike properties, tags are fully mutable. */ - tags?: Record; - /** Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. */ - properties?: Record; - /** Evaluators to be used for the evaluation. */ - evaluators: Record; -} - -/** Abstract data class for input data configuration. */ -export interface InputDataOutputParent { - type: string; -} - -/** Data Source for Application Insights. */ -export interface ApplicationInsightsConfigurationOutput extends InputDataOutputParent { - readonly type: "app_insights"; - /** LogAnalytic Workspace resourceID associated with ApplicationInsights */ - resourceId: string; - /** Query to fetch the data. */ - query: string; - /** Service name. */ - serviceName: string; - /** Connection String to connect to ApplicationInsights. */ - connectionString?: string; -} - -/** Dataset as source for evaluation. */ -export interface DatasetOutput extends InputDataOutputParent { - readonly type: "dataset"; - /** Evaluation input data */ - id: string; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemDataOutput { - /** The timestamp the resource was created at. */ - readonly createdAt?: string; - /** The identity that created the resource. */ - readonly createdBy?: string; - /** The identity type that created the resource. */ - readonly createdByType?: string; - /** The timestamp of resource last modification (UTC) */ - readonly lastModifiedAt?: string; -} - -/** Evaluator Configuration */ -export interface EvaluatorConfigurationOutput { - /** Identifier of the evaluator. */ - id: string; - /** Initialization parameters of the evaluator. */ - initParams?: Record; - /** Data parameters of the evaluator. */ - dataMapping?: Record; -} - -/** Evaluation Schedule Definition */ -export interface EvaluationScheduleOutput { - /** Name of the schedule, which also serves as the unique identifier for the evaluation */ - readonly name: string; - /** Data for evaluation. */ - data: ApplicationInsightsConfigurationOutput; - /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ - description?: string; - /** Metadata containing createdBy and modifiedBy information. */ - readonly systemData?: SystemDataOutput; - /** Provisioning State of the evaluation. It is set by service and is read-only. */ - readonly provisioningState?: string; - /** Evaluation's tags. Unlike properties, tags are fully mutable. */ - tags?: Record; - /** Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. */ - properties?: Record; - /** Enabled status of the evaluation. It is set by service and is read-only. */ - readonly isEnabled?: string; - /** Evaluators to be used for the evaluation. */ - evaluators: Record; - /** Trigger for the evaluation. */ - trigger: TriggerOutput; -} - -/** Abstract data class for input data configuration. */ -export interface TriggerOutputParent { - type: string; -} - -/** Recurrence Trigger Definition */ -export interface RecurrenceTriggerOutput extends TriggerOutputParent { - readonly type: "Recurrence"; - /** - * The frequency to trigger schedule. - * - * Possible values: "Month", "Week", "Day", "Hour", "Minute" - */ - frequency: FrequencyOutput; - /** Specifies schedule interval in conjunction with frequency */ - interval: number; - /** The recurrence schedule. */ - schedule?: RecurrenceScheduleOutput; -} - -/** RecurrenceSchedule Definition */ -export interface RecurrenceScheduleOutput { - /** List of hours for the schedule. */ - hours: number[]; - /** List of minutes for the schedule. */ - minutes: number[]; - /** List of days for the schedule. */ - weekDays?: WeekDaysOutput[]; - /** List of month days for the schedule */ - monthDays?: number[]; -} - -/** Cron Trigger Definition */ -export interface CronTriggerOutput extends TriggerOutputParent { - readonly type: "Cron"; - /** Cron expression for the trigger. */ - expression: string; -} - -/** An abstract representation of an input tool definition that an agent can use. */ -export type ToolDefinitionOutput = - | ToolDefinitionOutputParent - | CodeInterpreterToolDefinitionOutput - | FileSearchToolDefinitionOutput - | FunctionToolDefinitionOutput - | BingGroundingToolDefinitionOutput - | MicrosoftFabricToolDefinitionOutput - | SharepointToolDefinitionOutput - | AzureAISearchToolDefinitionOutput; -/** An abstract representation of a single item of thread message content. */ -export type MessageContentOutput = - | MessageContentOutputParent - | MessageTextContentOutput - | MessageImageFileContentOutput; -/** An abstract representation of an annotation to text thread message content. */ -export type MessageTextAnnotationOutput = - | MessageTextAnnotationOutputParent - | MessageTextFileCitationAnnotationOutput - | MessageTextFilePathAnnotationOutput; -/** An abstract representation of a required action for an agent thread run to continue. */ -export type RequiredActionOutput = RequiredActionOutputParent | SubmitToolOutputsActionOutput; -/** An abstract representation a a tool invocation needed by the model to continue a run. */ -export type RequiredToolCallOutput = RequiredToolCallOutputParent | RequiredFunctionToolCallOutput; -/** An abstract representation of the details for a run step. */ -export type RunStepDetailsOutput = - | RunStepDetailsOutputParent - | RunStepMessageCreationDetailsOutput - | RunStepToolCallDetailsOutput; -/** An abstract representation of a detailed tool call as recorded within a run step for an existing run. */ -export type RunStepToolCallOutput = - | RunStepToolCallOutputParent - | RunStepCodeInterpreterToolCallOutput - | RunStepFileSearchToolCallOutput - | RunStepBingGroundingToolCallOutput - | RunStepAzureAISearchToolCallOutput - | RunStepSharepointToolCallOutput - | RunStepMicrosoftFabricToolCallOutput - | RunStepFunctionToolCallOutput; -/** An abstract representation of an emitted output from a code interpreter tool. */ -export type RunStepCodeInterpreterToolCallOutputOutput = - | RunStepCodeInterpreterToolCallOutputOutputParent - | RunStepCodeInterpreterLogOutputOutput - | RunStepCodeInterpreterImageOutputOutput; -/** An abstract representation of a vector store chunking strategy configuration. */ -export type VectorStoreChunkingStrategyResponseOutput = - | VectorStoreChunkingStrategyResponseOutputParent - | VectorStoreAutoChunkingStrategyResponseOutput - | VectorStoreStaticChunkingStrategyResponseOutput; -/** Connection properties */ -export type InternalConnectionPropertiesOutput = - | InternalConnectionPropertiesOutputParent - | InternalConnectionPropertiesApiKeyAuthOutput - | InternalConnectionPropertiesAADAuthOutput - | InternalConnectionPropertiesSASAuthOutput; -/** Abstract data class for input data configuration. */ -export type InputDataOutput = - | InputDataOutputParent - | ApplicationInsightsConfigurationOutput - | DatasetOutput; -/** Abstract data class for input data configuration. */ -export type TriggerOutput = TriggerOutputParent | RecurrenceTriggerOutput | CronTriggerOutput; -/** Alias for VectorStoreDataSourceAssetTypeOutput */ -export type VectorStoreDataSourceAssetTypeOutput = "uri_asset" | "id_asset"; -/** Alias for AgentsApiResponseFormatModeOutput */ -export type AgentsApiResponseFormatModeOutput = string; -/** Alias for ApiResponseFormatOutput */ -export type ApiResponseFormatOutput = string; -/** Alias for AgentsApiResponseFormatOptionOutput */ -export type AgentsApiResponseFormatOptionOutput = - | string - | AgentsApiResponseFormatModeOutput - | AgentsApiResponseFormatOutput; -/** Alias for MessageRoleOutput */ -export type MessageRoleOutput = string; -/** Alias for MessageAttachmentToolDefinitionOutput */ -export type MessageAttachmentToolDefinitionOutput = - | CodeInterpreterToolDefinitionOutput - | FileSearchToolDefinitionOutput; -/** Alias for MessageStatusOutput */ -export type MessageStatusOutput = string; -/** Alias for MessageIncompleteDetailsReasonOutput */ -export type MessageIncompleteDetailsReasonOutput = string; -/** Alias for TruncationStrategyOutput */ -export type TruncationStrategyOutput = string; -/** Alias for AgentsApiToolChoiceOptionModeOutput */ -export type AgentsApiToolChoiceOptionModeOutput = string; -/** Alias for AgentsNamedToolChoiceTypeOutput */ -export type AgentsNamedToolChoiceTypeOutput = string; -/** Alias for AgentsApiToolChoiceOptionOutput */ -export type AgentsApiToolChoiceOptionOutput = - | string - | AgentsApiToolChoiceOptionModeOutput - | AgentsNamedToolChoiceOutput; -/** Alias for RunStatusOutput */ -export type RunStatusOutput = string; -/** Alias for IncompleteRunDetailsOutput */ -export type IncompleteRunDetailsOutput = string; -/** Alias for RunStepTypeOutput */ -export type RunStepTypeOutput = string; -/** Alias for RunStepStatusOutput */ -export type RunStepStatusOutput = string; -/** Alias for RunStepErrorCodeOutput */ -export type RunStepErrorCodeOutput = string; -/** Alias for FilePurposeOutput */ -export type FilePurposeOutput = string; -/** Alias for FileStateOutput */ -export type FileStateOutput = string; -/** Alias for VectorStoreStatusOutput */ -export type VectorStoreStatusOutput = string; -/** Alias for VectorStoreExpirationPolicyAnchorOutput */ -export type VectorStoreExpirationPolicyAnchorOutput = string; -/** Alias for VectorStoreFileStatusOutput */ -export type VectorStoreFileStatusOutput = string; -/** Alias for VectorStoreFileErrorCodeOutput */ -export type VectorStoreFileErrorCodeOutput = string; -/** Alias for VectorStoreChunkingStrategyResponseTypeOutput */ -export type VectorStoreChunkingStrategyResponseTypeOutput = string; -/** Alias for VectorStoreFileBatchStatusOutput */ -export type VectorStoreFileBatchStatusOutput = string; -/** The Type (or category) of the connection */ -export type ConnectionTypeOutput = - | "AzureOpenAI" - | "Serverless" - | "AzureBlob" - | "AIServices" - | "CognitiveSearch"; -/** Authentication type used by Azure AI service to connect to another service */ -export type AuthenticationTypeOutput = "ApiKey" | "AAD" | "SAS"; -/** Paged collection of Evaluation items */ -export type PagedEvaluationOutput = Paged; -/** Alias for FrequencyOutput */ -export type FrequencyOutput = string; -/** Alias for WeekDaysOutput */ -export type WeekDaysOutput = string; -/** Paged collection of EvaluationSchedule items */ -export type PagedEvaluationScheduleOutput = Paged; diff --git a/sdk/ai/ai-projects/src/customization/parameters.ts b/sdk/ai/ai-projects/src/customization/parameters.ts deleted file mode 100644 index 2450b4aa1b65..000000000000 --- a/sdk/ai/ai-projects/src/customization/parameters.ts +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; -import type { RequestParameters } from "@azure-rest/core-client"; -import type { - CreateAgentOptions, - ListSortOrder, - UpdateAgentOptions, - AgentThreadCreationOptions, - UpdateAgentThreadOptions, - ThreadMessageOptions, - CreateRunOptions, - ToolOutput, - CreateAndRunThreadOptions, - FilePurpose, - VectorStoreOptions, - VectorStoreUpdateOptions, - VectorStoreFileStatusFilter, - VectorStoreDataSource, - VectorStoreChunkingStrategyRequest, - ConnectionType, - Evaluation, - EvaluationSchedule, -} from "./models.js"; - -export interface CreateAgentBodyParam { - body: CreateAgentOptions; -} - -export type CreateAgentParameters = CreateAgentBodyParam & RequestParameters; - -export interface ListAgentsQueryParamProperties { - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListAgentsQueryParam { - queryParameters?: ListAgentsQueryParamProperties; -} - -export type ListAgentsParameters = ListAgentsQueryParam & RequestParameters; -export type GetAgentParameters = RequestParameters; - -export interface UpdateAgentBodyParam { - body: UpdateAgentOptions; -} - -export type UpdateAgentParameters = UpdateAgentBodyParam & RequestParameters; -export type DeleteAgentParameters = RequestParameters; - -export interface CreateThreadBodyParam { - body: AgentThreadCreationOptions; -} - -export type CreateThreadParameters = CreateThreadBodyParam & RequestParameters; -export type GetThreadParameters = RequestParameters; - -export interface UpdateThreadBodyParam { - body: UpdateAgentThreadOptions; -} - -export type UpdateThreadParameters = UpdateThreadBodyParam & RequestParameters; -export type DeleteThreadParameters = RequestParameters; - -export interface CreateMessageBodyParam { - body: ThreadMessageOptions; -} - -export type CreateMessageParameters = CreateMessageBodyParam & RequestParameters; - -export interface ListMessagesQueryParamProperties { - /** Filter messages by the run ID that generated them. */ - runId?: string; - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListMessagesQueryParam { - queryParameters?: ListMessagesQueryParamProperties; -} - -export type ListMessagesParameters = ListMessagesQueryParam & RequestParameters; -export type GetMessageParameters = RequestParameters; - -export interface UpdateMessageBodyParam { - body: { metadata?: Record | null }; -} - -export type UpdateMessageParameters = UpdateMessageBodyParam & RequestParameters; - -export interface CreateRunBodyParam { - body: CreateRunOptions; -} - -export type CreateRunParameters = CreateRunBodyParam & RequestParameters; - -export interface ListRunsQueryParamProperties { - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListRunsQueryParam { - queryParameters?: ListRunsQueryParamProperties; -} - -export type ListRunsParameters = ListRunsQueryParam & RequestParameters; -export type GetRunParameters = RequestParameters; - -export interface UpdateRunBodyParam { - body: { metadata?: Record | null }; -} - -export type UpdateRunParameters = UpdateRunBodyParam & RequestParameters; - -export interface SubmitToolOutputsToRunBodyParam { - body: { toolOutputs: Array; stream?: boolean | null }; -} - -export type SubmitToolOutputsToRunParameters = SubmitToolOutputsToRunBodyParam & RequestParameters; -export type CancelRunParameters = RequestParameters; - -export interface CreateThreadAndRunBodyParam { - body: CreateAndRunThreadOptions; -} - -export type CreateThreadAndRunParameters = CreateThreadAndRunBodyParam & RequestParameters; -export type GetRunStepParameters = RequestParameters; - -export interface ListRunStepsQueryParamProperties { - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListRunStepsQueryParam { - queryParameters?: ListRunStepsQueryParamProperties; -} - -export type ListRunStepsParameters = ListRunStepsQueryParam & RequestParameters; - -export interface ListFilesQueryParamProperties { - /** - * The purpose of the file. - * - * Possible values: "fine-tune", "fine-tune-results", "assistants", "assistants_output", "batch", "batch_output", "vision" - */ - purpose?: FilePurpose; -} - -export interface ListFilesQueryParam { - queryParameters?: ListFilesQueryParamProperties; -} - -export type ListFilesParameters = ListFilesQueryParam & RequestParameters; - -export interface UploadFileBodyParam { - body: - | FormData - | Array< - | { - name: "file"; - body: string | Uint8Array | ReadableStream | NodeJS.ReadableStream | File; - filename?: string; - contentType?: string; - } - | { - name: "purpose"; - body: FilePurpose; - filename?: string; - contentType?: string; - } - | { name: "filename"; body: string } - >; -} - -export interface UploadFileMediaTypesParam { - /** The name of the file to upload. */ - contentType: "multipart/form-data"; -} - -export type UploadFileParameters = UploadFileMediaTypesParam & - UploadFileBodyParam & - RequestParameters; -export type DeleteFileParameters = RequestParameters; -export type GetFileParameters = RequestParameters; -export type GetFileContentParameters = RequestParameters; - -export interface ListVectorStoresQueryParamProperties { - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListVectorStoresQueryParam { - queryParameters?: ListVectorStoresQueryParamProperties; -} - -export type ListVectorStoresParameters = ListVectorStoresQueryParam & RequestParameters; - -export interface CreateVectorStoreBodyParam { - body: VectorStoreOptions; -} - -export type CreateVectorStoreParameters = CreateVectorStoreBodyParam & RequestParameters; -export type GetVectorStoreParameters = RequestParameters; - -export interface ModifyVectorStoreBodyParam { - body: VectorStoreUpdateOptions; -} - -export type ModifyVectorStoreParameters = ModifyVectorStoreBodyParam & RequestParameters; -export type DeleteVectorStoreParameters = RequestParameters; - -export interface ListVectorStoreFilesQueryParamProperties { - /** - * Filter by file status. - * - * Possible values: "in_progress", "completed", "failed", "cancelled" - */ - filter?: VectorStoreFileStatusFilter; - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListVectorStoreFilesQueryParam { - queryParameters?: ListVectorStoreFilesQueryParamProperties; -} - -export type ListVectorStoreFilesParameters = ListVectorStoreFilesQueryParam & RequestParameters; - -export interface CreateVectorStoreFileBodyParam { - body: { - fileId?: string; - dataSources?: Array; - chunkingStrategy?: VectorStoreChunkingStrategyRequest; - }; -} - -export type CreateVectorStoreFileParameters = CreateVectorStoreFileBodyParam & RequestParameters; -export type GetVectorStoreFileParameters = RequestParameters; -export type DeleteVectorStoreFileParameters = RequestParameters; - -export interface CreateVectorStoreFileBatchBodyParam { - body: { - fileIds?: string[]; - dataSources?: Array; - chunkingStrategy?: VectorStoreChunkingStrategyRequest; - }; -} - -export type CreateVectorStoreFileBatchParameters = CreateVectorStoreFileBatchBodyParam & - RequestParameters; -export type GetVectorStoreFileBatchParameters = RequestParameters; -export type CancelVectorStoreFileBatchParameters = RequestParameters; - -export interface ListVectorStoreFileBatchFilesQueryParamProperties { - /** - * Filter by file status. - * - * Possible values: "in_progress", "completed", "failed", "cancelled" - */ - filter?: VectorStoreFileStatusFilter; - /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ - limit?: number; - /** - * Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order. - * - * Possible values: "asc", "desc" - */ - order?: ListSortOrder; - /** A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. */ - after?: string; - /** A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. */ - before?: string; -} - -export interface ListVectorStoreFileBatchFilesQueryParam { - queryParameters?: ListVectorStoreFileBatchFilesQueryParamProperties; -} - -export type ListVectorStoreFileBatchFilesParameters = ListVectorStoreFileBatchFilesQueryParam & - RequestParameters; -export type GetWorkspaceParameters = RequestParameters; - -export interface ListConnectionsQueryParamProperties { - /** Category of the workspace connection. */ - category?: ConnectionType; - /** Indicates whether to list datastores. Service default: do not list datastores. */ - includeAll?: boolean; - /** Target of the workspace connection. */ - target?: string; -} - -export interface ListConnectionsQueryParam { - queryParameters?: ListConnectionsQueryParamProperties; -} - -export type ListConnectionsParameters = ListConnectionsQueryParam & RequestParameters; -export type GetConnectionParameters = RequestParameters; - -export interface GetConnectionWithSecretsBodyParam { - body: { ignored: string }; -} - -export type GetConnectionWithSecretsParameters = GetConnectionWithSecretsBodyParam & - RequestParameters; -export type GetAppInsightsParameters = RequestParameters; - -export interface GetHeaders { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - "x-ms-client-request-id"?: string; -} - -export interface GetHeaderParam { - headers?: RawHttpHeadersInput & GetHeaders; -} - -export type GetParameters = GetHeaderParam & RequestParameters; - -export interface CreateBodyParam { - /** Evaluation to run. */ - body: Evaluation; -} - -export type CreateParameters = CreateBodyParam & RequestParameters; - -export interface ListHeaders { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - "x-ms-client-request-id"?: string; -} - -export interface ListQueryParamProperties { - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -export interface ListQueryParam { - queryParameters?: ListQueryParamProperties; -} - -export interface ListHeaderParam { - headers?: RawHttpHeadersInput & ListHeaders; -} - -export type ListParameters = ListQueryParam & ListHeaderParam & RequestParameters; - -export interface UpdateHeaders { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - "x-ms-client-request-id"?: string; -} - -/** The resource instance. */ -export type EvaluationResourceMergeAndPatch = Partial; - -export interface UpdateBodyParam { - /** The resource instance. */ - body: EvaluationResourceMergeAndPatch; -} - -export interface UpdateHeaderParam { - headers?: RawHttpHeadersInput & UpdateHeaders; -} - -export interface UpdateMediaTypesParam { - /** This request has a JSON Merge Patch body. */ - contentType: "application/merge-patch+json"; -} - -export type UpdateParameters = UpdateHeaderParam & - UpdateMediaTypesParam & - UpdateBodyParam & - RequestParameters; - -export interface GetScheduleHeaders { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - "x-ms-client-request-id"?: string; -} - -export interface GetScheduleHeaderParam { - headers?: RawHttpHeadersInput & GetScheduleHeaders; -} - -export type GetScheduleParameters = GetScheduleHeaderParam & RequestParameters; - -export interface CreateOrReplaceScheduleHeaders { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - "x-ms-client-request-id"?: string; -} - -export interface CreateOrReplaceScheduleBodyParam { - /** The resource instance. */ - body: EvaluationSchedule; -} - -export interface CreateOrReplaceScheduleHeaderParam { - headers?: RawHttpHeadersInput & CreateOrReplaceScheduleHeaders; -} - -export type CreateOrReplaceScheduleParameters = CreateOrReplaceScheduleHeaderParam & - CreateOrReplaceScheduleBodyParam & - RequestParameters; - -export interface ListScheduleHeaders { - /** An opaque, globally-unique, client-generated string identifier for the request. */ - "x-ms-client-request-id"?: string; -} - -export interface ListScheduleQueryParamProperties { - /** The number of result items to return. */ - top?: number; - /** The number of result items to skip. */ - skip?: number; - /** The maximum number of result items per page. */ - maxpagesize?: number; -} - -export interface ListScheduleQueryParam { - queryParameters?: ListScheduleQueryParamProperties; -} - -export interface ListScheduleHeaderParam { - headers?: RawHttpHeadersInput & ListScheduleHeaders; -} - -export type ListScheduleParameters = ListScheduleQueryParam & - ListScheduleHeaderParam & - RequestParameters; -export type DisableScheduleParameters = RequestParameters; diff --git a/sdk/ai/ai-projects/src/customization/streamingModels.ts b/sdk/ai/ai-projects/src/customization/streamingModels.ts deleted file mode 100644 index dfa8cd09421b..000000000000 --- a/sdk/ai/ai-projects/src/customization/streamingModels.ts +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { MessageRole } from "./models.js"; - -/** Represents a message delta i.e. any changed fields on a message during streaming. */ -export interface MessageDeltaChunk { - /** The identifier of the message, which can be referenced in API endpoints. */ - id: string; - - /** The object type, which is always `thread.message.delta`. */ - object: "thread.message.delta"; - - /** The delta containing the fields that have changed on the Message. */ - delta: MessageDelta; -} - -/** Represents the typed 'delta' payload within a streaming message delta chunk. */ -export interface MessageDelta { - /** The entity that produced the message. */ - role: MessageRole; - - /** The content of the message as an array of text and/or images. */ - content: Array; -} - -/** Represents the content of a message delta. */ -export type MessageDeltaContent = - | MessageDeltaContentParent - | MessageDeltaTextContent - | MessageDeltaImageFileContent; - -/** The abstract base representation of a partial streamed message content payload. */ -export interface MessageDeltaContentParent { - /** The index of the content part of the message. */ - index: number; - - /** The type of content for this content part. */ - type: string; -} -/** Represents a streamed image file content part within a streaming message delta chunk. */ -export interface MessageDeltaImageFileContent extends MessageDeltaContentParent { - /** The type of content for this content part, which is always "image_file." */ - type: "image_file"; - - /** The image_file data. */ - imageFile?: MessageDeltaImageFileContentObject; -} - -/** Represents the 'image_file' payload within streaming image file content. */ -export interface MessageDeltaImageFileContentObject { - /** The file ID of the image in the message content. */ - fileId?: string; -} - -/** Represents a streamed text content part within a streaming message delta chunk. */ -export interface MessageDeltaTextContent extends MessageDeltaContentParent { - /** The type of content for this content part, which is always "text." */ - type: "text"; - - /** The text content details. */ - text?: MessageDeltaTextContentObject; -} - -/** Represents the data of a streamed text content part within a streaming message delta chunk. */ -export interface MessageDeltaTextContentObject { - /** The data that makes up the text. */ - value?: string; - - /** Annotations for the text. */ - annotations?: Array; -} - -/** Represents a text annotation within a streamed text content part. */ -export type MessageDeltaTextAnnotation = - | MessageDeltaTextAnnotationParent - | MessageDeltaTextFileCitationAnnotation - | MessageDeltaTextFilePathAnnotation; - -/** The abstract base representation of a streamed text content part's text annotation. */ -export interface MessageDeltaTextAnnotationParent { - /** The index of the annotation within a text content part. */ - index: number; - - /** The type of the text content annotation. */ - type: string; -} - -/** Represents a streamed file citation applied to a streaming text content part. */ -export interface MessageDeltaTextFileCitationAnnotation extends MessageDeltaTextAnnotationParent { - /** The type of the text content annotation, which is always "file_citation." */ - type: "file_citation"; - - /** The file citation information. */ - fileCitation?: MessageDeltaTextFileCitationAnnotationObject; - - /** The text in the message content that needs to be replaced */ - text?: string; - - /** The start index of this annotation in the content text. */ - startIndex?: number; - - /** The end index of this annotation in the content text. */ - endIndex?: number; -} - -/** Represents the data of a streamed file citation as applied to a streaming text content part. */ -export interface MessageDeltaTextFileCitationAnnotationObject { - /** The ID of the specific file the citation is from. */ - fileId?: string; - - /** The specific quote in the cited file. */ - quote?: string; -} - -/** Represents a streamed file path annotation applied to a streaming text content part. */ -export interface MessageDeltaTextFilePathAnnotation extends MessageDeltaTextAnnotationParent { - /** The type of the text content annotation, which is always "file_path." */ - type: "file_path"; - - /** The file path information. */ - filePath?: MessageDeltaTextFilePathAnnotationObject; - - /** The start index of this annotation in the content text. */ - startIndex?: number; - - /** The end index of this annotation in the content text. */ - endIndex?: number; - - /** The text in the message content that needs to be replaced */ - text?: string; -} - -/** Represents the data of a streamed file path annotation as applied to a streaming text content part. */ -export interface MessageDeltaTextFilePathAnnotationObject { - /** The file ID for the annotation. */ - fileId?: string; -} - -/** A representation of the URL used for the text citation. */ -export interface MessageDeltaTextUrlCitationDetails { - /** The URL where the citation is from. */ - url?: string; - - /** The title of the URL. */ - title?: string; -} - -/** Represents a run step delta i.e. any changed fields on a run step during streaming. */ -export interface RunStepDeltaChunk { - /** The identifier of the run step, which can be referenced in API endpoints. */ - id: string; - - /** The object type, which is always `thread.run.step.delta`. */ - object: "thread.run.step.delta"; - - /** The delta containing the fields that have changed on the run step. */ - delta: RunStepDelta; -} - -/** Represents the delta payload in a streaming run step delta chunk. */ -export interface RunStepDelta { - /** The details of the run step. */ - stepDetails?: RunStepDeltaDetail; -} - -/** Represents a single run step detail item in a streaming run step's delta payload. */ -export interface RunStepDeltaDetail { - /** The object type for the run step detail object. */ - type: string; -} - -/** Represents a message creation within a streaming run step delta. */ -export interface RunStepDeltaMessageCreation extends RunStepDeltaDetail { - /** The object type, which is always "message_creation." */ - type: "message_creation"; - - /** The message creation data. */ - messageCreation?: RunStepDeltaMessageCreationObject; -} - -/** Represents the data within a streaming run step message creation response object. */ -export interface RunStepDeltaMessageCreationObject { - /** The ID of the newly-created message. */ - messageId?: string; -} - -/** Represents an invocation of tool calls as part of a streaming run step. */ -export interface RunStepDeltaToolCallObject extends RunStepDeltaDetail { - /** The object type, which is always "tool_calls." */ - type: "tool_calls"; - - /** The collection of tool calls for the tool call detail item. */ - toolCalls?: Array; -} - -/** Represents a single tool call within a streaming run step's delta tool call details. */ -export type RunStepDeltaToolCall = - | RunStepDeltaToolCallParent - | RunStepDeltaFunctionToolCall - | RunStepDeltaFileSearchToolCall - | RunStepDeltaCodeInterpreterToolCall; - -/** The abstract base representation of a single tool call within a streaming run step's delta tool call details. */ -export interface RunStepDeltaToolCallParent { - /** The index of the tool call detail in the run step's tool_calls array. */ - index: number; - - /** The ID of the tool call, used when submitting outputs to the run. */ - id: string; - - /** The type of the tool call detail item in a streaming run step's details. */ - type: string; -} - -/** Represents a function tool call within a streaming run step's tool call details. */ -export interface RunStepDeltaFunctionToolCall extends RunStepDeltaToolCallParent { - /** The object type, which is always "function." */ - type: "function"; - - /** The function data for the tool call. */ - function?: RunStepDeltaFunction; -} - -/** Represents a file search tool call within a streaming run step's tool call details. */ -export interface RunStepDeltaFileSearchToolCall extends RunStepDeltaToolCallParent { - /** The object type, which is always "file_search." */ - type: "file_search"; - - /** Reserved for future use. */ - fileSearch?: Array; -} - -/** Represents a Code Interpreter tool call within a streaming run step's tool call details. */ -export interface RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCallParent { - /** The object type, which is always "code_interpreter." */ - type: "code_interpreter"; - - /** The Code Interpreter data for the tool call. */ - codeInterpreter?: RunStepDeltaCodeInterpreterDetailItemObject; -} - -/** Represents the function data in a streaming run step delta's function tool call. */ -export interface RunStepDeltaFunction { - /** The name of the function. */ - name?: string; - - /** The arguments passed to the function as input. */ - arguments?: string; - - /** The output of the function, null if outputs have not yet been submitted. */ - output?: string | null; -} - -/** Represents the Code Interpreter data in a streaming run step's tool call output. */ -export type RunStepDeltaCodeInterpreterOutput = - | RunStepDeltaCodeInterpreterOutputParent - | RunStepDeltaCodeInterpreterLogOutput - | RunStepDeltaCodeInterpreterImageOutput; - -/** Represents the Code Interpreter tool call data in a streaming run step's tool calls. */ -export interface RunStepDeltaCodeInterpreterDetailItemObject { - /** The input into the Code Interpreter tool call. */ - input?: string; - - /** - * The outputs from the Code Interpreter tool call. Code Interpreter can output one or more - * items, including text (`logs`) or images (`image`). Each of these are represented by a - * different object type. - */ - outputs?: Array; -} - -/** The abstract base representation of a streaming run step tool call's Code Interpreter tool output. */ -export interface RunStepDeltaCodeInterpreterOutputParent { - /** The index of the output in the streaming run step tool call's Code Interpreter outputs array. */ - index: number; - - /** The type of the streaming run step tool call's Code Interpreter output. */ - type: string; -} - -/** Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. */ -export interface RunStepDeltaCodeInterpreterLogOutput - extends RunStepDeltaCodeInterpreterOutputParent { - /** The type of the object, which is always "logs." */ - type: "logs"; - - /** The text output from the Code Interpreter tool call. */ - logs?: string; -} - -/** Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. */ -export interface RunStepDeltaCodeInterpreterImageOutput - extends RunStepDeltaCodeInterpreterOutputParent { - /** The object type, which is always "image." */ - type: "image"; - - /** The image data for the Code Interpreter tool call output. */ - image?: RunStepDeltaCodeInterpreterImageOutputObject; -} - -/** Represents the data for a streaming run step's Code Interpreter tool call image output. */ -export interface RunStepDeltaCodeInterpreterImageOutputObject { - /** The file ID for the image. */ - fileId?: string; -} diff --git a/sdk/ai/ai-projects/src/customization/streamingWireModels.ts b/sdk/ai/ai-projects/src/customization/streamingWireModels.ts deleted file mode 100644 index 7f03d43bbcb1..000000000000 --- a/sdk/ai/ai-projects/src/customization/streamingWireModels.ts +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { MessageRole } from "../generated/src/models.js"; - -/** Represents a message delta i.e. any changed fields on a message during streaming. */ -export interface MessageDeltaChunk { - /** The identifier of the message, which can be referenced in API endpoints. */ - id: string; - - /** The object type, which is always `thread.message.delta`. */ - object: "thread.message.delta"; - - /** The delta containing the fields that have changed on the Message. */ - delta: MessageDelta; -} - -/** Represents the typed 'delta' payload within a streaming message delta chunk. */ -export interface MessageDelta { - /** The entity that produced the message. */ - role: MessageRole; - - /** The content of the message as an array of text and/or images. */ - content: Array; -} - -export type MessageDeltaContent = - | MessageDeltaContentParent - | MessageDeltaTextContent - | MessageDeltaImageFileContent; - -/** The abstract base representation of a partial streamed message content payload. */ -export interface MessageDeltaContentParent { - /** The index of the content part of the message. */ - index: number; - - /** The type of content for this content part. */ - type: string; -} -/** Represents a streamed image file content part within a streaming message delta chunk. */ -export interface MessageDeltaImageFileContent extends MessageDeltaContentParent { - /** The type of content for this content part, which is always "image_file." */ - type: "image_file"; - - /** The image_file data. */ - image_file?: MessageDeltaImageFileContentObject; -} - -/** Represents the 'image_file' payload within streaming image file content. */ -export interface MessageDeltaImageFileContentObject { - /** The file ID of the image in the message content. */ - file_id?: string; -} - -/** Represents a streamed text content part within a streaming message delta chunk. */ -export interface MessageDeltaTextContent extends MessageDeltaContentParent { - /** The type of content for this content part, which is always "text." */ - type: "text"; - - /** The text content details. */ - text?: MessageDeltaTextContentObject; -} - -/** Represents the data of a streamed text content part within a streaming message delta chunk. */ -export interface MessageDeltaTextContentObject { - /** The data that makes up the text. */ - value?: string; - - /** Annotations for the text. */ - annotations?: Array; -} - -export type MessageDeltaTextAnnotation = - | MessageDeltaTextAnnotationParent - | MessageDeltaTextFileCitationAnnotation - | MessageDeltaTextFilePathAnnotation; - -/** The abstract base representation of a streamed text content part's text annotation. */ -export interface MessageDeltaTextAnnotationParent { - /** The index of the annotation within a text content part. */ - index: number; - - /** The type of the text content annotation. */ - type: string; -} - -/** Represents a streamed file citation applied to a streaming text content part. */ -export interface MessageDeltaTextFileCitationAnnotation extends MessageDeltaTextAnnotationParent { - /** The type of the text content annotation, which is always "file_citation." */ - type: "file_citation"; - - /** The file citation information. */ - file_citation?: MessageDeltaTextFileCitationAnnotationObject; - - /** The text in the message content that needs to be replaced */ - text?: string; - - /** The start index of this annotation in the content text. */ - start_index?: number; - - /** The end index of this annotation in the content text. */ - end_index?: number; -} - -/** Represents the data of a streamed file citation as applied to a streaming text content part. */ -export interface MessageDeltaTextFileCitationAnnotationObject { - /** The ID of the specific file the citation is from. */ - file_id?: string; - - /** The specific quote in the cited file. */ - quote?: string; -} - -/** Represents a streamed file path annotation applied to a streaming text content part. */ -export interface MessageDeltaTextFilePathAnnotation extends MessageDeltaTextAnnotationParent { - /** The type of the text content annotation, which is always "file_path." */ - type: "file_path"; - - /** The file path information. */ - file_path?: MessageDeltaTextFilePathAnnotationObject; - - /** The start index of this annotation in the content text. */ - start_index?: number; - - /** The end index of this annotation in the content text. */ - end_index?: number; - - /** The text in the message content that needs to be replaced */ - text?: string; -} - -/** Represents the data of a streamed file path annotation as applied to a streaming text content part. */ -export interface MessageDeltaTextFilePathAnnotationObject { - /** The file ID for the annotation. */ - file_id?: string; -} - -/** A representation of the URL used for the text citation. */ -export interface MessageDeltaTextUrlCitationDetails { - /** The URL where the citation is from. */ - url?: string; - - /** The title of the URL. */ - title?: string; -} - -/** Represents a run step delta i.e. any changed fields on a run step during streaming. */ -export interface RunStepDeltaChunk { - /** The identifier of the run step, which can be referenced in API endpoints. */ - id: string; - - /** The object type, which is always `thread.run.step.delta`. */ - object: "thread.run.step.delta"; - - /** The delta containing the fields that have changed on the run step. */ - delta: RunStepDelta; -} - -/** Represents the delta payload in a streaming run step delta chunk. */ -export interface RunStepDelta { - /** The details of the run step. */ - step_details?: RunStepDeltaDetail; -} - -/** Represents a single run step detail item in a streaming run step's delta payload. */ -export interface RunStepDeltaDetail { - /** The object type for the run step detail object. */ - type: string; -} - -/** Represents a message creation within a streaming run step delta. */ -export interface RunStepDeltaMessageCreation extends RunStepDeltaDetail { - /** The object type, which is always "message_creation." */ - type: "message_creation"; - - /** The message creation data. */ - message_creation?: RunStepDeltaMessageCreationObject; -} - -/** Represents the data within a streaming run step message creation response object. */ -export interface RunStepDeltaMessageCreationObject { - /** The ID of the newly-created message. */ - message_id?: string; -} - -/** Represents an invocation of tool calls as part of a streaming run step. */ -export interface RunStepDeltaToolCallObject extends RunStepDeltaDetail { - /** The object type, which is always "tool_calls." */ - type: "tool_calls"; - - /** The collection of tool calls for the tool call detail item. */ - tool_calls?: Array; -} - -export type RunStepDeltaToolCall = - | RunStepDeltaToolCallParent - | RunStepDeltaFunctionToolCall - | RunStepDeltaFileSearchToolCall - | RunStepDeltaCodeInterpreterToolCall; - -/** The abstract base representation of a single tool call within a streaming run step's delta tool call details. */ -export interface RunStepDeltaToolCallParent { - /** The index of the tool call detail in the run step's tool_calls array. */ - index: number; - - /** The ID of the tool call, used when submitting outputs to the run. */ - id: string; - - /** The type of the tool call detail item in a streaming run step's details. */ - type: string; -} - -/** Represents a function tool call within a streaming run step's tool call details. */ -export interface RunStepDeltaFunctionToolCall extends RunStepDeltaToolCallParent { - /** The object type, which is always "function." */ - type: "function"; - - /** The function data for the tool call. */ - function?: RunStepDeltaFunction; -} - -/** Represents a file search tool call within a streaming run step's tool call details. */ -export interface RunStepDeltaFileSearchToolCall extends RunStepDeltaToolCallParent { - /** The object type, which is always "file_search." */ - type: "file_search"; - - /** Reserved for future use. */ - file_search?: Array; -} - -/** Represents a Code Interpreter tool call within a streaming run step's tool call details. */ -export interface RunStepDeltaCodeInterpreterToolCall extends RunStepDeltaToolCallParent { - /** The object type, which is always "code_interpreter." */ - type: "code_interpreter"; - - /** The Code Interpreter data for the tool call. */ - code_interpreter?: RunStepDeltaCodeInterpreterDetailItemObject; -} - -/** Represents the function data in a streaming run step delta's function tool call. */ -export interface RunStepDeltaFunction { - /** The name of the function. */ - name?: string; - - /** The arguments passed to the function as input. */ - arguments?: string; - - /** The output of the function, null if outputs have not yet been submitted. */ - output?: string | null; -} - -export type RunStepDeltaCodeInterpreterOutput = - | RunStepDeltaCodeInterpreterOutputParent - | RunStepDeltaCodeInterpreterLogOutput - | RunStepDeltaCodeInterpreterImageOutput; - -/** Represents the Code Interpreter tool call data in a streaming run step's tool calls. */ -export interface RunStepDeltaCodeInterpreterDetailItemObject { - /** The input into the Code Interpreter tool call. */ - input?: string; - - /** - * The outputs from the Code Interpreter tool call. Code Interpreter can output one or more - * items, including text (`logs`) or images (`image`). Each of these are represented by a - * different object type. - */ - outputs?: Array; -} - -/** The abstract base representation of a streaming run step tool call's Code Interpreter tool output. */ -export interface RunStepDeltaCodeInterpreterOutputParent { - /** The index of the output in the streaming run step tool call's Code Interpreter outputs array. */ - index: number; - - /** The type of the streaming run step tool call's Code Interpreter output. */ - type: string; -} - -/** Represents a log output as produced by the Code Interpreter tool and as represented in a streaming run step's delta tool calls collection. */ -export interface RunStepDeltaCodeInterpreterLogOutput - extends RunStepDeltaCodeInterpreterOutputParent { - /** The type of the object, which is always "logs." */ - type: "logs"; - - /** The text output from the Code Interpreter tool call. */ - logs?: string; -} - -/** Represents an image output as produced the Code interpreter tool and as represented in a streaming run step's delta tool calls collection. */ -export interface RunStepDeltaCodeInterpreterImageOutput - extends RunStepDeltaCodeInterpreterOutputParent { - /** The object type, which is always "image." */ - type: "image"; - - /** The image data for the Code Interpreter tool call output. */ - image?: RunStepDeltaCodeInterpreterImageOutputObject; -} - -/** Represents the data for a streaming run step's Code Interpreter tool call image output. */ -export interface RunStepDeltaCodeInterpreterImageOutputObject { - /** The file ID for the image. */ - file_id?: string; -} diff --git a/sdk/ai/ai-projects/src/generated/src/index.ts b/sdk/ai/ai-projects/src/generated/src/index.ts deleted file mode 100644 index 0afd734a7856..000000000000 --- a/sdk/ai/ai-projects/src/generated/src/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import ProjectsClient from "./projectsClient.js"; - -export * from "./projectsClient.js"; -export * from "./parameters.js"; -export * from "./responses.js"; -export * from "./clientDefinitions.js"; -export * from "./isUnexpected.js"; -export * from "./models.js"; -export * from "./outputModels.js"; -export * from "./paginateHelper.js"; - -export default ProjectsClient; diff --git a/sdk/ai/ai-projects/src/generated/src/logger.ts b/sdk/ai/ai-projects/src/generated/src/logger.ts deleted file mode 100644 index ac271f422ccc..000000000000 --- a/sdk/ai/ai-projects/src/generated/src/logger.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { createClientLogger } from "@azure/logger"; -export const logger = createClientLogger("ai-projects"); diff --git a/sdk/ai/ai-projects/src/generated/src/paginateHelper.ts b/sdk/ai/ai-projects/src/generated/src/paginateHelper.ts deleted file mode 100644 index 94d5220235d9..000000000000 --- a/sdk/ai/ai-projects/src/generated/src/paginateHelper.ts +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - getPagedAsyncIterator, - PagedAsyncIterableIterator, - PagedResult, -} from "@azure/core-paging"; -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; - -/** - * Helper type to extract the type of an array - */ -export type GetArrayType = T extends Array ? TData : never; - -/** - * The type of a custom function that defines how to get a page and a link to the next one if any. - */ -export type GetPage = ( - pageLink: string, - maxPageSize?: number, -) => Promise<{ - page: TPage; - nextPageLink?: string; -}>; - -/** - * Options for the paging helper - */ -export interface PagingOptions { - /** - * Custom function to extract pagination details for crating the PagedAsyncIterableIterator - */ - customGetPage?: GetPage[]>; -} - -/** - * Helper type to infer the Type of the paged elements from the response type - * This type is generated based on the swagger information for x-ms-pageable - * specifically on the itemName property which indicates the property of the response - * where the page items are found. The default value is `value`. - * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter - */ -export type PaginateReturn = TResult extends { - body: { value?: infer TPage }; -} - ? GetArrayType - : Array; - -/** - * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension - * @param client - Client to use for sending the next page requests - * @param initialResponse - Initial response containing the nextLink and current page of elements - * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results - * @returns - PagedAsyncIterableIterator to iterate the elements - */ -export function paginate( - client: Client, - initialResponse: TResponse, - options: PagingOptions = {}, -): PagedAsyncIterableIterator> { - // Extract element type from initial response - type TElement = PaginateReturn; - let firstRun = true; - const itemName = "value"; - const nextLinkName = "nextLink"; - const { customGetPage } = options; - const pagedResult: PagedResult = { - firstPageLink: "", - getPage: - typeof customGetPage === "function" - ? customGetPage - : async (pageLink: string) => { - const result = firstRun - ? initialResponse - : await client.pathUnchecked(pageLink).get(); - firstRun = false; - checkPagingRequest(result); - const nextLink = getNextLink(result.body, nextLinkName); - const values = getElements(result.body, itemName); - return { - page: values, - nextPageLink: nextLink, - }; - }, - }; - - return getPagedAsyncIterator(pagedResult); -} - -/** - * Gets for the value of nextLink in the body - */ -function getNextLink(body: unknown, nextLinkName?: string): string | undefined { - if (!nextLinkName) { - return undefined; - } - - const nextLink = (body as Record)[nextLinkName]; - - if (typeof nextLink !== "string" && typeof nextLink !== "undefined") { - throw new Error( - `Body Property ${nextLinkName} should be a string or undefined`, - ); - } - - return nextLink; -} - -/** - * Gets the elements of the current request in the body. - */ -function getElements(body: unknown, itemName: string): T[] { - const value = (body as Record)[itemName] as T[]; - - // value has to be an array according to the x-ms-pageable extension. - // The fact that this must be an array is used above to calculate the - // type of elements in the page in PaginateReturn - if (!Array.isArray(value)) { - throw new Error( - `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, - ); - } - - return value ?? []; -} - -/** - * Checks if a request failed - */ -function checkPagingRequest(response: PathUncheckedResponse): void { - const Http2xxStatusCodes = [ - "200", - "201", - "202", - "203", - "204", - "205", - "206", - "207", - "208", - "226", - ]; - if (!Http2xxStatusCodes.includes(response.status)) { - throw createRestError( - `Pagination failed with unexpected statusCode ${response.status}`, - response, - ); - } -} diff --git a/sdk/ai/ai-projects/src/index.ts b/sdk/ai/ai-projects/src/index.ts index 1ea737dc35e1..0afd734a7856 100644 --- a/sdk/ai/ai-projects/src/index.ts +++ b/sdk/ai/ai-projects/src/index.ts @@ -1,13 +1,15 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { AIProjectsClient, AIProjectsClientOptions } from "./aiProjectsClient.js"; -import { ProjectsClientOptions } from "./generated/src/projectsClient.js"; -export { AgentsOperations } from "./agents/index.js"; -export { ConnectionsOperations } from "./connections/index.js"; -export { TelemetryOperations, TelemetryOptions } from "./telemetry/index.js"; +import ProjectsClient from "./projectsClient.js"; -export * from "./agents/inputOutputs.js"; -export * from "./connections/inputOutput.js"; +export * from "./projectsClient.js"; +export * from "./parameters.js"; +export * from "./responses.js"; +export * from "./clientDefinitions.js"; +export * from "./isUnexpected.js"; +export * from "./models.js"; +export * from "./outputModels.js"; +export * from "./paginateHelper.js"; -export { AIProjectsClient, AIProjectsClientOptions, ProjectsClientOptions }; +export default ProjectsClient; diff --git a/sdk/ai/ai-projects/src/generated/src/isUnexpected.ts b/sdk/ai/ai-projects/src/isUnexpected.ts similarity index 99% rename from sdk/ai/ai-projects/src/generated/src/isUnexpected.ts rename to sdk/ai/ai-projects/src/isUnexpected.ts index 6f5865336149..6c647316f0c2 100644 --- a/sdk/ai/ai-projects/src/generated/src/isUnexpected.ts +++ b/sdk/ai/ai-projects/src/isUnexpected.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { +import type { CreateAgent200Response, CreateAgentDefaultResponse, ListAgents200Response, @@ -112,9 +112,9 @@ import { const responseMap: Record = { "POST /assistants": ["200"], "GET /assistants": ["200"], - "GET /assistants/{assistantId}": ["200"], - "POST /assistants/{assistantId}": ["200"], - "DELETE /assistants/{assistantId}": ["200"], + "GET /assistants/{agentId}": ["200"], + "POST /assistants/{agentId}": ["200"], + "DELETE /assistants/{agentId}": ["200"], "POST /threads": ["200"], "GET /threads/{threadId}": ["200"], "POST /threads/{threadId}": ["200"], diff --git a/sdk/ai/ai-projects/src/logger.ts b/sdk/ai/ai-projects/src/logger.ts index 9f092c1689f3..ac271f422ccc 100644 --- a/sdk/ai/ai-projects/src/logger.ts +++ b/sdk/ai/ai-projects/src/logger.ts @@ -2,5 +2,4 @@ // Licensed under the MIT License. import { createClientLogger } from "@azure/logger"; -import { PACKAGE_NAME } from "./constants.js"; -export const logger = createClientLogger(PACKAGE_NAME); +export const logger = createClientLogger("ai-projects"); diff --git a/sdk/ai/ai-projects/src/generated/src/models.ts b/sdk/ai/ai-projects/src/models.ts similarity index 81% rename from sdk/ai/ai-projects/src/generated/src/models.ts rename to sdk/ai/ai-projects/src/models.ts index bbb5a48ded51..14b7ec37171f 100644 --- a/sdk/ai/ai-projects/src/generated/src/models.ts +++ b/sdk/ai/ai-projects/src/models.ts @@ -63,6 +63,7 @@ export interface FileSearchToolDefinitionDetails { * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. */ max_num_results?: number; + /** Ranking options for file search. */ ranking_options?: FileSearchRankingOptions; } @@ -100,7 +101,7 @@ export interface BingGroundingToolDefinition extends ToolDefinitionParent { bing_grounding: ToolConnectionList; } -/** A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint_grounding` tools. */ +/** A set of connection resources currently used by either the `bing_grounding`, `fabric_aiskill`, or `sharepoint_grounding` tools. */ export interface ToolConnectionList { /** * The connections attached to this tool. There can be a maximum of 1 connection @@ -117,10 +118,10 @@ export interface ToolConnection { /** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ export interface MicrosoftFabricToolDefinition extends ToolDefinitionParent { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; + /** The object type, which is always 'fabric_aiskill'. */ + type: "fabric_aiskill"; /** The list of connections used by the Microsoft Fabric tool. */ - microsoft_fabric: ToolConnectionList; + fabric_aiskill: ToolConnectionList; } /** The input definition information for a sharepoint tool as used to configure an agent. */ @@ -137,13 +138,106 @@ export interface AzureAISearchToolDefinition extends ToolDefinitionParent { type: "azure_ai_search"; } +/** The input definition information for an OpenAPI tool as used to configure an agent. */ +export interface OpenApiToolDefinition extends ToolDefinitionParent { + /** The object type, which is always 'openapi'. */ + type: "openapi"; + /** The openapi function definition. */ + openapi: OpenApiFunctionDefinition; +} + +/** The input definition information for an openapi function. */ +export interface OpenApiFunctionDefinition { + /** The name of the function to be called. */ + name: string; + /** A description of what the function does, used by the model to choose when and how to call the function. */ + description?: string; + /** The openapi function shape, described as a JSON Schema object. */ + spec: unknown; + /** Open API authentication details */ + auth: OpenApiAuthDetails; +} + +/** authentication details for OpenApiFunctionDefinition */ +export interface OpenApiAuthDetailsParent { + type: OpenApiAuthType; +} + +/** Security details for OpenApi anonymous authentication */ +export interface OpenApiAnonymousAuthDetails extends OpenApiAuthDetailsParent { + /** The object type, which is always 'anonymous'. */ + type: "anonymous"; +} + +/** Security details for OpenApi connection authentication */ +export interface OpenApiConnectionAuthDetails extends OpenApiAuthDetailsParent { + /** The object type, which is always 'connection'. */ + type: "connection"; + /** Connection auth security details */ + security_scheme: OpenApiConnectionSecurityScheme; +} + +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiConnectionSecurityScheme { + /** Connection id for Connection auth type */ + connection_id: string; +} + +/** Security details for OpenApi managed_identity authentication */ +export interface OpenApiManagedAuthDetails extends OpenApiAuthDetailsParent { + /** The object type, which is always 'managed_identity'. */ + type: "managed_identity"; + /** Connection auth security details */ + security_scheme: OpenApiManagedSecurityScheme; +} + +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiManagedSecurityScheme { + /** Authentication scope for managed_identity auth type */ + audience: string; +} + +/** The input definition information for a azure function tool as used to configure an agent. */ +export interface AzureFunctionToolDefinition extends ToolDefinitionParent { + /** The object type, which is always 'azure_function'. */ + type: "azure_function"; + /** The definition of the concrete function that the function tool should call. */ + azure_function: AzureFunctionDefinition; +} + +/** The definition of Azure function. */ +export interface AzureFunctionDefinition { + /** The definition of azure function and its parameters. */ + function: FunctionDefinition; + /** Input storage queue. The queue storage trigger runs a function as messages are added to it. */ + input_binding: AzureFunctionBinding; + /** Output storage queue. The function writes output to this queue when the input items are processed. */ + output_binding: AzureFunctionBinding; +} + +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionBinding { + /** The type of binding, which is always 'storage_queue'. */ + type: "storage_queue"; + /** Storage queue. */ + storage_queue: AzureFunctionStorageQueue; +} + +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionStorageQueue { + /** URI to the Azure Storage Queue service allowing you to manipulate a queue. */ + queue_service_endpoint: string; + /** The name of an Azure function storage queue. */ + queue_name: string; +} + /** * A set of resources that are used by the agent's tools. The resources are specific to the type of * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` * tool requires a list of vector store IDs. */ export interface ToolResources { - /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ + /** Resources to be used by the `code_interpreter` tool consisting of file IDs. */ code_interpreter?: CodeInterpreterToolResource; /** Resources to be used by the `file_search` tool consisting of vector store IDs. */ file_search?: FileSearchToolResource; @@ -158,7 +252,7 @@ export interface CodeInterpreterToolResource { * associated with the tool. */ file_ids?: string[]; - /** The data sources to be used. This option is mutually exclusive with fileIds. */ + /** The data sources to be used. This option is mutually exclusive with the `fileIds` property. */ data_sources?: Array; } @@ -169,7 +263,11 @@ export interface CodeInterpreterToolResource { export interface VectorStoreDataSource { /** Asset URI. */ uri: string; - /** The asset type * */ + /** + * The asset type + * + * Possible values: "uri_asset", "id_asset" + */ type: VectorStoreDataSourceAssetType; } @@ -181,9 +279,9 @@ export interface FileSearchToolResource { */ vector_store_ids?: string[]; /** - * The list of vector store configuration objects from Azure. This list is limited to one - * element. The only element of this list contains - * the list of azure asset IDs used by the search tool. + * The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. */ vector_stores?: Array; } @@ -232,7 +330,25 @@ export interface AgentsApiResponseFormat { * * Possible values: "text", "json_object" */ - type?: ApiResponseFormat; + type?: ResponseFormat; +} + +/** The type of response format being defined: `json_schema` */ +export interface ResponseFormatJsonSchemaType { + /** Type */ + type: "json_schema"; + /** The JSON schema, describing response format. */ + json_schema: ResponseFormatJsonSchema; +} + +/** A description of what the response format is for, used by the model to determine how to respond in the format. */ +export interface ResponseFormatJsonSchema { + /** A description of what the response format is for, used by the model to determine how to respond in the format. */ + description?: string; + /** The name of a schema. */ + name: string; + /** The JSON schema object, describing the response format. */ + schema: unknown; } /** The request details to use when modifying an existing agent. */ @@ -313,9 +429,9 @@ export interface MessageAttachment { /** The ID of the file to attach to the message. */ file_id?: string; /** Azure asset ID. */ - data_sources?: Array; + data_source?: VectorStoreDataSource; /** The tools to add to this file. */ - tools: MessageAttachmentToolDefinition[]; + tools: Array; } /** The details used to update an existing agent thread */ @@ -330,141 +446,6 @@ export interface UpdateAgentThreadOptions { metadata?: Record | null; } -/** A single, existing message within an agent thread. */ -export interface ThreadMessage { - /** The identifier, which can be referenced in API endpoints. */ - id: string; - /** The object type, which is always 'thread.message'. */ - object: "thread.message"; - /** The Unix timestamp, in seconds, representing when this object was created. */ - created_at: number; - /** The ID of the thread that this message belongs to. */ - thread_id: string; - /** - * The status of the message. - * - * Possible values: "in_progress", "incomplete", "completed" - */ - status: MessageStatus; - /** On an incomplete message, details about why the message is incomplete. */ - incomplete_details: MessageIncompleteDetails | null; - /** The Unix timestamp (in seconds) for when the message was completed. */ - completed_at: number | null; - /** The Unix timestamp (in seconds) for when the message was marked as incomplete. */ - incomplete_at: number | null; - /** - * The role associated with the agent thread message. - * - * Possible values: "user", "assistant" - */ - role: MessageRole; - /** The list of content items associated with the agent thread message. */ - content: Array; - /** If applicable, the ID of the agent that authored this message. */ - assistant_id: string | null; - /** If applicable, the ID of the run associated with the authoring of this message. */ - run_id: string | null; - /** A list of files attached to the message, and the tools they were added to. */ - attachments: Array | null; - /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ - metadata: Record | null; -} - -/** Information providing additional detail about a message entering an incomplete status. */ -export interface MessageIncompleteDetails { - /** - * The provided reason describing why the message was marked as incomplete. - * - * Possible values: "content_filter", "max_tokens", "run_cancelled", "run_failed", "run_expired" - */ - reason: MessageIncompleteDetailsReason; -} - -/** An abstract representation of a single item of thread message content. */ -export interface MessageContentParent { - type: string; -} - -/** A representation of a textual item of thread message content. */ -export interface MessageTextContent extends MessageContentParent { - /** The object type, which is always 'text'. */ - type: "text"; - /** The text and associated annotations for this thread message content item. */ - text: MessageTextDetails; -} - -/** The text and associated annotations for a single item of agent thread message content. */ -export interface MessageTextDetails { - /** The text data. */ - value: string; - /** A list of annotations associated with this text. */ - annotations: Array; -} - -/** An abstract representation of an annotation to text thread message content. */ -export interface MessageTextAnnotationParent { - /** The textual content associated with this text annotation item. */ - text: string; - type: string; -} - -/** A citation within the message that points to a specific quote from a specific File associated with the agent or the message. Generated when the agent uses the 'file_search' tool to search files. */ -export interface MessageTextFileCitationAnnotation - extends MessageTextAnnotationParent { - /** The object type, which is always 'file_citation'. */ - type: "file_citation"; - /** - * A citation within the message that points to a specific quote from a specific file. - * Generated when the agent uses the "file_search" tool to search files. - */ - file_citation: MessageTextFileCitationDetails; - /** The first text index associated with this text annotation. */ - start_index?: number; - /** The last text index associated with this text annotation. */ - end_index?: number; -} - -/** A representation of a file-based text citation, as used in a file-based annotation of text thread message content. */ -export interface MessageTextFileCitationDetails { - /** The ID of the file associated with this citation. */ - file_id: string; - /** The specific quote cited in the associated file. */ - quote: string; -} - -/** A citation within the message that points to a file located at a specific path. */ -export interface MessageTextFilePathAnnotation - extends MessageTextAnnotationParent { - /** The object type, which is always 'file_path'. */ - type: "file_path"; - /** A URL for the file that's generated when the agent used the code_interpreter tool to generate a file. */ - file_path: MessageTextFilePathDetails; - /** The first text index associated with this text annotation. */ - start_index?: number; - /** The last text index associated with this text annotation. */ - end_index?: number; -} - -/** An encapsulation of an image file ID, as used by message image content. */ -export interface MessageTextFilePathDetails { - /** The ID of the specific file that the citation is from. */ - file_id: string; -} - -/** A representation of image file content in a thread message. */ -export interface MessageImageFileContent extends MessageContentParent { - /** The object type, which is always 'image_file'. */ - type: "image_file"; - /** The image file for this thread message content item. */ - image_file: MessageImageFileDetails; -} - -/** An image reference, as represented in thread message content. */ -export interface MessageImageFileDetails { - /** The ID for the file associated with this image. */ - file_id: string; -} - /** The details used when creating a new run of an agent thread. */ export interface CreateRunOptions { /** The ID of the agent that should run the thread. */ @@ -479,7 +460,7 @@ export interface CreateRunOptions { */ additional_instructions?: string | null; /** Adds additional messages to the thread before creating the run. */ - additional_messages?: Array | null; + additional_messages?: Array | null; /** The overridden list of enabled tools that the agent should use to run the thread. */ tools?: Array | null; /** @@ -518,6 +499,8 @@ export interface CreateRunOptions { tool_choice?: AgentsApiToolChoiceOption | null; /** Specifies the format that the model must output. */ response_format?: AgentsApiResponseFormatOption | null; + /** If `true` functions will run in parallel during tool use. */ + parallel_tool_calls?: boolean; /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } @@ -544,7 +527,7 @@ export interface AgentsNamedToolChoice { /** * the type of tool. If type is `function`, the function name must be set. * - * Possible values: "function", "code_interpreter", "file_search", "bing_grounding", "microsoft_fabric", "sharepoint_grounding", "azure_ai_search" + * Possible values: "function", "code_interpreter", "file_search", "bing_grounding", "fabric_aiskill", "sharepoint_grounding", "azure_ai_search" */ type: AgentsNamedToolChoiceType; /** The name of the function to call */ @@ -644,6 +627,8 @@ export interface CreateAndRunThreadOptions { tool_choice?: AgentsApiToolChoiceOption | null; /** Specifies the format that the model must output. */ response_format?: AgentsApiResponseFormatOption | null; + /** If `true` functions will run in parallel during tool use. */ + parallel_tool_calls?: boolean; /** A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. */ metadata?: Record | null; } @@ -722,7 +707,7 @@ export interface VectorStoreUpdateOptions { export interface Evaluation { /** Data for evaluation. */ data: InputData; - /** Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. */ + /** Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. */ displayName?: string; /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ description?: string; @@ -746,7 +731,7 @@ export interface ApplicationInsightsConfiguration extends InputDataParent { /** Query to fetch the data. */ query: string; /** Service name. */ - serviceName: string; + serviceName?: string; /** Connection String to connect to ApplicationInsights. */ connectionString?: string; } @@ -832,17 +817,15 @@ export type ToolDefinition = | BingGroundingToolDefinition | MicrosoftFabricToolDefinition | SharepointToolDefinition - | AzureAISearchToolDefinition; -/** An abstract representation of a single item of thread message content. */ -export type MessageContent = - | MessageContentParent - | MessageTextContent - | MessageImageFileContent; -/** An abstract representation of an annotation to text thread message content. */ -export type MessageTextAnnotation = - | MessageTextAnnotationParent - | MessageTextFileCitationAnnotation - | MessageTextFilePathAnnotation; + | AzureAISearchToolDefinition + | OpenApiToolDefinition + | AzureFunctionToolDefinition; +/** authentication details for OpenApiFunctionDefinition */ +export type OpenApiAuthDetails = + | OpenApiAuthDetailsParent + | OpenApiAnonymousAuthDetails + | OpenApiConnectionAuthDetails + | OpenApiManagedAuthDetails; /** An abstract representation of a vector store chunking strategy configuration. */ export type VectorStoreChunkingStrategyRequest = | VectorStoreChunkingStrategyRequestParent @@ -855,29 +838,30 @@ export type InputData = | Dataset; /** Abstract data class for input data configuration. */ export type Trigger = TriggerParent | RecurrenceTrigger | CronTrigger; +/** Alias for OpenApiAuthType */ +export type OpenApiAuthType = string; /** Alias for VectorStoreDataSourceAssetType */ -export type VectorStoreDataSourceAssetType = "uri_asset" | "id_asset"; +export type VectorStoreDataSourceAssetType = string; /** Alias for AgentsApiResponseFormatMode */ export type AgentsApiResponseFormatMode = string; -/** Alias for ApiResponseFormat */ -export type ApiResponseFormat = string; +/** Alias for ResponseFormat */ +export type ResponseFormat = string; /** Alias for AgentsApiResponseFormatOption */ export type AgentsApiResponseFormatOption = | string | AgentsApiResponseFormatMode - | AgentsApiResponseFormat; + | AgentsApiResponseFormat + | ResponseFormatJsonSchemaType; /** Alias for ListSortOrder */ -export type ListSortOrder = "asc" | "desc"; +export type ListSortOrder = string; /** Alias for MessageRole */ export type MessageRole = string; /** Alias for MessageAttachmentToolDefinition */ export type MessageAttachmentToolDefinition = | CodeInterpreterToolDefinition | FileSearchToolDefinition; -/** Alias for MessageStatus */ -export type MessageStatus = string; -/** Alias for MessageIncompleteDetailsReason */ -export type MessageIncompleteDetailsReason = string; +/** Alias for RunAdditionalFieldList */ +export type RunAdditionalFieldList = string; /** Alias for TruncationStrategy */ export type TruncationStrategy = string; /** Alias for AgentsApiToolChoiceOptionMode */ @@ -903,7 +887,8 @@ export type ConnectionType = | "Serverless" | "AzureBlob" | "AIServices" - | "CognitiveSearch"; + | "CognitiveSearch" + | "ApiKey"; /** Alias for Frequency */ export type Frequency = string; /** Alias for WeekDays */ diff --git a/sdk/ai/ai-projects/src/generated/src/outputModels.ts b/sdk/ai/ai-projects/src/outputModels.ts similarity index 85% rename from sdk/ai/ai-projects/src/generated/src/outputModels.ts rename to sdk/ai/ai-projects/src/outputModels.ts index bff61aa85e67..b35274ecd792 100644 --- a/sdk/ai/ai-projects/src/generated/src/outputModels.ts +++ b/sdk/ai/ai-projects/src/outputModels.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { Paged } from "@azure/core-paging"; - /** An abstract representation of an input tool definition that an agent can use. */ export interface ToolDefinitionOutputParent { type: string; @@ -32,6 +30,7 @@ export interface FileSearchToolDefinitionDetailsOutput { * Note that the file search tool may output fewer than `max_num_results` results. See the file search tool documentation for more information. */ max_num_results?: number; + /** Ranking options for file search. */ ranking_options?: FileSearchRankingOptionsOutput; } @@ -71,7 +70,7 @@ export interface BingGroundingToolDefinitionOutput bing_grounding: ToolConnectionListOutput; } -/** A set of connection resources currently used by either the `bing_grounding`, `microsoft_fabric`, or `sharepoint_grounding` tools. */ +/** A set of connection resources currently used by either the `bing_grounding`, `fabric_aiskill`, or `sharepoint_grounding` tools. */ export interface ToolConnectionListOutput { /** * The connections attached to this tool. There can be a maximum of 1 connection @@ -89,10 +88,10 @@ export interface ToolConnectionOutput { /** The input definition information for a Microsoft Fabric tool as used to configure an agent. */ export interface MicrosoftFabricToolDefinitionOutput extends ToolDefinitionOutputParent { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; + /** The object type, which is always 'fabric_aiskill'. */ + type: "fabric_aiskill"; /** The list of connections used by the Microsoft Fabric tool. */ - microsoft_fabric: ToolConnectionListOutput; + fabric_aiskill: ToolConnectionListOutput; } /** The input definition information for a sharepoint tool as used to configure an agent. */ @@ -111,13 +110,111 @@ export interface AzureAISearchToolDefinitionOutput type: "azure_ai_search"; } +/** The input definition information for an OpenAPI tool as used to configure an agent. */ +export interface OpenApiToolDefinitionOutput + extends ToolDefinitionOutputParent { + /** The object type, which is always 'openapi'. */ + type: "openapi"; + /** The openapi function definition. */ + openapi: OpenApiFunctionDefinitionOutput; +} + +/** The input definition information for an openapi function. */ +export interface OpenApiFunctionDefinitionOutput { + /** The name of the function to be called. */ + name: string; + /** A description of what the function does, used by the model to choose when and how to call the function. */ + description?: string; + /** The openapi function shape, described as a JSON Schema object. */ + spec: any; + /** Open API authentication details */ + auth: OpenApiAuthDetailsOutput; +} + +/** authentication details for OpenApiFunctionDefinition */ +export interface OpenApiAuthDetailsOutputParent { + type: OpenApiAuthTypeOutput; +} + +/** Security details for OpenApi anonymous authentication */ +export interface OpenApiAnonymousAuthDetailsOutput + extends OpenApiAuthDetailsOutputParent { + /** The object type, which is always 'anonymous'. */ + type: "anonymous"; +} + +/** Security details for OpenApi connection authentication */ +export interface OpenApiConnectionAuthDetailsOutput + extends OpenApiAuthDetailsOutputParent { + /** The object type, which is always 'connection'. */ + type: "connection"; + /** Connection auth security details */ + security_scheme: OpenApiConnectionSecuritySchemeOutput; +} + +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiConnectionSecuritySchemeOutput { + /** Connection id for Connection auth type */ + connection_id: string; +} + +/** Security details for OpenApi managed_identity authentication */ +export interface OpenApiManagedAuthDetailsOutput + extends OpenApiAuthDetailsOutputParent { + /** The object type, which is always 'managed_identity'. */ + type: "managed_identity"; + /** Connection auth security details */ + security_scheme: OpenApiManagedSecuritySchemeOutput; +} + +/** Security scheme for OpenApi managed_identity authentication */ +export interface OpenApiManagedSecuritySchemeOutput { + /** Authentication scope for managed_identity auth type */ + audience: string; +} + +/** The input definition information for a azure function tool as used to configure an agent. */ +export interface AzureFunctionToolDefinitionOutput + extends ToolDefinitionOutputParent { + /** The object type, which is always 'azure_function'. */ + type: "azure_function"; + /** The definition of the concrete function that the function tool should call. */ + azure_function: AzureFunctionDefinitionOutput; +} + +/** The definition of Azure function. */ +export interface AzureFunctionDefinitionOutput { + /** The definition of azure function and its parameters. */ + function: FunctionDefinitionOutput; + /** Input storage queue. The queue storage trigger runs a function as messages are added to it. */ + input_binding: AzureFunctionBindingOutput; + /** Output storage queue. The function writes output to this queue when the input items are processed. */ + output_binding: AzureFunctionBindingOutput; +} + +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionBindingOutput { + /** The type of binding, which is always 'storage_queue'. */ + type: "storage_queue"; + /** Storage queue. */ + storage_queue: AzureFunctionStorageQueueOutput; +} + +/** The structure for keeping storage queue name and URI. */ +export interface AzureFunctionStorageQueueOutput { + /** URI to the Azure Storage Queue service allowing you to manipulate a queue. */ + queue_service_endpoint: string; + /** The name of an Azure function storage queue. */ + queue_name: string; +} + /** * A set of resources that are used by the agent's tools. The resources are specific to the type of * tool. For example, the `code_interpreter` tool requires a list of file IDs, while the `file_search` * tool requires a list of vector store IDs. */ export interface ToolResourcesOutput { - /** Resources to be used by the `code_interpreter tool` consisting of file IDs. */ + /** Resources to be used by the `code_interpreter` tool consisting of file IDs. */ code_interpreter?: CodeInterpreterToolResourceOutput; /** Resources to be used by the `file_search` tool consisting of vector store IDs. */ file_search?: FileSearchToolResourceOutput; @@ -132,7 +229,7 @@ export interface CodeInterpreterToolResourceOutput { * associated with the tool. */ file_ids?: string[]; - /** The data sources to be used. This option is mutually exclusive with fileIds. */ + /** The data sources to be used. This option is mutually exclusive with the `fileIds` property. */ data_sources?: Array; } @@ -143,7 +240,11 @@ export interface CodeInterpreterToolResourceOutput { export interface VectorStoreDataSourceOutput { /** Asset URI. */ uri: string; - /** The asset type * */ + /** + * The asset type + * + * Possible values: "uri_asset", "id_asset" + */ type: VectorStoreDataSourceAssetTypeOutput; } @@ -155,9 +256,9 @@ export interface FileSearchToolResourceOutput { */ vector_store_ids?: string[]; /** - * The list of vector store configuration objects from Azure. This list is limited to one - * element. The only element of this list contains - * the list of azure asset IDs used by the search tool. + * The list of vector store configuration objects from Azure. + * This list is limited to one element. + * The only element of this list contains the list of azure asset IDs used by the search tool. */ vector_stores?: Array; } @@ -206,7 +307,25 @@ export interface AgentsApiResponseFormatOutput { * * Possible values: "text", "json_object" */ - type?: ApiResponseFormatOutput; + type?: ResponseFormatOutput; +} + +/** The type of response format being defined: `json_schema` */ +export interface ResponseFormatJsonSchemaTypeOutput { + /** Type */ + type: "json_schema"; + /** The JSON schema, describing response format. */ + json_schema: ResponseFormatJsonSchemaOutput; +} + +/** A description of what the response format is for, used by the model to determine how to respond in the format. */ +export interface ResponseFormatJsonSchemaOutput { + /** A description of what the response format is for, used by the model to determine how to respond in the format. */ + description?: string; + /** The name of a schema. */ + name: string; + /** The JSON schema object, describing the response format. */ + schema: any; } /** Represents an agent that can call the model and use tools. */ @@ -279,9 +398,9 @@ export interface MessageAttachmentOutput { /** The ID of the file to attach to the message. */ file_id?: string; /** Azure asset ID. */ - data_sources?: Array; + data_source?: VectorStoreDataSourceOutput; /** The tools to add to this file. */ - tools: MessageAttachmentToolDefinitionOutput[]; + tools: Array; } /** Information about a single thread associated with an agent. */ @@ -390,6 +509,27 @@ export interface MessageTextAnnotationOutputParent { type: string; } +/** A citation within the message that points to a specific URL associated with the message. Generated when the agent uses tools such as 'bing_grounding' to search the Internet. */ +export interface MessageTextUrlCitationAnnotationOutput + extends MessageTextAnnotationOutputParent { + /** The object type, which is always 'url_citation'. */ + type: "url_citation"; + /** The details of the URL citation. */ + url_citation: MessageTextUrlCitationDetailsOutput; + /** The first text index associated with this text annotation. */ + start_index?: number; + /** The last text index associated with this text annotation. */ + end_index?: number; +} + +/** A representation of a URL citation, as used in text thread message content. */ +export interface MessageTextUrlCitationDetailsOutput { + /** The URL associated with this citation. */ + url: string; + /** The title of the URL. */ + title?: string; +} + /** A citation within the message that points to a specific quote from a specific File associated with the agent or the message. Generated when the agent uses the 'file_search' tool to search files. */ export interface MessageTextFileCitationAnnotationOutput extends MessageTextAnnotationOutputParent { @@ -484,7 +624,7 @@ export interface AgentsNamedToolChoiceOutput { /** * the type of tool. If type is `function`, the function name must be set. * - * Possible values: "function", "code_interpreter", "file_search", "bing_grounding", "microsoft_fabric", "sharepoint_grounding", "azure_ai_search" + * Possible values: "function", "code_interpreter", "file_search", "bing_grounding", "fabric_aiskill", "sharepoint_grounding", "azure_ai_search" */ type: AgentsNamedToolChoiceTypeOutput; /** The name of the function to call */ @@ -558,7 +698,7 @@ export interface ThreadRunOutput { /** Override the tools the agent can use for this run. This is useful for modifying the behavior on a per-run basis */ tool_resources?: UpdateToolResourcesOptionsOutput | null; /** Determines if tools can be executed in parallel within the run. */ - parallelToolCalls?: boolean; + parallel_tool_calls: boolean; } /** An abstract representation of a required action for an agent thread run to continue. */ @@ -581,7 +721,7 @@ export interface SubmitToolOutputsDetailsOutput { tool_calls: Array; } -/** An abstract representation a a tool invocation needed by the model to continue a run. */ +/** An abstract representation of a tool invocation needed by the model to continue a run. */ export interface RequiredToolCallOutputParent { /** The ID of the tool call. This ID must be referenced when submitting tool outputs. */ id: string; @@ -613,6 +753,16 @@ export interface RunErrorOutput { message: string; } +/** Details on why the run is incomplete. Will be `null` if the run is not incomplete. */ +export interface IncompleteRunDetailsOutput { + /** + * The reason why the run is incomplete. This indicates which specific token limit was reached during the run. + * + * Possible values: "max_completion_tokens", "max_prompt_tokens" + */ + reason: IncompleteDetailsReasonOutput; +} + /** Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.). */ export interface RunCompletionUsageOutput { /** Number of completion tokens used over the course of the run. */ @@ -803,8 +953,38 @@ export interface RunStepFileSearchToolCallOutput extends RunStepToolCallOutputParent { /** The object type, which is always 'file_search'. */ type: "file_search"; - /** Reserved for future use. */ - file_search: Record; + /** The ID of the tool call. This ID must be referenced when you submit tool outputs. */ + id: string; + /** For now, this is always going to be an empty object. */ + file_search: RunStepFileSearchToolCallResultsOutput; +} + +/** The results of the file search. */ +export interface RunStepFileSearchToolCallResultsOutput { + /** Ranking options for file search. */ + ranking_options?: FileSearchRankingOptionsOutput; + /** The array of a file search results */ + results: Array; +} + +/** File search tool call result. */ +export interface RunStepFileSearchToolCallResultOutput { + /** The ID of the file that result was found in. */ + file_id: string; + /** The name of the file that result was found in. */ + file_name: string; + /** The score of the result. All values must be a floating point number between 0 and 1. */ + score: number; + /** The content of the result that was found. The content is only included if requested via the include query parameter. */ + content?: Array; +} + +/** The file search result content object. */ +export interface FileSearchToolCallContentOutput { + /** The type of the content. */ + type: "text"; + /** The text content of the file. */ + text: string; } /** @@ -849,10 +1029,10 @@ export interface RunStepSharepointToolCallOutput */ export interface RunStepMicrosoftFabricToolCallOutput extends RunStepToolCallOutputParent { - /** The object type, which is always 'microsoft_fabric'. */ - type: "microsoft_fabric"; + /** The object type, which is always 'fabric_aiskill'. */ + type: "fabric_aiskill"; /** Reserved for future use. */ - microsoft_fabric: Record; + fabric_aiskill: Record; } /** @@ -1091,12 +1271,12 @@ export interface VectorStoreFileOutput { chunking_strategy: VectorStoreChunkingStrategyResponseOutput; } -/** Details on the error that may have ocurred while processing a file for this vector store */ +/** Details on the error that may have occurred while processing a file for this vector store */ export interface VectorStoreFileErrorOutput { /** * One of `server_error` or `rate_limit_exceeded`. * - * Possible values: "internal_error", "file_not_found", "parsing_error", "unhandled_mime_type" + * Possible values: "server_error", "invalid_file", "unsupported_file" */ code: VectorStoreFileErrorCodeOutput; /** A human-readable description of the error. */ @@ -1232,6 +1412,13 @@ export interface CredentialsSASAuthOutput { SAS: string; } +/** Connection properties for connections with no authentication */ +export interface InternalConnectionPropertiesNoAuthOutput + extends InternalConnectionPropertiesOutputParent { + /** Authentication type of the connection target */ + authType: "None"; +} + /** Response from getting properties of the Application Insights resource */ export interface GetAppInsightsResponseOutput { /** A unique identifier for the resource */ @@ -1254,7 +1441,7 @@ export interface EvaluationOutput { readonly id: string; /** Data for evaluation. */ data: InputDataOutput; - /** Display Name for evaluation. It helps to find evaluation easily in AI Studio. It does not need to be unique. */ + /** Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. */ displayName?: string; /** Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. */ description?: string; @@ -1284,7 +1471,7 @@ export interface ApplicationInsightsConfigurationOutput /** Query to fetch the data. */ query: string; /** Service name. */ - serviceName: string; + serviceName?: string; /** Connection String to connect to ApplicationInsights. */ connectionString?: string; } @@ -1318,6 +1505,14 @@ export interface EvaluatorConfigurationOutput { dataMapping?: Record; } +/** Paged collection of Evaluation items */ +export interface PagedEvaluationOutput { + /** The Evaluation items on this page */ + value: Array; + /** The link to the next page of items */ + nextLink?: string; +} + /** Evaluation Schedule Definition */ export interface EvaluationScheduleOutput { /** Name of the schedule, which also serves as the unique identifier for the evaluation */ @@ -1381,6 +1576,14 @@ export interface CronTriggerOutput extends TriggerOutputParent { expression: string; } +/** Paged collection of EvaluationSchedule items */ +export interface PagedEvaluationScheduleOutput { + /** The EvaluationSchedule items on this page */ + value: Array; + /** The link to the next page of items */ + nextLink?: string; +} + /** An abstract representation of an input tool definition that an agent can use. */ export type ToolDefinitionOutput = | ToolDefinitionOutputParent @@ -1390,7 +1593,15 @@ export type ToolDefinitionOutput = | BingGroundingToolDefinitionOutput | MicrosoftFabricToolDefinitionOutput | SharepointToolDefinitionOutput - | AzureAISearchToolDefinitionOutput; + | AzureAISearchToolDefinitionOutput + | OpenApiToolDefinitionOutput + | AzureFunctionToolDefinitionOutput; +/** authentication details for OpenApiFunctionDefinition */ +export type OpenApiAuthDetailsOutput = + | OpenApiAuthDetailsOutputParent + | OpenApiAnonymousAuthDetailsOutput + | OpenApiConnectionAuthDetailsOutput + | OpenApiManagedAuthDetailsOutput; /** An abstract representation of a single item of thread message content. */ export type MessageContentOutput = | MessageContentOutputParent @@ -1399,13 +1610,14 @@ export type MessageContentOutput = /** An abstract representation of an annotation to text thread message content. */ export type MessageTextAnnotationOutput = | MessageTextAnnotationOutputParent + | MessageTextUrlCitationAnnotationOutput | MessageTextFileCitationAnnotationOutput | MessageTextFilePathAnnotationOutput; /** An abstract representation of a required action for an agent thread run to continue. */ export type RequiredActionOutput = | RequiredActionOutputParent | SubmitToolOutputsActionOutput; -/** An abstract representation a a tool invocation needed by the model to continue a run. */ +/** An abstract representation of a tool invocation needed by the model to continue a run. */ export type RequiredToolCallOutput = | RequiredToolCallOutputParent | RequiredFunctionToolCallOutput; @@ -1439,7 +1651,8 @@ export type InternalConnectionPropertiesOutput = | InternalConnectionPropertiesOutputParent | InternalConnectionPropertiesApiKeyAuthOutput | InternalConnectionPropertiesAADAuthOutput - | InternalConnectionPropertiesSASAuthOutput; + | InternalConnectionPropertiesSASAuthOutput + | InternalConnectionPropertiesNoAuthOutput; /** Abstract data class for input data configuration. */ export type InputDataOutput = | InputDataOutputParent @@ -1450,17 +1663,20 @@ export type TriggerOutput = | TriggerOutputParent | RecurrenceTriggerOutput | CronTriggerOutput; +/** Alias for OpenApiAuthTypeOutput */ +export type OpenApiAuthTypeOutput = string; /** Alias for VectorStoreDataSourceAssetTypeOutput */ -export type VectorStoreDataSourceAssetTypeOutput = "uri_asset" | "id_asset"; +export type VectorStoreDataSourceAssetTypeOutput = string; /** Alias for AgentsApiResponseFormatModeOutput */ export type AgentsApiResponseFormatModeOutput = string; -/** Alias for ApiResponseFormatOutput */ -export type ApiResponseFormatOutput = string; +/** Alias for ResponseFormatOutput */ +export type ResponseFormatOutput = string; /** Alias for AgentsApiResponseFormatOptionOutput */ export type AgentsApiResponseFormatOptionOutput = | string | AgentsApiResponseFormatModeOutput - | AgentsApiResponseFormatOutput; + | AgentsApiResponseFormatOutput + | ResponseFormatJsonSchemaTypeOutput; /** Alias for MessageRoleOutput */ export type MessageRoleOutput = string; /** Alias for MessageAttachmentToolDefinitionOutput */ @@ -1484,8 +1700,8 @@ export type AgentsApiToolChoiceOptionOutput = | AgentsNamedToolChoiceOutput; /** Alias for RunStatusOutput */ export type RunStatusOutput = string; -/** Alias for IncompleteRunDetailsOutput */ -export type IncompleteRunDetailsOutput = string; +/** Alias for IncompleteDetailsReasonOutput */ +export type IncompleteDetailsReasonOutput = string; /** Alias for RunStepTypeOutput */ export type RunStepTypeOutput = string; /** Alias for RunStepStatusOutput */ @@ -1514,14 +1730,11 @@ export type ConnectionTypeOutput = | "Serverless" | "AzureBlob" | "AIServices" - | "CognitiveSearch"; + | "CognitiveSearch" + | "ApiKey"; /** Authentication type used by Azure AI service to connect to another service */ -export type AuthenticationTypeOutput = "ApiKey" | "AAD" | "SAS"; -/** Paged collection of Evaluation items */ -export type PagedEvaluationOutput = Paged; +export type AuthenticationTypeOutput = "ApiKey" | "AAD" | "SAS" | "None"; /** Alias for FrequencyOutput */ export type FrequencyOutput = string; /** Alias for WeekDaysOutput */ export type WeekDaysOutput = string; -/** Paged collection of EvaluationSchedule items */ -export type PagedEvaluationScheduleOutput = Paged; diff --git a/sdk/ai/ai-projects/src/paginateHelper.ts b/sdk/ai/ai-projects/src/paginateHelper.ts new file mode 100644 index 000000000000..70694e2c93c6 --- /dev/null +++ b/sdk/ai/ai-projects/src/paginateHelper.ts @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import type { Client, PathUncheckedResponse } from "@azure-rest/core-client"; +import { createRestError } from "@azure-rest/core-client"; + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, + TLink = string, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator( + pagedResult, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + (((settings?: PageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken as unknown as TLink | undefined, + }); + }) as unknown as ( + settings?: TPageSettings, + ) => AsyncIterableIterator), + }; +} + +async function* getItemAsyncIterator( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + const firstVal = await pages.next(); + // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is + if (!Array.isArray(firstVal.value)) { + // can extract elements from this page + const { toElements } = pagedResult; + if (toElements) { + yield* toElements(firstVal.value) as TElement[]; + for await (const page of pages) { + yield* toElements(page) as TElement[]; + } + } else { + yield firstVal.value; + // `pages` is of type `AsyncIterableIterator` but TPage = TElement in this case + yield* pages as unknown as AsyncIterableIterator; + } + } else { + yield* firstVal.value; + for await (const page of pages) { + // pages is of type `AsyncIterableIterator` so `page` is of type `TPage`. In this branch, + // it must be the case that `TPage = TElement[]` + yield* page as unknown as TElement[]; + } + } +} + +async function* getPageAsyncIterator( + pagedResult: PagedResult, + options: { + pageLink?: TLink; + } = {}, +): AsyncIterableIterator { + const { pageLink } = options; + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); + if (!response) { + return; + } + yield response.page; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + yield response.page; + } +} + +/** + * An interface that tracks the settings for paged iteration + */ +export interface PageSettings { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +} + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: (settings?: TPageSettings) => AsyncIterableIterator; +} + +/** + * An interface that describes how to communicate with the service. + */ +interface PagedResult { + /** + * Link to the first page of results. + */ + firstPageLink: TLink; + /** + * A method that returns a page of results. + */ + getPage: ( + pageLink: TLink, + ) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: (settings?: TPageSettings) => AsyncIterableIterator; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => unknown[]; +} + +/** + * Helper type to extract the type of an array + */ +export type GetArrayType = T extends Array ? TData : never; + +/** + * The type of a custom function that defines how to get a page and a link to the next one if any. + */ +export type GetPage = (pageLink: string) => Promise<{ + page: TPage; + nextPageLink?: string; +}>; + +/** + * Options for the paging helper + */ +export interface PagingOptions { + /** + * Custom function to extract pagination details for crating the PagedAsyncIterableIterator + */ + customGetPage?: GetPage[]>; +} + +/** + * Helper type to infer the Type of the paged elements from the response type + * This type is generated based on the swagger information for x-ms-pageable + * specifically on the itemName property which indicates the property of the response + * where the page items are found. The default value is `value`. + * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter + */ +export type PaginateReturn = TResult extends { + body: { value?: infer TPage }; +} + ? GetArrayType + : Array; + +/** + * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension + * @param client - Client to use for sending the next page requests + * @param initialResponse - Initial response containing the nextLink and current page of elements + * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results + * @returns - PagedAsyncIterableIterator to iterate the elements + */ +export function paginate( + client: Client, + initialResponse: TResponse, + options: PagingOptions = {}, +): PagedAsyncIterableIterator> { + // Extract element type from initial response + type TElement = PaginateReturn; + let firstRun = true; + const itemName = "value"; + const nextLinkName = "nextLink"; + const { customGetPage } = options; + const pagedResult: PagedResult = { + firstPageLink: "", + getPage: + typeof customGetPage === "function" + ? customGetPage + : async (pageLink: string) => { + const result = firstRun + ? initialResponse + : await client.pathUnchecked(pageLink).get(); + firstRun = false; + checkPagingRequest(result); + const nextLink = getNextLink(result.body, nextLinkName); + const values = getElements(result.body, itemName); + return { + page: values, + nextPageLink: nextLink, + }; + }, + }; + + return getPagedAsyncIterator(pagedResult); +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if (typeof nextLink !== "string" && typeof nextLink !== "undefined") { + throw new Error( + `Body Property ${nextLinkName} should be a string or undefined`, + ); + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + + // value has to be an array according to the x-ms-pageable extension. + // The fact that this must be an array is used above to calculate the + // type of elements in the page in PaginateReturn + if (!Array.isArray(value)) { + throw new Error( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest(response: PathUncheckedResponse): void { + const Http2xxStatusCodes = [ + "200", + "201", + "202", + "203", + "204", + "205", + "206", + "207", + "208", + "226", + ]; + if (!Http2xxStatusCodes.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/sdk/ai/ai-projects/src/generated/src/parameters.ts b/sdk/ai/ai-projects/src/parameters.ts similarity index 87% rename from sdk/ai/ai-projects/src/generated/src/parameters.ts rename to sdk/ai/ai-projects/src/parameters.ts index 0a432a8a8cac..a73fc462f132 100644 --- a/sdk/ai/ai-projects/src/generated/src/parameters.ts +++ b/sdk/ai/ai-projects/src/parameters.ts @@ -1,15 +1,16 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; -import { RequestParameters } from "@azure-rest/core-client"; -import { +import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline"; +import type { RequestParameters } from "@azure-rest/core-client"; +import type { CreateAgentOptions, ListSortOrder, UpdateAgentOptions, AgentThreadCreationOptions, UpdateAgentThreadOptions, ThreadMessageOptions, + RunAdditionalFieldList, CreateRunOptions, ToolOutput, CreateAndRunThreadOptions, @@ -115,7 +116,31 @@ export interface CreateRunBodyParam { body: CreateRunOptions; } -export type CreateRunParameters = CreateRunBodyParam & RequestParameters; +/** This is the wrapper object for the parameter `include[]` with explode set to false and style set to form. */ +export interface CreateRunIncludeQueryParam { + /** Value of the parameter */ + value: RunAdditionalFieldList[]; + /** Should we explode the value? */ + explode: false; + /** Style of the value */ + style: "form"; +} + +export interface CreateRunQueryParamProperties { + /** + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + */ + "include[]"?: RunAdditionalFieldList[] | CreateRunIncludeQueryParam; +} + +export interface CreateRunQueryParam { + queryParameters?: CreateRunQueryParamProperties; +} + +export type CreateRunParameters = CreateRunQueryParam & + CreateRunBodyParam & + RequestParameters; export interface ListRunsQueryParamProperties { /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ @@ -159,9 +184,47 @@ export interface CreateThreadAndRunBodyParam { export type CreateThreadAndRunParameters = CreateThreadAndRunBodyParam & RequestParameters; -export type GetRunStepParameters = RequestParameters; + +/** This is the wrapper object for the parameter `include[]` with explode set to false and style set to form. */ +export interface GetRunStepIncludeQueryParam { + /** Value of the parameter */ + value: RunAdditionalFieldList[]; + /** Should we explode the value? */ + explode: false; + /** Style of the value */ + style: "form"; +} + +export interface GetRunStepQueryParamProperties { + /** + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + */ + "include[]"?: RunAdditionalFieldList[] | GetRunStepIncludeQueryParam; +} + +export interface GetRunStepQueryParam { + queryParameters?: GetRunStepQueryParamProperties; +} + +export type GetRunStepParameters = GetRunStepQueryParam & RequestParameters; + +/** This is the wrapper object for the parameter `include[]` with explode set to false and style set to form. */ +export interface ListRunStepsIncludeQueryParam { + /** Value of the parameter */ + value: RunAdditionalFieldList[]; + /** Should we explode the value? */ + explode: false; + /** Style of the value */ + style: "form"; +} export interface ListRunStepsQueryParamProperties { + /** + * A list of additional fields to include in the response. + * Currently the only supported value is `step_details.tool_calls[*].file_search.results[*].content` to fetch the file search result content. + */ + "include[]"?: RunAdditionalFieldList[] | ListRunStepsIncludeQueryParam; /** A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. */ limit?: number; /** @@ -303,7 +366,7 @@ export type ListVectorStoreFilesParameters = ListVectorStoreFilesQueryParam & export interface CreateVectorStoreFileBodyParam { body: { file_id?: string; - data_sources?: Array; + data_source?: VectorStoreDataSource; chunking_strategy?: VectorStoreChunkingStrategyRequest; }; } diff --git a/sdk/ai/ai-projects/src/generated/src/projectsClient.ts b/sdk/ai/ai-projects/src/projectsClient.ts similarity index 76% rename from sdk/ai/ai-projects/src/generated/src/projectsClient.ts rename to sdk/ai/ai-projects/src/projectsClient.ts index 0b9e70f572f7..6fea84080bbf 100644 --- a/sdk/ai/ai-projects/src/generated/src/projectsClient.ts +++ b/sdk/ai/ai-projects/src/projectsClient.ts @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { getClient, ClientOptions } from "@azure-rest/core-client"; +import type { ClientOptions } from "@azure-rest/core-client"; +import { getClient } from "@azure-rest/core-client"; import { logger } from "./logger.js"; -import { TokenCredential } from "@azure/core-auth"; -import { ProjectsClient } from "./clientDefinitions.js"; +import type { TokenCredential } from "@azure/core-auth"; +import type { ProjectsClient } from "./clientDefinitions.js"; /** The optional parameters for the client */ export interface ProjectsClientOptions extends ClientOptions { @@ -14,10 +15,10 @@ export interface ProjectsClientOptions extends ClientOptions { /** * Initialize a new instance of `ProjectsClient` - * @param endpointParam - The Azure AI Studio project endpoint, in the form `https://.api.azureml.ms` or `https://..api.azureml.ms`, where is the Azure region where the project is deployed (e.g. westus) and is the GUID of the Enterprise private link. + * @param endpointParam - The Azure AI Foundry project endpoint, in the form `https://.api.azureml.ms` or `https://..api.azureml.ms`, where is the Azure region where the project is deployed (e.g. westus) and is the GUID of the Enterprise private link. * @param subscriptionId - The Azure subscription ID. * @param resourceGroupName - The name of the Azure Resource Group. - * @param projectName - The Azure AI Studio project name. + * @param projectName - The Azure AI Foundry project name. * @param credentials - uniquely identify client credential * @param options - the parameter for all optional parameters */ @@ -33,7 +34,7 @@ export default function createClient( options.endpoint ?? options.baseUrl ?? `${endpointParam}/agents/v1.0/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/${projectName}`; - const userAgentInfo = `azsdk-js-ai-projects-rest/1.0.0-beta.3`; + const userAgentInfo = `azsdk-js-ai-projects-rest/1.0.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}` diff --git a/sdk/ai/ai-projects/src/generated/src/responses.ts b/sdk/ai/ai-projects/src/responses.ts similarity index 99% rename from sdk/ai/ai-projects/src/generated/src/responses.ts rename to sdk/ai/ai-projects/src/responses.ts index 3504ed2c5d5d..c20db6322400 100644 --- a/sdk/ai/ai-projects/src/generated/src/responses.ts +++ b/sdk/ai/ai-projects/src/responses.ts @@ -1,23 +1,27 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RawHttpHeaders } from "@azure/core-rest-pipeline"; -import { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; -import { +import type { RawHttpHeaders } from "@azure/core-rest-pipeline"; +import type { HttpResponse, ErrorResponse } from "@azure-rest/core-client"; +import type { AgentOutput, OpenAIPageableListOfAgentOutput, - OpenAIPageableListOfVectorStoreOutput, AgentDeletionStatusOutput, AgentThreadOutput, ThreadDeletionStatusOutput, ThreadMessageOutput, + OpenAIPageableListOfThreadMessageOutput, ThreadRunOutput, + OpenAIPageableListOfThreadRunOutput, RunStepOutput, + OpenAIPageableListOfRunStepOutput, FileListResponseOutput, OpenAIFileOutput, FileDeletionStatusOutput, + OpenAIPageableListOfVectorStoreOutput, VectorStoreOutput, VectorStoreDeletionStatusOutput, + OpenAIPageableListOfVectorStoreFileOutput, VectorStoreFileOutput, VectorStoreFileDeletionStatusOutput, VectorStoreFileBatchOutput, @@ -29,10 +33,6 @@ import { PagedEvaluationOutput, EvaluationScheduleOutput, PagedEvaluationScheduleOutput, - OpenAIPageableListOfVectorStoreFileOutput, - OpenAIPageableListOfRunStepOutput, - OpenAIPageableListOfThreadRunOutput, - OpenAIPageableListOfThreadMessageOutput, } from "./outputModels.js"; /** The new agent instance. */ diff --git a/sdk/ai/ai-projects/src/telemetry/index.ts b/sdk/ai/ai-projects/src/telemetry/index.ts deleted file mode 100644 index 625ede77e570..000000000000 --- a/sdk/ai/ai-projects/src/telemetry/index.ts +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Client } from "@azure-rest/core-client"; -import type { TelemetryOptions } from "./telemetry.js"; -import { - getConnectionString, - getTelemetryOptions, - resetTelemetryOptions, - updateTelemetryOptions, -} from "./telemetry.js"; -import type { ConnectionsInternalOperations } from "../connections/internalModels.js"; -import type { ConnectionsOperations } from "../connections/customModels.js"; -export { TelemetryOptions } from "./telemetry.js"; - -/** - * Telemetry operations - **/ -export interface TelemetryOperations { - /** - * Get the appinsights connection string confired in the workspace - * @returns The telemetry connection string - **/ - getConnectionString(): Promise; - - /** - * Update the telemetry settings - * @param options - The telemetry options - * @returns void - * */ - updateSettings(options: TelemetryOptions): void; - - /** - * get the telemetry settings - * @returns The telemetry options - * */ - getSettings(): TelemetryOptions; -} - -/** - * Get the telemetry operations - * @param connection - The connections operations - * @returns The telemetry operations - **/ -export function getTelemetryOperations( - context: Client, - connection: ConnectionsOperations, -): TelemetryOperations { - resetTelemetryOptions(); - return { - getConnectionString: () => - getConnectionString(context, connection as ConnectionsInternalOperations), - updateSettings: (options: TelemetryOptions) => updateTelemetryOptions(options), - getSettings: () => getTelemetryOptions(), - }; -} diff --git a/sdk/ai/ai-projects/src/telemetry/telemetry.ts b/sdk/ai/ai-projects/src/telemetry/telemetry.ts deleted file mode 100644 index 8b9102d41621..000000000000 --- a/sdk/ai/ai-projects/src/telemetry/telemetry.ts +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { GetAppInsightsResponseOutput } from "../customization/outputModels.js"; -import type { Client } from "@azure-rest/core-client"; -import { createRestError } from "@azure-rest/core-client"; -import type { ConnectionsInternalOperations } from "../connections/internalModels.js"; - -const expectedStatuses = ["200"]; - -/** - * Telemetry options - */ -export interface TelemetryOptions { - /** Enable content recording */ - enableContentRecording: boolean; -} - -const telemetryOptions: TelemetryOptions & { connectionString: string | undefined } = { - enableContentRecording: false, - connectionString: undefined, -}; - -/** - * Update the telemetry settings - * @param options - The telemetry options - */ -export function updateTelemetryOptions(options: TelemetryOptions): void { - telemetryOptions.enableContentRecording = options.enableContentRecording; -} - -/** - * Get the telemetry options - * @returns The telemetry options - */ -export function getTelemetryOptions(): TelemetryOptions { - return structuredClone(telemetryOptions); -} - -/** - * Reset the telemetry options - */ -export function resetTelemetryOptions(): void { - telemetryOptions.connectionString = undefined; - telemetryOptions.enableContentRecording = false; -} - -/** - * Get the appinsights connection string confired in the workspace - * @param connection - get the connection string - * @returns The telemetry connection string - */ -export async function getConnectionString( - context: Client, - connection: ConnectionsInternalOperations, -): Promise { - if (!telemetryOptions.connectionString) { - const workspace = await connection.getWorkspace(); - if (workspace.properties.applicationInsights) { - const result = await context - .path("/{appInsightsResourceUrl}", workspace.properties.applicationInsights) - .get({ skipUrlEncoding: true }); - if (!expectedStatuses.includes(result.status)) { - throw createRestError(result); - } - telemetryOptions.connectionString = ( - result.body as GetAppInsightsResponseOutput - ).properties.ConnectionString; - } else { - throw new Error("Application Insights connection string not found."); - } - } - return telemetryOptions.connectionString as string; -} diff --git a/sdk/ai/ai-projects/src/tracing.ts b/sdk/ai/ai-projects/src/tracing.ts deleted file mode 100644 index 50ce1eb044a2..000000000000 --- a/sdk/ai/ai-projects/src/tracing.ts +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { - OperationTracingOptions, - Resolved, - SpanStatusError, - TracingSpan, -} from "@azure/core-tracing"; -import { createTracingClient } from "@azure/core-tracing"; -import { PACKAGE_NAME, SDK_VERSION } from "./constants.js"; -import { getErrorMessage } from "@azure/core-util"; -import { logger } from "./logger.js"; - -export enum TracingAttributes { - GEN_AI_MESSAGE_ID = "gen_ai.message.id", - GEN_AI_MESSAGE_STATUS = "gen_ai.message.status", - GEN_AI_THREAD_ID = "gen_ai.thread.id", - GEN_AI_THREAD_RUN_ID = "gen_ai.thread.run.id", - GEN_AI_AGENT_ID = "gen_ai.agent.id", - GEN_AI_AGENT_NAME = "gen_ai.agent.name", - GEN_AI_AGENT_DESCRIPTION = "gen_ai.agent.description", - GEN_AI_OPERATION_NAME = "gen_ai.operation.name", - GEN_AI_THREAD_RUN_STATUS = "gen_ai.thread.run.status", - GEN_AI_REQUEST_MODEL = "gen_ai.request.model", - GEN_AI_REQUEST_TEMPERATURE = "gen_ai.request.temperature", - GEN_AI_REQUEST_TOP_P = "gen_ai.request.top_p", - GEN_AI_REQUEST_MAX_INPUT_TOKENS = "gen_ai.request.max_input_tokens", - GEN_AI_REQUEST_MAX_OUTPUT_TOKENS = "gen_ai.request.max_output_tokens", - GEN_AI_RESPONSE_MODEL = "gen_ai.response.model", - GEN_AI_SYSTEM = "gen_ai.system", - SERVER_ADDRESS = "server.address", - AZ_AI_AGENT_SYSTEM = "az.ai.agents", - GEN_AI_TOOL_NAME = "gen_ai.tool.name", - GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id", - GEN_AI_REQUEST_RESPONSE_FORMAT = "gen_ai.request.response_format", - GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens", - GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens", - GEN_AI_SYSTEM_MESSAGE = "gen_ai.system.message", - GEN_AI_EVENT_CONTENT = "gen_ai.event.content", - ERROR_TYPE = "error.type", -} -export enum TracingOperationName { - CREATE_AGENT = "create_agent", - CREATE_UPDATE_AGENT = "update_agent", - CREATE_THREAD = "create_thread", - CREATE_MESSAGE = "create_message", - CREATE_RUN = "create_run", - START_THREAD_RUN = "start_thread_run", - EXECUTE_TOOL = "execute_tool", - LIST_MESSAGES = "list_messages", - SUBMIT_TOOL_OUTPUTS = "submit_tool_outputs", - CREATE_THREAD_RUN = "create_thread_run", -} - -export interface TracingAttributeOptions { - operationName?: string; - name?: string; - description?: string; - serverAddress?: string; - threadId?: string; - agentId?: string; - instructions?: string; - additional_instructions?: string; - runId?: string; - runStatus?: string; - responseModel?: string; - model?: string; - temperature?: number; - topP?: number; - maxPromptTokens?: number; - maxCompletionTokens?: number; - responseFormat?: string; - genAiSystem?: string; - messageId?: string; - messageStatus?: string; - eventContent?: string; - usagePromptTokens?: number; - usageCompletionTokens?: number; -} - -export type Span = Omit; -export type OptionsWithTracing = { - tracingOptions?: OperationTracingOptions; - tracingAttributeOptions?: TracingAttributeOptions; -}; - -export class TracingUtility { - private static tracingClient = createTracingClient({ - namespace: "Microsoft.CognitiveServices", - packageName: PACKAGE_NAME, - packageVersion: SDK_VERSION, - }); - - static async withSpan< - Options extends OptionsWithTracing, - Request extends (updatedOptions: Options) => ReturnType, - >( - name: string, - options: Options, - request: Request, - startTrace?: (span: Span, updatedOptions: Options) => void, - endTrace?: (span: Span, updatedOptions: Options, result: ReturnType) => void, - ): Promise>> { - return TracingUtility.tracingClient.withSpan( - name, - options, - async (updatedOptions: Options, span: Span) => { - if (startTrace) { - try { - updatedOptions.tracingAttributeOptions = { - ...updatedOptions.tracingAttributeOptions, - operationName: name, - }; - startTrace(span, updatedOptions); - } catch (e) { - logger.warning( - `Skipping updating span before request execution due to an error: ${getErrorMessage(e)}`, - ); - } - } - let result: ReturnType | undefined; - try { - result = await request(updatedOptions); - } catch (error) { - const errorStatus: SpanStatusError = { status: "error" }; - if (error instanceof Error) { - errorStatus.error = error; - } - throw error; - } - - if (endTrace && result !== undefined) { - try { - endTrace(span, updatedOptions, result); - } catch (e) { - logger.warning( - `Skipping updating span after request execution due to an error: ${getErrorMessage(e)}`, - ); - } - } - return result; - }, - { spanKind: "client" }, - ); - } - - static updateSpanAttributes( - span: Span, - attributeOptions: Omit, - ): void { - TracingUtility.setAttributes(span, attributeOptions); - } - - static setSpanAttributes( - span: Span, - operationName: string, - attributeOptions: TracingAttributeOptions, - ): void { - attributeOptions.operationName = operationName; - TracingUtility.setAttributes(span, attributeOptions); - } - - static setAttributes(span: Span, attributeOptions: TracingAttributeOptions): void { - if (span.isRecording()) { - const { - name, - operationName, - description, - serverAddress, - threadId, - agentId, - messageId, - runId, - model, - temperature, - topP, - maxPromptTokens, - maxCompletionTokens, - responseFormat, - runStatus, - responseModel, - usageCompletionTokens, - usagePromptTokens, - genAiSystem = TracingAttributes.AZ_AI_AGENT_SYSTEM, - } = attributeOptions; - - if (genAiSystem) { - span.setAttribute(TracingAttributes.GEN_AI_SYSTEM, genAiSystem); - } - if (name) { - span.setAttribute(TracingAttributes.GEN_AI_AGENT_NAME, name); - } - if (description) { - span.setAttribute(TracingAttributes.GEN_AI_AGENT_DESCRIPTION, description); - } - - if (serverAddress) { - span.setAttribute(TracingAttributes.SERVER_ADDRESS, serverAddress); - } - - if (threadId) { - span.setAttribute(TracingAttributes.GEN_AI_THREAD_ID, threadId); - } - - if (agentId) { - span.setAttribute(TracingAttributes.GEN_AI_AGENT_ID, agentId); - } - - if (runId) { - span.setAttribute(TracingAttributes.GEN_AI_THREAD_RUN_ID, runId); - } - - if (messageId) { - span.setAttribute(TracingAttributes.GEN_AI_MESSAGE_ID, messageId); - } - if (model) { - span.setAttribute(TracingAttributes.GEN_AI_REQUEST_MODEL, model); - } - - if (temperature !== null) { - span.setAttribute(TracingAttributes.GEN_AI_REQUEST_TEMPERATURE, temperature); - } - - if (topP !== null) { - span.setAttribute(TracingAttributes.GEN_AI_REQUEST_TOP_P, topP); - } - - if (maxPromptTokens !== null) { - span.setAttribute(TracingAttributes.GEN_AI_REQUEST_MAX_INPUT_TOKENS, maxPromptTokens); - } - - if (maxCompletionTokens !== null) { - span.setAttribute(TracingAttributes.GEN_AI_REQUEST_MAX_OUTPUT_TOKENS, maxCompletionTokens); - } - - if (responseFormat) { - span.setAttribute(TracingAttributes.GEN_AI_REQUEST_RESPONSE_FORMAT, responseFormat); - } - - if (runStatus) { - span.setAttribute(TracingAttributes.GEN_AI_THREAD_RUN_STATUS, runStatus); - } - - if (responseModel) { - span.setAttribute(TracingAttributes.GEN_AI_RESPONSE_MODEL, responseModel); - } - - if (usagePromptTokens) { - span.setAttribute(TracingAttributes.GEN_AI_USAGE_INPUT_TOKENS, usagePromptTokens); - } - - if (usageCompletionTokens) { - span.setAttribute(TracingAttributes.GEN_AI_USAGE_OUTPUT_TOKENS, usageCompletionTokens); - } - if (operationName) { - span.setAttribute(TracingAttributes.GEN_AI_OPERATION_NAME, operationName); - } - } - return; - } - - static addSpanEvent( - span: Span, - eventName: string, - attributeOptions: Omit, - ): void { - if (span.isRecording()) { - const { - threadId, - agentId, - runId, - messageId, - eventContent, - usageCompletionTokens, - usagePromptTokens, - messageStatus, - } = attributeOptions; - const attributes: Record = {}; - - if (eventContent) { - attributes[TracingAttributes.GEN_AI_EVENT_CONTENT] = eventContent; - } - - if (threadId) { - attributes[TracingAttributes.GEN_AI_THREAD_ID] = threadId; - } - - if (agentId) { - attributes[TracingAttributes.GEN_AI_AGENT_ID] = agentId; - } - - if (runId) { - attributes[TracingAttributes.GEN_AI_THREAD_RUN_ID] = runId; - } - - if (messageId) { - attributes[TracingAttributes.GEN_AI_MESSAGE_ID] = messageId; - } - if (messageStatus) { - attributes[TracingAttributes.GEN_AI_MESSAGE_STATUS] = messageStatus; - } - - if (usagePromptTokens) { - attributes[TracingAttributes.GEN_AI_USAGE_INPUT_TOKENS] = usagePromptTokens; - } - - if (usageCompletionTokens) { - attributes[TracingAttributes.GEN_AI_USAGE_OUTPUT_TOKENS] = usageCompletionTokens; - } - - if (span.addEvent) { - span.addEvent(eventName, { attributes }); - } - } - return; - } -} diff --git a/sdk/ai/ai-projects/test.env b/sdk/ai/ai-projects/test.env deleted file mode 100644 index 167bfe7e6307..000000000000 --- a/sdk/ai/ai-projects/test.env +++ /dev/null @@ -1 +0,0 @@ -AZURE_AI_PROJECTS_CONNECTION_STRING="" diff --git a/sdk/ai/ai-projects/test/public/agents/assistants.spec.ts b/sdk/ai/ai-projects/test/public/agents/assistants.spec.ts deleted file mode 100644 index 13c577ce7e09..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/assistants.spec.ts +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - assistants", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should delete agent", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Delete agent - const deleted = await agents.deleteAgent(agent.id); - assert.isNotNull(deleted); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); - - it("should list assistants", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // List agents - const assistants = await agents.listAgents(); - assert.isNotEmpty(assistants); - assert.isAtLeast(assistants.data.length, 1); - console.log(`Listed agents, agents count: ${assistants.data.length}`); - - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); - - it("should create agent", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); - - it("should update agent", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Update agent - const updated = await agents.updateAgent(agent.id, { name: "my-updated-agent" }); - assert.isNotNull(updated); - assert.equal(updated.name, "my-updated-agent"); - console.log(`Updated agent name to ${updated.name}, agent ID: ${agent.id}`); - - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/files.spec.ts b/sdk/ai/ai-projects/test/public/agents/files.spec.ts deleted file mode 100644 index 0fca88426747..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/files.spec.ts +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - files", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should list files", async function () { - const files = await agents.listFiles(); - assert.isNotEmpty(files); - }); - - it("should upload file", async function () { - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "fileName" }); - assert.isNotEmpty(file); - }); - - it("should upload file and poll", async function () { - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const poller = agents.uploadFileAndPoll(fileContent, "assistants", { - fileName: "fileName", - pollingOptions: { sleepIntervalInMs: 1000 }, - }); - const file = await poller.pollUntilDone(); - assert.notInclude(["uploaded", "pending", "running"], file.status); - assert.isNotEmpty(file); - }); - - it("should delete file", async function () { - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "fileName" }); - const deleted = await agents.deleteFile(file.id); - assert.isNotNull(deleted); - }); - - it("should retrieve file", async function () { - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "fileName" }); - const _file = await agents.getFile(file.id); - assert.isNotEmpty(_file); - assert.equal(_file.id, file.id); - await agents.deleteFile(file.id); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/functionTool.spec.ts b/sdk/ai/ai-projects/test/public/agents/functionTool.spec.ts deleted file mode 100644 index 379c686bfe39..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/functionTool.spec.ts +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import { delay } from "@azure-tools/test-recorder"; -import type { - AgentsOperations, - AIProjectsClient, - FunctionToolDefinition, - FunctionToolDefinitionOutput, - MessageContentOutput, - MessageImageFileContentOutput, - MessageTextContentOutput, - SubmitToolOutputsActionOutput, -} from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; -import { isOutputOfType } from "../../../src/agents/utils.js"; - -describe("Agents - function tool", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - let getCurrentDateTimeTool: FunctionToolDefinition; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - getCurrentDateTimeTool = { - type: "function", - function: { - name: "getCurrentDateTime", - description: "Get current date time", - parameters: {}, - }, - }; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - function getCurrentDateTime(): {} { - return { currentDateTime: "2024-10-10 12:30:19" }; - } - - it("should create agent with function tool", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [getCurrentDateTimeTool], - }); - console.log(`Created agent, agent ID: ${agent.id}`); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - assert.isNotEmpty(agent.tools); - assert.equal((agent.tools[0] as FunctionToolDefinition).function.name, "getCurrentDateTime"); - - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); - - it("should create agent with run function tool", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are a helpful agent", - tools: [getCurrentDateTimeTool], - }); - console.log(`Created agent, agent ID: ${agent.id}`); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - assert.isNotEmpty(agent.tools); - assert.equal((agent.tools[0] as FunctionToolDefinition).function.name, "getCurrentDateTime"); - - // Create thread - const thread = await agents.createThread(); - assert.isNotNull(thread); - assert.isNotNull(thread.id); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "Hello, what's the time?", - }); - assert.isNotNull(message.id); - console.log(`Created message, message ID ${message.id}`); - - // Create run - let run = await agents.createRun(thread.id, agent.id); - assert.isNotNull(run); - assert.isNotNull(run.id); - console.log(`Created Run, Run ID: ${run.id}`); - let toolCalled = false; - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await agents.getRun(thread.id, run.id); - if (run.status === "failed") { - console.log(`Run failed - ${run.lastError?.code} - ${run.lastError?.message}`); - break; - } - console.log(`Current Run status - ${run.status}, run ID: ${run.id}`); - if (run.status === "requires_action" && run.requiredAction) { - console.log(`Run requires action - ${run.requiredAction}`); - if ( - isOutputOfType(run.requiredAction, "submit_tool_outputs") - ) { - const submitToolOutputsActionOutput = run.requiredAction as SubmitToolOutputsActionOutput; - const toolCalls = submitToolOutputsActionOutput.submitToolOutputs.toolCalls; - for (const toolCall of toolCalls) { - if (isOutputOfType(toolCall, "function")) { - const functionOutput = toolCall as FunctionToolDefinitionOutput; - console.log(`Function tool call - ${functionOutput.function.name}`); - const toolResponse = getCurrentDateTime(); - toolCalled = true; - run = await agents.submitToolOutputsToRun(thread.id, run.id, [ - { toolCallId: toolCall.id, output: JSON.stringify(toolResponse) }, - ]); - console.log(`Submitted tool response - ${run.status}`); - } - } - } - } - } - assert.oneOf(run.status, ["cancelled", "failed", "completed", "expired"]); - assert.isTrue(toolCalled); - console.log(`Run status - ${run.status}, run ID: ${run.id}`); - const messages = await agents.listMessages(thread.id); - messages.data.forEach((threadMessage) => { - console.log( - `Thread Message Created at - ${threadMessage.createdAt} - Role - ${threadMessage.role}`, - ); - threadMessage.content.forEach((content: MessageContentOutput) => { - if (isOutputOfType(content, "text")) { - const textContent = content as MessageTextContentOutput; - console.log(`Text Message Content - ${textContent.text.value}`); - } else if (isOutputOfType(content, "image_file")) { - const imageContent = content as MessageImageFileContentOutput; - console.log(`Image Message Content - ${imageContent.imageFile.fileId}`); - } - }); - }); - - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/messages.spec.ts b/sdk/ai/ai-projects/test/public/agents/messages.spec.ts deleted file mode 100644 index dd3b8bd5c007..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/messages.spec.ts +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - messages", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should create message", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - assert.isNotNull(message); - assert.isNotNull(message.id); - - // Delete thread - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); - - it("should list messages", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create messages - const firstMessage = await agents.createMessage(thread.id, { - role: "user", - content: "knock knock", - }); - const secondMessage = await agents.createMessage(thread.id, { - role: "assistant", - content: "who's there?", - }); - console.log(`Created messages, message IDs: ${firstMessage.id}, ${secondMessage.id}`); - - // List messages - const messages = await agents.listMessages(thread.id); - assert.isNotEmpty(messages); - assert.equal(messages.data.length, 2); - assert.equal(messages.data[1].id, firstMessage.id); - assert.equal(messages.data[0].id, secondMessage.id); - console.log(`Listed ${messages.data.length} messages, thread ID: ${thread.id}`); - - // Delete thread - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); - - it("should update message", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Update message - const updatedMessage = await agents.updateMessage(thread.id, message.id, { - metadata: { key: "value" }, - }); - assert.isNotNull(updatedMessage); - assert.equal(updatedMessage.id, message.id); - assert.equal(updatedMessage.metadata?.key, "value"); - console.log( - `Updated message to have metadata "key":"${updatedMessage.metadata?.key}", message ID: ${updatedMessage.id}`, - ); - - // Delete thread - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/runSteps.spec.ts b/sdk/ai/ai-projects/test/public/agents/runSteps.spec.ts deleted file mode 100644 index 86eda91364ed..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/runSteps.spec.ts +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import { delay } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - run steps", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("should list run steps", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await agents.createRun(thread.id, agent.id); - console.log(`Created run, run ID: ${run.id}`); - - // Wait for run to complete - assert.oneOf(run.status, ["queued", "in_progress", "requires_action", "completed"]); - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await agents.getRun(thread.id, run.id); - console.log(`Run status: ${run.status}`); - assert.include(["queued", "in_progress", "requires_action", "completed"], run.status); - } - - // List run steps - const runSteps = await agents.listRunSteps(thread.id, run.id); - assert.isNotNull(runSteps.data); - - // Clean up - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); - - it("should get steps", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "hello, world!", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Create run - let run = await agents.createRun(thread.id, agent.id); - console.log(`Created run, run ID: ${run.id}`); - - // Wait for run to complete - assert.oneOf(run.status, ["queued", "in_progress", "requires_action", "completed"]); - console.log(`Run status - ${run.status}, run ID: ${run.id}`); - while (["queued", "in_progress", "requires_action"].includes(run.status)) { - await delay(1000); - run = await agents.getRun(thread.id, run.id); - console.log(`Run status - ${run.status}, run ID: ${run.id}`); - assert.include(["queued", "in_progress", "requires_action", "completed"], run.status); - } - - // List run steps - const runSteps = await agents.listRunSteps(thread.id, run.id); - assert.isNotNull(runSteps.data); - assert.isTrue(runSteps.data.length > 0); - console.log(`Listed run steps, run ID: ${run.id}`); - - // Get specific run step - const stepId = runSteps.data[0].id; - const step = await agents.getRunStep(thread.id, run.id, stepId); - console.log(`Retrieved run, step ID: ${stepId}`); - assert.isNotNull(step); - assert.equal(step.id, stepId); - - // Clean up - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/runs.spec.ts b/sdk/ai/ai-projects/test/public/agents/runs.spec.ts deleted file mode 100644 index 21682dc31465..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/runs.spec.ts +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import { delay } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - Run", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("should create agent and run agent", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - assert.isNotNull(thread); - assert.isNotNull(thread.id); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create run - const run = await agents.createRun(thread.id, agent.id); - assert.isNotNull(run); - assert.isNotNull(run.id); - console.log(`Created Run, Run ID: ${run.id}`); - - // Delete agent and thread - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - await agents.deleteThread(thread.id); - console.log(`Deleted Thread, thread ID: ${thread.id}`); - }); - - it("should create and get run", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - assert.isNotNull(thread); - assert.isNotNull(thread.id); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create run - const run = await agents.createRun(thread.id, agent.id); - assert.isNotNull(run); - assert.isNotNull(run.id); - console.log(`Created Run, Run ID: ${run.id}`); - - // Get run - const runDetails = await agents.getRun(thread.id, run.id); - assert.isNotNull(runDetails); - assert.isNotNull(runDetails.id); - assert.equal(run.id, runDetails.id); - console.log(`Retrieved run, Run ID: ${runDetails.id}`); - - // Delete agent and thread - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - await agents.deleteThread(thread.id); - console.log(`Deleted Thread, thread ID: ${thread.id}`); - }); - - it("should create and get run status", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - assert.isNotNull(thread); - assert.isNotNull(thread.id); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "Hello, tell me a joke", - }); - assert.isNotNull(message.id); - console.log(`Created message, message ID ${message.id}`); - - // Create run - const run = await agents.createRun(thread.id, agent.id); - assert.isNotNull(run); - assert.isNotNull(run.id); - console.log(`Created Run, Run ID: ${run.id}`); - - // Get run status - let runDetails = await agents.getRun(thread.id, run.id); - assert.isNotNull(runDetails); - assert.isNotNull(runDetails.id); - assert.equal(run.id, runDetails.id); - console.log(`Retrieved run status - ${runDetails.status}, run ID: ${runDetails.id}`); - - // Wait for status to update - assert.oneOf(runDetails.status, [ - "queued", - "in_progress", - "requires_action", - "cancelling", - "cancelled", - "failed", - "completed", - "expired", - ]); - while (["queued", "in_progress", "requires_action"].includes(runDetails.status)) { - await delay(1000); - runDetails = await agents.getRun(thread.id, run.id); - if (runDetails.lastError) { - console.log( - `Run status ${runDetails.status} - ${runDetails.lastError.code} - ${runDetails.lastError.message}`, - "color:red", - ); - } - if (runDetails) { - console.log(`Run status - ${runDetails.status}, run ID: ${runDetails.id}`); - } else { - console.log("Run details are undefined."); - } - } - assert.oneOf(runDetails.status, ["cancelled", "failed", "completed", "expired"]); - console.log(`Run status - ${runDetails.status}, run ID: ${runDetails.id}`); - - // Delete agent and thread - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - await agents.deleteThread(thread.id); - console.log(`Deleted Thread, thread ID: ${thread.id}`); - }); - - it("should create and list runs", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - assert.isNotNull(thread); - assert.isNotNull(thread.id); - console.log(`Created Thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "Hello, tell me a joke", - }); - assert.isNotNull(message.id); - console.log(`Created message, message ID ${message.id}`); - - // Create run - const run = await agents.createRun(thread.id, agent.id); - assert.isNotNull(run); - assert.isNotNull(run.id); - console.log(`Created Run, Run ID: ${run.id}`); - - // Get run status - const runs = await agents.listRuns(thread.id); - assert.isNotNull(runs); - assert.isArray(runs.data); - console.log(`List - found no of runs: ${runs.data.length}, first run ID: ${runs.firstId}`); - const runDetails = runs.data.find((threadRun) => threadRun.id === run.id); - assert.isNotNull(runDetails); - if (runDetails) { - console.log(`Run status - ${runDetails.status}, run ID: ${runDetails.id}`); - } else { - console.log("Run details are undefined."); - } - - // Delete agent and thread - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - await agents.deleteThread(thread.id); - console.log(`Deleted Thread, thread ID: ${thread.id}`); - }); - - it("should create and run in single call", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4o", { - name: "my-agent", - instructions: "You are helpful agent", - }); - assert.isNotNull(agent); - assert.isNotNull(agent.id); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create run - const run = await agents.createThreadAndRun(agent.id, { - thread: { - messages: [ - { - role: "user", - content: "Hello, tell me a joke", - }, - ], - }, - }); - assert.isNotNull(run); - assert.isNotNull(run.id); - assert.isNotNull(run.threadId); - console.log(`Created Run, Run ID: ${run.id}, Thread ID: ${run.threadId}`); - console.log(`Started : ${run.createdAt}`); - - // Get run - const runDetails = await agents.getRun(run.threadId, run.id); - assert.isNotNull(runDetails); - assert.isNotNull(runDetails.id); - assert.equal(run.id, runDetails.id); - console.log(`Retrieved run, Run ID: ${runDetails.id}`); - - // Delete agent and thread - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - await agents.deleteThread(run.threadId); - console.log(`Deleted Thread, thread ID: ${run.threadId}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/streaming.spec.ts b/sdk/ai/ai-projects/test/public/agents/streaming.spec.ts deleted file mode 100644 index a22b42a134cf..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/streaming.spec.ts +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient, ThreadRunOutput } from "../../../src/index.js"; -import { MessageStreamEvent, RunStreamEvent } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - streaming", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("should run streaming", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4-1106-preview", { - name: "My Friendly Test Assistant", - instructions: "You are helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Create message - const message = await agents.createMessage(thread.id, { - role: "user", - content: "Hello, tell me a joke", - }); - console.log(`Created message, message ID: ${message.id}`); - - // Run streaming - const streamEventMessages = await agents.createRun(thread.id, agent.id).stream(); - let hasEventMessages = false; - - for await (const eventMessage of streamEventMessages) { - hasEventMessages = true; - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log(`Thread Run Created - ${(eventMessage.data as ThreadRunOutput).assistantId}`); - break; - case MessageStreamEvent.ThreadMessageDelta: - console.log(`Thread Message Delta, thread ID: ${thread.id}`); - break; - case RunStreamEvent.ThreadRunCompleted: - console.log(`Thread Run Completed, thread ID: ${thread.id}`); - break; - } - } - assert.isTrue(hasEventMessages); - assert.isNotNull(streamEventMessages); - - // Delete agent and thread - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - await agents.deleteThread(thread.id); - console.log(`Deleted Thread, thread ID: ${thread.id}`); - }); - - // eslint-disable-next-line no-only-tests/no-only-tests - it("should create thread and run streaming", async function () { - // Create agent - const agent = await agents.createAgent("gpt-4-1106-preview", { - name: "My Friendly Test Assistant", - instructions: "You are helpful agent", - }); - console.log(`Created agent, agent ID: ${agent.id}`); - - // Create thread and run streaming - const streamEventMessages = await agents - .createThreadAndRun(agent.id, { - thread: { messages: [{ role: "user", content: "Hello, tell me a joke" }] }, - }) - .stream(); - - let hasEventMessages = false; - for await (const eventMessage of streamEventMessages) { - hasEventMessages = true; - switch (eventMessage.event) { - case RunStreamEvent.ThreadRunCreated: - console.log("Thread Run Created"); - break; - case MessageStreamEvent.ThreadMessageDelta: - console.log("Thread Message Delta"); - break; - case RunStreamEvent.ThreadRunCompleted: - console.log("Thread Run Completed"); - break; - } - } - assert.isTrue(hasEventMessages); - assert.isNotNull(streamEventMessages); - - // Delete agent - await agents.deleteAgent(agent.id); - console.log(`Deleted agent, agent ID: ${agent.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/threads.spec.ts b/sdk/ai/ai-projects/test/public/agents/threads.spec.ts deleted file mode 100644 index da8415a0eabc..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/threads.spec.ts +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - threads", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should create thread", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - assert.isNotNull(thread); - assert.isNotNull(thread.id); - - // Delete thread - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); - - it("should retrieve thread", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Retrieve thread - const _thread = await agents.getThread(thread.id); - assert.isNotEmpty(_thread); - assert.equal(_thread.id, thread.id); - console.log(`Retrieved thread, thread ID: ${_thread.id}`); - - // Delete thread - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); - - it("should update thread", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Update thread - await agents.updateThread(thread.id, { metadata: { key: "value" } }); - const _thread = await agents.getThread(thread.id); - assert.equal(_thread.id, thread.id); - assert.isNotEmpty(_thread.metadata); - assert.equal(_thread.metadata?.key, "value"); - console.log( - `Updated thread to have metadata "key":"${_thread.metadata?.key}", thread ID: ${_thread.id}`, - ); - - // Delete thread - await agents.deleteThread(thread.id); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); - - it("should delete thread", async function () { - // Create thread - const thread = await agents.createThread(); - console.log(`Created thread, thread ID: ${thread.id}`); - - // Delete thread - const deleted = await agents.deleteThread(thread.id); - assert.isNotNull(deleted); - console.log(`Deleted thread, thread ID: ${thread.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/tracing.spec.ts b/sdk/ai/ai-projects/test/public/agents/tracing.spec.ts deleted file mode 100644 index 2b56026dd0cc..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/tracing.spec.ts +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createMockProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe, vi } from "vitest"; -import type { MockTracingSpan } from "@azure-tools/test-utils-vitest"; -import { MockInstrumenter } from "@azure-tools/test-utils-vitest"; -import type { - AddEventOptions, - Instrumenter, - InstrumenterSpanOptions, - TracingContext, - TracingSpan, -} from "@azure/core-tracing"; -import { useInstrumenter } from "@azure/core-tracing"; -import type { - ThreadRunOutput, - ThreadMessageOutput, - AgentThreadOutput, - AgentOutput, -} from "../../../src/generated/src/index.js"; - -interface ExtendedMockTrackingSpan extends MockTracingSpan { - events?: { name: string; attributes: Record }[]; - addEvent?(eventName: string, options?: AddEventOptions): void; -} -class ExtendedMockInstrumenter extends MockInstrumenter { - extendSpan(span: any): void { - if (!span.events) { - span.events = []; - } - span.addEvent = (eventName: string, options?: AddEventOptions) => { - span.events.push({ name: eventName, ...options }); - }; - } - startSpan( - name: string, - spanOptions?: InstrumenterSpanOptions, - ): { span: TracingSpan; tracingContext: TracingContext } { - const { span, tracingContext } = super.startSpan(name, spanOptions); - this.extendSpan(span); - return { span, tracingContext }; - } -} - -describe("Agent Tracing", () => { - let instrumenter: Instrumenter; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - let response: any = {}; - let status = 200; - beforeEach(async function () { - instrumenter = new ExtendedMockInstrumenter(); - useInstrumenter(instrumenter); - - projectsClient = createMockProjectsClient(() => { - return { bodyAsText: JSON.stringify(response), status: status }; - }); - agents = projectsClient.agents; - }); - - afterEach(async function () { - (instrumenter as MockInstrumenter).reset(); - vi.clearAllMocks(); - response = {}; - status = 200; - }); - - it("create agent", async function () { - const agentResponse: Partial = { id: "agentId", object: "assistant" }; - response = agentResponse; - status = 200; - const request = { - name: "agentName", - instructions: "You are helpful agent", - response_format: "json", - }; - const model = "gpt-4o"; - await agents.createAgent(model, request); - const mockedInstrumenter = instrumenter as MockInstrumenter; - assert.isAbove(mockedInstrumenter.startedSpans.length, 0); - const span = mockedInstrumenter.startedSpans[0] as ExtendedMockTrackingSpan; - assert.equal(span.attributes["gen_ai.agent.id"], agentResponse.id); - assert.equal(span.attributes["gen_ai.operation.name"], "create_agent"); - assert.equal(span.attributes["gen_ai.agent.name"], request.name); - assert.equal(span.attributes["gen_ai.request.model"], model); - const event = span.events?.find((e) => e.name === "gen_ai.system.message"); - assert.isDefined(event); - assert.equal( - event?.attributes["gen_ai.event.content"], - JSON.stringify({ content: request.instructions }), - ); - }); - - it("create run", async function () { - const runResponse: Partial = { - id: "runId", - object: "thread.run", - status: "queued", - thread_id: "threadId", - assistant_id: "agentId", - }; - response = runResponse; - status = 200; - await agents.createRun("threadId", "agentId"); - const mockedInstrumenter = instrumenter as MockInstrumenter; - assert.isAbove(mockedInstrumenter.startedSpans.length, 0); - const span = mockedInstrumenter.startedSpans[0] as ExtendedMockTrackingSpan; - assert.equal(span.attributes["gen_ai.thread.id"], runResponse.thread_id); - assert.equal(span.attributes["gen_ai.operation.name"], "create_run"); - assert.equal(span.attributes["gen_ai.agent.id"], runResponse.assistant_id); - assert.equal(span.attributes["gen_ai.thread.run.status"], runResponse.status); - assert.equal(span.events!.length, 1); - }); - - it("create Thread", async function () { - const threadResponse: Partial = { id: "threadId", object: "thread" }; - response = threadResponse; - status = 200; - await agents.createThread(); - const mockedInstrumenter = instrumenter as MockInstrumenter; - assert.isAbove(mockedInstrumenter.startedSpans.length, 0); - const span = mockedInstrumenter.startedSpans[0]; - assert.equal(span.attributes["gen_ai.thread.id"], threadResponse.id); - assert.equal(span.attributes["gen_ai.operation.name"], "create_thread"); - }); - - it("create Message", async function () { - const messageResponse: Partial = { - id: "messageId", - object: "thread.message", - thread_id: "threadId", - }; - projectsClient.telemetry.updateSettings({ enableContentRecording: true }); - response = messageResponse; - status = 200; - const request = { content: "hello, world!", role: "user" }; - await agents.createMessage("threadId", request); - const mockedInstrumenter = instrumenter as MockInstrumenter; - assert.isAbove(mockedInstrumenter.startedSpans.length, 0); - const span = mockedInstrumenter.startedSpans[0] as ExtendedMockTrackingSpan; - assert.equal(span.attributes["gen_ai.thread.id"], messageResponse.thread_id); - assert.equal(span.attributes["gen_ai.operation.name"], "create_message"); - const event = span.events?.find((e) => e.name === "gen_ai.user.message"); - assert.isDefined(event); - assert.equal(event?.attributes["gen_ai.event.content"], JSON.stringify(request)); - assert.equal(event?.attributes["gen_ai.thread.id"], messageResponse.thread_id); - assert.equal(event?.name, "gen_ai.user.message"); - }); - - it("list messages", async function () { - const listMessages = { - object: "list", - data: [ - { - id: "messageId", - object: "thread.message", - thread_id: "threadId", - role: "assistant", - content: [{ type: "text", text: { value: "You are helpful agent" } }], - }, - { - id: "messageId2", - object: "thread.message", - thread_id: "threadId", - role: "user", - content: [{ type: "text", text: { value: "Hello, tell me a joke" } }], - }, - ], - }; - response = listMessages; - projectsClient.telemetry.updateSettings({ enableContentRecording: true }); - status = 200; - await agents.listMessages("threadId"); - const mockedInstrumenter = instrumenter as MockInstrumenter; - assert.isAbove(mockedInstrumenter.startedSpans.length, 0); - const span = mockedInstrumenter.startedSpans[0] as ExtendedMockTrackingSpan; - assert.isDefined(span.events); - assert.equal(span.events!.length, 2); - assert.equal( - span.events![0].attributes["gen_ai.event.content"], - JSON.stringify({ - content: { text: listMessages.data[0].content[0].text }, - role: listMessages.data[0].role, - }), - ); - assert.equal(span.events![0].name, "gen_ai.assistant.message"); - assert.equal( - span.events![1].attributes["gen_ai.event.content"], - JSON.stringify({ - content: { text: listMessages.data[1].content[0].text }, - role: listMessages.data[1].role, - }), - ); - assert.equal(span.events![1].name, "gen_ai.user.message"); - }); - - it("Submit tool outputs to run", async function () { - const submitToolOutputs = { - object: "thread.run", - id: "runId", - status: "queued", - thread_id: "threadId", - assistant_id: "agentId", - }; - response = submitToolOutputs; - status = 200; - const toolOutputs = [ - { toolCallId: "toolcallId1", output: "output1" }, - { toolCallId: "toolcallId2", output: "output2" }, - ]; - await agents.submitToolOutputsToRun("threadId", "runId", toolOutputs); - const mockedInstrumenter = instrumenter as MockInstrumenter; - assert.isAbove(mockedInstrumenter.startedSpans.length, 0); - const span = mockedInstrumenter.startedSpans[0] as ExtendedMockTrackingSpan; - assert.equal(span.attributes["gen_ai.thread.id"], submitToolOutputs.thread_id); - assert.equal(span.attributes["gen_ai.operation.name"], "submit_tool_outputs"); - assert.equal(span.attributes["gen_ai.thread.run.status"], submitToolOutputs.status); - assert.isDefined(span.events); - assert.equal(span.events!.length, 2); - assert.equal( - span.events![0].attributes["gen_ai.event.content"], - JSON.stringify({ content: toolOutputs[0].output, id: toolOutputs[0].toolCallId }), - ); - assert.equal(span.events![0].name, "gen_ai.tool.message"); - assert.equal( - span.events![1].attributes["gen_ai.event.content"], - JSON.stringify({ content: toolOutputs[1].output, id: toolOutputs[1].toolCallId }), - ); - assert.equal(span.events![1].name, "gen_ai.tool.message"); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/vectorStores.spec.ts b/sdk/ai/ai-projects/test/public/agents/vectorStores.spec.ts deleted file mode 100644 index f55ad4f2a487..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/vectorStores.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - vector stores", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should create vector store", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - assert.isNotNull(vectorStore); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Delete vector store - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should delete vector store", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Delete vector store - const deletionStatus = await agents.deleteVectorStore(vectorStore.id); - assert.isTrue(deletionStatus.deleted); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("get vector store", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Retrieve vector store - const _vectorStore = await agents.getVectorStore(vectorStore.id); - assert.equal(_vectorStore.id, vectorStore.id); - console.log(`Retrieved vector store, vector store ID: ${_vectorStore.id}`); - - // Delete vector store - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("list vector stores", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // List vector stores - const vectorStores = await agents.listVectorStores(); - assert.isNotNull(vectorStores); - assert.isAtLeast(vectorStores.data.length, 1); - console.log(`Listed ${vectorStores.data.length} vector stores`); - - // Delete vector store - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("modify vector store", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Modify vector store - const updatedVectorStore = await agents.modifyVectorStore(vectorStore.id, { name: "updated" }); - assert.equal(updatedVectorStore.id, vectorStore.id); - assert.equal(updatedVectorStore.name, "updated"); - console.log( - `Updated vector store name to ${updatedVectorStore.name}, vector store ID: ${updatedVectorStore.id}`, - ); - - // Delete vector store - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should create vector store and poll", async function () { - // Create vector store - const poller = agents.createVectorStoreAndPoll(); - const vectorStore = await poller.pollUntilDone(); - assert.isNotNull(vectorStore); - assert.notEqual(vectorStore.status, "in_progress"); - console.log( - `Created vector store with status ${vectorStore.status}, vector store ID: ${vectorStore.id}`, - ); - - // Delete vector store - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/vectorStoresFileBatches.spec.ts b/sdk/ai/ai-projects/test/public/agents/vectorStoresFileBatches.spec.ts deleted file mode 100644 index e11a9453b52b..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/vectorStoresFileBatches.spec.ts +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - vector stores file batches", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should create a vector store file batch", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload files - const file1Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file1 = await agents.uploadFile(file1Content, "assistants", { fileName: "file1.txt" }); - console.log(`Uploaded file1, file1 ID: ${file1.id}`); - - const file2Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file2 = await agents.uploadFile(file2Content, "assistants", { fileName: "file2.txt" }); - console.log(`Uploaded file2, file2 ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - assert.isNotNull(vectorStoreFileBatch); - assert.isNotEmpty(vectorStoreFileBatch.id); - assert.equal(vectorStoreFileBatch.vectorStoreId, vectorStore.id); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Clean up - await agents.deleteFile(file1.id); - console.log(`Deleted file1, file1 ID: ${file1.id}`); - await agents.deleteFile(file2.id); - console.log(`Deleted file2, file2 ID: ${file2.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should retrieve a vector store file batch", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload files - const file1Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file1 = await agents.uploadFile(file1Content, "assistants", { fileName: "file1.txt" }); - console.log(`Uploaded file1, file1 ID: ${file1.id}`); - - const file2Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file2 = await agents.uploadFile(file2Content, "assistants", { fileName: "file2.txt" }); - console.log(`Uploaded file2, file2 ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Retrieve vector store file batch - const _vectorStoreFileBatch = await agents.getVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - assert.isNotNull(_vectorStoreFileBatch); - assert.equal(_vectorStoreFileBatch.id, vectorStoreFileBatch.id); - console.log( - `Retrieved vector store file batch, vector store file batch ID: ${_vectorStoreFileBatch.id}`, - ); - - // Clean up - await agents.deleteFile(file1.id); - console.log(`Deleted file1, file1 ID: ${file1.id}`); - await agents.deleteFile(file2.id); - console.log(`Deleted file2, file2 ID: ${file2.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should list vector store file batches", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload files - const file1Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file1 = await agents.uploadFile(file1Content, "assistants", { fileName: "file1.txt" }); - console.log(`Uploaded file1, file1 ID: ${file1.id}`); - - const file2Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file2 = await agents.uploadFile(file2Content, "assistants", { fileName: "file2.txt" }); - console.log(`Uploaded file2, file2 ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // List vector store files in the batch - const vectorStoreFiles = await agents.listVectorStoreFileBatchFiles( - vectorStore.id, - vectorStoreFileBatch.id, - ); - assert.isNotNull(vectorStoreFiles); - assert.equal(vectorStoreFiles.data.length, 2); - console.log( - `Listed ${vectorStoreFiles.data.length} vector store files in the batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Clean up - await agents.deleteFile(file1.id); - console.log(`Deleted file1, file1 ID: ${file1.id}`); - await agents.deleteFile(file2.id); - console.log(`Deleted file2, file2 ID: ${file2.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should cancel a vector store file batch", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload files - const file1Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file1 = await agents.uploadFile(file1Content, "assistants", { fileName: "file1.txt" }); - console.log(`Uploaded file1, file1 ID: ${file1.id}`); - - const file2Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file2 = await agents.uploadFile(file2Content, "assistants", { fileName: "file2.txt" }); - console.log(`Uploaded file2, file2 ID: ${file2.id}`); - - // Create vector store file batch - const vectorStoreFileBatch = await agents.createVectorStoreFileBatch(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - console.log( - `Created vector store file batch, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Cancel vector store file batch - const cancelled = await agents.cancelVectorStoreFileBatch( - vectorStore.id, - vectorStoreFileBatch.id, - ); - assert.isNotNull(cancelled.status); - - // Clean up - await agents.deleteFile(file1.id); - console.log(`Deleted file1, file1 ID: ${file1.id}`); - await agents.deleteFile(file2.id); - console.log(`Deleted file2, file2 ID: ${file2.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should create a vector store file batch and poll", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload files - const file1Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file1 = await agents.uploadFile(file1Content, "assistants", { fileName: "file1.txt" }); - console.log(`Uploaded file1, file1 ID: ${file1.id}`); - - const file2Content = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file2 = await agents.uploadFile(file2Content, "assistants", { fileName: "file2.txt" }); - console.log(`Uploaded file2, file2 ID: ${file2.id}`); - - // Create vector store file batch - const poller = agents.createVectorStoreFileBatchAndPoll(vectorStore.id, { - fileIds: [file1.id, file2.id], - }); - const vectorStoreFileBatch = await poller.pollUntilDone(); - assert.isNotNull(vectorStoreFileBatch); - assert.isNotEmpty(vectorStoreFileBatch.id); - assert.equal(vectorStoreFileBatch.vectorStoreId, vectorStore.id); - assert.notEqual(vectorStoreFileBatch.status, "in_progress"); - console.log( - `Created vector store file batch with status ${vectorStoreFileBatch.status}, vector store file batch ID: ${vectorStoreFileBatch.id}`, - ); - - // Clean up - await agents.deleteFile(file1.id); - console.log(`Deleted file1, file1 ID: ${file1.id}`); - await agents.deleteFile(file2.id); - console.log(`Deleted file2, file2 ID: ${file2.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/agents/vectorStoresFiles.spec.ts b/sdk/ai/ai-projects/test/public/agents/vectorStoresFiles.spec.ts deleted file mode 100644 index 86edcf72a43b..000000000000 --- a/sdk/ai/ai-projects/test/public/agents/vectorStoresFiles.spec.ts +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AgentsOperations, AIProjectsClient } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - vector stores files", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let agents: AgentsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - agents = projectsClient.agents; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and agents operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(agents); - }); - - it("should create a vector store file", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload file - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "filename.txt" }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await agents.createVectorStoreFile(vectorStore.id, { fileId: file.id }); - assert.isNotNull(vectorStoreFile); - assert.isNotEmpty(vectorStoreFile.id); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Clean up - await agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - await agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should retrieve a vector store file", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload file - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "filename.txt" }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await agents.createVectorStoreFile(vectorStore.id, { fileId: file.id }); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Retrieve vector store file - const _vectorStoreFile = await agents.getVectorStoreFile(vectorStore.id, vectorStoreFile.id); - assert.isNotNull(_vectorStoreFile); - assert.equal(_vectorStoreFile.id, vectorStoreFile.id); - console.log(`Retrieved vector store file, vector store file ID: ${_vectorStoreFile.id}`); - - // Clean up - await agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - await agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should list vector store files", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload file - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "filename.txt" }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await agents.createVectorStoreFile(vectorStore.id, { fileId: file.id }); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Clean up - await agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - await agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should delete a vector store file", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload file - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "fileName.txt" }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file - const vectorStoreFile = await agents.createVectorStoreFile(vectorStore.id, { fileId: file.id }); - console.log(`Created vector store file, vector store file ID: ${vectorStoreFile.id}`); - - // Clean up - const deletionStatus = await agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - assert(deletionStatus.deleted); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - await agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); - - it("should create a vector store file and poll.", async function () { - // Create vector store - const vectorStore = await agents.createVectorStore(); - console.log(`Created vector store, vector store ID: ${vectorStore.id}`); - - // Upload file - const fileContent = new ReadableStream({ - start(controller) { - controller.enqueue(new TextEncoder().encode("fileContent")); - controller.close(); - }, - }); - const file = await agents.uploadFile(fileContent, "assistants", { fileName: "filename.txt" }); - console.log(`Uploaded file, file ID: ${file.id}`); - - // Create vector store file and poll - const poller = agents.createVectorStoreFileAndPoll(vectorStore.id, { - fileId: file.id, - }); - const vectorStoreFile = await poller.pollUntilDone(); - assert.isNotNull(vectorStoreFile); - assert.isNotEmpty(vectorStoreFile.id); - assert.notEqual(vectorStoreFile.status, "in_progress"); - console.log( - `Created vector store file with status ${vectorStoreFile.status}, vector store file ID: ${vectorStoreFile.id}`, - ); - - // Clean up - await agents.deleteVectorStoreFile(vectorStore.id, vectorStoreFile.id); - console.log(`Deleted vector store file, vector store file ID: ${vectorStoreFile.id}`); - await agents.deleteFile(file.id); - console.log(`Deleted file, file ID: ${file.id}`); - await agents.deleteVectorStore(vectorStore.id); - console.log(`Deleted vector store, vector store ID: ${vectorStore.id}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/connections/connections.spec.ts b/sdk/ai/ai-projects/test/public/connections/connections.spec.ts deleted file mode 100644 index 639ed77daf3a..000000000000 --- a/sdk/ai/ai-projects/test/public/connections/connections.spec.ts +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AIProjectsClient, ConnectionsOperations } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("Agents - assistants", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let connections: ConnectionsOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - connections = projectsClient.connections; - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("client and connection operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(connections); - }); - - it("should list connections", async function () { - // List connections - const connectionsList = await connections.listConnections(); - assert.isNotNull(connectionsList); - assert.isAtLeast(connectionsList.length, 1); - console.log(`Retrieved ${connectionsList.length} connections`); - }); - - it("should retrieve a connection without secrets", async function () { - // List connections - const connectionsList = await connections.listConnections(); - assert.isNotNull(connectionsList); - assert.isAtLeast(connectionsList.length, 1); - - // Retrieve one connection - for (const _connection of connectionsList) { - const connectionName = _connection.name; - const connection = await connections.getConnection(connectionName); - assert.isNotNull(connection); - assert.equal(connection.name, connectionName); - console.log(`Retrieved connection, connection name: ${connection.name}`); - } - }); - - it("should retrieve a connection with secrets", async function () { - // List connections - const connectionsList = await connections.listConnections(); - assert.isNotNull(connectionsList); - assert.isAtLeast(connectionsList.length, 1); - - // Retrieve one connection with secrets - for (const _connection of connectionsList) { - const connectionName = _connection.name; - const connection = await connections.getConnectionWithSecrets(connectionName); - assert.isNotNull(connection); - assert.equal(connection.name, connectionName); - console.log(`Retrieved connection with secrets, connection name: ${connection.name}`); - } - }); -}); diff --git a/sdk/ai/ai-projects/test/public/sampleTest.spec.ts b/sdk/ai/ai-projects/test/public/sampleTest.spec.ts new file mode 100644 index 000000000000..d4919ac91ac5 --- /dev/null +++ b/sdk/ai/ai-projects/test/public/sampleTest.spec.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createRecorder } from "./utils/recordedClient.js"; +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async function () { + // recorder = await createRecorder(this); + }); + + afterEach(async function () { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/sdk/ai/ai-projects/test/public/telemetry/telemetry.spec.ts b/sdk/ai/ai-projects/test/public/telemetry/telemetry.spec.ts deleted file mode 100644 index 1f19f895196f..000000000000 --- a/sdk/ai/ai-projects/test/public/telemetry/telemetry.spec.ts +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { Recorder, VitestTestContext } from "@azure-tools/test-recorder"; -import type { AIProjectsClient, TelemetryOperations } from "../../../src/index.js"; -import { createRecorder, createProjectsClient } from "../utils/createClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("AI Projects - Telemetry", () => { - let recorder: Recorder; - let projectsClient: AIProjectsClient; - let telemetry: TelemetryOperations; - - beforeEach(async function (context: VitestTestContext) { - recorder = await createRecorder(context); - projectsClient = createProjectsClient(recorder); - telemetry = projectsClient.telemetry; - }); - - afterEach(async function () { - await recorder.stop(); - }); - it("client and connection operations are accessible", async function () { - assert.isNotNull(projectsClient); - assert.isNotNull(telemetry); - }); - - it("update settings", async function () { - assert.equal(telemetry.getSettings().enableContentRecording, false); - telemetry.updateSettings({ enableContentRecording: true }); - assert.equal(telemetry.getSettings().enableContentRecording, true); - }); - - it("get settings", async function () { - const options = telemetry.getSettings(); - assert.equal(options.enableContentRecording, false); - options.enableContentRecording = true; - assert.equal(telemetry.getSettings().enableContentRecording, false); - }); - - it("get app insights connection string", async function () { - const connectionString = await telemetry.getConnectionString(); - assert.isNotEmpty(connectionString); - console.log(`Connection string retrieved ${connectionString}`); - }); -}); diff --git a/sdk/ai/ai-projects/test/public/utils/createClient.ts b/sdk/ai/ai-projects/test/public/utils/createClient.ts deleted file mode 100644 index 4232d503bf3e..000000000000 --- a/sdk/ai/ai-projects/test/public/utils/createClient.ts +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import type { RecorderStartOptions, VitestTestContext } from "@azure-tools/test-recorder"; -import { Recorder } from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { AIProjectsClient } from "../../../src/index.js"; -import type { ClientOptions } from "@azure-rest/core-client"; -import type { PipelineRequest, PipelineResponse } from "@azure/core-rest-pipeline"; -import { createHttpHeaders } from "@azure/core-rest-pipeline"; - -const replaceableVariables: Record = { - GENERIC_STRING: "Sanitized", - ENDPOINT: "Sanitized.azure.com", - SUBSCRIPTION_ID: "00000000-0000-0000-0000-000000000000", - RESOURCE_GROUP_NAME: "00000", - WORKSPACE_NAME: "00000", - DATASET_NAME: "00000", - TENANT_ID: "00000000-0000-0000-0000-000000000000", - USER_OBJECT_ID: "00000000-0000-0000-0000-000000000000", - API_KEY: "00000000000000000000000000000000000000000000000000000000000000000000", - AZURE_AI_PROJECTS_CONNECTION_STRING: `Sanitized.azure.com;00000000-0000-0000-0000-000000000000;00000;00000`, -}; - -const recorderEnvSetup: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables, - sanitizerOptions: { - generalSanitizers: [ - { - regex: true, - target: "(%2F|/)?subscriptions(%2F|/)([-\\w\\._\\(\\)]+)", - value: replaceableVariables.SUBSCRIPTION_ID, - groupForReplace: "3", - }, - { - regex: true, - target: "(%2F|/)?resource[gG]roups(%2F|/)([-\\w\\._\\(\\)]+)", - value: replaceableVariables.RESOURCE_GROUP_NAME, - groupForReplace: "3", - }, - { - regex: true, - target: "/workspaces/([-\\w\\._\\(\\)]+)", - value: replaceableVariables.WORKSPACE_NAME, - groupForReplace: "1", - }, - { - regex: true, - target: "/userAssignedIdentities/([-\\w\\._\\(\\)]+)", - value: replaceableVariables.GENERIC_STRING, - groupForReplace: "1", - }, - { - regex: true, - target: "/components/([-\\w\\._\\(\\)]+)", - value: replaceableVariables.GENERIC_STRING, - groupForReplace: "1", - }, - { - regex: true, - target: "/vaults/([-\\w\\._\\(\\)]+)", - value: replaceableVariables.GENERIC_STRING, - groupForReplace: "1", - }, - { - regex: true, - target: "(azureml|http|https):\\/\\/([^\\/]+)", - value: replaceableVariables.ENDPOINT, - groupForReplace: "2", - }, - ], - bodyKeySanitizers: [ - { - jsonPath: "properties.ConnectionString", - value: - "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://region.applicationinsights.azure.com/;LiveEndpoint=https://region.livediagnostics.monitor.azure.com/;ApplicationId=00000000-0000-0000-0000-000000000000", - }, - { jsonPath: "properties.credentials.key", value: replaceableVariables.API_KEY }, - ], - }, - removeCentralSanitizers: ["AZSDK3430", "AZSDK3493"], -}; - -/** - * creates the recorder and reads the environment variables from the `.env` file. - * Should be called first in the test suite to make sure environment variables are - * read before they are being used. - */ -export async function createRecorder(context: VitestTestContext): Promise { - const recorder = new Recorder(context); - await recorder.start(recorderEnvSetup); - return recorder; -} - -export function createProjectsClient( - recorder?: Recorder, - options?: ClientOptions, -): AIProjectsClient { - const credential = createTestCredential(); - const connectionString = process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - return AIProjectsClient.fromConnectionString( - connectionString, - credential, - recorder ? recorder.configureClientOptions(options ?? {}) : options, - ); -} - -export function createMockProjectsClient( - responseFn: (request: PipelineRequest) => Partial, -): AIProjectsClient { - const options: ClientOptions = { additionalPolicies: [] }; - options.additionalPolicies?.push({ - policy: { - name: "RequestMockPolicy", - sendRequest: async (req) => { - const response = responseFn(req); - return { - headers: createHttpHeaders(), - status: 200, - request: req, - ...response, - } as PipelineResponse; - }, - }, - position: "perCall", - }); - const credential = createTestCredential(); - const connectionString = process.env["AZURE_AI_PROJECTS_CONNECTION_STRING"] || ""; - return AIProjectsClient.fromConnectionString(connectionString, credential, options); -} diff --git a/sdk/ai/ai-projects/test/public/utils/env.ts b/sdk/ai/ai-projects/test/public/utils/env.ts deleted file mode 100644 index 866412f4082d..000000000000 --- a/sdk/ai/ai-projects/test/public/utils/env.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import * as dotenv from "dotenv"; - -dotenv.config(); diff --git a/sdk/ai/ai-projects/test/public/utils/recordedClient.ts b/sdk/ai/ai-projects/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..6e425fdcfdf9 --- /dev/null +++ b/sdk/ai/ai-projects/test/public/utils/recordedClient.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + Recorder, + RecorderStartOptions, + VitestTestContext, +} from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder( + context: VitestTestContext, +): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/sdk/ai/ai-projects/tsconfig.browser.config.json b/sdk/ai/ai-projects/tsconfig.browser.config.json deleted file mode 100644 index 75871518e3a0..000000000000 --- a/sdk/ai/ai-projects/tsconfig.browser.config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["./tsconfig.test.json", "../../../tsconfig.browser.base.json"] -} diff --git a/sdk/ai/ai-projects/tsconfig.json b/sdk/ai/ai-projects/tsconfig.json deleted file mode 100644 index 273d9078a24a..000000000000 --- a/sdk/ai/ai-projects/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "references": [ - { "path": "./tsconfig.src.json" }, - { "path": "./tsconfig.samples.json" }, - { "path": "./tsconfig.test.json" } - ] -} diff --git a/sdk/ai/ai-projects/tsconfig.samples.json b/sdk/ai/ai-projects/tsconfig.samples.json deleted file mode 100644 index 2d4719a40861..000000000000 --- a/sdk/ai/ai-projects/tsconfig.samples.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../../tsconfig.samples.base.json", - "compilerOptions": { - "paths": { - "@azure-rest/ai-projects": ["./dist/esm"] - } - } -} diff --git a/sdk/ai/ai-projects/tsconfig.src.json b/sdk/ai/ai-projects/tsconfig.src.json deleted file mode 100644 index a244b17dbda6..000000000000 --- a/sdk/ai/ai-projects/tsconfig.src.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "../../../tsconfig.lib.json", - "compilerOptions": { - "skipLibCheck": true - } -} diff --git a/sdk/ai/ai-projects/tsconfig.test.json b/sdk/ai/ai-projects/tsconfig.test.json deleted file mode 100644 index c3b436a98976..000000000000 --- a/sdk/ai/ai-projects/tsconfig.test.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": ["./tsconfig.src.json", "../../../tsconfig.test.base.json"], - "compilerOptions": { - "skipLibCheck": true - } -} diff --git a/sdk/ai/ai-projects/tsp-location.yaml b/sdk/ai/ai-projects/tsp-location.yaml index c0cd4f77cb68..068826d8952a 100644 --- a/sdk/ai/ai-projects/tsp-location.yaml +++ b/sdk/ai/ai-projects/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Projects -commit: 0d2ca01a170641d8b1f5dace38b8995bb7563be8 -repo: Azure/azure-rest-api-specs +commit: ea5f848a0840194ec52209ddd6690bd239f2a03d +repo: /mnt/vss/_work/1/s/azure-rest-api-specs additionalDirectories: diff --git a/sdk/ai/ai-projects/vitest.browser.config.ts b/sdk/ai/ai-projects/vitest.browser.config.ts deleted file mode 100644 index a42d98966103..000000000000 --- a/sdk/ai/ai-projects/vitest.browser.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "../../../vitest.browser.shared.config.ts"; - -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - testTimeout: 100000, - hookTimeout: 50000, - include: [ - "dist-test/browser/**/**/*.spec.js", - ], - }, - }), -); diff --git a/sdk/ai/ai-projects/vitest.config.ts b/sdk/ai/ai-projects/vitest.config.ts deleted file mode 100644 index 95d8903c0f43..000000000000 --- a/sdk/ai/ai-projects/vitest.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig, mergeConfig } from "vitest/config"; -import viteConfig from "../../../vitest.shared.config.ts"; - -export default mergeConfig( - viteConfig, - defineConfig({ - test: { - testTimeout: 100000, - hookTimeout: 50000, - }, - }) -); diff --git a/sdk/ai/ai-projects/vitest.esm.config.ts b/sdk/ai/ai-projects/vitest.esm.config.ts deleted file mode 100644 index 2f6e757a54f7..000000000000 --- a/sdk/ai/ai-projects/vitest.esm.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { mergeConfig } from "vitest/config"; -import vitestConfig from "./vitest.config.ts"; -import vitestEsmConfig from "../../../vitest.esm.shared.config.ts"; - -export default mergeConfig( - vitestConfig, - vitestEsmConfig -);