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.1.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.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_tracekit_core-1.2.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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.1.tar.gz
Algorithm Hash digest
SHA256 4085c63e35193bf4bc273c0c982a3fa6d49a6a3dfb9e3e2a567d77bd63cab62a
MD5 2728a32f388c391f17f50263b8f03675
BLAKE2b-256 fffaedf40116aab5bccc5aa64182e1530893789677932c368baa910b71829392

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llm_tracekit_core-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1666f140dbc514fdd55612a54db791556583a0812be2cd239bfc5eb02f848a56
MD5 015f9985fdbd3e346b468cc25a203d66
BLAKE2b-256 19c24a4f749192beeab172aaf6e46cc68391b636e3227d575314c73ec3ec8d48

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