hivetrace


Namehivetrace JSON
Version 1.0.3 PyPI version JSON
download
home_pagehttp://hivetrace.ai
SummaryHivetrace SDK for monitoring LLM applications
upload_time2025-02-11 18:13:40
maintainerNone
docs_urlNone
authorRaft
requires_python>=3.8
licenseNone
keywords sdk monitoring logging llm ai hivetrace
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hivetrace SDK

## Description
Hivetrace SDK is designed for integration with the Hivetrace service, providing monitoring of user prompts and LLM responses.
The SDK automatically loads the configuration and sends data to the API

## Installation

Install the SDK via pip:

```sh
pip install hivetrace
```

## Usage

```python
from hivetrace import HivetraceSDK
```

Create a hivetrace_config.json with the contents:
```json
{
  "hivetrace_url": "https://your-hivetrace-instance.com"
}
```
Specify the path to the config

```python
hivetrace_config_path = "your/path/hivetrace_config.json"
```

# Initialize the SDK
hivetrace = HivetraceSDK(hivetrace_config_path)

```python
# Send a user prompt
response = hivetrace.monitor_user(
    application_id="123",
    message="The monitoring user prompt is sent here",
    additional_parameters={
        "user_id": "1"
    }
)

# Send a response from your LLM
response = hivetrace.monitor_llm(
    application_id="123",
    message="The monitoring llm response is sent here",
    additional_parameters={
        "agent_id": "2"
    }
)
```

## API

### `monitor_user(application_id: str, message: str, additional_parameters: dict = None) -> dict`
Sends a user prompt to the Hivetrace

- `application_id` - application identifier
- `message` - user prompt
- `additional_parameters` - dictionary of additional parameters (optional)

#### Response Example for monitor_user()
```json
{
    "status": "processed",
    "total_user_monitoring_result": [
        {
            "is_toxic": true,
            "type_of_violation": "injection"
        }
    ]
}
```

### `monitor_llm(application_id: str, message: str, additional_parameters: dict = None) -> dict`
Sends an LLM response to the Hivetrace

- `application_id` - application identifier
- `message` - LLM response
- `additional_parameters` - dictionary of additional parameters (optional)

#### Response Example for monitor_llm()
```json
{
    "status": "processed",
    "llm monitoring result": {
        "is_toxic": false,
        "type_of_violation": "safe"
    }
}
```

## Additional Parameters
The `additional_parameters` argument is a flexible dictionary that allows passing extra metadata along with requests

## Configuration

The SDK loads configuration from the client file. The allowed domain (`hivetrace_url`) is automatically retrieved from the configuration.
If the domain is not specified, the SDK raises a `HostNotFound` error

## License

This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)




            

