-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agent CRUD tests and sample (#31581)
Created Test Infrastructure for testing Created test for agent crud operations Create sample for agent basic ### What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen? ### Are there test cases added in this PR? _(If not, why?)_ Yes ### Provide a list of related PRs _(if any)_ ### Command used to generate this PR:**_(Applicable only to SDK release request PRs)_ ### Checklists - [ ] Added impacted package name to the issue description - [ ] Does this PR needs any fixes in the SDK Generator?** _(If so, create an Issue in the [Autorest/typescript](https://github.com/Azure/autorest.typescript) repository and link it here)_ - [ ] Added a changelog (if necessary)
- Loading branch information
Showing
37 changed files
with
342 additions
and
68 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
## 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 { ClientOptions } from '@azure-rest/core-client'; | ||
import { Pipeline } from '@azure/core-rest-pipeline'; | ||
import { RequestParameters } from '@azure-rest/core-client'; | ||
import { TokenCredential } from '@azure/core-auth'; | ||
|
||
// @public (undocumented) | ||
export interface AgentsOperations { | ||
// Warning: (ae-forgotten-export) The symbol "AgentsCancelRunParameters" needs to be exported by the entry point index.d.ts | ||
cancelRun: (threadId: string, runId: string, options?: AgentsCancelRunParameters) => Promise<ThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "CreateAgentOptions" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "AgentOutput" needs to be exported by the entry point index.d.ts | ||
createAgent: (options: CreateAgentOptions) => Promise<AgentOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsCreateMessageParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "ThreadMessageOutput" needs to be exported by the entry point index.d.ts | ||
createMessage: (threadId: string, options: AgentsCreateMessageParameters) => Promise<ThreadMessageOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsCreateRunParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "ThreadRunOutput" needs to be exported by the entry point index.d.ts | ||
createRun: (threadId: string, options: AgentsCreateRunParameters) => Promise<ThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsCreateThreadParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "AgentThreadOutput" needs to be exported by the entry point index.d.ts | ||
createThread: (options: AgentsCreateThreadParameters) => Promise<AgentThreadOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsCreateThreadAndRunParameters" needs to be exported by the entry point index.d.ts | ||
createThreadAndRun: (options: AgentsCreateThreadAndRunParameters) => Promise<ThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentDeletionStatusOutput" needs to be exported by the entry point index.d.ts | ||
deleteAgent: (assistantId: string) => Promise<AgentDeletionStatusOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsDeleteFileParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "FileDeletionStatusOutput" needs to be exported by the entry point index.d.ts | ||
deleteFile: (fileId: string, options?: AgentsDeleteFileParameters) => Promise<FileDeletionStatusOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsDeleteThreadParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "ThreadDeletionStatusOutput" needs to be exported by the entry point index.d.ts | ||
deleteThread: (threadId: string, options?: AgentsDeleteThreadParameters) => Promise<ThreadDeletionStatusOutput>; | ||
getAgent: (assistantId: string) => Promise<AgentOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsGetFileParameters" needs to be exported by the entry point index.d.ts | ||
getFile: (fileId: string, options?: AgentsGetFileParameters) => Promise<OpenAIFileOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsGetFileContentParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "FileContentResponseOutput" needs to be exported by the entry point index.d.ts | ||
getFileContent: (fileId: string, options?: AgentsGetFileContentParameters) => Promise<FileContentResponseOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsGetRunParameters" needs to be exported by the entry point index.d.ts | ||
getRun: (threadId: string, runId: string, options?: AgentsGetRunParameters) => Promise<ThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsGetThreadParameters" needs to be exported by the entry point index.d.ts | ||
getThread: (threadId: string, options?: AgentsGetThreadParameters) => Promise<AgentThreadOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsListAgentsQueryParamProperties" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "OpenAIPageableListOfAgentOutput" needs to be exported by the entry point index.d.ts | ||
listAgents: (options?: AgentsListAgentsQueryParamProperties) => Promise<OpenAIPageableListOfAgentOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsListFilesParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "FileListResponseOutput" needs to be exported by the entry point index.d.ts | ||
listFiles: (options?: AgentsListFilesParameters) => Promise<FileListResponseOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsListMessagesParameters" needs to be exported by the entry point index.d.ts | ||
listMessages: (threadId: string, options?: AgentsListMessagesParameters) => Promise<ThreadMessageOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsListRunsParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "OpenAIPageableListOfThreadRunOutput" needs to be exported by the entry point index.d.ts | ||
listRuns: (threadId: string, options?: AgentsListRunsParameters) => Promise<OpenAIPageableListOfThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsSubmitToolOutputsToRunParameters" needs to be exported by the entry point index.d.ts | ||
submitToolOutputsToRun: (threadId: string, runId: string, options: AgentsSubmitToolOutputsToRunParameters) => Promise<ThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "UpdateAgentOptions" needs to be exported by the entry point index.d.ts | ||
updateAgent: (assistantId: string, options: UpdateAgentOptions) => Promise<AgentOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsUpdateMessageParameters" needs to be exported by the entry point index.d.ts | ||
updateMessage: (threadId: string, messageId: string, options: AgentsUpdateMessageParameters) => Promise<ThreadMessageOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsUpdateRunParameters" needs to be exported by the entry point index.d.ts | ||
updateRun: (threadId: string, runId: string, options: AgentsUpdateRunParameters) => Promise<ThreadRunOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsUpdateThreadParameters" needs to be exported by the entry point index.d.ts | ||
updateThread: (threadId: string, options: AgentsUpdateThreadParameters) => Promise<AgentThreadOutput>; | ||
// Warning: (ae-forgotten-export) The symbol "AgentsUploadFileParameters" needs to be exported by the entry point index.d.ts | ||
// Warning: (ae-forgotten-export) The symbol "OpenAIFileOutput" needs to be exported by the entry point index.d.ts | ||
uploadFile: (options: AgentsUploadFileParameters) => Promise<OpenAIFileOutput>; | ||
} | ||
|
||
// @public (undocumented) | ||
export class AIProjectsClient { | ||
// Warning: (ae-forgotten-export) The symbol "AIProjectsClientOptions" needs to be exported by the entry point index.d.ts | ||
constructor(endpointParam: string, subscriptionId: string, resourceGroupName: string, projectName: string, credential: TokenCredential, options?: AIProjectsClientOptions); | ||
readonly agents: AgentsOperations; | ||
// Warning: (ae-forgotten-export) The symbol "CreateProjectsClient" needs to be exported by the entry point index.d.ts | ||
static fromConnectionString(connectionString: string, credential: TokenCredential, options?: CreateProjectsClient): AIProjectsClient; | ||
readonly pipeline: Pipeline; | ||
} | ||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
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"] || "<endpoint>>;<subscription>;<resource group>;<project>"; | ||
|
||
export async function main(): Promise<void> { | ||
const client = AIProjectsClient.fromConnectionString(connectionString || "", new DefaultAzureCredential()); | ||
|
||
const agent = await client.agents.createAgent({model:"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`); | ||
} | ||
|
||
main().catch((err) => { | ||
console.error("The sample encountered an error:", err); | ||
}); |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.