From 2ea046bc4d695194294721c81bdb56f0a2d0ba9f Mon Sep 17 00:00:00 2001 From: Gerardo Lecaros <10088504+glecaros@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:09:24 -0800 Subject: [PATCH] [azopenaiassistants] Updates for 2024-10-01-preview (#23730) * hash+gen * Adding in MessageAttachmentToolDefinition * Accidental copy/paste * Updating doc comment for MessageAttachmentToolDefinition * Update docindex.yml to use Python 3.11 (#23719) Co-authored-by: Daniel Jurek * Refresh OIDC token in azadmin test resources scripts (#23722) * remove pkg.go.dev link in readme (#23708) * remove pkg.go.dev link in readme * fix changelog * upgrade typesspec-go (#23720) * [azopenai] Inference changes for 2024-10-01-preview (#23672) * update for 1.2.0 release (#23728) * Sync eng/common directory with azure-sdk-tools for PR 9328 (#23692) * ensure that ChangedServices value within the generated pr diff is always properly an array of strings * upload the changed services as an attachment named AdditionalTags in save-package-properties.yml, to allow PipelineWitness to tag public builds during log processing --------- Co-authored-by: Scott Beddall Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com> Co-authored-by: Patrick Hallisey * refine typespec release tool (#23735) * Added permissions & resourcetype parameters in listblob response (#23687) * one * Add permissions in ListBlobsIncludeItems * Add permissions in ListBlobsIncludeItems * Appending the value to swagger * Added Owner,Group,Permissions,Acl,ResourceType in ListBlob Response * [Storage] Prep for stg 95 GA release (#23742) * Prep for stg 95 GA release * Update CHANGELOG.md format for changelog * Add SparseCheckoutPaths to archetype-typespec-emitter.yml (#23740) Co-authored-by: Wei Hu * [azopenai] Update azopenai changelog. (#23732) * Fix missing stress matrix display name filter (#23726) Co-authored-by: Ben Broderick Phillips * update date (#23746) * [azopenai] non-existing deployments fail in a different way now. (#23747) * Increment package version after release of ai/azopenai (#23750) * [Release] sdk/resourcemanager/hybridcompute/armhybridcompute/2.1.0-beta.1 generation from spec commit: 63d530d0def1c624f5d42d39170ff4ac196522e2 (#23753) * Increment package version after release of security/keyvault/azadmin (#23749) * Update azopenai* to use hardcoded variable group config (#23748) * Update azopenai* to use hardcoded variable group config * Remove bicep template for ai services * [Release] sdk/resourcemanager/networkcloud/armnetworkcloud/1.2.0-beta.1 generation from spec commit: 4e46346c63935bace7e24f806b4b084f2589d660 (#23757) * Add helpers to log a GitHub "notice" (#23764) Co-authored-by: Mike Harder * Increment package version after release of storage/azdatalake (#23745) * Increment package version after release of storage/azblob (#23744) * Increment package version after release of storage/azfile (#23743) * batching adjustments for create-prjobmatrix (#23773) Co-authored-by: Scott Beddall * changelog * updated version * Update sdk/ai/azopenaiassistants/CHANGELOG.md Co-authored-by: Wes Haggard * updated --------- Co-authored-by: ripark Co-authored-by: Richard Park <51494936+richardpark-msft@users.noreply.github.com> Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Daniel Jurek Co-authored-by: Ben Broderick Phillips Co-authored-by: Chenjie Shi Co-authored-by: Ashley Stanton-Nurse Co-authored-by: Scott Beddall Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com> Co-authored-by: Patrick Hallisey Co-authored-by: ashruti-msft <137055338+ashruti-msft@users.noreply.github.com> Co-authored-by: tanyasethi-msft <124860586+tanyasethi-msft@users.noreply.github.com> Co-authored-by: Wei Hu Co-authored-by: Grace Wilcox <43627800+gracewilcox@users.noreply.github.com> Co-authored-by: Judy Liu Co-authored-by: Mike Harder Co-authored-by: Wes Haggard --- sdk/ai/azopenaiassistants/CHANGELOG.md | 11 ++- sdk/ai/azopenaiassistants/autorest.md | 16 ++++ sdk/ai/azopenaiassistants/client.go | 78 +++++++++---------- sdk/ai/azopenaiassistants/client_test.go | 17 ++-- sdk/ai/azopenaiassistants/constants.go | 16 ---- .../internal/transform/transform.go | 20 +---- sdk/ai/azopenaiassistants/models.go | 17 ++-- sdk/ai/azopenaiassistants/models_custom.go | 45 +++++++++++ sdk/ai/azopenaiassistants/models_serde.go | 39 +++------- .../testdata/tsp-location.yaml | 2 +- sdk/ai/azopenaiassistants/version.go | 2 +- 11 files changed, 142 insertions(+), 121 deletions(-) diff --git a/sdk/ai/azopenaiassistants/CHANGELOG.md b/sdk/ai/azopenaiassistants/CHANGELOG.md index de8f13abca6d..2346663cea94 100644 --- a/sdk/ai/azopenaiassistants/CHANGELOG.md +++ b/sdk/ai/azopenaiassistants/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 0.3.0 (2024-12-03) + +### Features Added + +- Added support for the `ParallelToolCalls` option. + +### Breaking Changes + +- `MessageAttachmentToolAssignment` is now `MessageAttachmentToolDefinition`. + ## 0.2.1 (2024-09-10) ### Features Added @@ -23,7 +33,6 @@ ### Bugs Fixed - ThreadRun.RequiredAction was deserialized incorrectly, making it impossible to actually resubmit a tool output. (PR#22834) - ## 0.1.0 (2024-03-05) * Initial release of the `azopenaiassistants` library diff --git a/sdk/ai/azopenaiassistants/autorest.md b/sdk/ai/azopenaiassistants/autorest.md index cfef00356f3b..dd54872470e8 100644 --- a/sdk/ai/azopenaiassistants/autorest.md +++ b/sdk/ai/azopenaiassistants/autorest.md @@ -155,6 +155,22 @@ directive: return $; ``` +MessageAttachmentToolDefinition + +```yaml +directive: + - from: swagger-document + where: $.definitions + transform: | + // create the dummy type that I can use to point to my manually created union + $.MessageAttachmentToolDefinition = { + "x-ms-external": true, + "type": "object", + "properties": { "ignored": { "type": "string" } }, + "x-ms-client-name": "MessageAttachmentToolDefinition" + }; +``` + ## Model -> DeploymentName ```yaml diff --git a/sdk/ai/azopenaiassistants/client.go b/sdk/ai/azopenaiassistants/client.go index d6ab9bfc959a..e8db46718417 100644 --- a/sdk/ai/azopenaiassistants/client.go +++ b/sdk/ai/azopenaiassistants/client.go @@ -33,7 +33,7 @@ type Client struct { // CancelRun - Cancels a run of an in progress thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread being run. // - runID - The ID of the run to cancel. // - options - CancelRunOptions contains the optional parameters for the Client.CancelRun method. @@ -87,7 +87,7 @@ func (client *Client) cancelRunHandleResponse(resp *http.Response) (CancelRunRes // batch as soon as possible. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store that the file batch belongs to. // - batchID - The ID of the file batch to cancel. // - options - CancelVectorStoreFileBatchOptions contains the optional parameters for the Client.CancelVectorStoreFileBatch @@ -141,7 +141,7 @@ func (client *Client) cancelVectorStoreFileBatchHandleResponse(resp *http.Respon // CreateAssistant - Creates a new assistant. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - body - The request details to use when creating a new assistant. // - options - CreateAssistantOptions contains the optional parameters for the Client.CreateAssistant method. func (client *Client) CreateAssistant(ctx context.Context, body CreateAssistantBody, options *CreateAssistantOptions) (CreateAssistantResponse, error) { @@ -188,7 +188,7 @@ func (client *Client) createAssistantHandleResponse(resp *http.Response) (Create // CreateMessage - Creates a new message on a specified thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to create the new message on. // - body - A single message within an assistant thread, as provided during that thread's creation for its initial state. // - options - CreateMessageOptions contains the optional parameters for the Client.CreateMessage method. @@ -240,7 +240,7 @@ func (client *Client) createMessageHandleResponse(resp *http.Response) (CreateMe // CreateRun - Creates a new run for an assistant thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to run. // - createRunBody - The details used when creating a new run of an assistant thread. // - options - CreateRunOptions contains the optional parameters for the Client.CreateRun method. @@ -292,7 +292,7 @@ func (client *Client) createRunHandleResponse(resp *http.Response) (CreateRunRes // CreateThread - Creates a new thread. Threads contain messages and can be run by assistants. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - body - The details used to create a new assistant thread. // - options - CreateThreadOptions contains the optional parameters for the Client.CreateThread method. func (client *Client) CreateThread(ctx context.Context, body CreateThreadBody, options *CreateThreadOptions) (CreateThreadResponse, error) { @@ -339,7 +339,7 @@ func (client *Client) createThreadHandleResponse(resp *http.Response) (CreateThr // CreateThreadAndRun - Creates a new assistant thread and immediately starts a run using that new thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - body - The details used when creating and immediately running a new assistant thread. // - options - CreateThreadAndRunOptions contains the optional parameters for the Client.CreateThreadAndRun method. func (client *Client) CreateThreadAndRun(ctx context.Context, body CreateAndRunThreadBody, options *CreateThreadAndRunOptions) (CreateThreadAndRunResponse, error) { @@ -386,7 +386,7 @@ func (client *Client) createThreadAndRunHandleResponse(resp *http.Response) (Cre // CreateVectorStore - Creates a vector store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - body - Request object for creating a vector store. // - options - CreateVectorStoreOptions contains the optional parameters for the Client.CreateVectorStore method. func (client *Client) CreateVectorStore(ctx context.Context, body VectorStoreBody, options *CreateVectorStoreOptions) (CreateVectorStoreResponse, error) { @@ -433,7 +433,7 @@ func (client *Client) createVectorStoreHandleResponse(resp *http.Response) (Crea // CreateVectorStoreFile - Create a vector store file by attaching a file to a vector store. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store for which to create a File. // - body - Request object for creating a vector store file. // - options - CreateVectorStoreFileOptions contains the optional parameters for the Client.CreateVectorStoreFile method. @@ -485,7 +485,7 @@ func (client *Client) createVectorStoreFileHandleResponse(resp *http.Response) ( // CreateVectorStoreFileBatch - Create a vector store file batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store for which to create a File Batch. // - options - CreateVectorStoreFileBatchOptions contains the optional parameters for the Client.CreateVectorStoreFileBatch // method. @@ -537,7 +537,7 @@ func (client *Client) createVectorStoreFileBatchHandleResponse(resp *http.Respon // DeleteAssistant - Deletes an assistant. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - assistantID - The ID of the assistant to delete. // - options - DeleteAssistantOptions contains the optional parameters for the Client.DeleteAssistant method. func (client *Client) DeleteAssistant(ctx context.Context, assistantID string, options *DeleteAssistantOptions) (DeleteAssistantResponse, error) { @@ -585,7 +585,7 @@ func (client *Client) deleteAssistantHandleResponse(resp *http.Response) (Delete // DeleteFile - Delete a previously uploaded file. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - fileID - The ID of the file to delete. // - options - DeleteFileOptions contains the optional parameters for the Client.DeleteFile method. func (client *Client) DeleteFile(ctx context.Context, fileID string, options *DeleteFileOptions) (DeleteFileResponse, error) { @@ -633,7 +633,7 @@ func (client *Client) deleteFileHandleResponse(resp *http.Response) (DeleteFileR // DeleteThread - Deletes an existing thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to delete. // - options - DeleteThreadOptions contains the optional parameters for the Client.DeleteThread method. func (client *Client) DeleteThread(ctx context.Context, threadID string, options *DeleteThreadOptions) (DeleteThreadResponse, error) { @@ -681,7 +681,7 @@ func (client *Client) deleteThreadHandleResponse(resp *http.Response) (DeleteThr // DeleteVectorStore - Deletes the vector store object matching the specified ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store to delete. // - options - DeleteVectorStoreOptions contains the optional parameters for the Client.DeleteVectorStore method. func (client *Client) DeleteVectorStore(ctx context.Context, vectorStoreID string, options *DeleteVectorStoreOptions) (DeleteVectorStoreResponse, error) { @@ -730,7 +730,7 @@ func (client *Client) deleteVectorStoreHandleResponse(resp *http.Response) (Dele // will not be deleted. To delete the file, use the delete file endpoint. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store that the file belongs to. // - fileID - The ID of the file to delete its relationship to the vector store. // - options - DeleteVectorStoreFileOptions contains the optional parameters for the Client.DeleteVectorStoreFile method. @@ -783,7 +783,7 @@ func (client *Client) deleteVectorStoreFileHandleResponse(resp *http.Response) ( // GetAssistant - Retrieves an existing assistant. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - assistantID - The ID of the assistant to retrieve. // - options - GetAssistantOptions contains the optional parameters for the Client.GetAssistant method. func (client *Client) GetAssistant(ctx context.Context, assistantID string, options *GetAssistantOptions) (GetAssistantResponse, error) { @@ -831,7 +831,7 @@ func (client *Client) getAssistantHandleResponse(resp *http.Response) (GetAssist // GetFile - Returns information about a specific file. Does not retrieve file content. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - fileID - The ID of the file to retrieve. // - options - GetFileOptions contains the optional parameters for the Client.GetFile method. func (client *Client) GetFile(ctx context.Context, fileID string, options *GetFileOptions) (GetFileResponse, error) { @@ -879,7 +879,7 @@ func (client *Client) getFileHandleResponse(resp *http.Response) (GetFileRespons // GetMessage - Gets an existing message from an existing thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to retrieve the specified message from. // - messageID - The ID of the message to retrieve from the specified thread. // - options - GetMessageOptions contains the optional parameters for the Client.GetMessage method. @@ -932,7 +932,7 @@ func (client *Client) getMessageHandleResponse(resp *http.Response) (GetMessageR // GetRun - Gets an existing run from an existing thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to retrieve run information from. // - runID - The ID of the thread to retrieve information about. // - options - GetRunOptions contains the optional parameters for the Client.GetRun method. @@ -985,7 +985,7 @@ func (client *Client) getRunHandleResponse(resp *http.Response) (GetRunResponse, // GetRunStep - Gets a single run step from a thread run. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread that was run. // - runID - The ID of the specific run to retrieve the step from. // - stepID - The ID of the step to retrieve information about. @@ -1043,7 +1043,7 @@ func (client *Client) getRunStepHandleResponse(resp *http.Response) (GetRunStepR // GetThread - Gets information about an existing thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to retrieve information about. // - options - GetThreadOptions contains the optional parameters for the Client.GetThread method. func (client *Client) GetThread(ctx context.Context, threadID string, options *GetThreadOptions) (GetThreadResponse, error) { @@ -1091,7 +1091,7 @@ func (client *Client) getThreadHandleResponse(resp *http.Response) (GetThreadRes // GetVectorStore - Returns the vector store object matching the specified ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store to retrieve. // - options - GetVectorStoreOptions contains the optional parameters for the Client.GetVectorStore method. func (client *Client) GetVectorStore(ctx context.Context, vectorStoreID string, options *GetVectorStoreOptions) (GetVectorStoreResponse, error) { @@ -1139,7 +1139,7 @@ func (client *Client) getVectorStoreHandleResponse(resp *http.Response) (GetVect // GetVectorStoreFile - Retrieves a vector store file. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store that the file belongs to. // - fileID - The ID of the file being retrieved. // - options - GetVectorStoreFileOptions contains the optional parameters for the Client.GetVectorStoreFile method. @@ -1192,7 +1192,7 @@ func (client *Client) getVectorStoreFileHandleResponse(resp *http.Response) (Get // GetVectorStoreFileBatch - Retrieve a vector store file batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store that the file batch belongs to. // - batchID - The ID of the file batch being retrieved. // - options - GetVectorStoreFileBatchOptions contains the optional parameters for the Client.GetVectorStoreFileBatch @@ -1246,7 +1246,7 @@ func (client *Client) getVectorStoreFileBatchHandleResponse(resp *http.Response) // ListAssistants - Gets a list of assistants that were previously created. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - options - ListAssistantsOptions contains the optional parameters for the Client.ListAssistants method. func (client *Client) internalListAssistants(ctx context.Context, options *ListAssistantsOptions) (ListAssistantsResponse, error) { var err error @@ -1303,7 +1303,7 @@ func (client *Client) listAssistantsHandleResponse(resp *http.Response) (ListAss // ListFiles - Gets a list of previously uploaded files. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - options - ListFilesOptions contains the optional parameters for the Client.ListFiles method. func (client *Client) ListFiles(ctx context.Context, options *ListFilesOptions) (ListFilesResponse, error) { var err error @@ -1351,7 +1351,7 @@ func (client *Client) listFilesHandleResponse(resp *http.Response) (ListFilesRes // ListMessages - Gets a list of messages that exist on a thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to list messages from. // - options - ListMessagesOptions contains the optional parameters for the Client.ListMessages method. func (client *Client) internalListMessages(ctx context.Context, threadID string, options *ListMessagesOptions) (ListMessagesResponse, error) { @@ -1416,7 +1416,7 @@ func (client *Client) listMessagesHandleResponse(resp *http.Response) (ListMessa // ListRunSteps - Gets a list of run steps from a thread run. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread that was run. // - runID - The ID of the run to list steps from. // - options - ListRunStepsOptions contains the optional parameters for the Client.ListRunSteps method. @@ -1483,7 +1483,7 @@ func (client *Client) listRunStepsHandleResponse(resp *http.Response) (ListRunSt // ListRuns - Gets a list of runs for a specified thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to list runs from. // - options - ListRunsOptions contains the optional parameters for the Client.ListRuns method. func (client *Client) internalListRuns(ctx context.Context, threadID string, options *ListRunsOptions) (ListRunsResponse, error) { @@ -1545,7 +1545,7 @@ func (client *Client) listRunsHandleResponse(resp *http.Response) (ListRunsRespo // ListVectorStoreFileBatchFiles - Returns a list of vector store files in a batch. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store that the file batch belongs to. // - batchID - The ID of the file batch that the files belong to. // - options - ListVectorStoreFileBatchFilesOptions contains the optional parameters for the Client.ListVectorStoreFileBatchFiles @@ -1616,7 +1616,7 @@ func (client *Client) listVectorStoreFileBatchFilesHandleResponse(resp *http.Res // ListVectorStoreFiles - Returns a list of vector store files. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store that the files belong to. // - options - ListVectorStoreFilesOptions contains the optional parameters for the Client.ListVectorStoreFiles method. func (client *Client) internalListVectorStoreFiles(ctx context.Context, vectorStoreID string, options *ListVectorStoreFilesOptions) (ListVectorStoreFilesResponse, error) { @@ -1681,7 +1681,7 @@ func (client *Client) listVectorStoreFilesHandleResponse(resp *http.Response) (L // ListVectorStores - Returns a list of vector stores. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - options - ListVectorStoresOptions contains the optional parameters for the Client.ListVectorStores method. func (client *Client) internalListVectorStores(ctx context.Context, options *ListVectorStoresOptions) (ListVectorStoresResponse, error) { var err error @@ -1738,7 +1738,7 @@ func (client *Client) listVectorStoresHandleResponse(resp *http.Response) (ListV // ModifyVectorStore - The ID of the vector store to modify. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - vectorStoreID - The ID of the vector store to modify. // - body - Request object for updating a vector store. // - options - ModifyVectorStoreOptions contains the optional parameters for the Client.ModifyVectorStore method. @@ -1791,7 +1791,7 @@ func (client *Client) modifyVectorStoreHandleResponse(resp *http.Response) (Modi // outputs will have a status of 'requiresaction' with a requiredaction.type of 'submittooloutputs'. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread that was run. // - runID - The ID of the run that requires tool outputs. // - options - SubmitToolOutputsToRunOptions contains the optional parameters for the Client.SubmitToolOutputsToRun method. @@ -1847,7 +1847,7 @@ func (client *Client) submitToolOutputsToRunHandleResponse(resp *http.Response) // UpdateAssistant - Modifies an existing assistant. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - assistantID - The ID of the assistant to modify. // - body - The request details to use when modifying an existing assistant. // - options - UpdateAssistantOptions contains the optional parameters for the Client.UpdateAssistant method. @@ -1899,7 +1899,7 @@ func (client *Client) updateAssistantHandleResponse(resp *http.Response) (Update // UpdateMessage - Modifies an existing message on an existing thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread containing the specified message to modify. // - messageID - The ID of the message to modify on the specified thread. // - options - UpdateMessageOptions contains the optional parameters for the Client.UpdateMessage method. @@ -1955,7 +1955,7 @@ func (client *Client) updateMessageHandleResponse(resp *http.Response) (UpdateMe // UpdateRun - Modifies an existing thread run. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread associated with the specified run. // - runID - The ID of the run to modify. // - options - UpdateRunOptions contains the optional parameters for the Client.UpdateRun method. @@ -2011,7 +2011,7 @@ func (client *Client) updateRunHandleResponse(resp *http.Response) (UpdateRunRes // UpdateThread - Modifies an existing thread. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - threadID - The ID of the thread to modify. // - body - The details used to update an existing assistant thread. // - options - UpdateThreadOptions contains the optional parameters for the Client.UpdateThread method. @@ -2063,7 +2063,7 @@ func (client *Client) updateThreadHandleResponse(resp *http.Response) (UpdateThr // UploadFile - Uploads a file for use by other operations. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01-preview +// Generated from API version 2024-10-01-preview // - file - The file data (not filename) to upload. // - purpose - The intended purpose of the file. // - options - UploadFileOptions contains the optional parameters for the Client.UploadFile method. diff --git a/sdk/ai/azopenaiassistants/client_test.go b/sdk/ai/azopenaiassistants/client_test.go index a29701e6d69c..2af3043a0cbf 100644 --- a/sdk/ai/azopenaiassistants/client_test.go +++ b/sdk/ai/azopenaiassistants/client_test.go @@ -157,9 +157,9 @@ func TestAssistantMessages(t *testing.T) { Attachments: []azopenaiassistants.MessageAttachment{ { FileID: uploadResp.ID, - Tools: []azopenaiassistants.MessageAttachmentToolAssignment{ - {Type: to.Ptr(azopenaiassistants.MessageAttachmentToolAssignmentTypeCodeInterpreter)}, - {Type: to.Ptr(azopenaiassistants.MessageAttachmentToolAssignmentTypeFileSearch)}, + Tools: []azopenaiassistants.MessageAttachmentToolDefinition{ + {CodeInterpreterToolDefinition: &azopenaiassistants.CodeInterpreterToolDefinition{}}, + {FileSearchToolDefinition: &azopenaiassistants.FileSearchToolDefinition{}}, }, }, }, @@ -169,17 +169,12 @@ func TestAssistantMessages(t *testing.T) { attachmentTools := messageResp.Attachments[0].Tools // just trying to keep a consistent ordering of the tools for our checks. - if *attachmentTools[0].Type == azopenaiassistants.MessageAttachmentToolAssignmentTypeFileSearch { + if attachmentTools[0].FileSearchToolDefinition != nil { attachmentTools[0], attachmentTools[1] = attachmentTools[1], attachmentTools[0] } - require.Equal(t, azopenaiassistants.MessageAttachmentToolAssignment{ - Type: to.Ptr(azopenaiassistants.MessageAttachmentToolAssignmentType("code_interpreter")), - }, attachmentTools[0]) - - require.Equal(t, azopenaiassistants.MessageAttachmentToolAssignment{ - Type: to.Ptr(azopenaiassistants.MessageAttachmentToolAssignmentType("file_search")), - }, attachmentTools[1]) + require.NotNil(t, attachmentTools[0].CodeInterpreterToolDefinition) + require.NotNil(t, attachmentTools[1].FileSearchToolDefinition) messageID := messageResp.ID diff --git a/sdk/ai/azopenaiassistants/constants.go b/sdk/ai/azopenaiassistants/constants.go index 8a2f14260b9f..a946c09271bf 100644 --- a/sdk/ai/azopenaiassistants/constants.go +++ b/sdk/ai/azopenaiassistants/constants.go @@ -322,22 +322,6 @@ func PossibleListSortOrderValues() []ListSortOrder { } } -// MessageAttachmentToolAssignmentType - The type of the tool being selected. -type MessageAttachmentToolAssignmentType string - -const ( - MessageAttachmentToolAssignmentTypeCodeInterpreter MessageAttachmentToolAssignmentType = "code_interpreter" - MessageAttachmentToolAssignmentTypeFileSearch MessageAttachmentToolAssignmentType = "file_search" -) - -// PossibleMessageAttachmentToolAssignmentTypeValues returns the possible values for the MessageAttachmentToolAssignmentType const type. -func PossibleMessageAttachmentToolAssignmentTypeValues() []MessageAttachmentToolAssignmentType { - return []MessageAttachmentToolAssignmentType{ - MessageAttachmentToolAssignmentTypeCodeInterpreter, - MessageAttachmentToolAssignmentTypeFileSearch, - } -} - // MessageIncompleteDetailsReason - A set of reasons describing why a message is marked as incomplete. type MessageIncompleteDetailsReason string diff --git a/sdk/ai/azopenaiassistants/internal/transform/transform.go b/sdk/ai/azopenaiassistants/internal/transform/transform.go index 2d547a425f45..5b3eb4d66b2d 100644 --- a/sdk/ai/azopenaiassistants/internal/transform/transform.go +++ b/sdk/ai/azopenaiassistants/internal/transform/transform.go @@ -266,24 +266,8 @@ func (t *transformer) replaceDocs() error { log.Printf("replaceDocs()") err := transformFiles(t.fileCache, "replaceDocs", []string{"client.go"}, func(text string) (string, error) { - docString := ` -// CreateVectorStoreFile - Create a vector store file by attaching a file to a vector store. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-07-01-preview -// - vectorStoreID - The ID of the vector store for which to create a File. -// - options - CreateVectorStoreFileOptions contains the optional parameters for the Client.CreateVectorStoreFile method. -` - newDocString := ` -// CreateVectorStoreFile - Create a vector store file by attaching a file to a vector store. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-07-01-preview -// - vectorStoreID - The ID of the vector store for which to create a File. -// - body - Request object for creating a vector store file. -// - options - CreateVectorStoreFileOptions contains the optional parameters for the Client.CreateVectorStoreFile method. -` - text = strings.ReplaceAll(text, docString, newDocString) + docStringRE := regexp.MustCompile(`(?s)(- options - CreateVectorStoreFileOptions)`) + text = docStringRE.ReplaceAllString(text, " - body - Request object for creating a vector store file.\n"+`// $1`) return text, nil }, nil) return err diff --git a/sdk/ai/azopenaiassistants/models.go b/sdk/ai/azopenaiassistants/models.go index 9b7d28878200..13003befa3e8 100644 --- a/sdk/ai/azopenaiassistants/models.go +++ b/sdk/ai/azopenaiassistants/models.go @@ -216,6 +216,9 @@ type CreateAndRunThreadBody struct { // values may be up to 512 characters in length. Metadata map[string]*string + // Whether to enable parallel function calling during tool use. + ParallelToolCalls *bool + // Specifies the format that the model must output. ResponseFormat *AssistantResponseFormat @@ -388,6 +391,9 @@ type CreateRunBody struct { // The overridden model name that the assistant should use to run the thread. Model *string + // Whether to enable parallel function calling during tool use. + ParallelToolCalls *bool + // Specifies the format that the model must output. ResponseFormat *AssistantResponseFormat @@ -554,13 +560,7 @@ type MessageAttachment struct { FileID *string // REQUIRED; The tools to add to this file. - Tools []MessageAttachmentToolAssignment -} - -// MessageAttachmentToolAssignment - The possible tools to which files will be added by this message -type MessageAttachmentToolAssignment struct { - // REQUIRED; The type of the tool being selected. - Type *MessageAttachmentToolAssignmentType + Tools []MessageAttachmentToolDefinition } // MessageContent - An abstract representation of a single item of thread message content. @@ -1700,6 +1700,9 @@ type ThreadRun struct { // REQUIRED; The object type, which is always 'thread.run'. Object *string + // REQUIRED; Whether to enable parallel function calling during tool use. + ParallelToolCalls *bool + // REQUIRED; The response format of the tool calls used in this run. ResponseFormat *AssistantResponseFormat diff --git a/sdk/ai/azopenaiassistants/models_custom.go b/sdk/ai/azopenaiassistants/models_custom.go index d906f58e2d35..19e57a14f785 100644 --- a/sdk/ai/azopenaiassistants/models_custom.go +++ b/sdk/ai/azopenaiassistants/models_custom.go @@ -5,6 +5,7 @@ package azopenaiassistants import ( "encoding/json" + "errors" "fmt" ) @@ -151,3 +152,47 @@ func unmarshalStringOrObject[T any](jsonBytes []byte) (string, *T, error) { return "", model, nil } + +// MessageAttachmentToolDefinition allows you to specify tools for use with a message attachment. +type MessageAttachmentToolDefinition struct { + *CodeInterpreterToolDefinition + *FileSearchToolDefinition +} + +// MarshalJSON implements the json.Marshaller interface for type MessageAttachmentToolDefinition. +func (m MessageAttachmentToolDefinition) MarshalJSON() ([]byte, error) { + if m.CodeInterpreterToolDefinition != nil && m.FileSearchToolDefinition != nil { + return nil, errors.New("only one tool definition should be set in MessageAttachmentToolDefinition") + } + + switch { + case m.CodeInterpreterToolDefinition != nil: + return json.Marshal(m.CodeInterpreterToolDefinition) + case m.FileSearchToolDefinition != nil: + return json.Marshal(m.FileSearchToolDefinition) + default: + return nil, errors.New("no tool definition was set in MessageAttachmentToolDefinition") + } +} + +// UnmarshalJSON implements the json.Marshaller interface for type MessageAttachmentToolDefinition. +func (m *MessageAttachmentToolDefinition) UnmarshalJSON(data []byte) error { + // There's only two types right now (CodeInterpreterToolDefinition and FileSearchToolDefinition) + // and CodeInterpreterToolDefinition is a subset of FileSearchToolDefinition + var toolDef *FileSearchToolDefinition + + if err := json.Unmarshal(data, &toolDef); err != nil { + return err + } + + switch *toolDef.Type { + case "code_interpreter": + m.CodeInterpreterToolDefinition = &CodeInterpreterToolDefinition{Type: toolDef.Type} + return nil + case "file_search": + m.FileSearchToolDefinition = toolDef + return nil + default: + return fmt.Errorf("unhandled tool definition type %s", *toolDef.Type) + } +} diff --git a/sdk/ai/azopenaiassistants/models_serde.go b/sdk/ai/azopenaiassistants/models_serde.go index f9a0bd4560ac..36971e5177c0 100644 --- a/sdk/ai/azopenaiassistants/models_serde.go +++ b/sdk/ai/azopenaiassistants/models_serde.go @@ -426,6 +426,7 @@ func (c CreateAndRunThreadBody) MarshalJSON() ([]byte, error) { populate(objectMap, "max_completion_tokens", c.MaxCompletionTokens) populate(objectMap, "max_prompt_tokens", c.MaxPromptTokens) populate(objectMap, "metadata", c.Metadata) + populate(objectMap, "parallel_tool_calls", c.ParallelToolCalls) populate(objectMap, "response_format", c.ResponseFormat) populate(objectMap, "stream", c.stream) populate(objectMap, "temperature", c.Temperature) @@ -465,6 +466,9 @@ func (c *CreateAndRunThreadBody) UnmarshalJSON(data []byte) error { case "metadata": err = unpopulate(val, "Metadata", &c.Metadata) delete(rawMsg, key) + case "parallel_tool_calls": + err = unpopulate(val, "ParallelToolCalls", &c.ParallelToolCalls) + delete(rawMsg, key) case "response_format": err = unpopulate(val, "ResponseFormat", &c.ResponseFormat) delete(rawMsg, key) @@ -737,6 +741,7 @@ func (c CreateRunBody) MarshalJSON() ([]byte, error) { populate(objectMap, "max_prompt_tokens", c.MaxPromptTokens) populate(objectMap, "metadata", c.Metadata) populate(objectMap, "model", c.Model) + populate(objectMap, "parallel_tool_calls", c.ParallelToolCalls) populate(objectMap, "response_format", c.ResponseFormat) populate(objectMap, "stream", c.stream) populate(objectMap, "temperature", c.Temperature) @@ -780,6 +785,9 @@ func (c *CreateRunBody) UnmarshalJSON(data []byte) error { case "model": err = unpopulate(val, "Model", &c.Model) delete(rawMsg, key) + case "parallel_tool_calls": + err = unpopulate(val, "ParallelToolCalls", &c.ParallelToolCalls) + delete(rawMsg, key) case "response_format": err = unpopulate(val, "ResponseFormat", &c.ResponseFormat) delete(rawMsg, key) @@ -1212,33 +1220,6 @@ func (m *MessageAttachment) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MessageAttachmentToolAssignment. -func (m MessageAttachmentToolAssignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MessageAttachmentToolAssignment. -func (m *MessageAttachmentToolAssignment) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type MessageContent. func (m MessageContent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3740,6 +3721,7 @@ func (t ThreadRun) MarshalJSON() ([]byte, error) { populate(objectMap, "metadata", t.Metadata) populate(objectMap, "model", t.Model) objectMap["object"] = "thread.run" + populate(objectMap, "parallel_tool_calls", t.ParallelToolCalls) populate(objectMap, "required_action", t.RequiredAction) populate(objectMap, "response_format", t.ResponseFormat) populateTimeUnix(objectMap, "started_at", t.StartedAt) @@ -3808,6 +3790,9 @@ func (t *ThreadRun) UnmarshalJSON(data []byte) error { case "object": err = unpopulate(val, "Object", &t.Object) delete(rawMsg, key) + case "parallel_tool_calls": + err = unpopulate(val, "ParallelToolCalls", &t.ParallelToolCalls) + delete(rawMsg, key) case "required_action": t.RequiredAction, err = unmarshalRequiredActionClassification(val) delete(rawMsg, key) diff --git a/sdk/ai/azopenaiassistants/testdata/tsp-location.yaml b/sdk/ai/azopenaiassistants/testdata/tsp-location.yaml index eb22bfa29d48..84a5ad727f91 100644 --- a/sdk/ai/azopenaiassistants/testdata/tsp-location.yaml +++ b/sdk/ai/azopenaiassistants/testdata/tsp-location.yaml @@ -1,5 +1,5 @@ #location: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/cacb3dc095486d8691c47dea944fc9ed0f4d0e32/specification/ai/OpenAI.Assistants/client.tsp directory: specification/ai/OpenAI.Assistants # https://github.com/Azure/azure-rest-api-specs/pull/29067 -commit: eb46d197d57e1f71f1819f37779f387f20c344e9 +commit: ea5bac870d87ff0424a4e4f5c448b0a66890838d repo: Azure/azure-rest-api-specs diff --git a/sdk/ai/azopenaiassistants/version.go b/sdk/ai/azopenaiassistants/version.go index 90f0c93ccacf..c418e8e81825 100644 --- a/sdk/ai/azopenaiassistants/version.go +++ b/sdk/ai/azopenaiassistants/version.go @@ -7,5 +7,5 @@ package azopenaiassistants const ( - version = "v0.2.1" + version = "v0.3.0" )