Skip to content

Commit a8b7f88

Browse files
jpalvarezlsamvaity
andauthored
MemoryStores updates , tests and samples (#47389)
* Updating codeowners * changes in from the private repo * Formatting problems * Changelog correction * Update URL sanitizer regex in ClientTestBase --------- Co-authored-by: Sameeksha Vaity <[email protected]>
1 parent 7ced330 commit a8b7f88

File tree

18 files changed

+953
-174
lines changed

18 files changed

+953
-174
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@
8383
# ServiceOwners: @mojayara @Prasanna-Padmanabhan
8484

8585
# PRLabel: %AI
86-
/sdk/ai/ @dargilco @jhakulin @jpalvarezl @Azure/azure-java-sdk
86+
/sdk/ai/ @dargilco @trrwilson @jpalvarezl @Azure/azure-java-sdk
8787

8888
# PRLabel: %AI Agents
89-
/sdk/ai/azure-ai-agents-persistent/ @dargilco @jhakulin @jayantjha @Azure/azure-java-sdk
89+
/sdk/ai/azure-ai-agents-persistent/ @dargilco @trrwilson @jayantjha @Azure/azure-java-sdk
9090

9191
# PRLabel: %AI Model Inference
92-
/sdk/ai/azure-ai-inference/ @dargilco @jhakulin @glharper @Azure/azure-java-sdk
92+
/sdk/ai/azure-ai-inference/ @dargilco @trrwilson @glharper @Azure/azure-java-sdk
9393

9494
# PRLabel: %Voice Live
9595
/sdk/ai/azure-ai-voicelive/ @rhurey @xitzhang @amber-yujueWang

sdk/ai/azure-ai-agents/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44

55
### Features Added
66

7+
- New `MemorySearchAgent` sample was added demonstrating memory search functionality
8+
- Tests for `MemoryStoresClient` and `MemoryStoresAsyncClient`
9+
- Various documentation updates
10+
711
### Breaking Changes
812

13+
- `MemoryStoreObject` was renamed to `MemoryStoreDetails`
14+
915
### Bugs Fixed
1016

1117
### Other Changes
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
directory: specification/ai/Azure.AI.Agents.V2.java
2-
commit: d9fef42c87992deb6b3e16de0bd0386723cb9865
2+
commit: 203d09050acd4d23496c0da4aaff9c6bb83097aa
33
repo: Azure/azure-rest-api-specs-pr
44
additionalDirectories:
55
- specification/ai/Azure.AI.Projects

sdk/ai/azure-ai-agents/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/ai/azure-ai-agents",
5-
"Tag": ""
5+
"Tag": "java/ai/azure-ai-agents_ca2ca780eb"
66
}

sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/MemoryStoresAsyncClient.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.azure.ai.agents.models.MemorySearchOptions;
1616
import com.azure.ai.agents.models.MemoryStoreDefinition;
1717
import com.azure.ai.agents.models.MemoryStoreDeleteScopeResponse;
18-
import com.azure.ai.agents.models.MemoryStoreObject;
18+
import com.azure.ai.agents.models.MemoryStoreDetails;
1919
import com.azure.ai.agents.models.MemoryStoreSearchResponse;
2020
import com.azure.ai.agents.models.MemoryStoreUpdateCompletedResult;
2121
import com.azure.ai.agents.models.MemoryStoreUpdateResponse;
@@ -537,15 +537,15 @@ public Mono<Response<BinaryData>> getUpdateResultWithResponse(String name, Strin
537537
*/
538538
@Generated
539539
@ServiceMethod(returns = ReturnType.SINGLE)
540-
public Mono<MemoryStoreObject> createMemoryStore(String name, MemoryStoreDefinition definition, String description,
540+
public Mono<MemoryStoreDetails> createMemoryStore(String name, MemoryStoreDefinition definition, String description,
541541
Map<String, String> metadata) {
542542
// Generated convenience method for createMemoryStoreWithResponse
543543
RequestOptions requestOptions = new RequestOptions();
544544
CreateMemoryStoreRequest createMemoryStoreRequestObj
545545
= new CreateMemoryStoreRequest(name, definition).setDescription(description).setMetadata(metadata);
546546
BinaryData createMemoryStoreRequest = BinaryData.fromObject(createMemoryStoreRequestObj);
547547
return createMemoryStoreWithResponse(createMemoryStoreRequest, requestOptions).flatMap(FluxUtil::toMono)
548-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class));
548+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class));
549549
}
550550

