Skip to content

Commit d81feb4

Browse files
committed
feat(jsdoc): add JSDoc comments for Hyper
1 parent 3203043 commit d81feb4

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

src/hyper.ts

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,59 @@ const baseUrl = process.env.HYPER_BASE_URL || 'https://api.gethyper.ai/v1';
66

77
/**
88
* Hyper API client.
9-
* @param {string} apiKey - Your Hyper API key.
9+
* @param {string} apiKey - Your Hyper API key. Generate one at https://app.gethyper.ai/settings/api-keys, save it in a `.env` file, and pass it to the constructor like `new Hyper(process.env.HYPER_API_KEY)`.
1010
* @example
11-
* const hyper = new Hyper('hyper_123...');
11+
* import { Hyper } from 'hypercode';
12+
* import dotenv from "dotenv";
13+
*
14+
* dotenv.config();
15+
*
16+
* const hyper = new Hyper(process.env.HYPER_API_KEY);
1217
*/
1318
export class Hyper {
1419
private readonly headers: Headers;
1520

21+
/**
22+
* Hyper Types API. The `types` feature of the Developer API empowers you to retrieve structured data that is validated against specific data types. With the addition of a `contextId`, the API provides live, context-aware responses. More information: https://docs.gethyper.ai/types
23+
* @example
24+
* const { data, error } = await hyper.types.string('Who is the CEO of SpaceX?');
25+
* console.log(data); // Elon Musk
26+
* @example
27+
* const { data, error } = await hyper.types.integer(
28+
'How many planets are in the Solar System?',
29+
{ contextId: 'context-456' },
30+
);
31+
* console.log(data); // 8
32+
*/
1633
readonly types = new Types(this);
34+
35+
/**
36+
* Hyper Search API. Utilize our Embeddings Search API to perform nuanced searches across integrated third-party data sources and internal documents. Leverage the `contextId` to scope searches to specific business contexts for enhanced relevance. More information: https://docs.gethyper.ai/search
37+
* @example
38+
* const { data, error } = await hyper.search.execute('quarterly sales report', {
39+
contextId: 'context-123',
40+
});
41+
*/
1742
readonly search = new Search(this);
43+
44+
/**
45+
* Hyper Contexts API. Context groups in the Hyper app serve as collections of data aggregated from files, web URLs, and third-party integrations. They play a crucial role in refining search results and tailoring the contextual data provided to large language models. More information: https://docs.gethyper.ai/context
46+
* @example
47+
* const { data, error } = await hyper.contexts.list();
48+
*/
1849
readonly contexts = new Contexts(this);
1950

51+
/**
52+
*
53+
* @param {string} apiKey - Your Hyper API key. Generate one at https://app.gethyper.ai/settings/api-keys, save it in a `.env` file, and pass it to the constructor like `new Hyper(process.env.HYPER_API_KEY)`.
54+
* @example
55+
* import { Hyper } from 'hypercode';
56+
* import dotenv from "dotenv";
57+
*
58+
* dotenv.config();
59+
*
60+
* const hyper = new Hyper(process.env.HYPER_API_KEY);
61+
*/
2062
constructor(private readonly apiKey?: string) {
2163
if (!apiKey) {
2264
this.apiKey = process.env.HYPER_API_KEY;

0 commit comments

Comments
 (0)