Skip to content

Commit 606268c

Browse files
committed
feat(jsdoc): add JSDoc comments for Search
1 parent 1155bc8 commit 606268c

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/search/@types/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
export type MethodParamsOptions = {
2+
/**
3+
* The context ID to be used for the request, you can get all context IDs by calling `hyper.contexts.list()` and then using the `id` field from the response.
4+
*/
25
contextId: string;
36
};
47

@@ -37,7 +40,16 @@ type MetaDataType =
3740
};
3841

3942
export type SearchResultData = {
43+
/**
44+
* The content of the document
45+
*/
4046
page_content: string;
47+
/**
48+
* The type of the document
49+
*/
4150
type: 'Document';
51+
/**
52+
* Metadata about the document
53+
*/
4254
metadata: MetaDataType;
4355
};

src/search/search.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import type { MethodParamsOptions, SearchResultData } from './@types';
44
export class Search {
55
constructor(private readonly hyper: Hyper) {}
66

7+
/**
8+
* Execute embeddings Search API to perform nuanced searches across integrated third-party data sources and internal documents. More information: https://docs.gethyper.ai/search#post-v1-search
9+
* @param {string} query - The query to be processed
10+
* @param {MethodParamsOptions} options - Optional parameters to be passed to the request, such as `contextId`
11+
* @returns The result of embeddings Search API to perform nuanced searches across integrated third-party data sources and internal documents
12+
* @example
13+
* const { data, error } = await hyper.search.execute(
14+
'quarterly sales report',
15+
{ contextId: '123e4567-e89b-12d3-a456-426614174000' },
16+
);
17+
* console.log(data);
18+
*/
719
async execute(query: string, options?: MethodParamsOptions) {
820
const payload = options?.contextId
921
? { query, context_id: options.contextId }

0 commit comments

Comments
 (0)