Skip to main content

Core utilities for LLM Tracekit and Coralogix Guardrails SDK.

Project description

LLM Tracekit Core

Core utilities for LLM Tracekit instrumentations and Coralogix integration.

Installation

pip install llm-tracekit-core

Usage

Setting up Coralogix Export

Use setup_export_to_coralogix to configure tracing and export spans to Coralogix:

from llm_tracekit.core import setup_export_to_coralogix

setup_export_to_coralogix(
    service_name="ai-service",
    application_name="ai-application",
    subsystem_name="ai-subsystem",
    capture_content=True,
)

Environment Variables

The exporter reads connection details from environment variables:

export CX_TOKEN="your-coralogix-api-key"
export CX_ENDPOINT="https://your-domain.coralogix.com"

Manual Tracing Setup

Alternatively, set up tracing manually using OpenTelemetry:

from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

tracer_provider = TracerProvider(
    resource=Resource.create({SERVICE_NAME: "ai-service"}),
)
exporter = OTLPSpanExporter()
span_processor = SimpleSpanProcessor(exporter)
tracer_provider.add_span_processor(span_processor)
trace.set_tracer_provider(tracer_provider)

Enabling Message Content Capture

Message content (prompts, completions, function arguments, return values) is not captured by default.

To enable capture:

  • Pass capture_content=True when calling setup_export_to_coralogix
  • Or set the environment variable OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true

Note: Most Coralogix AI evaluations require message content, so enabling capture is highly recommended.

API Reference

setup_export_to_coralogix

def setup_export_to_coralogix(
    service_name: str,
    application_name: str,
    subsystem_name: str,
    capture_content: bool = False,
) -> None

Configures OpenTelemetry to export spans to Coralogix.

Parameters:

  • service_name: Name of your service
  • application_name: Coralogix application name
  • subsystem_name: Coralogix subsystem name
  • capture_content: Whether to capture message content in spans

License

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_tracekit_core-1.2.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_tracekit_core-1.2.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_tracekit_core-1.2.0.tar.gz.

File metadata

  • Download URL: llm_tracekit_core-1.2.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llm_tracekit_core-1.2.0.tar.gz
Algorithm Hash digest
SHA256 5b730ddb34013caa798cad230d9625eed9056bc0adcead7e734c24c0e1d372d9
MD5 82c0b0f63e252ec1be21f17fb89336d1
BLAKE2b-256 8f399cb417346324f4c6d67c073d3ba6af4b97bcb0e8c43e70e1c8caf0a5190e

See more details on using hashes here.

File details

Details for the file llm_tracekit_core-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: llm_tracekit_core-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llm_tracekit_core-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c0c7b2fec9d4003b5ee919d68b3b3881a878c623ab9638b7c9dc9db0f4b00c
MD5 c9a9eab51b6060a9265fb86d53f5b665
BLAKE2b-256 2a886ad84f2fd2885ef7d03fd2b5361d93eb03a9d7b5492fd0ad51dbddb96fe6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page