querymemory
v0.2.0
Published
Official Query Memory SDK for Knowledge, Agent, Web Parsing, and Extraction APIs
Maintainers
Readme
Query Memory JavaScript SDK
Official SDK for Query Memory Knowledge, Agent, and Web Parsing APIs.
Install
npm install querymemoryQuick Start
import QueryMemoryClient from 'querymemory';
const client = new QueryMemoryClient({
baseUrl: 'https://api.querymemory.com',
apiKey: process.env.QUERY_MEMORY_API_KEY,
});
const result = await client.knowledge.query({
knowledgeId: '<KNOWLEDGE_ID>',
query: 'Summarize the latest bill',
topK: 5,
});
console.log(result);Use root domain for baseUrl (no /api/v1):
- Correct:
https://api.querymemory.com - Incorrect:
https://api.querymemory.com/api/v1
Auth Modes
- Public query APIs use
apiKey. - Management APIs can use
authToken(JWT) orapiKey(user API key), depending on backend policy.
You can pass one or both to one client.
Modules
client.knowledge.*query,getQueryJob,waitForQueryJoblist,availableDocuments,get,create,update,delete
client.agents.*query,getJob,waitForJob,getUserslist,get,create,updatecreateSession,listSessions,getSession,sendSessionMessage
client.web.*querylistEndpoints,getEndpoint,createEndpoint,updateEndpoint,deleteEndpoint
client.documents.*list,get,delete,getStorageStats,getDocumentStorageStats
client.ingestion.*ingest,reupload,index,getJob,waitForJob,getEndpointDocumentingestAndIndex(upload + auto-index + wait helper)
client.connectors.*catalog,list,connect,sync,listFilespreviewFile,addToSql,addFileToDocuments,disconnect
client.sql.*fromConnector,getDocumentDetailupdateInstructions,updatePredefinedQueriessyncSchema,runQuery,testConnection
Upload + Auto Index Example
import QueryMemoryClient from 'querymemory';
const client = new QueryMemoryClient({
baseUrl: 'https://api.querymemory.com',
apiKey: process.env.QUERY_MEMORY_API_KEY,
});
const file = new Blob(['hello world'], { type: 'text/plain' });
const result = await client.ingestion.ingestAndIndex({
endpoint: 'text',
file,
filename: 'hello.txt',
indexMode: 'pro',
});
console.log(result.document);Errors
SDK throws QueryMemoryError with:
messagestatusdetails
