Metadata-Version: 2.1
Name: claroai
Version: 0.0b1
Summary: Claro AI Python client
Home-page: https://getclaro.ai
Author: Claro AI
Author-email: hello@getclaro.ai
Keywords: Claro AI,Claro API
Description-Content-Type: text/markdown
Requires-Dist: urllib3 <2.1.0,>=1.25.3
Requires-Dist: python-dateutil
Requires-Dist: pydantic >=2
Requires-Dist: typing-extensions >=4.7.1

# 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

```sh
pip install claroai
```


Then import the package:
```python
import claroai
```

## Getting Started



```python
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)
