You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hypercode is a friendly npm package that makes it easy to get live, structured LLM responses in your application.
3
+
`Hypercode` is a npm package for Node.js that allows you to consume the [Hyper APIs](https://docs.gethyper.ai) easily in your JavaScript or TypeScript projects with complete **type-safety**. `Hypercode` handles the complexity of context management and response formatting, allowing you to focus on creating dynamic and intelligent features that enhance user experience. It is a friendly npm package that makes it easy to get live, structured LLM responses with custom contexts in useful formats like integers, booleans, strings, dates, and lots more.
4
4
5
-
With Hypercode, you can easily query language models and receive responses in useful formats like integers, booleans, strings, and dates:
5
+
Create a free account today on [Hyper](https://app.gethyper.ai) to start building your own custom contexts, integrating them into your applications, generate API Keys, and use them in your projects with `Hypercode`!
6
+
7
+
Find the npm package [here](https://www.npmjs.com/package/hypercode)
- Context Management (get information about the created contexts, more methods coming soon) - [Learn More](#context-management)
14
+
- Response Formatting (get response in a specific format or data type) - [Learn More](#response-formatting---types-in-hypercode)
15
+
- Embeddings Search (perform nuanced searches across integrated third-party data sources and internal documents) - [Learn More](#embeddings-search)
16
+
17
+
**Here's a quick example of how you can use Hypercode to get a boolean response:**
6
18
7
19
```javascript
8
-
constisEarthFlat=awaithyper.boolean('Is the earth flat?');
20
+
const{ data:isEarthFlat} =awaithyper.types.boolean('Is the earth flat?');
9
21
10
22
console.log(isEarthFlat); // false
11
23
```
12
24
13
25
You can also pass information along with your queries in the form of `context`. Context represents bundles of live data with relevance to the query, ensuring the LLM his given all the information necessary to product an accurate response. You can build context objects in the [Hyper app](https://app.gethyper.ai), then use them in Hypercode:
14
26
15
27
```javascript
16
-
constproductLaunchDate=awaithyper.datetime('When is the product launch?', {
Start by installing the Hypercode package through npm:
75
+
Start by installing the Hypercode package through your preferred package manager:
76
+
77
+
#### Using npm
60
78
61
79
```bash
62
-
npm install hypercode
80
+
npm i neoenv
63
81
```
64
82
65
-
### Step 2: Set your Hyper API Key
83
+
or
66
84
67
-
> **_NOTE:_** You can generate an API key from the [API Key Settings](https://app.gethyper.ai/settings/api-keys) page in the Hyper app.
85
+
```bash
86
+
npm install --save neoenv
87
+
```
68
88
69
-
In your `.env` file, set your Hyper API Key:
89
+
#### Using Yarn
70
90
71
91
```bash
72
-
HYPER_API_KEY=your_api_key_here
92
+
yarn add neoenv
73
93
```
74
94
75
-
Make sure to replace `your_api_key_here` with your actual Hyper API key.
95
+
#### Using pnpm
76
96
77
-
Alternatively, you can set the key yourself by calling the `hyper.init` method:
97
+
```bash
98
+
pnpm add neoenv
99
+
```
78
100
79
-
```javascript
80
-
require('dotenv').config();
81
-
consthyper=require('hypercode');
101
+
### Step 2: Set your Hyper API Key
82
102
83
-
hyper.init('API_KEY_HERE');
103
+
> **_NOTE:_** You need to generate an API key from the [API Key Settings](https://app.gethyper.ai/settings/api-keys) page in the Hyper app.
84
104
85
-
// Continue with other function calls
105
+
In your `.env` file, set your Hyper API Key:
106
+
107
+
```bash
108
+
HYPER_API_KEY="your_api_key_here"
86
109
```
87
110
111
+
Make sure to replace `your_api_key_here` with your actual Hyper API key obtained from the Hyper app.
112
+
88
113
### Step 3: Import Hypercode in Your Project
89
114
90
-
Import Hypercode in your JavaScript or TypeScript file.
115
+
Import Hypercode in your JavaScript or TypeScript file to start using it:
91
116
92
117
```javascript
93
-
consthyper=require('hypercode');
118
+
import { Hyper } from'hypercode';
119
+
importdotenvfrom'dotenv';
120
+
121
+
dotenv.config();
122
+
123
+
consthyper=newHyper(process.env.HYPER_API_KEY);
124
+
125
+
// Use the `hyper` object to make different function calls
94
126
```
95
127
96
128
### Step 4: Start Querying
97
129
98
-
Now you're ready to start querying language models with Hypercode!
130
+
Now you're ready to start querying language models with your own created custom contexts with Hypercode!
99
131
100
-
## Types in Hypercode
132
+
## Examples
101
133
102
-
Hypercode provides a variety of structured query types, allowing you to seamlessly integrate LLM responses into your applications. You can utilize context with `contextId` when you need the model to consider specific background information for generating a response. Here's a breakdown of the types and how they can be used:
134
+
**You can find diferent example code in the [examples](https://github.com/gethyperai/hypercode/tree/main/examples) folder.**
103
135
104
-
-**boolean**: Get a true or false answer.
136
+
## Context Management
137
+
138
+
Hypercode allows you to programmatically manage your contexts that are created inside the [Hyper App](https://app.gethyper.ai). You can get information about the created contexts, and more methods are coming soon. More information about contexts can be found [here](https://docs.gethyper.ai/context).
139
+
140
+
**Here's a quick example of how you can use Hypercode to list down all the contexts:**
Hypercode provides a variety of structured query types, allowing you to seamlessly integrate LLM responses into your applications. You can utilize context with `contextId` when you need the model to consider specific background information for generating a response. More information about `types` can be found [here](https://docs.gethyper.ai/types) Here's a breakdown of the types and how they can be used:
151
+
152
+
-**string**: Get a simple string answer.
105
153
106
154
```javascript
107
-
constcanCatsSeeInTheDark=awaithyper.boolean('Can cats see in the dark?');
You can pass the `contextId` as an optional parameter to all the `types` methods. The `contextId` is the id of the context that you want to use for the query. Here's one example with the `integer` method:
'What were the customer satisfaction ratings from the last survey?',
227
+
{ contextId:'customer-reviews-context-id' },
228
+
);
229
+
230
+
// Get an array of booleans as the answer
231
+
const { data } =awaithyper.types.booleanArray(
232
+
'Are services meeting performance targets?',
233
+
{ contextId:'performance-reviews-context-id' },
234
+
);
235
+
236
+
// Get an array of datetimes as the answer
237
+
const { data } =awaithyper.types.datetimeArray(
238
+
'What are the upcoming project deadlines?',
239
+
{ contextId:'project-management-context-id' },
240
+
);
241
+
```
242
+
243
+
## Embeddings Search
244
+
245
+
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 about `search` can be found [here](https://docs.gethyper.ai/search).
With Hypercode, integrating live, structured responses from language models into your application has never been easier. By handling the complexity of context management and response formatting, Hypercode empowers you to focus on creating dynamic and intelligent features that enhance user experience.
257
+
With Hypercode, integrating live, structured responses in specific `types`from language models into your application has never been easier. By handling the complexity of managing the `contexts`and response formatting, Hypercode empowers you to focus on creating dynamic and intelligent features that enhance user experience. With the powerful `search` feature, developers can perform nuanced search across integrated third-party data sources and internal documents to get the most relevant results from the context.
150
258
151
259
Remember, the examples provided are just a starting point. The potential uses of Hypercode are limited only by your imagination and the needs of your application. Whether you're building smart assistants, data analysis tools, content generators, or any other AI-driven application, Hypercode is designed to streamline your workflow and bring the power of LLMs to your fingertips.
260
+
261
+
Create a free account on [Hyper](https://app.gethyper.ai) to start building your own custom contexts and integrating them into your applications today!
262
+
263
+
## Bugs and Features
264
+
265
+
See the [issues](https://github.com/gethyperai/hypercode/issues) for a list of proposed features and known issues. Feel free to raise new issues.
0 commit comments