🎁Examples

Example tutorials on how to use and troubleshoot with Future Agi that will guide you through our data logging format and help you select the format that best fits your infrastructure needs.

from fi_client import Client
from fi.utils.types import ModelTypes, Environments

client = Client(api_key="fi_api_key", secret_key="fi_secret_key",uri="fi_api_url")

Example 1: Logging a Chat History Event one by one.

client.log(
    model_id="model_1",
    model_type=ModelTypes.GENERATIVE_LLM,
    environment=Environments.PRODUCTION,
    conversation={
        "chat_history": [
            {"role": "user", "content": "Hello!", "context": [["part1", "part2"]]}
        ]
    }
)

Example 2: Logging a Chat History Event and conversation ID

client.log(
    model_id="model_1",
    model_type=ModelTypes.GENERATIVE_LLM,
    environment=Environments.PRODUCTION,
    conversation={
        "chat_history": [
            {"role": "user", "content": "Hello!", "context": [["part1", "part2"]]}
        ],
        "conversation_id": "conv_1",
    }
)

Example 3: Logging a Chat Graph Event

client.log(
    model_id="model_2",
    model_type=ModelTypes.GENERATIVE_LLM,
    environment=Environments.STAGING,
    conversation={
        "chat_graph": {
            "conversation_id": "conv_1",
            "nodes": [
                {
                    "message": {
                        "id": "msg_1",
                        "author": {"role": "user", "metadata": {}},
                        "content": {"content_type": "text", "parts": ["Hello"]},
                        "context": [["part1", "part2"]]
                    },
                    "node_id": "node_1",
                    "parent_id": "node_0",
                    "timestamp": 1625216400
                }
            ]
        }
    },
    tags={"project": "AI project"}
)

Last updated