Zapier Platform CLI app (zapier-mem0) with Add Memory / Delete Memory
creates and Search Memories / Get Memories searches against the Mem0 v3
API. Custom API-key auth (Authorization: Token), base-URL + auth
injected via beforeRequest middleware, non-2xx surfaced as errors.
Add Memory polls GET /v1/event/{id}/ for async extraction. Includes an
E2E test suite via createAppTester.
38 lines
977 B
JavaScript
38 lines
977 B
JavaScript
'use strict';
|
|
|
|
const perform = async (z, bundle) => {
|
|
const body = {
|
|
query: bundle.inputData.query,
|
|
output_format: 'v1.1',
|
|
limit: bundle.inputData.limit || 10,
|
|
};
|
|
if (bundle.inputData.user_id) body.filters = { user_id: bundle.inputData.user_id };
|
|
|
|
const response = await z.request({
|
|
url: '/v3/memories/search/',
|
|
method: 'POST',
|
|
body,
|
|
});
|
|
// Searches must return an array.
|
|
const data = response.data;
|
|
return Array.isArray(data) ? data : data.results || [];
|
|
};
|
|
|
|
module.exports = {
|
|
key: 'search_memories',
|
|
noun: 'Memory',
|
|
display: {
|
|
label: 'Search Memories',
|
|
description: 'Semantic search over stored memories.',
|
|
},
|
|
operation: {
|
|
perform,
|
|
inputFields: [
|
|
{ key: 'query', label: 'Query', type: 'string', required: true },
|
|
{ key: 'user_id', label: 'User ID', type: 'string' },
|
|
{ key: 'limit', label: 'Limit', type: 'integer', default: '10' },
|
|
],
|
|
sample: { id: '00000000-0000-0000-0000-000000000000', memory: 'User loves hiking' },
|
|
},
|
|
};
|