Try our new Claude Code Skill to automatically integrate Hyperspell into your project
import Hyperspell from 'hyperspell';
const client = new Hyperspell({
apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});
const queryResult = await client.memories.search({ query: 'query' });
console.log(queryResult.query_id);{
"documents": [
{
"source": "collections",
"resource_id": "<string>",
"title": "<string>",
"metadata": {
"created_at": "2023-11-07T05:31:56Z",
"indexed_at": "2023-11-07T05:31:56Z",
"last_modified": "2023-11-07T05:31:56Z",
"status": "pending",
"events": [
{
"message": "<string>",
"type": "error",
"time": "2023-11-07T05:31:56Z"
}
],
"url": "<string>"
},
"score": 123
}
],
"query_id": "<string>",
"errors": [
{}
],
"answer": "<string>",
"score": 123
}Retrieves documents matching the query.
import Hyperspell from 'hyperspell';
const client = new Hyperspell({
apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});
const queryResult = await client.memories.search({ query: 'query' });
console.log(queryResult.query_id);{
"documents": [
{
"source": "collections",
"resource_id": "<string>",
"title": "<string>",
"metadata": {
"created_at": "2023-11-07T05:31:56Z",
"indexed_at": "2023-11-07T05:31:56Z",
"last_modified": "2023-11-07T05:31:56Z",
"status": "pending",
"events": [
{
"message": "<string>",
"type": "error",
"time": "2023-11-07T05:31:56Z"
}
],
"url": "<string>"
},
"score": 123
}
],
"query_id": "<string>",
"errors": [
{}
],
"answer": "<string>",
"score": 123
}API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.
Query to run.
If true, the query will be answered along with matching source documents.
Only query documents from these sources.
collections, reddit, notion, slack, google_calendar, google_mail, box, google_drive, vault, web_crawler Search options for the query.
Show child attributes
Maximum number of results to return.
Successful Response
Show child attributes
The ID of the query. This can be used to retrieve the query later, or add feedback to it. If the query failed, this will be None.
Errors that occurred during the query. These are meant to help the developer debug the query, and are not meant to be shown to the user.
Show child attributes
The answer to the query, if the request was set to answer.
The average score of the query feedback, if any.
Was this page helpful?