551551
/**
@@ -563,13 +563,13 @@ public Mono<MemoryStoreObject> createMemoryStore(String name, MemoryStoreDefinit
563563
*/
564564
@Generated
565565
@ServiceMethod(returns = ReturnType.SINGLE)
566-
public Mono<MemoryStoreObject> createMemoryStore(String name, MemoryStoreDefinition definition) {
566+
public Mono<MemoryStoreDetails> createMemoryStore(String name, MemoryStoreDefinition definition) {
567567
// Generated convenience method for createMemoryStoreWithResponse
568568
RequestOptions requestOptions = new RequestOptions();
569569
CreateMemoryStoreRequest createMemoryStoreRequestObj = new CreateMemoryStoreRequest(name, definition);
570570
BinaryData createMemoryStoreRequest = BinaryData.fromObject(createMemoryStoreRequestObj);
571571
return createMemoryStoreWithResponse(createMemoryStoreRequest, requestOptions).flatMap(FluxUtil::toMono)
572-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class));
572+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class));
573573
}
574574

575575
/**
@@ -586,11 +586,11 @@ public Mono<MemoryStoreObject> createMemoryStore(String name, MemoryStoreDefinit
586586
*/
587587
@Generated
588588
@ServiceMethod(returns = ReturnType.SINGLE)
589-
public Mono<MemoryStoreObject> getMemoryStore(String name) {
589+
public Mono<MemoryStoreDetails> getMemoryStore(String name) {
590590
// Generated convenience method for getMemoryStoreWithResponse
591591
RequestOptions requestOptions = new RequestOptions();
592592
return getMemoryStoreWithResponse(name, requestOptions).flatMap(FluxUtil::toMono)
593-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class));
593+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class));
594594
}
595595

596596
/**
@@ -616,7 +616,7 @@ public Mono<MemoryStoreObject> getMemoryStore(String name) {
616616
*/
617617
@Generated
618618
@ServiceMethod(returns = ReturnType.COLLECTION)
619-
public PagedFlux<MemoryStoreObject> listMemoryStores(Integer limit, ListAgentsRequestOrder order, String after,
619+
public PagedFlux<MemoryStoreDetails> listMemoryStores(Integer limit, ListAgentsRequestOrder order, String after,
620620
String before) {
621621
// Generated convenience method for listMemoryStores
622622
RequestOptions requestOptions = new RequestOptions();
@@ -637,11 +637,11 @@ public PagedFlux<MemoryStoreObject> listMemoryStores(Integer limit, ListAgentsRe
637637
Flux<PagedResponse<BinaryData>> flux = (continuationTokenParam == null)
638638
? pagedFluxResponse.byPage().take(1)
639639
: pagedFluxResponse.byPage(continuationTokenParam).take(1);
640-
return flux.map(pagedResponse -> new PagedResponseBase<Void, MemoryStoreObject>(pagedResponse.getRequest(),
640+
return flux.map(pagedResponse -> new PagedResponseBase<Void, MemoryStoreDetails>(pagedResponse.getRequest(),
641641
pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
642642
pagedResponse.getValue()
643643
.stream()
644-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class))
644+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class))
645645
.collect(Collectors.toList()),
646646
pagedResponse.getContinuationToken(), null));
647647
});
@@ -659,19 +659,19 @@ public PagedFlux<MemoryStoreObject> listMemoryStores(Integer limit, ListAgentsRe
659659
*/
660660
@Generated
661661
@ServiceMethod(returns = ReturnType.COLLECTION)
662-
public PagedFlux<MemoryStoreObject> listMemoryStores() {
662+
public PagedFlux<MemoryStoreDetails> listMemoryStores() {
663663
// Generated convenience method for listMemoryStores
664664
RequestOptions requestOptions = new RequestOptions();
665665
PagedFlux<BinaryData> pagedFluxResponse = listMemoryStores(requestOptions);
666666
return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> {
667667
Flux<PagedResponse<BinaryData>> flux = (continuationTokenParam == null)
668668
? pagedFluxResponse.byPage().take(1)
669669
: pagedFluxResponse.byPage(continuationTokenParam).take(1);
670-
return flux.map(pagedResponse -> new PagedResponseBase<Void, MemoryStoreObject>(pagedResponse.getRequest(),
670+
return flux.map(pagedResponse -> new PagedResponseBase<Void, MemoryStoreDetails>(pagedResponse.getRequest(),
671671
pagedResponse.getStatusCode(), pagedResponse.getHeaders(),
672672
pagedResponse.getValue()
673673
.stream()
674-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class))
674+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class))
675675
.collect(Collectors.toList()),
676676
pagedResponse.getContinuationToken(), null));
677677
});
@@ -826,14 +826,14 @@ public Mono<Response<BinaryData>> deleteScopeWithResponse(String name, BinaryDat
826826
*/
827827
@Generated
828828
@ServiceMethod(returns = ReturnType.SINGLE)
829-
public Mono<MemoryStoreObject> updateMemoryStore(String name, String description, Map<String, String> metadata) {
829+
public Mono<MemoryStoreDetails> updateMemoryStore(String name, String description, Map<String, String> metadata) {
830830
// Generated convenience method for updateMemoryStoreWithResponse
831831
RequestOptions requestOptions = new RequestOptions();
832832
UpdateMemoryStoreRequest updateMemoryStoreRequestObj
833833
= new UpdateMemoryStoreRequest().setDescription(description).setMetadata(metadata);
834834
BinaryData updateMemoryStoreRequest = BinaryData.fromObject(updateMemoryStoreRequestObj);
835835
return updateMemoryStoreWithResponse(name, updateMemoryStoreRequest, requestOptions).flatMap(FluxUtil::toMono)
836-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class));
836+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class));
837837
}
838838

