Skip to main content
Version: 2.0.0

Pipeline class - Constructor

The Pipeline class is the main entry point for passing observability data to Gentrace. This document focuses on the constructor. Learn more about using pipelines [here] (pipeline/basics).

Constructor

Arguments

options

The constructor takes an options object with the type PipelineOptions.

Types

🛠️ PipelineOptions

slug?

An optional slug for the pipeline.

logger?

An optional logger object with info and warn methods for logging messages and warnings.

typescript
import { Pipeline} from "@gentrace/core";
 
const pipeline = new Pipeline({
slug: "my-pipeline",
logger: {
info: (message, context) => {
console.log(message, context);
},
warn: (message, context) => {
console.warn(message, context);
}
}
});
 
plugins?

An optional object containing the plugins to be used within this pipeline.

typescript
import { Pipeline } from "@gentrace/core";
import { initPlugin } from "@gentrace/openai";
 
const openaiPlugin = await initPlugin({
apiKey: process.env.OPENAI_KEY,
});
 
const pipeline = new Pipeline({
slug: "my-pipeline",
logger: {
info: (message, context) => {
console.log(message, context);
},
warn: (message, context) => {
console.warn(message, context);
}
},
plugins: {
openai: openaiPlugin
}
});