πŸ–₯️Python SDK Client

Comprehensive Manager Class for System Components and API Interaction

Installation

pip install futureagi

1. Required Parameters:

β€’ model_id: A unique identifier for your model. This helps in tracking and distinguishing between different models in your system.

β€’ model_type: The type of model you are using. For instance, ModelTypes.GENERATIVE_LLM specifies that the model is a Generative Language Learning Model.

β€’ environment: The environment in which the model is running, such as Environments.PRODUCTION for production environments. This helps in differentiating between development, testing, and production stages.

β€’ conversation: A dictionary containing the conversation data. For example, chat_history can include user interactions. This is essential for models that deal with conversational AI to log the context of interactions.

2. Optional Parameters:

β€’ model_version: The version of the model being used. This is useful for tracking changes and improvements in different versions of your model.

β€’ prediction_timestamp: A timestamp indicating when the prediction was made. This helps in logging the exact time of the event, which is crucial for time-series analysis and debugging.

β€’ tags: A dictionary of tags for additional metadata. This can include project names, specific identifiers, or any other relevant information to categorize and filter events.

3. Supported Model Types:

β€’ GENERATIVE_LLM: For text data.

β€’ GENERATIVE_IMAGE: For text and image data.

4. Supported Environments:

β€’ TRAINING: For models in the training phase.

β€’ VALIDATION: For models in the validation phase.

β€’ PRODUCTION: For models deployed in a production environment.

β€’ CORPUS: For models dealing with a large collection of data or corpus.

Example Code:

Below is an example of how to log an event with the Fi AI Client, including the usage of each parameter:

from fi.utils.types import ModelTypes, Environments

client.log(
    model_id="your_model_id",  # Unique identifier for the model
    model_type=ModelTypes.GENERATIVE_LLM,  # Type of model (e.g., Generative LLM)
    environment=Environments.PRODUCTION,  # Environment (e.g., Production)
    model_version="1.0.0",  # Version of the model (optional)
    prediction_timestamp=1625216400,  # Timestamp of the prediction (optional)
    conversation={
        "chat_history": [
            {"role": "user", "content": "How do I implement a neural network in Python?"},
            {"role": "assistant", "content": "To implement a neural network in Python, you can use libraries like TensorFlow or PyTorch. Here’s a simple example using PyTorch..."}
        ]
    },  # Conversation data (optional)
    tags={"project": "AI project"}  # Additional metadata tags (optional)
)

Explanation of Each Key:

β€’ model_id: This key is crucial for identifying the specific model making the predictions. It allows for detailed tracking and management of different models within your system.

β€’ model_type: Specifies the type of model being used, which helps in understanding the nature and purpose of the logged events. ModelTypes.GENERATIVE_LLM indicates that the model generates language-based outputs.

β€’ environment: Indicates the deployment stage of the model. By specifying Environments.PRODUCTION, you ensure that the logs are appropriately categorized, helping in monitoring and managing production models.

β€’ model_version: Helps in version control by logging which version of the model was used for a particular event. This is useful for tracking performance and debugging issues related to specific versions.

β€’ prediction_timestamp: Provides the exact time when the prediction was made. This is essential for time-based analysis and understanding the sequence of events.

β€’ conversation: Contains the details of the conversation, including user inputs. This is particularly important for conversational models to retain context and improve the accuracy of responses.

β€’ tags: Allows for additional customization and categorization of events. By using tags, you can add project names or other identifiers to make filtering and searching through logs more efficient.

By understanding and utilizing these parameters effectively, you can ensure comprehensive and organized logging of events, facilitating better monitoring, debugging, and analysis of your AI models.

Last updated