Skip to main content

LlamaIndex Tool for Hive Intelligence

Project description

Hive Tool for LlamaIndex

This tool provides integration with Hive Intelligence, enabling powerful crypto and Web3 intelligence capabilities.

Installation

Install the package using pip:

pip install llama-index-tools-hive

Setup

Set your Hive API key as an environment variable:

export HIVE_API_KEY=your_api_key_here

On Windows:

set HIVE_API_KEY=your_api_key_here

Basic Usage

Import and Initialize

from llama_index.tools.hive import HiveToolSpec, HiveSearchMessage

# Initialize with API key and optional search parameters
hive_tool = HiveToolSpec(
    api_key="your_api_key_here",  # or it will use HIVE_API_KEY env var
)

Simple Search

# Single prompt search
results = hive_tool.search(
    prompt="What is the current price of Ethereum?", include_data_sources=True
)
print("Search results:", results)

Chat-style Conversation

# Create conversation messages
chat_msgs = [
    HiveSearchMessage(role="user", content="Price of what?"),
    HiveSearchMessage(role="assistant", content="Please specify asset."),
    HiveSearchMessage(role="user", content="BTC"),
]

# Execute chat search
results = hive_tool.search(messages=chat_msgs, include_data_sources=True)
print("Chat response:", results)

Advanced Usage

Search with Custom Parameters

results = hive_tool.search(
    prompt="Analyze the latest trends in DeFi",
    include_data_sources=True,  # Include sources in response
)

API Reference

HiveToolSpec

__init__(self, api_key: str, temperature: Optional[float] = None, top_k: Optional[int] = None, top_p: Optional[float] = None)

  • api_key: Your Hive Intelligence API key
  • temperature: Controls randomness (0.0 to 1.0) - optional
  • top_k: Limit number of results returned - optional
  • top_p: Nucleus sampling parameter - optional

search(self, prompt: str = None, messages: List[HiveSearchMessage] = None, include_data_sources: bool = False) -> HiveSearchResponse

Parameters:

  • prompt: The search query or question (string)
  • messages: List of HiveSearchMessage objects for chat-style conversations
  • include_data_sources: Whether to include data sources in the response

Returns:

  • HiveSearchResponse containing the search results

Examples

Full Example Script

from llama_index.tools.hive import HiveToolSpec, HiveSearchMessage


def main():
    # Initialize with API key and search parameters
    hive = HiveToolSpec(api_key="your_api_key_here")

    # Simple search
    print("--- Simple Search ---")
    results = hive.search(
        prompt="What is the current price of Bitcoin?",
        include_data_sources=True,
    )
    print("Results:", results)

    # Chat conversation
    print("\n--- Chat Conversation ---")
    chat = [
        HiveSearchMessage(role="user", content="Tell me about"),
        HiveSearchMessage(
            role="assistant", content="What would you like to know about?"
        ),
        HiveSearchMessage(role="user", content="Ethereum upgrades"),
    ]
    results = hive.search(messages=chat)
    print("Chat response:", results)


if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_hive-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_hive-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_hive-0.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_hive-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c588d311bc373f6f4752ed23d46b69ffb39667068743c11a97054a33de0edf12
MD5 dbf3f3f8317d365d0e4b29de4f9bba97
BLAKE2b-256 cdf223c192126d50b021ac6f15b787730066e8198c1919d78eebcd4b2d4375d8

See more details on using hashes here.

File details

Details for the file llama_index_tools_hive-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_hive-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 955ca15b4a8be413071f2535f0e065bd991d9952a9d0aac502061e58c2bde22a
MD5 e96d4e3c298cdaf154966d2c245c8ed0
BLAKE2b-256 4497499018bbc3f022845ac207dd2acbd13d47c2e9b76d4346f45bb76f0cf039

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page