839839
/**
@@ -850,13 +850,13 @@ public Mono<MemoryStoreObject> updateMemoryStore(String name, String description
850850
*/
851851
@Generated
852852
@ServiceMethod(returns = ReturnType.SINGLE)
853-
public Mono<MemoryStoreObject> updateMemoryStore(String name) {
853+
public Mono<MemoryStoreDetails> updateMemoryStore(String name) {
854854
// Generated convenience method for updateMemoryStoreWithResponse
855855
RequestOptions requestOptions = new RequestOptions();
856856
UpdateMemoryStoreRequest updateMemoryStoreRequestObj = new UpdateMemoryStoreRequest();
857857
BinaryData updateMemoryStoreRequest = BinaryData.fromObject(updateMemoryStoreRequestObj);
858858
return updateMemoryStoreWithResponse(name, updateMemoryStoreRequest, requestOptions).flatMap(FluxUtil::toMono)
859-
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreObject.class));
859+
.map(protocolMethodData -> protocolMethodData.toObject(MemoryStoreDetails.class));
860860
}
861861

862862
/**

sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/MemoryStoresClient.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import com.azure.ai.agents.models.MemorySearchOptions;
1616
import com.azure.ai.agents.models.MemoryStoreDefinition;
1717
import com.azure.ai.agents.models.MemoryStoreDeleteScopeResponse;
18-
import com.azure.ai.agents.models.MemoryStoreObject;
18+
import com.azure.ai.agents.models.MemoryStoreDetails;
1919
import com.azure.ai.agents.models.MemoryStoreSearchResponse;
2020
import com.azure.ai.agents.models.MemoryStoreUpdateCompletedResult;
2121
import com.azure.ai.agents.models.MemoryStoreUpdateResponse;
@@ -528,15 +528,15 @@ public Response<BinaryData> getUpdateResultWithResponse(String name, String upda
528528
*/
529529
@Generated
530530
@ServiceMethod(returns = ReturnType.SINGLE)
531-
public MemoryStoreObject createMemoryStore(String name, MemoryStoreDefinition definition, String description,
531+
public MemoryStoreDetails createMemoryStore(String name, MemoryStoreDefinition definition, String description,
532532
Map<String, String> metadata) {
533533
// Generated convenience method for createMemoryStoreWithResponse
534534
RequestOptions requestOptions = new RequestOptions();
535535
CreateMemoryStoreRequest createMemoryStoreRequestObj
536536
= new CreateMemoryStoreRequest(name, definition).setDescription(description).setMetadata(metadata);
537537
BinaryData createMemoryStoreRequest = BinaryData.fromObject(createMemoryStoreRequestObj);
538538
return createMemoryStoreWithResponse(createMemoryStoreRequest, requestOptions).getValue()
539-
.toObject(MemoryStoreObject.class);
539+
.toObject(MemoryStoreDetails.class);
540540
}
541541

542542
/**
@@ -554,13 +554,13 @@ public MemoryStoreObject createMemoryStore(String name, MemoryStoreDefinition de
554554
*/
555555
@Generated
556556
@ServiceMethod(returns = ReturnType.SINGLE)
557-
public MemoryStoreObject createMemoryStore(String name, MemoryStoreDefinition definition) {
557+
public MemoryStoreDetails createMemoryStore(String name, MemoryStoreDefinition definition) {
558558
// Generated convenience method for createMemoryStoreWithResponse
559559
RequestOptions requestOptions = new RequestOptions();
560560
CreateMemoryStoreRequest createMemoryStoreRequestObj = new CreateMemoryStoreRequest(name, definition);
561561
BinaryData createMemoryStoreRequest = BinaryData.fromObject(createMemoryStoreRequestObj);
562562
return createMemoryStoreWithResponse(createMemoryStoreRequest, requestOptions).getValue()
563-
.toObject(MemoryStoreObject.class);
563+
.toObject(MemoryStoreDetails.class);
564564
}
565565

566566
/**
@@ -577,10 +577,10 @@ public MemoryStoreObject createMemoryStore(String name, MemoryStoreDefinition de
577577
*/
578578
@Generated
579579
@ServiceMethod(returns = ReturnType.SINGLE)
580-
public MemoryStoreObject getMemoryStore(String name) {
580+
public MemoryStoreDetails getMemoryStore(String name) {
581581
// Generated convenience method for getMemoryStoreWithResponse
582582
RequestOptions requestOptions = new RequestOptions();
583-
return getMemoryStoreWithResponse(name, requestOptions).getValue().toObject(MemoryStoreObject.class);
583+
return getMemoryStoreWithResponse(name, requestOptions).getValue().toObject(MemoryStoreDetails.class);
584584
}
585585

586586
/**
@@ -606,7 +606,7 @@ public MemoryStoreObject getMemoryStore(String name) {
606606
*/
607607
@Generated
608608
@ServiceMethod(returns = ReturnType.COLLECTION)
609-
public PagedIterable<MemoryStoreObject> listMemoryStores(Integer limit, ListAgentsRequestOrder order, String after,
609+
public PagedIterable<MemoryStoreDetails> listMemoryStores(Integer limit, ListAgentsRequestOrder order, String after,
610610
String before) {
611611
// Generated convenience method for listMemoryStores
612612
RequestOptions requestOptions = new RequestOptions();
@@ -623,7 +623,7 @@ public PagedIterable<MemoryStoreObject> listMemoryStores(Integer limit, ListAgen
623623
requestOptions.addQueryParam("before", before, false);
624624
}
625625
return serviceClient.listMemoryStores(requestOptions)
626-
.mapPage(bodyItemValue -> bodyItemValue.toObject(MemoryStoreObject.class));
626+
.mapPage(bodyItemValue -> bodyItemValue.toObject(MemoryStoreDetails.class));
627627
}
628628

629629
/**
@@ -638,11 +638,11 @@ public PagedIterable<MemoryStoreObject> listMemoryStores(Integer limit, ListAgen
638638
*/
639639
@Generated
640640
@ServiceMethod(returns = ReturnType.COLLECTION)
641-
public PagedIterable<MemoryStoreObject> listMemoryStores() {
641+
public PagedIterable<MemoryStoreDetails> listMemoryStores() {
642642
// Generated convenience method for listMemoryStores
643643
RequestOptions requestOptions = new RequestOptions();
644644
return serviceClient.listMemoryStores(requestOptions)
645-
.mapPage(bodyItemValue -> bodyItemValue.toObject(MemoryStoreObject.class));
645+
.mapPage(bodyItemValue -> bodyItemValue.toObject(MemoryStoreDetails.class));
646646
}
647647

648648
/**
@@ -792,14 +792,14 @@ public Response<BinaryData> deleteScopeWithResponse(String name, BinaryData dele
792792
*/
793793
@Generated
794794
@ServiceMethod(returns = ReturnType.SINGLE)
795-
public MemoryStoreObject updateMemoryStore(String name, String description, Map<String, String> metadata) {
795+
public MemoryStoreDetails updateMemoryStore(String name, String description, Map<String, String> metadata) {
796796
// Generated convenience method for updateMemoryStoreWithResponse
797797
RequestOptions requestOptions = new RequestOptions();
798798
UpdateMemoryStoreRequest updateMemoryStoreRequestObj
799799
= new UpdateMemoryStoreRequest().setDescription(description).setMetadata(metadata);
800800
BinaryData updateMemoryStoreRequest = BinaryData.fromObject(updateMemoryStoreRequestObj);
801801
return updateMemoryStoreWithResponse(name, updateMemoryStoreRequest, requestOptions).getValue()
802-
.toObject(MemoryStoreObject.class);
802+
.toObject(MemoryStoreDetails.class);
803803
}
804804

805805
/**
@@ -816,13 +816,13 @@ public MemoryStoreObject updateMemoryStore(String name, String description, Map<
816816
*/
817817
@Generated
818818
@ServiceMethod(returns = ReturnType.SINGLE)
819-
public MemoryStoreObject updateMemoryStore(String name) {
819+
public MemoryStoreDetails updateMemoryStore(String name) {
820820
// Generated convenience method for updateMemoryStoreWithResponse
821821
RequestOptions requestOptions = new RequestOptions();
822822
UpdateMemoryStoreRequest updateMemoryStoreRequestObj = new UpdateMemoryStoreRequest();
823823
BinaryData updateMemoryStoreRequest = BinaryData.fromObject(updateMemoryStoreRequestObj);
824824
return updateMemoryStoreWithResponse(name, updateMemoryStoreRequest, requestOptions).getValue()
825-
.toObject(MemoryStoreObject.class);
825+
.toObject(MemoryStoreDetails.class);
826826
}
827827

828828
/**

sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/MCPToolAllowedTools.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33
// Code generated by Microsoft (R) TypeSpec Code Generator.
4-
54
package com.azure.ai.agents.models;
65

76
import com.azure.core.annotation.Fluent;
@@ -18,6 +17,7 @@
1817
*/
1918
@Fluent
2019
public final class MCPToolAllowedTools implements JsonSerializable<MCPToolAllowedTools> {
20+
2121
/*
2222
* List of allowed tool names.
2323
*/
@@ -68,8 +68,8 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
6868
* Reads an instance of MCPToolAllowedTools from the JsonReader.
6969
*
7070
* @param jsonReader The JsonReader being read.
71-
* @return An instance of MCPToolAllowedTools if the JsonReader was pointing to an instance of it, or null if it
72-
* was pointing to JSON null.
71+
* @return An instance of MCPToolAllowedTools if the JsonReader was pointing to an instance of it, or null if it was
72+
* pointing to JSON null.
7373
* @throws IOException If an error occurs while reading the MCPToolAllowedTools.
7474
*/
7575
@Generated
@@ -79,15 +79,13 @@ public static MCPToolAllowedTools fromJson(JsonReader jsonReader) throws IOExcep
7979
while (reader.nextToken() != JsonToken.END_OBJECT) {
8080
String fieldName = reader.getFieldName();
8181
reader.nextToken();
82-
8382
if ("tool_names".equals(fieldName)) {
8483
List<String> toolNames = reader.readArray(reader1 -> reader1.getString());
8584
deserializedMCPToolAllowedTools.toolNames = toolNames;
8685
} else {
8786
reader.skipChildren();
8887
}
8988
}
90-
9189
return deserializedMCPToolAllowedTools;
9290
});
9391
}

sdk/ai/azure-ai-agents/src/main/java/com/azure/ai/agents/models/MCPToolRequireApproval.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT License.
33
// Code generated by Microsoft (R) TypeSpec Code Generator.
4-
54
package com.azure.ai.agents.models;
65

76
import com.azure.core.annotation.Fluent;
@@ -17,6 +16,7 @@
1716
*/
1817
@Fluent
1918
public final class MCPToolRequireApproval implements JsonSerializable<MCPToolRequireApproval> {
19+
2020
/*
2121
* A list of tools that always require approval.
2222
*/
@@ -107,7 +107,6 @@ public static MCPToolRequireApproval fromJson(JsonReader jsonReader) throws IOEx
107107
while (reader.nextToken() != JsonToken.END_OBJECT) {
108108
String fieldName = reader.getFieldName();
109109
reader.nextToken();
110-
111110
if ("always".equals(fieldName)) {
112111
deserializedMCPToolRequireApproval.always = MCPToolRequireApprovalAlways.fromJson(reader);
113112
} else if ("never".equals(fieldName)) {
@@ -116,7 +115,6 @@ public static MCPToolRequireApproval fromJson(JsonReader jsonReader) throws IOEx
116115
reader.skipChildren();
117116
}
118117
}
119-
120118
return deserializedMCPToolRequireApproval;
121119
});
122120
}

0 commit comments

Comments
 (0)