The Literal AI Python SDK provides observability for large language model (LLM) applications. It enables developers to trace, monitor, and debug their LLM interactions and application flows directly from their Python code. As of version 0.1.300, it's an actively developed library with frequent releases in its 0.1.x series, indicating ongoing feature development and potential API refinements.
pip install literalaiVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the Literal AI client and demonstrates how to trace a simple function representing an LLM call using the `@client.trace` decorator. It checks for the `LITERAL_API_KEY` environment variable to ensure the example runs correctly.
Ensure `LITERAL_API_KEY` is set in your environment. If you're using an older client, update to the latest version and verify your authentication method.
Regularly check release notes for breaking changes when updating the library. Pin your dependency version if stability is critical, and plan for periodic updates and code adjustments.
Identify whether you are operating in synchronous or asynchronous contexts and use the appropriate client methods and `await` keyword. For example, use `@client.atrace` decorator for async functions.
Install the library using pip: `pip install literalai`
Set the `LITERAL_API_KEY` environment variable with your actual API key, or pass it directly when initializing the client: `import os; from literalai import LiteralClient; literalai_client = LiteralClient(api_key=os.getenv('LITERAL_API_KEY'))` or `literalai_client = LiteralClient(api_key='YOUR_API_KEY_HERE')`Upgrade the `literalai` SDK to the latest version: `pip install --upgrade literalai`. If the issue persists, review the Literal AI documentation for any recent API changes related to feedback or step ingestion.
Upgrade the `literalai` SDK to the latest version: `pip install --upgrade literalai`. If the error continues, consult the official Literal AI documentation for the correct usage of thread filtering and ordering parameters.
No dependency data recorded yet.