Skip to content

Latest commit

 

History

History
295 lines (234 loc) · 40.1 KB

README.md

File metadata and controls

295 lines (234 loc) · 40.1 KB

Configurations

(configurations)

Overview

Available Operations

get_configurations

Retrieve a list of configurations

Example Usage

from honeyhive import HoneyHive

s = HoneyHive(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.configurations.get_configurations(project="<value>")

if res.configurations is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
project str ✔️ Project name for configuration like Example Project
env Optional[operations.Env] Environment - "dev", "staging" or "prod"
name Optional[str] The name of the configuration like v0
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.GetConfigurationsResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

create_configuration

Create a new configuration

Example Usage

from honeyhive import HoneyHive
from honeyhive.models import components

s = HoneyHive(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.configurations.create_configuration(request={
    "project": "660d7ba7995cacccce4d299e",
    "name": "function-v0",
    "provider": "openai",
    "parameters": components.PostConfigurationRequestParameters(
        call_type=components.PostConfigurationRequestCallType.CHAT,
        model="gpt-4-turbo-preview",
        hyperparameters={
            "temperature": 0,
            "max_tokens": 1000,
            "top_p": 1,
            "top_k": -1,
            "frequency_penalty": 0,
            "presence_penalty": 0,
            "stop_sequences": [
                "<value>",
            ],
        },
        selected_functions=[
            {
                "id": "64e3ba90e81f9b3a3808c27f",
                "name": "get_google_information",
                "description": "Get information from Google when you do not have that information in your context",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "query": {
                            "type": "string",
                            "description": "The query asked by the user",
                        },
                    },
                    "required": [
                        "query",
                    ],
                },
            },
        ],
        function_call_params=components.PostConfigurationRequestFunctionCallParams.AUTO,
        force_function={

        },
        **{
            "template": [
                {
                    "role": "system",
                    "content": "You are a web search assistant.",
                },
                {
                    "role": "user",
                    "content": "{{ query }}",
                },
            ],
        },
    ),
    "env": [
        components.PostConfigurationRequestEnv.STAGING,
    ],
    "user_properties": {
        "user_id": "google-oauth2|108897808434934946583",
        "user_name": "Dhruv Singh",
        "user_picture": "https://lh3.googleusercontent.com/a/ACg8ocLyQilNtK9RIv4M0p-0FBSbxljBP0p5JabnStku1AQKtFSK=s96-c",
        "user_email": "[email protected]",
    },
})

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
request components.PostConfigurationRequest ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.CreateConfigurationResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

update_configuration

Update an existing configuration

Example Usage

from honeyhive import HoneyHive
from honeyhive.models import components

s = HoneyHive(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.configurations.update_configuration(id="<id>", put_configuration_request={
    "project": "New Project",
    "name": "function-v0",
    "provider": "openai",
    "parameters": components.PutConfigurationRequestParameters(
        call_type=components.PutConfigurationRequestCallType.CHAT,
        model="gpt-4-turbo-preview",
        hyperparameters={
            "temperature": 0,
            "max_tokens": 1000,
            "top_p": 1,
            "top_k": -1,
            "frequency_penalty": 0,
            "presence_penalty": 0,
            "stop_sequences": [
                "<value>",
            ],
        },
        selected_functions=[
            {
                "id": "64e3ba90e81f9b3a3808c27f",
                "name": "get_google_information",
                "description": "Get information from Google when you do not have that information in your context",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "query": {
                            "type": "string",
                            "description": "The query asked by the user",
                        },
                    },
                    "required": [
                        "query",
                    ],
                },
            },
        ],
        function_call_params=components.PutConfigurationRequestFunctionCallParams.AUTO,
        force_function={

        },
        **{
            "template": [
                {
                    "role": "system",
                    "content": "You are a web search assistant.",
                },
                {
                    "role": "user",
                    "content": "{{ query }}",
                },
            ],
        },
    ),
    "env": [
        components.PutConfigurationRequestEnv.STAGING,
    ],
    "type": components.PutConfigurationRequestType.LLM,
    "user_properties": {
        "user_id": "google-oauth2|108897808434934946583",
        "user_name": "Dhruv Singh",
        "user_picture": "https://lh3.googleusercontent.com/a/ACg8ocLyQilNtK9RIv4M0p-0FBSbxljBP0p5JabnStku1AQKtFSK=s96-c",
        "user_email": "[email protected]",
    },
})

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description Example
id str ✔️ Configuration ID like 6638187d505c6812e4043f24
put_configuration_request components.PutConfigurationRequest ✔️ N/A {
"project": "New Project",
"name": "function-v0",
"provider": "openai",
"parameters": {
"call_type": "chat",
"model": "gpt-4-turbo-preview",
"hyperparameters": {
"temperature": 0,
"max_tokens": 1000,
"top_p": 1,
"top_k": -1,
"frequency_penalty": 0,
"presence_penalty": 0,
"stop_sequences": []
},
"responseFormat": {
"type": "text"
},
"selectedFunctions": [
{
"id": "64e3ba90e81f9b3a3808c27f",
"name": "get_google_information",
"description": "Get information from Google when you do not have that information in your context",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The query asked by the user"
}
},
"required": [
"query"
]
}
}
],
"functionCallParams": "auto",
"forceFunction": {},
"template": [
{
"role": "system",
"content": "You are a web search assistant."
},
{
"role": "user",
"content": "{{ query }}"
}
]
},
"env": [
"staging"
],
"type": "LLM",
"tags": [],
"user_properties": {
"user_id": "google-oauth2|108897808434934946583",
"user_name": "Dhruv Singh",
"user_picture": "https://lh3.googleusercontent.com/a/ACg8ocLyQilNtK9RIv4M0p-0FBSbxljBP0p5JabnStku1AQKtFSK=s96-c",
"user_email": "[email protected]"
}
}
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.UpdateConfigurationResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

delete_configuration

Delete a configuration

Example Usage

from honeyhive import HoneyHive

s = HoneyHive(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)

res = s.configurations.delete_configuration(id="<id>")

if res is not None:
    # handle response
    pass

Parameters

Parameter Type Required Description
id str ✔️ Configuration ID like 6638187d505c6812e4043f24
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

operations.DeleteConfigurationResponse

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*