Package Exports
- hive-intelligence
- hive-intelligence/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hive-intelligence) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
๐ง Hive Intelligence TypeScript SDK
The Hive Intelligence SDK lets you integrate real-time crypto and Web3 intelligence into your JavaScript or TypeScript apps using simple prompt or chat-style inputs.
๐ Installation
Using npm:
npm install hive-intelligenceOr using yarn:
yarn add hive-intelligence๐ Setup
Set your Hive API key as an environment variable:
export HIVE_API_KEY=your_api_key_here๐งช Example Usage
import { HiveSearchClient } from 'hive-intelligence';
import { HiveSearchRequest, HiveSearchMessage, HiveSearchResponse} from 'hive-intelligence';
// Get API key from env
const apiKey = process.env.HIVE_API_KEY;
if (!apiKey) {
throw new Error('Please set the HIVE_API_KEY environment variable');
}
// Initialize client
const client = new HiveSearchClient(apiKey);
// ๐ก Example 1: Prompt-based query
const promptRequest: HiveSearchRequest = {
prompt: 'What is the current price of Ethereum?'
};
client.search(promptRequest).then((response: HiveSearchResponse) => {
console.log('Prompt Response:', response);
}).catch(console.error);
// ๐ข Example 2: Chat-style query
const chatRequest: HiveSearchRequest = {
messages: [
{ role: 'user', content: 'Price of' },
{ role: 'assistant', content: 'Price of what?' },
{ role: 'user', content: 'BTC' }
]
};
client.search(chatRequest).then((response: HiveSearchResponse) => {
console.log('Chat Response:', response);
}).catch(console.error);๐ Request Options
prompt: Plaintext question or querymessages: Array of{ role, content }for chat- Optional parameters:
temperature: (e.g. 0.7) randomness of responsetop_k: max tokens consideredtop_p: nucleus samplinginclude_data_sources: show source info
โ Error Handling
On error, the SDK throws HiveSearchAPIError with:
status: HTTP status codestatusText: status messagebody: full API response