diff --git a/src/agentengines.ts b/src/agentengines.ts index ac654d4e..d23f57f6 100644 --- a/src/agentengines.ts +++ b/src/agentengines.ts @@ -9,7 +9,6 @@ import * as common from '@google/genai/vertex_internal'; import {ApiClient, BaseModule} from '@google/genai/vertex_internal'; import * as converters from './converters/_agentengines_converters.js'; -import {Memories} from './memories.js'; import {Sandboxes} from './sandboxes.js'; import {Sessions} from './sessions.js'; import * as types from './types.js'; @@ -17,13 +16,11 @@ import * as types from './types.js'; export class AgentEngines extends BaseModule { public readonly sessions: Sessions; public readonly sandboxes: Sandboxes; - public readonly memories: Memories; constructor(private readonly apiClient: ApiClient) { super(); this.sessions = new Sessions(apiClient); this.sandboxes = new Sandboxes(apiClient); - this.memories = new Memories(apiClient); } async createInternal( diff --git a/src/converters/_memories_converters.ts b/src/converters/_memories_converters.ts index c51ec829..4afc52a2 100644 --- a/src/converters/_memories_converters.ts +++ b/src/converters/_memories_converters.ts @@ -9,85 +9,8 @@ import * as common from '@google/genai/vertex_internal'; import * as types from '../types.js'; -export function agentEngineMemoryConfigToVertex( - fromObject: types.AgentEngineMemoryConfig, - parentObject: Record, -): Record { - const toObject: Record = {}; - - const fromDisplayName = common.getValueByPath(fromObject, ['displayName']); - if (parentObject !== undefined && fromDisplayName != null) { - common.setValueByPath(parentObject, ['displayName'], fromDisplayName); - } - - const fromDescription = common.getValueByPath(fromObject, ['description']); - if (parentObject !== undefined && fromDescription != null) { - common.setValueByPath(parentObject, ['description'], fromDescription); - } - - const fromTtl = common.getValueByPath(fromObject, ['ttl']); - if (parentObject !== undefined && fromTtl != null) { - common.setValueByPath(parentObject, ['ttl'], fromTtl); - } - - const fromExpireTime = common.getValueByPath(fromObject, ['expireTime']); - if (parentObject !== undefined && fromExpireTime != null) { - common.setValueByPath(parentObject, ['expireTime'], fromExpireTime); - } - - const fromRevisionExpireTime = common.getValueByPath(fromObject, [ - 'revisionExpireTime', - ]); - if (parentObject !== undefined && fromRevisionExpireTime != null) { - common.setValueByPath( - parentObject, - ['revisionExpireTime'], - fromRevisionExpireTime, - ); - } - - const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']); - if (parentObject !== undefined && fromRevisionTtl != null) { - common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl); - } - - const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [ - 'disableMemoryRevisions', - ]); - if (parentObject !== undefined && fromDisableMemoryRevisions != null) { - common.setValueByPath( - parentObject, - ['disableMemoryRevisions'], - fromDisableMemoryRevisions, - ); - } - - const fromTopics = common.getValueByPath(fromObject, ['topics']); - if (parentObject !== undefined && fromTopics != null) { - let transformedList = fromTopics; - if (Array.isArray(transformedList)) { - transformedList = transformedList.map((item) => { - return item; - }); - } - common.setValueByPath(parentObject, ['topics'], transformedList); - } - - const fromMetadata = common.getValueByPath(fromObject, ['metadata']); - if (parentObject !== undefined && fromMetadata != null) { - common.setValueByPath(parentObject, ['metadata'], fromMetadata); - } - - const fromMemoryId = common.getValueByPath(fromObject, ['memoryId']); - if (parentObject !== undefined && fromMemoryId != null) { - common.setValueByPath(parentObject, ['_query', 'memoryId'], fromMemoryId); - } - - return toObject; -} - -export function createAgentEngineMemoryRequestParametersToVertex( - fromObject: types.CreateAgentEngineMemoryRequestParameters, +export function createMemoryRequestParametersToVertex( + fromObject: types.CreateMemoryRequestParameters, ): Record { const toObject: Record = {}; @@ -108,14 +31,14 @@ export function createAgentEngineMemoryRequestParametersToVertex( const fromConfig = common.getValueByPath(fromObject, ['config']); if (fromConfig != null) { - agentEngineMemoryConfigToVertex(fromConfig, toObject); + memoryConfigToVertex(fromConfig, toObject); } return toObject; } -export function deleteAgentEngineMemoryRequestParametersToVertex( - fromObject: types.DeleteAgentEngineMemoryRequestParameters, +export function deleteMemoryRequestParametersToVertex( + fromObject: types.DeleteMemoryRequestParameters, ): Record { const toObject: Record = {}; @@ -127,8 +50,8 @@ export function deleteAgentEngineMemoryRequestParametersToVertex( return toObject; } -export function generateAgentEngineMemoriesConfigToVertex( - fromObject: types.GenerateAgentEngineMemoriesConfig, +export function generateMemoriesConfigToVertex( + fromObject: types.GenerateMemoriesConfig, parentObject: Record, ): Record { const toObject: Record = {}; @@ -210,8 +133,8 @@ export function generateAgentEngineMemoriesConfigToVertex( return toObject; } -export function generateAgentEngineMemoriesRequestParametersToVertex( - fromObject: types.GenerateAgentEngineMemoriesRequestParameters, +export function generateMemoriesRequestParametersToVertex( + fromObject: types.GenerateMemoriesRequestParameters, ): Record { const toObject: Record = {}; @@ -260,14 +183,14 @@ export function generateAgentEngineMemoriesRequestParametersToVertex( const fromConfig = common.getValueByPath(fromObject, ['config']); if (fromConfig != null) { - generateAgentEngineMemoriesConfigToVertex(fromConfig, toObject); + generateMemoriesConfigToVertex(fromConfig, toObject); } return toObject; } -export function getAgentEngineGenerateMemoriesOperationParametersToVertex( - fromObject: types.GetAgentEngineGenerateMemoriesOperationParameters, +export function getGenerateMemoriesOperationParametersToVertex( + fromObject: types.GetGenerateMemoriesOperationParameters, ): Record { const toObject: Record = {}; @@ -285,8 +208,8 @@ export function getAgentEngineGenerateMemoriesOperationParametersToVertex( return toObject; } -export function getAgentEngineMemoryOperationParametersToVertex( - fromObject: types.GetAgentEngineMemoryOperationParameters, +export function getMemoryOperationParametersToVertex( + fromObject: types.GetMemoryOperationParameters, ): Record { const toObject: Record = {}; @@ -304,8 +227,8 @@ export function getAgentEngineMemoryOperationParametersToVertex( return toObject; } -export function getAgentEngineMemoryRequestParametersToVertex( - fromObject: types.GetAgentEngineMemoryRequestParameters, +export function getMemoryRequestParametersToVertex( + fromObject: types.GetMemoryRequestParameters, ): Record { const toObject: Record = {}; @@ -317,72 +240,37 @@ export function getAgentEngineMemoryRequestParametersToVertex( return toObject; } -export function ingestEventsConfigToVertex( - fromObject: types.IngestEventsConfig, +export function listMemoriesConfigToVertex( + fromObject: types.ListMemoriesConfig, parentObject: Record, ): Record { const toObject: Record = {}; - const fromForceFlush = common.getValueByPath(fromObject, ['forceFlush']); - if (parentObject !== undefined && fromForceFlush != null) { - common.setValueByPath(parentObject, ['forceFlush'], fromForceFlush); - } - - const fromRevisionLabels = common.getValueByPath(fromObject, [ - 'revisionLabels', - ]); - if (parentObject !== undefined && fromRevisionLabels != null) { - common.setValueByPath(parentObject, ['revisionLabels'], fromRevisionLabels); - } - - const fromRevisionExpireTime = common.getValueByPath(fromObject, [ - 'revisionExpireTime', - ]); - if (parentObject !== undefined && fromRevisionExpireTime != null) { - common.setValueByPath( - parentObject, - ['revisionExpireTime'], - fromRevisionExpireTime, - ); - } - - const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']); - if (parentObject !== undefined && fromRevisionTtl != null) { - common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl); + const fromPageSize = common.getValueByPath(fromObject, ['pageSize']); + if (parentObject !== undefined && fromPageSize != null) { + common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize); } - const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [ - 'disableMemoryRevisions', - ]); - if (parentObject !== undefined && fromDisableMemoryRevisions != null) { - common.setValueByPath( - parentObject, - ['disableMemoryRevisions'], - fromDisableMemoryRevisions, - ); + const fromPageToken = common.getValueByPath(fromObject, ['pageToken']); + if (parentObject !== undefined && fromPageToken != null) { + common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken); } - const fromMetadata = common.getValueByPath(fromObject, ['metadata']); - if (parentObject !== undefined && fromMetadata != null) { - common.setValueByPath(parentObject, ['metadata'], fromMetadata); + const fromFilter = common.getValueByPath(fromObject, ['filter']); + if (parentObject !== undefined && fromFilter != null) { + common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter); } - const fromMetadataMergeStrategy = common.getValueByPath(fromObject, [ - 'metadataMergeStrategy', - ]); - if (parentObject !== undefined && fromMetadataMergeStrategy != null) { - common.setValueByPath( - parentObject, - ['metadataMergeStrategy'], - fromMetadataMergeStrategy, - ); + const fromOrderBy = common.getValueByPath(fromObject, ['orderBy']); + if (parentObject !== undefined && fromOrderBy != null) { + common.setValueByPath(parentObject, ['_query', 'orderBy'], fromOrderBy); } return toObject; } -export function ingestEventsRequestParametersToVertex( - fromObject: types.IngestEventsRequestParameters, +export function listMemoriesRequestParametersToVertex( + fromObject: types.ListMemoriesRequestParameters, ): Record { const toObject: Record = {}; @@ -391,95 +279,93 @@ export function ingestEventsRequestParametersToVertex( common.setValueByPath(toObject, ['_url', 'name'], fromName); } - const fromStreamId = common.getValueByPath(fromObject, ['streamId']); - if (fromStreamId != null) { - common.setValueByPath(toObject, ['streamId'], fromStreamId); - } - - const fromDirectContentsSource = common.getValueByPath(fromObject, [ - 'directContentsSource', - ]); - if (fromDirectContentsSource != null) { - common.setValueByPath( - toObject, - ['directContentsSource'], - fromDirectContentsSource, - ); - } - - const fromScope = common.getValueByPath(fromObject, ['scope']); - if (fromScope != null) { - common.setValueByPath(toObject, ['scope'], fromScope); - } - - const fromGenerationTriggerConfig = common.getValueByPath(fromObject, [ - 'generationTriggerConfig', - ]); - if (fromGenerationTriggerConfig != null) { - common.setValueByPath( - toObject, - ['generationTriggerConfig'], - fromGenerationTriggerConfig, - ); - } - const fromConfig = common.getValueByPath(fromObject, ['config']); if (fromConfig != null) { - ingestEventsConfigToVertex(fromConfig, toObject); + listMemoriesConfigToVertex(fromConfig, toObject); } return toObject; } -export function listAgentEngineMemoryConfigToVertex( - fromObject: types.ListAgentEngineMemoryConfig, +export function memoryConfigToVertex( + fromObject: types.MemoryConfig, parentObject: Record, ): Record { const toObject: Record = {}; - const fromPageSize = common.getValueByPath(fromObject, ['pageSize']); - if (parentObject !== undefined && fromPageSize != null) { - common.setValueByPath(parentObject, ['_query', 'pageSize'], fromPageSize); + const fromDisplayName = common.getValueByPath(fromObject, ['displayName']); + if (parentObject !== undefined && fromDisplayName != null) { + common.setValueByPath(parentObject, ['displayName'], fromDisplayName); } - const fromPageToken = common.getValueByPath(fromObject, ['pageToken']); - if (parentObject !== undefined && fromPageToken != null) { - common.setValueByPath(parentObject, ['_query', 'pageToken'], fromPageToken); + const fromDescription = common.getValueByPath(fromObject, ['description']); + if (parentObject !== undefined && fromDescription != null) { + common.setValueByPath(parentObject, ['description'], fromDescription); } - const fromFilter = common.getValueByPath(fromObject, ['filter']); - if (parentObject !== undefined && fromFilter != null) { - common.setValueByPath(parentObject, ['_query', 'filter'], fromFilter); + const fromTtl = common.getValueByPath(fromObject, ['ttl']); + if (parentObject !== undefined && fromTtl != null) { + common.setValueByPath(parentObject, ['ttl'], fromTtl); } - const fromOrderBy = common.getValueByPath(fromObject, ['orderBy']); - if (parentObject !== undefined && fromOrderBy != null) { - common.setValueByPath(parentObject, ['_query', 'orderBy'], fromOrderBy); + const fromExpireTime = common.getValueByPath(fromObject, ['expireTime']); + if (parentObject !== undefined && fromExpireTime != null) { + common.setValueByPath(parentObject, ['expireTime'], fromExpireTime); } - return toObject; -} + const fromRevisionExpireTime = common.getValueByPath(fromObject, [ + 'revisionExpireTime', + ]); + if (parentObject !== undefined && fromRevisionExpireTime != null) { + common.setValueByPath( + parentObject, + ['revisionExpireTime'], + fromRevisionExpireTime, + ); + } -export function listAgentEngineMemoryRequestParametersToVertex( - fromObject: types.ListAgentEngineMemoryRequestParameters, -): Record { - const toObject: Record = {}; + const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']); + if (parentObject !== undefined && fromRevisionTtl != null) { + common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl); + } - const fromName = common.getValueByPath(fromObject, ['name']); - if (fromName != null) { - common.setValueByPath(toObject, ['_url', 'name'], fromName); + const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [ + 'disableMemoryRevisions', + ]); + if (parentObject !== undefined && fromDisableMemoryRevisions != null) { + common.setValueByPath( + parentObject, + ['disableMemoryRevisions'], + fromDisableMemoryRevisions, + ); } - const fromConfig = common.getValueByPath(fromObject, ['config']); - if (fromConfig != null) { - listAgentEngineMemoryConfigToVertex(fromConfig, toObject); + const fromTopics = common.getValueByPath(fromObject, ['topics']); + if (parentObject !== undefined && fromTopics != null) { + let transformedList = fromTopics; + if (Array.isArray(transformedList)) { + transformedList = transformedList.map((item) => { + return item; + }); + } + common.setValueByPath(parentObject, ['topics'], transformedList); + } + + const fromMetadata = common.getValueByPath(fromObject, ['metadata']); + if (parentObject !== undefined && fromMetadata != null) { + common.setValueByPath(parentObject, ['metadata'], fromMetadata); + } + + const fromMemoryId = common.getValueByPath(fromObject, ['memoryId']); + if (parentObject !== undefined && fromMemoryId != null) { + common.setValueByPath(parentObject, ['_query', 'memoryId'], fromMemoryId); } return toObject; } -export function purgeAgentEngineMemoriesRequestParametersToVertex( - fromObject: types.PurgeAgentEngineMemoriesRequestParameters, +export function purgeMemoriesRequestParametersToVertex( + fromObject: types.PurgeMemoriesRequestParameters, ): Record { const toObject: Record = {}; @@ -512,8 +398,8 @@ export function purgeAgentEngineMemoriesRequestParametersToVertex( return toObject; } -export function retrieveAgentEngineMemoriesConfigToVertex( - fromObject: types.RetrieveAgentEngineMemoriesConfig, +export function retrieveMemoriesConfigToVertex( + fromObject: types.RetrieveMemoriesConfig, parentObject: Record, ): Record { const toObject: Record = {}; @@ -542,8 +428,8 @@ export function retrieveAgentEngineMemoriesConfigToVertex( return toObject; } -export function retrieveAgentEngineMemoriesRequestParametersToVertex( - fromObject: types.RetrieveAgentEngineMemoriesRequestParameters, +export function retrieveMemoriesRequestParametersToVertex( + fromObject: types.RetrieveMemoriesRequestParameters, ): Record { const toObject: Record = {}; @@ -581,7 +467,7 @@ export function retrieveAgentEngineMemoriesRequestParametersToVertex( const fromConfig = common.getValueByPath(fromObject, ['config']); if (fromConfig != null) { - retrieveAgentEngineMemoriesConfigToVertex(fromConfig, toObject); + retrieveMemoriesConfigToVertex(fromConfig, toObject); } return toObject; @@ -605,8 +491,8 @@ export function retrieveMemoryProfilesRequestParametersToVertex( return toObject; } -export function rollbackAgentEngineMemoryRequestParametersToVertex( - fromObject: types.RollbackAgentEngineMemoryRequestParameters, +export function rollbackMemoryRequestParametersToVertex( + fromObject: types.RollbackMemoryRequestParameters, ): Record { const toObject: Record = {}; @@ -625,8 +511,8 @@ export function rollbackAgentEngineMemoryRequestParametersToVertex( return toObject; } -export function updateAgentEngineMemoryConfigToVertex( - fromObject: types.UpdateAgentEngineMemoryConfig, +export function updateMemoryConfigToVertex( + fromObject: types.UpdateMemoryConfig, parentObject: Record, ): Record { const toObject: Record = {}; @@ -711,8 +597,8 @@ export function updateAgentEngineMemoryConfigToVertex( return toObject; } -export function updateAgentEngineMemoryRequestParametersToVertex( - fromObject: types.UpdateAgentEngineMemoryRequestParameters, +export function updateMemoryRequestParametersToVertex( + fromObject: types.UpdateMemoryRequestParameters, ): Record { const toObject: Record = {}; @@ -733,7 +619,7 @@ export function updateAgentEngineMemoryRequestParametersToVertex( const fromConfig = common.getValueByPath(fromObject, ['config']); if (fromConfig != null) { - updateAgentEngineMemoryConfigToVertex(fromConfig, toObject); + updateMemoryConfigToVertex(fromConfig, toObject); } return toObject; diff --git a/src/converters/_memorybanks_converters.ts b/src/converters/_memorybanks_converters.ts new file mode 100644 index 00000000..f22258ce --- /dev/null +++ b/src/converters/_memorybanks_converters.ts @@ -0,0 +1,170 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +// Code generated by the Google Gen AI SDK generator DO NOT EDIT. + +import * as common from '@google/genai/vertex_internal'; +import * as types from '../types.js'; + +export function createMemoryBankRequestParametersToVertex(): Record< + string, + unknown +> { + const toObject: Record = {}; + + return toObject; +} + +export function deleteMemoryBankRequestParametersToVertex( + fromObject: types.DeleteMemoryBankRequestParameters, +): Record { + const toObject: Record = {}; + + const fromName = common.getValueByPath(fromObject, ['name']); + if (fromName != null) { + common.setValueByPath(toObject, ['_url', 'name'], fromName); + } + + const fromForce = common.getValueByPath(fromObject, ['force']); + if (fromForce != null) { + common.setValueByPath(toObject, ['force'], fromForce); + } + + return toObject; +} + +export function getMemoryBankOperationParametersToVertex( + fromObject: types.GetMemoryBankOperationParameters, +): Record { + const toObject: Record = {}; + + const fromOperationName = common.getValueByPath(fromObject, [ + 'operationName', + ]); + if (fromOperationName != null) { + common.setValueByPath( + toObject, + ['_url', 'operationName'], + fromOperationName, + ); + } + + return toObject; +} + +export function ingestEventsConfigToVertex( + fromObject: types.IngestEventsConfig, + parentObject: Record, +): Record { + const toObject: Record = {}; + + const fromForceFlush = common.getValueByPath(fromObject, ['forceFlush']); + if (parentObject !== undefined && fromForceFlush != null) { + common.setValueByPath(parentObject, ['forceFlush'], fromForceFlush); + } + + const fromRevisionLabels = common.getValueByPath(fromObject, [ + 'revisionLabels', + ]); + if (parentObject !== undefined && fromRevisionLabels != null) { + common.setValueByPath(parentObject, ['revisionLabels'], fromRevisionLabels); + } + + const fromRevisionExpireTime = common.getValueByPath(fromObject, [ + 'revisionExpireTime', + ]); + if (parentObject !== undefined && fromRevisionExpireTime != null) { + common.setValueByPath( + parentObject, + ['revisionExpireTime'], + fromRevisionExpireTime, + ); + } + + const fromRevisionTtl = common.getValueByPath(fromObject, ['revisionTtl']); + if (parentObject !== undefined && fromRevisionTtl != null) { + common.setValueByPath(parentObject, ['revisionTtl'], fromRevisionTtl); + } + + const fromDisableMemoryRevisions = common.getValueByPath(fromObject, [ + 'disableMemoryRevisions', + ]); + if (parentObject !== undefined && fromDisableMemoryRevisions != null) { + common.setValueByPath( + parentObject, + ['disableMemoryRevisions'], + fromDisableMemoryRevisions, + ); + } + + const fromMetadata = common.getValueByPath(fromObject, ['metadata']); + if (parentObject !== undefined && fromMetadata != null) { + common.setValueByPath(parentObject, ['metadata'], fromMetadata); + } + + const fromMetadataMergeStrategy = common.getValueByPath(fromObject, [ + 'metadataMergeStrategy', + ]); + if (parentObject !== undefined && fromMetadataMergeStrategy != null) { + common.setValueByPath( + parentObject, + ['metadataMergeStrategy'], + fromMetadataMergeStrategy, + ); + } + + return toObject; +} + +export function ingestEventsRequestParametersToVertex( + fromObject: types.IngestEventsRequestParameters, +): Record { + const toObject: Record = {}; + + const fromName = common.getValueByPath(fromObject, ['name']); + if (fromName != null) { + common.setValueByPath(toObject, ['_url', 'name'], fromName); + } + + const fromStreamId = common.getValueByPath(fromObject, ['streamId']); + if (fromStreamId != null) { + common.setValueByPath(toObject, ['streamId'], fromStreamId); + } + + const fromDirectContentsSource = common.getValueByPath(fromObject, [ + 'directContentsSource', + ]); + if (fromDirectContentsSource != null) { + common.setValueByPath( + toObject, + ['directContentsSource'], + fromDirectContentsSource, + ); + } + + const fromScope = common.getValueByPath(fromObject, ['scope']); + if (fromScope != null) { + common.setValueByPath(toObject, ['scope'], fromScope); + } + + const fromGenerationTriggerConfig = common.getValueByPath(fromObject, [ + 'generationTriggerConfig', + ]); + if (fromGenerationTriggerConfig != null) { + common.setValueByPath( + toObject, + ['generationTriggerConfig'], + fromGenerationTriggerConfig, + ); + } + + const fromConfig = common.getValueByPath(fromObject, ['config']); + if (fromConfig != null) { + ingestEventsConfigToVertex(fromConfig, toObject); + } + + return toObject; +} diff --git a/src/converters/_memoryrevisions_converters.ts b/src/converters/_memoryrevisions_converters.ts index d963a398..2c2c8dc4 100644 --- a/src/converters/_memoryrevisions_converters.ts +++ b/src/converters/_memoryrevisions_converters.ts @@ -9,8 +9,8 @@ import * as common from '@google/genai/vertex_internal'; import * as types from '../types.js'; -export function getAgentEngineMemoryRevisionRequestParametersToVertex( - fromObject: types.GetAgentEngineMemoryRevisionRequestParameters, +export function getMemoryRevisionRequestParametersToVertex( + fromObject: types.GetMemoryRevisionRequestParameters, ): Record { const toObject: Record = {}; @@ -22,8 +22,8 @@ export function getAgentEngineMemoryRevisionRequestParametersToVertex( return toObject; } -export function listAgentEngineMemoryRevisionsConfigToVertex( - fromObject: types.ListAgentEngineMemoryRevisionsConfig, +export function listMemoryRevisionsConfigToVertex( + fromObject: types.ListMemoryRevisionsConfig, parentObject: Record, ): Record { const toObject: Record = {}; @@ -46,8 +46,8 @@ export function listAgentEngineMemoryRevisionsConfigToVertex( return toObject; } -export function listAgentEngineMemoryRevisionsRequestParametersToVertex( - fromObject: types.ListAgentEngineMemoryRevisionsRequestParameters, +export function listMemoryRevisionsRequestParametersToVertex( + fromObject: types.ListMemoryRevisionsRequestParameters, ): Record { const toObject: Record = {}; @@ -58,7 +58,7 @@ export function listAgentEngineMemoryRevisionsRequestParametersToVertex( const fromConfig = common.getValueByPath(fromObject, ['config']); if (fromConfig != null) { - listAgentEngineMemoryRevisionsConfigToVertex(fromConfig, toObject); + listMemoryRevisionsConfigToVertex(fromConfig, toObject); } return toObject; diff --git a/src/memories.ts b/src/memories.ts index ca0078b2..a51ad531 100644 --- a/src/memories.ts +++ b/src/memories.ts @@ -21,15 +21,14 @@ export class Memories extends BaseModule { } async createInternal( - params: types.CreateAgentEngineMemoryRequestParameters, - ): Promise { - let response: Promise; + params: types.CreateMemoryRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.createAgentEngineMemoryRequestParametersToVertex(params); + const body = converters.createMemoryRequestParametersToVertex(params); path = common.formatMap( '{name}/memories', body['_url'] as Record, @@ -50,10 +49,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEngineMemoryOperation; + return resp as types.MemoryOperation; }); } else { throw new Error( @@ -63,15 +62,14 @@ export class Memories extends BaseModule { } async delete( - params: types.DeleteAgentEngineMemoryRequestParameters, - ): Promise { - let response: Promise; + params: types.DeleteMemoryRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.deleteAgentEngineMemoryRequestParametersToVertex(params); + const body = converters.deleteMemoryRequestParametersToVertex(params); path = common.formatMap( '{name}', body['_url'] as Record, @@ -92,10 +90,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.DeleteAgentEngineMemoryOperation; + return resp as types.DeleteMemoryOperation; }); } else { throw new Error( @@ -105,15 +103,14 @@ export class Memories extends BaseModule { } async generateInternal( - params: types.GenerateAgentEngineMemoriesRequestParameters, - ): Promise { - let response: Promise; + params: types.GenerateMemoriesRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.generateAgentEngineMemoriesRequestParametersToVertex(params); + const body = converters.generateMemoriesRequestParametersToVertex(params); path = common.formatMap( '{name}/memories:generate', body['_url'] as Record, @@ -134,10 +131,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEngineGenerateMemoriesOperation; + return resp as types.GenerateMemoriesOperation; }); } else { throw new Error( @@ -146,16 +143,13 @@ export class Memories extends BaseModule { } } - async get( - params: types.GetAgentEngineMemoryRequestParameters, - ): Promise { + async get(params: types.GetMemoryRequestParameters): Promise { let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.getAgentEngineMemoryRequestParametersToVertex(params); + const body = converters.getMemoryRequestParametersToVertex(params); path = common.formatMap( '{name}', body['_url'] as Record, @@ -188,57 +182,15 @@ export class Memories extends BaseModule { } } - async ingestEventsInternal( - params: types.IngestEventsRequestParameters, - ): Promise { - let response: Promise; - - let path: string = ''; - let queryParams: Record = {}; - if (this.apiClient.isVertexAI()) { - const body = converters.ingestEventsRequestParametersToVertex(params); - path = common.formatMap( - '{name}/memories:ingestEvents', - body['_url'] as Record, - ); - queryParams = body['_query'] as Record; - delete body['_url']; - delete body['_query']; - delete body['config']; - - response = this.apiClient - .request({ - path: path, - queryParams: queryParams, - body: JSON.stringify(body), - httpMethod: 'POST', - httpOptions: params.config?.httpOptions, - abortSignal: params.config?.abortSignal, - }) - .then((httpResponse) => { - return httpResponse.json(); - }) as Promise; - - return response.then((resp) => { - return resp as types.MemoryBankIngestEventsOperation; - }); - } else { - throw new Error( - 'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).', - ); - } - } - async listInternal( - params: types.ListAgentEngineMemoryRequestParameters, - ): Promise { - let response: Promise; + params: types.ListMemoriesRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.listAgentEngineMemoryRequestParametersToVertex(params); + const body = converters.listMemoriesRequestParametersToVertex(params); path = common.formatMap( '{name}/memories', body['_url'] as Record, @@ -259,10 +211,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - const typedResp = new types.ListReasoningEnginesMemoriesResponse(); + const typedResp = new types.ListMemoriesResponse(); Object.assign(typedResp, resp); return typedResp; }); @@ -274,15 +226,14 @@ export class Memories extends BaseModule { } async getMemoryOperationInternal( - params: types.GetAgentEngineMemoryOperationParameters, - ): Promise { - let response: Promise; + params: types.GetMemoryOperationParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.getAgentEngineMemoryOperationParametersToVertex(params); + const body = converters.getMemoryOperationParametersToVertex(params); path = common.formatMap( '{operationName}', body['_url'] as Record, @@ -303,10 +254,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEngineMemoryOperation; + return resp as types.MemoryOperation; }); } else { throw new Error( @@ -316,17 +267,15 @@ export class Memories extends BaseModule { } async getGenerateMemoriesOperationInternal( - params: types.GetAgentEngineGenerateMemoriesOperationParameters, - ): Promise { - let response: Promise; + params: types.GetGenerateMemoriesOperationParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { const body = - converters.getAgentEngineGenerateMemoriesOperationParametersToVertex( - params, - ); + converters.getGenerateMemoriesOperationParametersToVertex(params); path = common.formatMap( '{operationName}', body['_url'] as Record, @@ -347,10 +296,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEngineGenerateMemoriesOperation; + return resp as types.GenerateMemoriesOperation; }); } else { throw new Error( @@ -360,15 +309,14 @@ export class Memories extends BaseModule { } async retrieveInternal( - params: types.RetrieveAgentEngineMemoriesRequestParameters, + params: types.RetrieveMemoriesRequestParameters, ): Promise { let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.retrieveAgentEngineMemoriesRequestParametersToVertex(params); + const body = converters.retrieveMemoriesRequestParametersToVertex(params); path = common.formatMap( '{name}/memories:retrieve', body['_url'] as Record, @@ -448,15 +396,14 @@ export class Memories extends BaseModule { } async rollbackInternal( - params: types.RollbackAgentEngineMemoryRequestParameters, - ): Promise { - let response: Promise; + params: types.RollbackMemoryRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.rollbackAgentEngineMemoryRequestParametersToVertex(params); + const body = converters.rollbackMemoryRequestParametersToVertex(params); path = common.formatMap( '{name}:rollback', body['_url'] as Record, @@ -477,10 +424,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEngineRollbackMemoryOperation; + return resp as types.RollbackMemoryOperation; }); } else { throw new Error( @@ -490,15 +437,14 @@ export class Memories extends BaseModule { } async updateInternal( - params: types.UpdateAgentEngineMemoryRequestParameters, - ): Promise { - let response: Promise; + params: types.UpdateMemoryRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.updateAgentEngineMemoryRequestParametersToVertex(params); + const body = converters.updateMemoryRequestParametersToVertex(params); path = common.formatMap( '{name}', body['_url'] as Record, @@ -519,10 +465,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEngineMemoryOperation; + return resp as types.MemoryOperation; }); } else { throw new Error( @@ -532,15 +478,14 @@ export class Memories extends BaseModule { } async purgeInternal( - params: types.PurgeAgentEngineMemoriesRequestParameters, - ): Promise { - let response: Promise; + params: types.PurgeMemoriesRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { - const body = - converters.purgeAgentEngineMemoriesRequestParametersToVertex(params); + const body = converters.purgeMemoriesRequestParametersToVertex(params); path = common.formatMap( '{name}/memories:purge', body['_url'] as Record, @@ -561,10 +506,10 @@ export class Memories extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - return resp as types.AgentEnginePurgeMemoriesOperation; + return resp as types.PurgeMemoriesOperation; }); } else { throw new Error( diff --git a/src/memorybanks.ts b/src/memorybanks.ts new file mode 100644 index 00000000..ede60c9c --- /dev/null +++ b/src/memorybanks.ts @@ -0,0 +1,186 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +// Code generated by the Google Gen AI SDK generator DO NOT EDIT. + +import * as common from '@google/genai/vertex_internal'; +import {ApiClient, BaseModule} from '@google/genai/vertex_internal'; +import * as converters from './converters/_memorybanks_converters.js'; +import {Memories} from './memories.js'; +import * as types from './types.js'; + +export class MemoryBanks extends BaseModule { + public readonly memories: Memories; + + constructor(private readonly apiClient: ApiClient) { + super(); + this.memories = new Memories(apiClient); + } + + async createInternal( + params: types.CreateMemoryBankRequestParameters, + ): Promise { + let response: Promise; + + let path: string = ''; + let queryParams: Record = {}; + if (this.apiClient.isVertexAI()) { + const body = converters.createMemoryBankRequestParametersToVertex(); + path = common.formatMap( + 'reasoningEngines', + body['_url'] as Record, + ); + queryParams = body['_query'] as Record; + delete body['_url']; + delete body['_query']; + delete body['config']; + + response = this.apiClient + .request({ + path: path, + queryParams: queryParams, + body: JSON.stringify(body), + httpMethod: 'POST', + httpOptions: params.config?.httpOptions, + abortSignal: params.config?.abortSignal, + }) + .then((httpResponse) => { + return httpResponse.json(); + }) as Promise; + + return response.then((resp) => { + return resp as types.MemoryBankOperation; + }); + } else { + throw new Error( + 'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).', + ); + } + } + + async deleteInternal( + params: types.DeleteMemoryBankRequestParameters, + ): Promise { + let response: Promise; + + let path: string = ''; + let queryParams: Record = {}; + if (this.apiClient.isVertexAI()) { + const body = converters.deleteMemoryBankRequestParametersToVertex(params); + path = common.formatMap( + '{name}', + body['_url'] as Record, + ); + queryParams = body['_query'] as Record; + delete body['_url']; + delete body['_query']; + delete body['config']; + + response = this.apiClient + .request({ + path: path, + queryParams: queryParams, + body: JSON.stringify(body), + httpMethod: 'DELETE', + httpOptions: params.config?.httpOptions, + abortSignal: params.config?.abortSignal, + }) + .then((httpResponse) => { + return httpResponse.json(); + }) as Promise; + + return response.then((resp) => { + return resp as types.DeleteMemoryBankOperation; + }); + } else { + throw new Error( + 'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).', + ); + } + } + + async ingestEventsInternal( + params: types.IngestEventsRequestParameters, + ): Promise { + let response: Promise; + + let path: string = ''; + let queryParams: Record = {}; + if (this.apiClient.isVertexAI()) { + const body = converters.ingestEventsRequestParametersToVertex(params); + path = common.formatMap( + '{name}/memories:ingestEvents', + body['_url'] as Record, + ); + queryParams = body['_query'] as Record; + delete body['_url']; + delete body['_query']; + delete body['config']; + + response = this.apiClient + .request({ + path: path, + queryParams: queryParams, + body: JSON.stringify(body), + httpMethod: 'POST', + httpOptions: params.config?.httpOptions, + abortSignal: params.config?.abortSignal, + }) + .then((httpResponse) => { + return httpResponse.json(); + }) as Promise; + + return response.then((resp) => { + return resp as types.MemoryBankIngestEventsOperation; + }); + } else { + throw new Error( + 'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).', + ); + } + } + + async getMemoryBankOperationInternal( + params: types.GetMemoryBankOperationParameters, + ): Promise { + let response: Promise; + + let path: string = ''; + let queryParams: Record = {}; + if (this.apiClient.isVertexAI()) { + const body = converters.getMemoryBankOperationParametersToVertex(params); + path = common.formatMap( + '{operationName}', + body['_url'] as Record, + ); + queryParams = body['_query'] as Record; + delete body['_url']; + delete body['_query']; + delete body['config']; + + response = this.apiClient + .request({ + path: path, + queryParams: queryParams, + body: JSON.stringify(body), + httpMethod: 'GET', + httpOptions: params.config?.httpOptions, + abortSignal: params.config?.abortSignal, + }) + .then((httpResponse) => { + return httpResponse.json(); + }) as Promise; + + return response.then((resp) => { + return resp as types.MemoryBankOperation; + }); + } else { + throw new Error( + 'This method is only supported by the Gemini Enterprise Agent Platform (previously known as Vertex AI).', + ); + } + } +} diff --git a/src/memoryrevisions.ts b/src/memoryrevisions.ts index 858cc2b5..5beac161 100644 --- a/src/memoryrevisions.ts +++ b/src/memoryrevisions.ts @@ -17,7 +17,7 @@ export class MemoryRevisions extends BaseModule { } async get( - params: types.GetAgentEngineMemoryRevisionRequestParameters, + params: types.GetMemoryRevisionRequestParameters, ): Promise { let response: Promise; @@ -25,9 +25,7 @@ export class MemoryRevisions extends BaseModule { let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { const body = - converters.getAgentEngineMemoryRevisionRequestParametersToVertex( - params, - ); + converters.getMemoryRevisionRequestParametersToVertex(params); path = common.formatMap( '{name}', body['_url'] as Record, @@ -61,17 +59,15 @@ export class MemoryRevisions extends BaseModule { } async listInternal( - params: types.ListAgentEngineMemoryRevisionsRequestParameters, - ): Promise { - let response: Promise; + params: types.ListMemoryRevisionsRequestParameters, + ): Promise { + let response: Promise; let path: string = ''; let queryParams: Record = {}; if (this.apiClient.isVertexAI()) { const body = - converters.listAgentEngineMemoryRevisionsRequestParametersToVertex( - params, - ); + converters.listMemoryRevisionsRequestParametersToVertex(params); path = common.formatMap( '{name}/revisions', body['_url'] as Record, @@ -92,10 +88,10 @@ export class MemoryRevisions extends BaseModule { }) .then((httpResponse) => { return httpResponse.json(); - }) as Promise; + }) as Promise; return response.then((resp) => { - const typedResp = new types.ListAgentEngineMemoryRevisionsResponse(); + const typedResp = new types.ListMemoryRevisionsResponse(); Object.assign(typedResp, resp); return typedResp; }); diff --git a/src/types/common.ts b/src/types/common.ts index 4c1f5580..abba4d46 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -1153,6 +1153,94 @@ export declare interface UpdateAgentEngineRequestParameters { config?: UpdateAgentEngineConfig; } +/** Config for create memory bank. */ +export declare interface CreateMemoryBankConfig { + /** Used to override HTTP request options. */ + httpOptions?: genaiTypes.HttpOptions; + /** Abort signal which can be used to cancel the request. + + NOTE: AbortSignal is a client-only operation. Using it to cancel an + operation will not cancel the request in the service. You will still + be charged usage for any applicable operations. + */ + abortSignal?: AbortSignal; +} + +/** Parameters for creating memory banks. */ +export declare interface CreateMemoryBankRequestParameters { + config?: CreateMemoryBankConfig; +} + +/** A memory bank. */ +export declare interface MemoryBank { + /** Required. Represents the ID of the schema. Must be 1-63 characters, start with a lowercase letter, and consist of lowercase letters, numbers, and hyphens. */ + name?: string; +} + +/** Operation that has an memory bank as a response. */ +export declare interface MemoryBankOperation { + /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ + name?: string; + /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ + metadata?: Record; + /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */ + done?: boolean; + /** The error result of the operation in case of failure or cancellation. */ + error?: Record; + /** The created Memory Bank. */ + response?: MemoryBank; +} + +/** Config for delete memory bank. */ +export declare interface DeleteMemoryBankConfig { + /** Used to override HTTP request options. */ + httpOptions?: genaiTypes.HttpOptions; + /** Abort signal which can be used to cancel the request. + + NOTE: AbortSignal is a client-only operation. Using it to cancel an + operation will not cancel the request in the service. You will still + be charged usage for any applicable operations. + */ + abortSignal?: AbortSignal; +} + +/** Parameters for deleting a memory bank. */ +export declare interface DeleteMemoryBankRequestParameters { + /** Name of the memory bank. */ + name: string; + /** If set to true, any child resources will also be deleted. */ + force?: boolean; + config?: DeleteMemoryBankConfig; +} + +/** Operation for deleting a memory bank. */ +export declare interface DeleteMemoryBankOperation { + /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ + name?: string; + /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ + metadata?: Record; + /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */ + done?: boolean; + /** The error result of the operation in case of failure or cancellation. */ + error?: Record; +} + +/** The direct contents source event for ingesting events. */ +export declare interface IngestionDirectContentsSourceEvent { + /** Required. The content of the event. */ + content?: genaiTypes.Content; + /** Optional. A unique identifier for the event. If an event with the same event_id is ingested multiple times, it will be de-duplicated. */ + eventId?: string; + /** Optional. The time at which the event occurred. If provided, this timestamp will be used for ordering events within a stream. If not provided, the server-side ingestion time will be used. */ + eventTime?: string; +} + +/** The direct contents source for ingesting events. */ +export declare interface IngestionDirectContentsSource { + /** Required. The events to ingest. */ + events?: IngestionDirectContentsSourceEvent[]; +} + /** The metadata values for memories. */ export declare interface MemoryMetadataValue { /** Represents a boolean value. */ @@ -1165,8 +1253,88 @@ export declare interface MemoryMetadataValue { timestampValue?: string; } +/** Config for ingesting events. */ +export declare interface IngestEventsConfig { + /** Used to override HTTP request options. */ + httpOptions?: genaiTypes.HttpOptions; + /** Abort signal which can be used to cancel the request. + + NOTE: AbortSignal is a client-only operation. Using it to cancel an + operation will not cancel the request in the service. You will still + be charged usage for any applicable operations. + */ + abortSignal?: AbortSignal; + /** Waits for the underlying memory generation operation to complete + before returning. Defaults to false. */ + waitForCompletion?: boolean; + /** Optional. Forces a flush of all pending events in the stream and triggers memory generation immediately bypassing any conditions configured in the `generation_trigger_config`. */ + forceFlush?: boolean; + /** Labels to apply to the memory revision. For example, you can use this to label a revision with its data source. */ + revisionLabels?: Record; + /** Optional. Input only. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted. */ + revisionExpireTime?: string; + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + revisionTtl?: string; + /** Optional. Input only. If true, no revisions will be created for this request. */ + disableMemoryRevisions?: boolean; + /** Optional. User-provided metadata for the generated memories. This is not generated by Memory Bank. */ + metadata?: Record; + /** Optional. The strategy to use when applying metadata to existing memories. */ + metadataMergeStrategy?: MemoryMetadataMergeStrategy; +} + +/** Parameters for ingesting events to Memory Bank. */ +export declare interface IngestEventsRequestParameters { + /** Name of the Memory Bank to ingest events into. */ + name: string; + /** The ID of the stream to ingest events into. */ + streamId?: string; + /** The direct memories source of the events that should be ingested. */ + directContentsSource?: IngestionDirectContentsSource; + /** The scope of the memories that should be generated from the stream. + + Memories will be consolidated across memories with the same scope. Scope + values cannot contain the wildcard character '*'. */ + scope?: Record; + /** The configuration for the memory generation trigger. */ + generationTriggerConfig?: MemoryGenerationTriggerConfig; + config?: IngestEventsConfig; +} + +/** Operation that ingests events into a memory bank. */ +export declare interface MemoryBankIngestEventsOperation { + /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ + name?: string; + /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ + metadata?: Record; + /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */ + done?: boolean; + /** The error result of the operation in case of failure or cancellation. */ + error?: Record; +} + +export declare interface GetMemoryBankOperationConfig { + /** Used to override HTTP request options. */ + httpOptions?: genaiTypes.HttpOptions; + /** Abort signal which can be used to cancel the request. + + NOTE: AbortSignal is a client-only operation. Using it to cancel an + operation will not cancel the request in the service. You will still + be charged usage for any applicable operations. + */ + abortSignal?: AbortSignal; +} + +/** Parameters for getting an operation with a memory bank as a response. */ +export declare interface GetMemoryBankOperationParameters { + /** The server-assigned name for the operation. */ + operationName: string; + /** Used to override the default configuration. */ + config?: GetMemoryBankOperationConfig; +} + /** Config for creating a Memory. */ -export declare interface AgentEngineMemoryConfig { +export declare interface MemoryConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1202,9 +1370,9 @@ export declare interface AgentEngineMemoryConfig { memoryId?: string; } -/** Parameters for creating Agent Engine Memories. */ -export declare interface CreateAgentEngineMemoryRequestParameters { - /** Name of the agent engine to create the memory under. */ +/** Parameters for creating Memories. */ +export declare interface CreateMemoryRequestParameters { + /** Name of the memory bank to create the memory under. */ name: string; /** The fact of the memory. @@ -1216,7 +1384,7 @@ export declare interface CreateAgentEngineMemoryRequestParameters { creating or generating memories. Up to 5 key-value pairs are accepted, and scope values cannot contain the wildcard character '*'. */ scope: Record; - config?: AgentEngineMemoryConfig; + config?: MemoryConfig; } /** Represents the structured value of the memory. */ @@ -1265,8 +1433,8 @@ export declare interface Memory { structuredContent?: MemoryStructuredContent; } -/** Operation that has an agent engine memory as a response. */ -export declare interface AgentEngineMemoryOperation { +/** Operation that has a memory as a response. */ +export declare interface MemoryOperation { /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ @@ -1275,12 +1443,12 @@ export declare interface AgentEngineMemoryOperation { done?: boolean; /** The error result of the operation in case of failure or cancellation. */ error?: Record; - /** The Agent Engine Memory. */ + /** The Memory. */ response?: Memory; } -/** Config for deleting an Agent Engine Memory. */ -export declare interface DeleteAgentEngineMemoryConfig { +/** Config for deleting a Memory. */ +export declare interface DeleteMemoryConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1292,15 +1460,15 @@ export declare interface DeleteAgentEngineMemoryConfig { abortSignal?: AbortSignal; } -/** Parameters for deleting agent engines. */ -export declare interface DeleteAgentEngineMemoryRequestParameters { - /** Name of the agent engine memory to delete. */ +/** Parameters for deleting memories. */ +export declare interface DeleteMemoryRequestParameters { + /** Name of the memory to delete. */ name: string; - config?: DeleteAgentEngineMemoryConfig; + config?: DeleteMemoryConfig; } -/** Operation for deleting agent engines. */ -export declare interface DeleteAgentEngineMemoryOperation { +/** Operation for deleting memories. */ +export declare interface DeleteMemoryOperation { /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ @@ -1347,7 +1515,7 @@ export declare interface GenerateMemoriesRequestDirectMemoriesSource { } /** Config for generating memories. */ -export declare interface GenerateAgentEngineMemoriesConfig { +export declare interface GenerateMemoriesConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1382,9 +1550,9 @@ export declare interface GenerateAgentEngineMemoriesConfig { allowedTopics?: MemoryTopicId[]; } -/** Parameters for generating agent engine memories. */ -export declare interface GenerateAgentEngineMemoriesRequestParameters { - /** Name of the agent engine to generate memories for. */ +/** Parameters for generating memories. */ +export declare interface GenerateMemoriesRequestParameters { + /** Name of the Memory Bank to generate memories with. */ name: string; /** The vertex session source of the memories that should be generated. */ vertexSessionSource?: GenerateMemoriesRequestVertexSessionSource; @@ -1399,7 +1567,7 @@ export declare interface GenerateAgentEngineMemoriesRequestParameters { provided, it will override the scope defined in the source content. Scope values cannot contain the wildcard character '*'. */ scope?: Record; - config?: GenerateAgentEngineMemoriesConfig; + config?: GenerateMemoriesConfig; } /** A memory that was generated. */ @@ -1422,8 +1590,8 @@ export class GenerateMemoriesResponse { generatedMemories?: GenerateMemoriesResponseGeneratedMemory[]; } -/** Operation that generates memories for an agent engine. */ -export declare interface AgentEngineGenerateMemoriesOperation { +/** Operation that generates memories with a Memory Bank. */ +export declare interface GenerateMemoriesOperation { /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ @@ -1436,8 +1604,8 @@ export declare interface AgentEngineGenerateMemoriesOperation { response?: GenerateMemoriesResponse; } -/** Config for getting an Agent Engine Memory. */ -export declare interface GetAgentEngineMemoryConfig { +/** Config for getting a Memory. */ +export declare interface GetMemoryConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1449,91 +1617,15 @@ export declare interface GetAgentEngineMemoryConfig { abortSignal?: AbortSignal; } -/** Parameters for getting an agent engine. */ -export declare interface GetAgentEngineMemoryRequestParameters { - /** Name of the agent engine. */ +/** Parameters for getting a Memory. */ +export declare interface GetMemoryRequestParameters { + /** Name of the memory. */ name: string; - config?: GetAgentEngineMemoryConfig; -} - -/** The direct contents source event for ingesting events. */ -export declare interface IngestionDirectContentsSourceEvent { - /** Required. The content of the event. */ - content?: genaiTypes.Content; - /** Optional. A unique identifier for the event. If an event with the same event_id is ingested multiple times, it will be de-duplicated. */ - eventId?: string; - /** Optional. The time at which the event occurred. If provided, this timestamp will be used for ordering events within a stream. If not provided, the server-side ingestion time will be used. */ - eventTime?: string; -} - -/** The direct contents source for ingesting events. */ -export declare interface IngestionDirectContentsSource { - /** Required. The events to ingest. */ - events?: IngestionDirectContentsSourceEvent[]; + config?: GetMemoryConfig; } -/** Config for ingesting events. */ -export declare interface IngestEventsConfig { - /** Used to override HTTP request options. */ - httpOptions?: genaiTypes.HttpOptions; - /** Abort signal which can be used to cancel the request. - - NOTE: AbortSignal is a client-only operation. Using it to cancel an - operation will not cancel the request in the service. You will still - be charged usage for any applicable operations. - */ - abortSignal?: AbortSignal; - /** Waits for the underlying memory generation operation to complete - before returning. Defaults to false. */ - waitForCompletion?: boolean; - /** Optional. Forces a flush of all pending events in the stream and triggers memory generation immediately bypassing any conditions configured in the `generation_trigger_config`. */ - forceFlush?: boolean; - /** Labels to apply to the memory revision. For example, you can use this to label a revision with its data source. */ - revisionLabels?: Record; - /** Optional. Input only. Timestamp of when the revision is considered expired. If not set, the memory revision will be kept until manually deleted. */ - revisionExpireTime?: string; - /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ - revisionTtl?: string; - /** Optional. Input only. If true, no revisions will be created for this request. */ - disableMemoryRevisions?: boolean; - /** Optional. User-provided metadata for the generated memories. This is not generated by Memory Bank. */ - metadata?: Record; - /** Optional. The strategy to use when applying metadata to existing memories. */ - metadataMergeStrategy?: MemoryMetadataMergeStrategy; -} - -/** Parameters for purging agent engine memories. */ -export declare interface IngestEventsRequestParameters { - /** Name of the Agent Engine to ingest events into. */ - name: string; - /** The ID of the stream to ingest events into. */ - streamId?: string; - /** The direct memories source of the events that should be ingested. */ - directContentsSource?: IngestionDirectContentsSource; - /** The scope of the memories that should be generated from the stream. - - Memories will be consolidated across memories with the same scope. Scope - values cannot contain the wildcard character '*'. */ - scope?: Record; - /** The configuration for the memory generation trigger. */ - generationTriggerConfig?: MemoryGenerationTriggerConfig; - config?: IngestEventsConfig; -} - -/** Operation that ingests events into a memory bank. */ -export declare interface MemoryBankIngestEventsOperation { - /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ - name?: string; - /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ - metadata?: Record; - /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */ - done?: boolean; - /** The error result of the operation in case of failure or cancellation. */ - error?: Record; -} - -/** Config for listing agent engine memories. */ -export declare interface ListAgentEngineMemoryConfig { +/** Config for listing memories. */ +export declare interface ListMemoriesConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1559,36 +1651,36 @@ export declare interface ListAgentEngineMemoryConfig { orderBy?: string; } -/** Parameters for listing agent engines. */ -export declare interface ListAgentEngineMemoryRequestParameters { - /** Name of the agent engine. */ +/** Parameters for listing memories. */ +export declare interface ListMemoriesRequestParameters { + /** Name of the Memory Bank. */ name: string; - config?: ListAgentEngineMemoryConfig; + config?: ListMemoriesConfig; } -/** Response for listing agent engine memories. */ -export class ListReasoningEnginesMemoriesResponse { +/** Response for listing memories. */ +export class ListMemoriesResponse { /** Used to retain the full HTTP response. */ sdkHttpResponse?: genaiTypes.HttpResponse; nextPageToken?: string; - /** List of agent engine memories. */ + /** List of memories. */ memories?: Memory[]; } /** Parameters for getting an operation with a memory as a response. */ -export declare interface GetAgentEngineMemoryOperationParameters { +export declare interface GetMemoryOperationParameters { /** The server-assigned name for the operation. */ operationName: string; /** Used to override the default configuration. */ - config?: GetAgentEngineOperationConfig; + config?: GetMemoryBankOperationConfig; } /** Parameters for getting an operation with generated memories as a response. */ -export declare interface GetAgentEngineGenerateMemoriesOperationParameters { +export declare interface GetGenerateMemoriesOperationParameters { /** The server-assigned name for the operation. */ operationName: string; /** Used to override the default configuration. */ - config?: GetAgentEngineOperationConfig; + config?: GetMemoryBankOperationConfig; } /** The parameters for semantic similarity search based retrieval. */ @@ -1626,7 +1718,7 @@ export declare interface MemoryConjunctionFilter { } /** Config for retrieving memories. */ -export declare interface RetrieveAgentEngineMemoriesConfig { +export declare interface RetrieveMemoriesConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1667,9 +1759,9 @@ export declare interface RetrieveAgentEngineMemoriesConfig { memoryTypes?: MemoryType[]; } -/** Parameters for retrieving agent engine memories. */ -export declare interface RetrieveAgentEngineMemoriesRequestParameters { - /** Name of the agent engine to retrieve memories from. */ +/** Parameters for retrieving memories. */ +export declare interface RetrieveMemoriesRequestParameters { + /** Name of the Memory Bank to retrieve memories from. */ name: string; /** The scope of the memories to retrieve. @@ -1681,7 +1773,7 @@ export declare interface RetrieveAgentEngineMemoriesRequestParameters { similaritySearchParams?: RetrieveMemoriesRequestSimilaritySearchParams; /** Parameters for simple (non-similarity search) retrieval. */ simpleRetrievalParams?: RetrieveMemoriesRequestSimpleRetrievalParams; - config?: RetrieveAgentEngineMemoriesConfig; + config?: RetrieveMemoriesConfig; } /** A retrieved memory. */ @@ -1713,9 +1805,9 @@ export declare interface RetrieveMemoryProfilesConfig { abortSignal?: AbortSignal; } -/** Parameters for retrieving agent engine memory profiles. */ +/** Parameters for retrieving memory profiles. */ export declare interface RetrieveMemoryProfilesRequestParameters { - /** Name of the agent engine to retrieve memory profiles from. */ + /** Name of the Memory Bank to retrieve memory profiles from. */ name: string; /** The scope of the memories to retrieve. @@ -1744,7 +1836,7 @@ export class RetrieveProfilesResponse { } /** Config for rolling back a memory. */ -export declare interface RollbackAgentEngineMemoryConfig { +export declare interface RollbackMemoryConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1758,17 +1850,17 @@ export declare interface RollbackAgentEngineMemoryConfig { waitForCompletion?: boolean; } -/** Parameters for generating agent engine memories. */ -export declare interface RollbackAgentEngineMemoryRequestParameters { - /** Name of the agent engine memory to rollback. */ +/** Parameters for generating memories. */ +export declare interface RollbackMemoryRequestParameters { + /** Name of the memory to rollback. */ name: string; /** The ID of the revision to rollback to. */ targetRevisionId: string; - config?: RollbackAgentEngineMemoryConfig; + config?: RollbackMemoryConfig; } /** Operation that rolls back a memory. */ -export declare interface AgentEngineRollbackMemoryOperation { +export declare interface RollbackMemoryOperation { /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ @@ -1779,8 +1871,8 @@ export declare interface AgentEngineRollbackMemoryOperation { error?: Record; } -/** Config for updating agent engine memory. */ -export declare interface UpdateAgentEngineMemoryConfig { +/** Config for updating a memory. */ +export declare interface UpdateMemoryConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1819,9 +1911,9 @@ export declare interface UpdateAgentEngineMemoryConfig { updateMask?: string; } -/** Parameters for updating agent engine memories. */ -export declare interface UpdateAgentEngineMemoryRequestParameters { - /** Name of the agent engine memory to update. */ +/** Parameters for updating memories. */ +export declare interface UpdateMemoryRequestParameters { + /** Name of the memory to update. */ name: string; /** The updated fact of the memory. @@ -1833,11 +1925,11 @@ export declare interface UpdateAgentEngineMemoryRequestParameters { creating or generating memories. Up to 5 key-value pairs are accepted, and scope values cannot contain the wildcard character '*'. */ scope?: Record; - config?: UpdateAgentEngineMemoryConfig; + config?: UpdateMemoryConfig; } /** Config for purging memories. */ -export declare interface PurgeAgentEngineMemoriesConfig { +export declare interface PurgeMemoriesConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1851,9 +1943,9 @@ export declare interface PurgeAgentEngineMemoriesConfig { waitForCompletion?: boolean; } -/** Parameters for purging agent engine memories. */ -export declare interface PurgeAgentEngineMemoriesRequestParameters { - /** Name of the Agent Engine to purge memories from. */ +/** Parameters for purging memories. */ +export declare interface PurgeMemoriesRequestParameters { + /** Name of the Memory Bank to purge memories from. */ name: string; /** The standard list filter to determine which memories to purge. More detail in [AIP-160](https://google.aip.dev/160). */ @@ -1875,7 +1967,7 @@ export declare interface PurgeAgentEngineMemoriesRequestParameters { filterGroups?: MemoryConjunctionFilter[]; /** If true, the memories will actually be purged. If false, the purge request will be validated but not executed. */ force?: boolean; - config?: PurgeAgentEngineMemoriesConfig; + config?: PurgeMemoriesConfig; } /** The response for purging memories. */ @@ -1884,8 +1976,8 @@ export class PurgeMemoriesResponse { purgeCount?: number; } -/** Operation that purges memories from an agent engine. */ -export declare interface AgentEnginePurgeMemoriesOperation { +/** Operation that purges memories from a Memory Bank. */ +export declare interface PurgeMemoriesOperation { /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */ @@ -1898,8 +1990,8 @@ export declare interface AgentEnginePurgeMemoriesOperation { response?: PurgeMemoriesResponse; } -/** Config for getting an Agent Engine Memory Revision. */ -export declare interface GetAgentEngineMemoryRevisionConfig { +/** Config for getting a Memory Revision. */ +export declare interface GetMemoryRevisionConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1911,11 +2003,11 @@ export declare interface GetAgentEngineMemoryRevisionConfig { abortSignal?: AbortSignal; } -/** Parameters for getting an Agent Engine memory revision. */ -export declare interface GetAgentEngineMemoryRevisionRequestParameters { - /** Name of the agent engine. */ +/** Parameters for getting a memory revision. */ +export declare interface GetMemoryRevisionRequestParameters { + /** Name of the Memory Revision. */ name: string; - config?: GetAgentEngineMemoryRevisionConfig; + config?: GetMemoryRevisionConfig; } /** An extracted memory that is the intermediate result before consolidation. */ @@ -1946,8 +2038,8 @@ export declare interface MemoryRevision { structuredData?: Record; } -/** Config for listing Agent Engine memory revisions. */ -export declare interface ListAgentEngineMemoryRevisionsConfig { +/** Config for listing memory revisions. */ +export declare interface ListMemoryRevisionsConfig { /** Used to override HTTP request options. */ httpOptions?: genaiTypes.HttpOptions; /** Abort signal which can be used to cancel the request. @@ -1964,15 +2056,15 @@ export declare interface ListAgentEngineMemoryRevisionsConfig { filter?: string; } -/** Parameters for listing Agent Engine memory revisions. */ -export declare interface ListAgentEngineMemoryRevisionsRequestParameters { - /** Name of the Agent Engine memory */ +/** Parameters for listing memory revisions. */ +export declare interface ListMemoryRevisionsRequestParameters { + /** Name of the memory */ name: string; - config?: ListAgentEngineMemoryRevisionsConfig; + config?: ListMemoryRevisionsConfig; } -/** Response for listing agent engine memory revisions. */ -export class ListAgentEngineMemoryRevisionsResponse { +/** Response for listing memory revisions. */ +export class ListMemoryRevisionsResponse { /** Used to retain the full HTTP response. */ sdkHttpResponse?: genaiTypes.HttpResponse; nextPageToken?: string; diff --git a/test/replays/agentengines_memories_test.ts b/test/replays/agentengines_memories_test.ts deleted file mode 100644 index 5ea110e3..00000000 --- a/test/replays/agentengines_memories_test.ts +++ /dev/null @@ -1,257 +0,0 @@ -/** - * @license - * Copyright 2026 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import 'jasmine'; - -import {NodeAuth} from '@google/genai/vertex_internal'; - -import {ReplayClient} from './_replay_client.js'; - -describe('Memories', () => { - let client: ReplayClient; - - beforeEach(() => { - client = new ReplayClient({ - project: 'test-project', - location: 'us-central1', - }); - }); - - it('creates a memory in an agent engine', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_create/test_private_create_memory.vertex.json'); - - const createOp = await client.agentEnginesInternal.memories.createInternal({ - name: - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584', - fact: 'memory_fact', - scope: {'user_id': '123'} - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(createOp.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - it('deletes an agent engine memory', async () => { - const fetchSpy = - client.setupReplay('ae_memories_delete/test_delete_memory.vertex.json'); - - const deleteOp = await client.agentEnginesInternal.memories.delete({ - name: - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/5605466683931099136', - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(deleteOp.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - - it('generates an agent engine memory', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_generate/test_private_generate_memory.vertex.json'); - - const aeName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584'; - - const generateOp = - await client.agentEnginesInternal.memories.generateInternal({ - name: aeName, - vertexSessionSource: { - session: - '{PROJECT_AND_LOCATION_PATH}/reasoningEngines/2886612747586371584/sessions/6922431337672474624' - }, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(generateOp.name).toBeDefined(); - client.verifyAllInteractions(); - }); - - it('gets an agent engine memory', async () => { - const fetchSpy = - client.setupReplay('ae_memories_get/test_get_memory.vertex.json'); - - const memoryName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688'; - const memory = await client.agentEnginesInternal.memories.get({ - name: memoryName, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(memory.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - - - it('gets an agent engine memory operation', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_get_memory_operation/test_private_get_memory_operation.vertex.json'); - - const opName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688/operations/1044963283964002304'; - const memoryOperation = - await client.agentEnginesInternal.memories.getMemoryOperationInternal({ - operationName: opName, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(memoryOperation.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - - it('gets an agent engine generate memory operation', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_get_generate_memories_operation/test_private_get_generate_memories_operation.vertex.json'); - - const opName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/operations/5669315676343369728'; - const generateMemoriesOperation = - await client.agentEnginesInternal.memories - .getGenerateMemoriesOperationInternal({ - operationName: opName, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(generateMemoriesOperation.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - it('lists agent engine memories', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_list/test_private_list_memory.vertex.json'); - - const aeName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584'; - - const memoryList = await client.agentEnginesInternal.memories.listInternal({ - name: aeName, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(memoryList.memories![0].name) - .toEqual( - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688'); - - client.verifyAllInteractions(); - }); - - it('retrieves an agent engine memory', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_retrieve/test_private_retrieve.vertex.json'); - - const aeName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584'; - - const retrievedMemories = - await client.agentEnginesInternal.memories.retrieveInternal({ - name: aeName, - scope: {'user_id': '123'}, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - - if (retrievedMemories?.retrievedMemories && - retrievedMemories.retrievedMemories.length > 0) { - expect(retrievedMemories.retrievedMemories[0].memory?.name).toBeDefined(); - } - - client.verifyAllInteractions(); - }); - - it('rolls back an agent engine memory', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_rollback/test_private_rollback.vertex.json'); - - const rollbackOperation = - await client.agentEnginesInternal.memories.rollbackInternal({ - name: - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688', - targetRevisionId: '3001207491565453312', - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(rollbackOperation.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - - it('updates an agent engine memory', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_update/test_private_update_memory.vertex.json'); - - const memoryName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688'; - - const updateOp = await client.agentEnginesInternal.memories.updateInternal({ - name: memoryName, - fact: 'memory_fact_updated', - scope: {'user_id': '123'}, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(updateOp.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - - it('purges an agent engine memory', async () => { - const fetchSpy = client.setupReplay( - 'ae_memories_private_purge/test_private_purge.vertex.json'); - - const purgeOp = await client.agentEnginesInternal.memories.purgeInternal({ - name: - 'projects/964831358985/locations/us-central1/reasoningEngines/6086402690647064576', - filter: 'scope.user_id=123', - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(purgeOp.name).toBeDefined(); - - client.verifyAllInteractions(); - }); - - - it('gets an agent engine memory revision', async () => { - const fetchSpy = client.setupReplay( - 'ae_memory_revisions_get/test_get_memory_revisions.vertex.json'); - - const memoryRevisionName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688/revisions/516064922187071488' - - const revision = await client.agentEnginesInternal.memories.revisions.get({ - name: memoryRevisionName, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(revision.name).toEqual(memoryRevisionName); - - client.verifyAllInteractions(); - }); - - it('lists agent engine memory revisions', async () => { - const fetchSpy = client.setupReplay( - 'ae_memory_revisions_private_list/test_private_list_memory_revisions.vertex.json'); - - const aeName = - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688'; - - const revisionList = - await client.agentEnginesInternal.memories.revisions.listInternal({ - name: aeName, - }); - - client.verifyInteraction(0, fetchSpy.calls.argsFor(0)); - expect(revisionList.memoryRevisions![0].name) - .toEqual( - 'projects/964831358985/locations/us-central1/reasoningEngines/2886612747586371584/memories/3858070028511346688/revisions/516064922187071488'); - - client.verifyAllInteractions(); - }); -}); diff --git a/test/unit/client_test.ts b/test/unit/client_test.ts index ee9e08ab..a4c6a69b 100644 --- a/test/unit/client_test.ts +++ b/test/unit/client_test.ts @@ -25,6 +25,5 @@ describe('GenAI Client Instantiation', () => { const ae = client.agentEnginesInternal; expect(ae.sessions).toBeDefined(); expect(ae.sandboxes).toBeDefined(); - expect(ae.memories).toBeDefined(); }); });