traceAI is OSS package to enable standardized tracing of AI applications and frameworks
traceAI is a set of conventions and plugins that integrates seamlessly with OpenTelemetry to instrument and monitor code executions across models, frameworks, and vendors, mapping them to standardized trace attributes.
traceAI is natively supported by Future AGI, but can be used with any OpenTelemetry-compatible backend as well. traceAI provides a set of instrumentations for popular machine learning SDKs and frameworks in a variety of languages like Langchain, OpenAI, Anthropic, and more.
- Standardized Tracing: Maps AI workflows to a consistent set of trace attributes and spans.
- Framework Agnostic: Works with popular AI frameworks like OpenAI, LangChain, Anthropic, and more.
- OpenTelemetry Integration: Seamlessly integrates with OpenTelemetry-compatible backends.
- Extensible Plugins: Easily add custom instrumentation for unsupported frameworks.
- Future AGI Native Support: Optimized for Future AGI's observability platform.
pip install traceAI-openaiSet up your environment variables to authenticate with FutureAGI
import os
os.environ["FI_API_KEY"] = FI_API_KEY
os.environ["FI_SECRET_KEY"] = FI_SECRET_KEY
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEYSet up the trace provider to establish the observability pipeline. The trace provider:
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="openai_app"
)Set up your OpenAI client with built-in observability. This includes support for text, image, and audio models.
from traceai_openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument(tracer_provider=trace_provider)Set up your OpenAI client with built-in observability.
import openai
openai.api_key = os.environ["OPENAI_API_KEY"]
response = openai.ChatCompletion.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Can you tell me a joke?"}
]
)
print(response.choices[0].message['content'].strip())We welcome contributions from the community! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name). - Commit your changes (
git commit -m 'Add your feature'). - Push to the branch (
git push origin feature/your-feature-name). - Open a pull request.
- Website: https://www.futureagi.com/
- Documentation: https://docs.futureagi.com/
- Cookbooks: How-To-Implement-Observability
- LinkedIn: https://www.linkedin.com/company/futureagi
- Twitter: https://x.com/FutureAGI_
- Reddit: https://www.reddit.com/user/Future_AGI/submitted/
- Substack: https://substack.com/@futureagi