new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

axiom/setup

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Axiom environment variables

Configure the following environment variables in a .env file: AXIOM_TOKEN (your Axiom API token), AXIOM_DATASET (your Axiom dataset name), OTEL_SERVICE_NAME (e.g., 'my-ai-app'), OTEL_EXPORTER_OTLP_ENDPOINT (set to 'https://api.axiom.co/v1/traces'), and OTEL_EXPORTER_OTLP_HEADERS (set to 'Authorization=Bearer YOUR_AXIOM_API_TOKEN,X-Axiom-Dataset=your-axiom-dataset-name').

Axiom OpenTelemetry dependencies for Node.js

For Node.js instrumentation, install the following packages: dotenv, @opentelemetry/exporter-trace-otlp-http, @opentelemetry/resources, @opentelemetry/sdk-node, @opentelemetry/sdk-trace-node, @opentelemetry/semantic-conventions, and @opentelemetry/api.

Axiom instrumentation file example for Node.js

Example instrumentation file (src/instrumentation.ts) that configures OpenTelemetry to send traces to Axiom: ```typescript import { trace } from '@opentelemetry/api'; import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'; import type { Resource } from '@opentelemetry/resources'; import { resourceFromAttributes } from '@opentelemetry/resources'; import { NodeSDK } from '@opentelemetry/sdk-node'; import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node'; import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; import { initAxiomAI, RedactionPolicy } from 'axiom/ai'; const tracer = trace.getTracer('my-tracer'); const sdk = new NodeSDK({ resource: resourceFromAttributes({ [ATTR_SERVICE_NAME]: 'my-ai-app', }) as Resource, spanProcessor: new SimpleSpanProcessor( new OTLPTraceExporter({ url: `https://api.axiom.co/v1/traces`, headers: { Authorization: `Bearer ${process.env.AXIOM_TOKEN}`, 'X-Axiom-Dataset': process.env.AXIOM_DATASET, }, }), ), }); sdk.start(); initAxiomAI({ tracer, redactionPolicy: RedactionPolicy.AxiomDefault }); ``` This sets up the OpenTelemetry SDK with Axiom's OTLP endpoint and initializes Axiom AI with a tracer and default redaction policy.

Axiom model wrapping example

Example of wrapping an AI SDK model for automatic tracing with Axiom: ```typescript import { createOpenAI } from '@ai-sdk/openai'; import { generateText } from 'ai'; import { wrapAISDKModel } from 'axiom/ai'; // 1. Create your standard AI model provider const openaiProvider = createOpenAI({ apiKey: process.env.OPENAI_API_KEY, }); // 2. Wrap the model to enable automatic tracing const tracedGpt4o = wrapAISDKModel(openaiProvider('gpt-4o')); // 3. Use the wrapped model as you normally would const { text } = await generateText({ model: tracedGpt4o, prompt: 'What is the capital of Spain?', }); console.log(text); ``` Calls made using the wrapped model automatically send detailed traces to the Axiom dataset.

Axiom observability setup overview

Axiom is a data platform with specialized features for AI engineering workflows. Its integration with the AI SDK uses a model wrapper to automatically capture detailed traces for every LLM call, giving visibility into application performance, cost, and behavior.

Axiom setup prerequisites

To set up Axiom observability, you need: an Axiom organization, a dataset to send traces to, and an API token with ingest permissions for your dataset.

Axiom SDK package installation

Install the Axiom SDK package in your project using the 'axiom' package.

Give your agent this brain