Tracing and Monitoring Model APIs


Graphsignal automatically instruments some client libraries, such as OpenAI and Banana, so that there is no need for manual tracing integration.

Manual integration

To monitor any model API calls to hosted models, simply wrap the API calls in graphsignal.start_trace() context or @graphsignal.trace_function decorator.

import graphsignal

graphsignal.configure(api_key='my-api-key', deployment='my-app-prod')

def generate(prompt):
    with graphsignal.start_trace('generate') as span:
        completion = await model_rest_api_call(prompt)
        span.set_data('prompt', prompt)
        span.set_data('completion', completion)

See Quick Start guide and API reference for full documentation.