Skip to main content

Module: batteries/logging-integrations

Integrations with external logging services. Currently only Weights and Biases is supported. You can see examples package for an example with OpenTelemetry.

Functions

WeightsAndBiasesTracer

WeightsAndBiasesTracer(«destructured», «destructured»): Element<any>

Weights and Biases logging integration for AI.JSX. The tracer allows for the creation of a trace tree that can be visualized in the Weights and Biases UI. To use it, wrap your application in a WeightsAndBiasesTracer component.

InitOptions, such as project name, can be passed to the WeightsAndBiasesTracer component.

Note

Make sure to

  1. Set the WANDB_API_KEY environment variable (in Node environments) and sessionStorage.getItem("WANDB_API_KEY") (in browser environments);
  2. Run await wandb.finish() after rendering is done.

See

https://docs.wandb.ai/ref/js/ for more info.

Example

await wandb.init()

console.log(
await AI.createRenderContext().render(
<WeightsAndBiasesTracer log={wandb.log}>
<CharacterGenerator />
</WeightsAndBiasesTracer>
)
);

await wandb.finish();

Parameters

NameType
«destructured»Object
› childrenNode
› log(_: Record<string, unknown>, step?: number, commit?: boolean) => any
«destructured»ComponentContext

Returns

Element<any>

Defined in

packages/ai-jsx/src/batteries/logging-integrations.tsx:60