Skip to content

Logging LLM Interractions

Make sure you have the dataidea package installed. You can install as

Install DATAIDEA
pip install -U dataidea

Setup your api key in a dot env file with a name like DATAIDEA_API_KEY

Read the api key

Get API Key
import os 

api_key = os.getenv('DATAIDEA_API_KEY')

Log an interraction

Log LLM interraction
from dataidea.logger import llm_log

llm_log({
        'api_key': api_key,
        'project_name': 'Test Project',
        'user_id': '1234567890',
        'source': 'gpt-4o',
        'query': 'This is a test query',
        'response': 'This is a test response',
        'metadata': {'extra': 'extra info'}
    })