Skip to main content

Claro AI Python client

Project description

Claro AI python client

API for data ingestion

project:

  • API version: 1.0.0
  • Package version: 0.0.b0

Requirements.

Python 3.7+

Installation & Usage

pip install

pip install claroai

Then import the package:

import claroai

Getting Started

import claroai

from pprint import pprint

from claroai.rest import ApiException


configuration = claroai.Configuration(username="test", password="test")


with claroai.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    conversation_api_instance = claroai.ConversationApi(api_client)

    conversation_data_schema = claroai.ConversationData(
        [  # List[claroai.ConversationSchema] or claroai.ConversationSchema
            claroai.ConversationSchema(
                conversation_id="1",
                conversation_created_at="2021-01-01T00:00:00Z",
                user_id="1",
                messages=[
                    {
                        "id": "Thiyagu",
                        "role": "user",
                        "body": "What time does the team arrive?",
                        "created_at": "2020-02-20T20:19:34Z",
                    }
                ],
            ),
            claroai.ConversationSchema(
                conversation_id="2",
                conversation_created_at="2021-01-01T00:00:00Z",
                user_id="1",
                messages=[
                    {
                        "id": "Thiyagu 2",
                        "role": "user",
                        "body": "What time does the team arrive?",
                        "created_at": "2020-02-20T20:19:34Z",
                    }
                ],
            ),
        ]
    )

    interaction_api_instance = claroai.InteractionApi(api_client)

    interaction_data_schema = claroai.InteractionData(
        claroai.InteractionSchema(  # claroai.InteractionSchema or List[claroai.InteractionSchema]
            conversation_id="1",
            interaction_id="1",
            user_id="1",
            content="What time does the team arrive?",
            created_at="2020-02-20T20:19:34Z",
            interacted_at="2020-02-20T20:19:34Z",
        )
    )
    try:
        # Log a batch of conversations to BigQuery
        conversation_api_response = conversation_api_instance.ingest_conversation(
            conversation_data_schema
        )

        print("The response of ConversationApi->ingest_conversations:\n")
        pprint(conversation_api_response)

        # Log a batch of interactions to BigQuery
        interaction_api_response = interaction_api_instance.ingest_interaction(
            interaction_data_schema
        )
        print("The response of ConversationApi->ingest_interactions:\n")
        pprint(interaction_api_response)

    except ApiException as e:
        print("Exception when ingesting data: %s\n" % e)

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

claroai-0.0b1.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

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

claroai-0.0b1-py3-none-any.whl (53.4 kB view details)

Uploaded Python 3

File details

Details for the file claroai-0.0b1.tar.gz.

File metadata

  • Download URL: claroai-0.0b1.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for claroai-0.0b1.tar.gz
Algorithm Hash digest
SHA256 679a70af232e0496f33abb2582cf65d2e74fea6b58f1cb7ed89475c2c1753a57
MD5 48056e31866f8252da92de07c565988e
BLAKE2b-256 8eab9ced7b0443dc9d0a73a2cf65466e46ee05d6054684583692277ac21e84ca

See more details on using hashes here.

File details

Details for the file claroai-0.0b1-py3-none-any.whl.

File metadata

  • Download URL: claroai-0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 53.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for claroai-0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a7710a21b2350876ed3c7526d2ec92abe80d13058375b782a552433804bfd2c
MD5 1de3d50ea082419737c653eae223d5ad
BLAKE2b-256 d90a70c9270dca690ef7ef92e613ecf8d25bf3317f5a220433e027857651d9d0

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