The HoneyHive SDK for Python
Project description
HoneyHive
SDK Installation
pip install honeyhive
SDK Example Usage
Example
import honeyhive
from honeyhive.models import operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.configurations.get_configurations(project_name='<value>', type=operations.Type.LLM)
if res.configurations is not None:
# handle response
pass
Available Resources and Operations
configurations
- get_configurations - Retrieve a list of configurations
- create_configuration - Create a new configuration
- delete_configuration - Delete a configuration
- update_configuration - Update an existing configuration
datapoints
- get_datapoints - Retrieve a list of datapoints
- create_datapoint - Create a new datapoint
- update_datapoint - Update a specific datapoint
- delete_datapoint - Delete a specific datapoint
- get_datapoint - Retrieve a specific datapoint
datasets
- delete_datasets - Delete a dataset
- get_datasets - Get datasets
- post_datasets - Create a dataset
- put_datasets - Update a dataset
events
- post_events - Create a new event
- put_events - Update an event
- delete_events_event_id_ - Delete an event
metrics
- delete_metrics - Delete a metric
- get_metrics - Get all metrics
- post_metrics - Create a new metric
- put_metrics - Update an existing metric
projects
- delete_project - Delete a project
- get_projects - Get a list of projects
- create_project - Create a new project
- update_project - Update an existing project
session
- start_session - Start a new session
- delete_session - Delete a session
- get_session - Retrieve a session
- process_event_trace - Process an event trace for a given session
tools
- delete_tool - Delete a tool
- get_tools - Retrieve a list of tools
- create_tool - Create a new tool
- update_tool - Update an existing tool
Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
Error Object | Status Code | Content Type |
---|---|---|
errors.SDKError | 4x-5xx | / |
Example
import honeyhive
from honeyhive.models import errors, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = None
try:
res = s.configurations.get_configurations(project_name='<value>', type=operations.Type.LLM)
except errors.SDKError as e:
# handle exception
raise(e)
if res.configurations is not None:
# handle response
pass
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the server_idx: int
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Variables |
---|---|---|
0 | https://api.honeyhive.ai |
None |
Example
import honeyhive
from honeyhive.models import operations
s = honeyhive.HoneyHive(
server_idx=0,
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.configurations.get_configurations(project_name='<value>', type=operations.Type.LLM)
if res.configurations is not None:
# handle response
pass
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the server_url: str
optional parameter when initializing the SDK client instance. For example:
import honeyhive
from honeyhive.models import operations
s = honeyhive.HoneyHive(
server_url="https://api.honeyhive.ai",
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.configurations.get_configurations(project_name='<value>', type=operations.Type.LLM)
if res.configurations is not None:
# handle response
pass
Custom HTTP Client
The Python SDK makes API calls using the requests HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session
object.
For example, you could specify a header for every request that this sdk makes as follows:
import honeyhive
import requests
http_client = requests.Session()
http_client.headers.update({'x-custom-header': 'someValue'})
s = honeyhive.HoneyHive(client: http_client)
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
bearer_auth |
http | HTTP Bearer |
To authenticate with the API the bearer_auth
parameter must be set when initializing the SDK client instance. For example:
import honeyhive
from honeyhive.models import operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.configurations.get_configurations(project_name='<value>', type=operations.Type.LLM)
if res.configurations is not None:
# handle response
pass
Per-Operation Security Schemes
Some operations in this SDK require the security scheme to be specified at the request level. For example:
import honeyhive
s = honeyhive.HoneyHive()
res = s.tools.get_tools("<YOUR_BEARER_TOKEN_HERE>")
if res.tools is not None:
# handle response
pass
SDK Installation
pip install git+https://github.com/honeyhiveai/python-sdk.git
Development
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!
SDK Created by Speakeasy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for honeyhive-0.1.91-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 432e72b0a6ae926db602c25ca914dfe82f2f53dca2fe6c20e72a36c3b6269bb3 |
|
MD5 | d4e2bd330e0ab7d55270746803b36628 |
|
BLAKE2b-256 | da665727618c81bf02611f8a0a4cacbd5badd3fb9c411bbc75cb70e4321f3b79 |
Hashes for honeyhive-0.1.91-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f6a0c9aeabe9025ba5789b85330eb4c63d69c094c3303353c5e81d230788473 |
|
MD5 | 38cbfceef2343b38a8a68d5fd9ff28ae |
|
BLAKE2b-256 | 3d851ecf120563f308bd190c73321f13c4ee4c919085e1904b8fd9bf877d220d |