Skip to main content
Version: 4.7.34

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.

Examples

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",
plugins: {
openai: openaiPlugin
}
});

Arguments

options: 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
}
});