The OpenInference attributes formatted as OpenTelemetry span attributes.
// Chaining multiple attributes
context.with(
setSession(
setPromptTemplate(context.active(), {
template: "hello {name}",
variables: { name: "world" },
version: "V1.0"
}),
{ sessionId: "session-123" }
),
() => {
// Extract all attributes for span
const attributes = getAttributesFromContext(context.active());
span.setAttributes(attributes);
}
);
Gets the OpenInference attributes from the given context