@@ -19,6 +19,7 @@ import (
1919 "testing"
2020 "time"
2121
22+ "cloud.google.com/go/vertexai/genai/types"
2223 "github.com/google/go-cmp/cmp"
2324 "github.com/google/go-cmp/cmp/cmpopts"
2425 "google.golang.org/genai"
@@ -35,27 +36,27 @@ func TestAgentEngines(t *testing.T) {
3536 p := client .AgentEngines .apiClient .ClientConfig ().Project
3637 model := fmt .Sprintf ("projects/%s/locations/%s/publishers/google/models/gemini-2.0-flash-001" , p , l )
3738 embeddingModel := fmt .Sprintf ("projects/%s/locations/%s/publishers/google/models/text-embedding-005" , p , l )
38- request := & CreateAgentEngineConfig {
39- ContextSpec : & ReasoningEngineContextSpec {
40- MemoryBankConfig : & ReasoningEngineContextSpecMemoryBankConfig {
41- GenerationConfig : & ReasoningEngineContextSpecMemoryBankConfigGenerationConfig {
39+ request := & types. CreateAgentEngineConfig {
40+ ContextSpec : & types. ReasoningEngineContextSpec {
41+ MemoryBankConfig : & types. ReasoningEngineContextSpecMemoryBankConfig {
42+ GenerationConfig : & types. ReasoningEngineContextSpecMemoryBankConfigGenerationConfig {
4243 Model : model ,
4344 },
44- SimilaritySearchConfig : & ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig {
45+ SimilaritySearchConfig : & types. ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig {
4546 EmbeddingModel : embeddingModel ,
4647 },
47- TTLConfig : & ReasoningEngineContextSpecMemoryBankConfigTTLConfig {
48+ TTLConfig : & types. ReasoningEngineContextSpecMemoryBankConfigTTLConfig {
4849 DefaultTTL : 120 * time .Second ,
4950 },
50- CustomizationConfigs : []* MemoryBankCustomizationConfig {{
51- MemoryTopics : []* MemoryBankCustomizationConfigMemoryTopic {{
52- ManagedMemoryTopic : & MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic {
53- ManagedTopicEnum : ManagedTopicEnumUserPreferences ,
51+ CustomizationConfigs : []* types. MemoryBankCustomizationConfig {{
52+ MemoryTopics : []* types. MemoryBankCustomizationConfigMemoryTopic {{
53+ ManagedMemoryTopic : & types. MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic {
54+ ManagedTopicEnum : types . ManagedTopicEnumUserPreferences ,
5455 },
5556 }},
56- GenerateMemoriesExamples : []* MemoryBankCustomizationConfigGenerateMemoriesExample {{
57- ConversationSource : & MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource {
58- Events : []* MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent {{
57+ GenerateMemoriesExamples : []* types. MemoryBankCustomizationConfigGenerateMemoriesExample {{
58+ ConversationSource : & types. MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource {
59+ Events : []* types. MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent {{
5960 Content : & genai.Content {
6061 Role : "user" ,
6162 Parts : []* genai.Part {{
@@ -64,10 +65,10 @@ func TestAgentEngines(t *testing.T) {
6465 },
6566 }},
6667 },
67- GeneratedMemories : []* MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory {{
68+ GeneratedMemories : []* types. MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory {{
6869 Fact : "I like to say hello." ,
69- Topics : []* MemoryTopicID {{
70- ManagedMemoryTopic : ManagedTopicEnumUserPreferences ,
70+ Topics : []* types. MemoryTopicID {{
71+ ManagedMemoryTopic : types . ManagedTopicEnumUserPreferences ,
7172 }},
7273 }},
7374 }},
@@ -93,7 +94,7 @@ func TestAgentEngines(t *testing.T) {
9394 if err != nil {
9495 tt .Fatalf ("delete() failed unexpectedly: %v" , err )
9596 }
96- operation := func () (* AgentEngineOperation , error ) {
97+ operation := func () (* types. AgentEngineOperation , error ) {
9798 return client .AgentEngines .getAgentOperation (tt .Context (), deleteOp .Name , nil )
9899 }
99100 waitForOperation (t , operation )
@@ -106,11 +107,11 @@ func TestAgentEngines(t *testing.T) {
106107 t .Run ("Get" , func (tt * testing.T ) {
107108 ctx := tt .Context ()
108109 client := newTestClient (tt )
109- want := & ReasoningEngine {
110+ want := & types. ReasoningEngine {
110111 DisplayName : tt .Name (),
111112 Description : "You can remove this agent engine if it is older than 10 minutes. It must be an orphan AE." ,
112113 }
113- config := & CreateAgentEngineConfig {
114+ config := & types. CreateAgentEngineConfig {
114115 DisplayName : want .DisplayName ,
115116 Description : want .Description ,
116117 }
@@ -119,7 +120,7 @@ func TestAgentEngines(t *testing.T) {
119120 if err != nil {
120121 tt .Errorf ("get() failed unexpectedly: %v" , err )
121122 }
122- if diff := cmp .Diff (got , want , cmpopts .IgnoreFields (ReasoningEngine {}, "CreateTime" , "Spec" , "UpdateTime" , "Name" )); diff != "" {
123+ if diff := cmp .Diff (got , want , cmpopts .IgnoreFields (types. ReasoningEngine {}, "CreateTime" , "Spec" , "UpdateTime" , "Name" )); diff != "" {
123124 tt .Errorf ("create() and get() had diff (-got +want): %v" , diff )
124125 }
125126
@@ -129,7 +130,7 @@ func TestAgentEngines(t *testing.T) {
129130 ctx := tt .Context ()
130131 client := newTestClient (tt )
131132 createAgentEngineAndWait (t , tt , client , nil )
132- list , err := client .AgentEngines .list (ctx , & ListAgentEngineConfig {PageSize : 2 })
133+ list , err := client .AgentEngines .list (ctx , & types. ListAgentEngineConfig {PageSize : 2 })
133134 if err != nil {
134135 tt .Fatalf ("list() failed unexpectedly: %v" , err )
135136 }
@@ -143,13 +144,13 @@ func TestAgentEngines(t *testing.T) {
143144 client := newTestClient (tt )
144145 re := createAgentEngineAndWait (t , tt , client , nil )
145146 want := fmt .Sprintf ("Updated(%s)" , re .DisplayName )
146- op , err := client .AgentEngines .update (ctx , re .Name , & UpdateAgentEngineConfig {
147+ op , err := client .AgentEngines .update (ctx , re .Name , & types. UpdateAgentEngineConfig {
147148 DisplayName : want ,
148149 })
149150 if err != nil {
150151 tt .Fatalf ("update() failed unexpectedly: %v" , err )
151152 }
152- operation := func () (* AgentEngineOperation , error ) {
153+ operation := func () (* types. AgentEngineOperation , error ) {
153154 return client .AgentEngines .getAgentOperation (tt .Context (), op .Name , nil )
154155 }
155156 updated := waitForOperation (tt , operation ).Response
0 commit comments