Skip to main content

Ivy Analytics API

Project description

ivyanalytics

Python bindings for ingesting conversational data into ivyanalytics

Requirements

Python 3.7+

Installation

pip install ivyanalytics

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import ivyanalytics
from ivyanalytics.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.ivyanalytics.io
# See configuration.py for a list of all supported configuration parameters.
configuration = ivyanalytics.Configuration(
    host = "https://api.ivyanalytics.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: HTTPBasic
configuration = ivyanalytics.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)


# Enter a context with an instance of the API client
with ivyanalytics.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = ivyanalytics.ConversationApi(api_client)
    conversation_data_schema = ivyanalytics.ConversationDataSchema(conversation_data_schema = ivyanalytics.ConversationDataSchema(conversations=
        [
            {
                "conversation_id": "my_historical_conv_id_1",
                "tenant_id": "<my_unique_tenant_id>",
                "conversation_created_at": "2020-02-20T20:19:34Z",
                "messages": [
                    {
                        "id": "message_id",
                        "role": "user",
                        "body": "What time does the team arrive?",
                        "created_at": "2020-02-20T20:19:34Z",
                    },
                    {
                        "id": "message_id",
                        "role": "assistant",
                        "body": "The team arrives at 6pm.",
                        "created_at": "2020-02-20T20:20:23Z",
                    },
                ],
                "metadata": {
                    "model": "gpt-3.5-turbo-16k",
                    "user_id": "2947451",
                    "metadata_1": "value",
                    "metadata_2": "value",
                },
            },
            {
                "conversation_id": "my_historical_conv_id_2",
                "tenant_id": "<my_unique_tenant_id>",
                "conversation_created_at": "2020-02-20T20:19:34Z",

                "messages": [
                    {
                        "id": "message_id",
                        "role": "user",
                        "body": "What time does the team arrive?",
                        "created_at": "2020-02-20T20:19:34Z",
                    },
                    {
                        "id": "message_id",
                        "role": "assistant",
                        "body": "The team arrives at 6pm.",
                        "created_at": "2020-02-20T20:20:23Z",
                    },
                ],
                "metadata": {
                    "model": "gpt-3.5-turbo-16k",
                    "user_id": "2947451",
                    "metadata_1": "value",
                    "metadata_2": "value",
                },
            },
        ]) )  

    try:
        # Log a batch of conversations to BigQuery
        api_response = api_instance.ingest_conversations(conversation_data_schema)
        print("The response of ConversationApi->ingest_conversations:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling ConversationApi->ingest_conversations: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.ivyanalytics.io

Class Method HTTP request Description
ConversationApi ingest_conversations POST /v1/conversations Log a batch of conversations to BigQuery

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

ivyanalytics-0.0b0.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

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

ivyanalytics-0.0b0-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file ivyanalytics-0.0b0.tar.gz.

File metadata

  • Download URL: ivyanalytics-0.0b0.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for ivyanalytics-0.0b0.tar.gz
Algorithm Hash digest
SHA256 0e58ac18f5fb294cc227c9bfef3f28f8f337724d8099d183b064335f8c2fc11a
MD5 104e2090906452ad3594999b9024c9fb
BLAKE2b-256 29bdb5f6f08d306924658105465723ecf9bf557bb181f1baadc95bf46d628351

See more details on using hashes here.

File details

Details for the file ivyanalytics-0.0b0-py3-none-any.whl.

File metadata

  • Download URL: ivyanalytics-0.0b0-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for ivyanalytics-0.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f3bc09dbfefcb84a06f2f550dca061ea347413eebf5d1c81f5c3d764cf60cd5
MD5 dc03373cdab8b23aaec525d5a92f596c
BLAKE2b-256 486e31666984fc712bc783b755f8540505662e40886952ca9a65adff5159d6ef

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