Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[azopenaiassistants] Updates for 2024-10-01-preview #23730

Merged
merged 34 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5c1c1ba
hash+gen
glecaros Nov 12, 2024
973425b
Adding in MessageAttachmentToolDefinition
Nov 12, 2024
e9ba07e
Accidental copy/paste
richardpark-msft Nov 13, 2024
2439933
Updating doc comment for MessageAttachmentToolDefinition
richardpark-msft Nov 13, 2024
03e1f7b
Update docindex.yml to use Python 3.11 (#23719)
azure-sdk Nov 11, 2024
65eebd8
Refresh OIDC token in azadmin test resources scripts (#23722)
benbp Nov 12, 2024
1e8e837
remove pkg.go.dev link in readme (#23708)
tadelesh Nov 12, 2024
89e2882
upgrade typesspec-go (#23720)
tadelesh Nov 12, 2024
1e6a91b
[azopenai] Inference changes for 2024-10-01-preview (#23672)
glecaros Nov 12, 2024
e0a090a
update for 1.2.0 release (#23728)
analogrelay Nov 12, 2024
0396de6
Sync eng/common directory with azure-sdk-tools for PR 9328 (#23692)
azure-sdk Nov 12, 2024
94d1c88
refine typespec release tool (#23735)
tadelesh Nov 13, 2024
2cb3d25
Added permissions & resourcetype parameters in listblob response (#2…
ashruti-msft Nov 13, 2024
494164b
[Storage] Prep for stg 95 GA release (#23742)
tanyasethi-msft Nov 13, 2024
f34ee7a
Add SparseCheckoutPaths to archetype-typespec-emitter.yml (#23740)
azure-sdk Nov 13, 2024
51b1b93
[azopenai] Update azopenai changelog. (#23732)
glecaros Nov 13, 2024
e6cc39e
Fix missing stress matrix display name filter (#23726)
azure-sdk Nov 13, 2024
73defdb
update date (#23746)
gracewilcox Nov 13, 2024
8cfb8a7
[azopenai] non-existing deployments fail in a different way now. (#23…
richardpark-msft Nov 13, 2024
58eae26
Increment package version after release of ai/azopenai (#23750)
azure-sdk Nov 13, 2024
5beffa7
[Release] sdk/resourcemanager/hybridcompute/armhybridcompute/2.1.0-be…
jliusan Nov 14, 2024
2e21713
Increment package version after release of security/keyvault/azadmin …
azure-sdk Nov 14, 2024
12cfdef
Update azopenai* to use hardcoded variable group config (#23748)
benbp Nov 14, 2024
d614de5
[Release] sdk/resourcemanager/networkcloud/armnetworkcloud/1.2.0-beta…
jliusan Nov 15, 2024
bf41d76
Add helpers to log a GitHub "notice" (#23764)
azure-sdk Nov 16, 2024
acd1321
Increment package version after release of storage/azdatalake (#23745)
azure-sdk Nov 18, 2024
9b8ccc5
Increment package version after release of storage/azblob (#23744)
azure-sdk Nov 18, 2024
72728af
Increment package version after release of storage/azfile (#23743)
azure-sdk Nov 18, 2024
52e99f7
batching adjustments for create-prjobmatrix (#23773)
azure-sdk Nov 18, 2024
5a8f31d
Merge branch 'main' into glecaros/aoai_assistants_2024-10-01-preview
glecaros Nov 19, 2024
fe3471a
changelog
glecaros Dec 2, 2024
ede6b74
updated version
glecaros Dec 2, 2024
f68aedd
Update sdk/ai/azopenaiassistants/CHANGELOG.md
glecaros Dec 2, 2024
28f95be
updated
glecaros Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion sdk/ai/azopenaiassistants/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
16 changes: 16 additions & 0 deletions sdk/ai/azopenaiassistants/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
78 changes: 39 additions & 39 deletions sdk/ai/azopenaiassistants/client.go

Large diffs are not rendered by default.

17 changes: 6 additions & 11 deletions sdk/ai/azopenaiassistants/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}},
},
},
},
Expand All @@ -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

Expand Down
16 changes: 0 additions & 16 deletions sdk/ai/azopenaiassistants/constants.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 2 additions & 18 deletions sdk/ai/azopenaiassistants/internal/transform/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 10 additions & 7 deletions sdk/ai/azopenaiassistants/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions sdk/ai/azopenaiassistants/models_custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package azopenaiassistants

import (
"encoding/json"
"errors"
"fmt"
)

Expand Down Expand Up @@ -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)
}
}
39 changes: 12 additions & 27 deletions sdk/ai/azopenaiassistants/models_serde.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/ai/azopenaiassistants/testdata/tsp-location.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion sdk/ai/azopenaiassistants/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
package azopenaiassistants

const (
version = "v0.2.1"
version = "v0.3.0"
)
Loading