Hive Agent Kit
This library provides you with an easy way to create and run Hive Agents.
Project Requirements
Install Python (>= 3.11):
Download from the official Python website.
Follow the installation instructions for your OS.
Acquiring an OpenAI API Key:
Sign up or log in to your OpenAI account at OpenAI API.
Navigate to the API section and generate a new API key.
Refer to the OpenAI Rate Limits for detailed information.
Supported Large Language Models (LLMs)
Here are the supported large language models in Hive Agent:
gpt-4o
gpt-4o-mini
gpt-4-turbo
gpt-4
gpt-3.5-turbo
gpt-3.5-turbo-instruct
Installation
You can either directly install from pip:
Or add it to your requirements.txt file:
Optional Dependencies
To install with the optional web3 dependencies, you can specify them as follows:
Or add it to your requirements.txt file:
Environment Setup
You need to specify an
OPENAI_API_KEY
in a .env file in this directory.Make a copy of the .env.example file and rename it to .env.
Configuration Setup
To use a configuration file with your HiveAgent
, follow these steps:
Create a Configuration File:
Create a TOML file (e.g.,
hive_config.toml
) in your project directory. (See hive_config_example.toml).Specify the Configuration Path:
When creating a
HiveAgent
instance, provide the relative or absolute path to your configuration file.
Usage
First, import the HiveAgent
class:
Load your environment variables:
Then create a HiveAgent instance:
Then, run your agent:
Finally, call the API endpoint, /api/v1/chat
, to see the result:
Adding tools
You can create tools that help your agent handle more complex tasks. Here's an example:
Adding Retriever
You can add retriever tools to create vector embeddings and retrieve semantic information. It will create vector index for every pdf documents under 'hive-agent-data/files/user' folder and can filter files with required_exts parameter.
Hive agent supports ".md", '.mdx' ,".txt", '.csv', '.docx', '.pdf' file types.
Hive agent supports 4 type of retriever (basic, chroma, pinecone-serverless, pinecone-pod) and controlled with retrieval_tool parameter.
Read the full tutorial here.
Last updated