For the complete documentation index, see llms.txt. This page is also available as Markdown.

Platform

Overview

Client lifecycle, authentication, and platform API access.

flush and shutdown control the span export pipeline. auth_check validates API credentials. The platform property exposes the async PlatformClient for secrets and other platform features.


auth_check (source)

Check if the provided credentials (public and secret key) are valid.

auth_check() -> bool

flush (source)

Force flush all pending spans and events to the InteractiveAI API.

This method manually flushes any pending spans, scores, and other events to the InteractiveAI API. It's useful in scenarios where you want to ensure all data is sent before proceeding, without waiting for the automatic flush interval.

flush() -> None

Example

# Record some spans and scores
with interactiveai.start_as_current_span(name="operation") as span:
    # Do work...
    pass

# Ensure all data is sent to InteractiveAI before proceeding
interactiveai.flush()

# Continue with other work

platform (source)

Access the platform API for secrets management and other platform features.

The PlatformClient is lazily initialized on first access and provides async methods for managing secrets stored in the InteractiveAI platform.

Returns: PlatformClient: A client for interacting with platform features.

Example: ```python # List all secrets secrets = await client.platform.secrets.list()


shutdown (source)

Shut down the InteractiveAI client and flush all pending data.

This method cleanly shuts down the InteractiveAI client, ensuring all pending data is flushed to the API and all background threads are properly terminated.

It's important to call this method when your application is shutting down to prevent data loss and resource leaks. For most applications, using the client as a context manager or relying on the automatic shutdown via atexit is sufficient.

Example

Last updated

Was this helpful?