Raw data

            {
    "_id": null,
    "home_page": "http://hivetrace.ai",
    "name": "hivetrace",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "SDK, monitoring, logging, LLM, AI, Hivetrace",
    "author": "Raft",
    "author_email": "sales@raftds.com",
    "download_url": "https://files.pythonhosted.org/packages/e2/32/ddedac751bfa19c628fed70fe6048e29ea53a178bc7fc7d034553810e47b/hivetrace-1.0.3.tar.gz",
    "platform": null,
    "description": "# Hivetrace SDK\n\n## Description\nHivetrace SDK is designed for integration with the Hivetrace service, providing monitoring of user prompts and LLM responses.\nThe SDK automatically loads the configuration and sends data to the API\n\n## Installation\n\nInstall the SDK via pip:\n\n```sh\npip install hivetrace\n```\n\n## Usage\n\n```python\nfrom hivetrace import HivetraceSDK\n```\n\nCreate a hivetrace_config.json with the contents:\n```json\n{\n  \"hivetrace_url\": \"https://your-hivetrace-instance.com\"\n}\n```\nSpecify the path to the config\n\n```python\nhivetrace_config_path = \"your/path/hivetrace_config.json\"\n```\n\n# Initialize the SDK\nhivetrace = HivetraceSDK(hivetrace_config_path)\n\n```python\n# Send a user prompt\nresponse = hivetrace.monitor_user(\n    application_id=\"123\",\n    message=\"The monitoring user prompt is sent here\",\n    additional_parameters={\n        \"user_id\": \"1\"\n    }\n)\n\n# Send a response from your LLM\nresponse = hivetrace.monitor_llm(\n    application_id=\"123\",\n    message=\"The monitoring llm response is sent here\",\n    additional_parameters={\n        \"agent_id\": \"2\"\n    }\n)\n```\n\n## API\n\n### `monitor_user(application_id: str, message: str, additional_parameters: dict = None) -> dict`\nSends a user prompt to the Hivetrace\n\n- `application_id` - application identifier\n- `message` - user prompt\n- `additional_parameters` - dictionary of additional parameters (optional)\n\n#### Response Example for monitor_user()\n```json\n{\n    \"status\": \"processed\",\n    \"total_user_monitoring_result\": [\n        {\n            \"is_toxic\": true,\n            \"type_of_violation\": \"injection\"\n        }\n    ]\n}\n```\n\n### `monitor_llm(application_id: str, message: str, additional_parameters: dict = None) -> dict`\nSends an LLM response to the Hivetrace\n\n- `application_id` - application identifier\n- `message` - LLM response\n- `additional_parameters` - dictionary of additional parameters (optional)\n\n#### Response Example for monitor_llm()\n```json\n{\n    \"status\": \"processed\",\n    \"llm monitoring result\": {\n        \"is_toxic\": false,\n        \"type_of_violation\": \"safe\"\n    }\n}\n```\n\n## Additional Parameters\nThe `additional_parameters` argument is a flexible dictionary that allows passing extra metadata along with requests\n\n## Configuration\n\nThe SDK loads configuration from the client file. The allowed domain (`hivetrace_url`) is automatically retrieved from the configuration.\nIf the domain is not specified, the SDK raises a `HostNotFound` error\n\n## License\n\nThis project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Hivetrace SDK for monitoring LLM applications",
    "version": "1.0.3",
    "project_urls": {
        "Homepage": "http://hivetrace.ai"
    },
    "split_keywords": [
        "sdk",
        " monitoring",
        " logging",
        " llm",
        " ai",
        " hivetrace"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a78e58f0db94ae5a9c7c058ff1a7a007c94a96b241b25aee945be2c8c3fef243",
                "md5": "83564492d3f9255a6f5a006c11255976",
                "sha256": "e795b0ddd2e29a02167d9480b290599bba2b09a5a2325ef6c446615d94e8f8fc"
            },
            "downloads": -1,
            "filename": "hivetrace-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "83564492d3f9255a6f5a006c11255976",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7119,
            "upload_time": "2025-02-11T18:13:38",
            "upload_time_iso_8601": "2025-02-11T18:13:38.816272Z",
            "url": "https://files.pythonhosted.org/packages/a7/8e/58f0db94ae5a9c7c058ff1a7a007c94a96b241b25aee945be2c8c3fef243/hivetrace-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e232ddedac751bfa19c628fed70fe6048e29ea53a178bc7fc7d034553810e47b",
                "md5": "b442240d42103b424f954d48e7564dc6",
                "sha256": "51b65f0930ccfdf23ef9e3c375adca6f98afd6d45518adcc57170b31d5723f0b"
            },
            "downloads": -1,
            "filename": "hivetrace-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "b442240d42103b424f954d48e7564dc6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 2968,
            "upload_time": "2025-02-11T18:13:40",
            "upload_time_iso_8601": "2025-02-11T18:13:40.907396Z",
            "url": "https://files.pythonhosted.org/packages/e2/32/ddedac751bfa19c628fed70fe6048e29ea53a178bc7fc7d034553810e47b/hivetrace-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-11 18:13:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "hivetrace"
}
        
Elapsed time: 1.87806s