Pipeline class - Constructor
- TypeScript
- Python
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";constopenaiPlugin = awaitinitPlugin ({apiKey :process .env .OPENAI_KEY ,});constpipeline = newPipeline ({slug : "my-pipeline",plugins : {openai :openaiPlugin }});
python
import osimport gentracegentrace.init(api_key=os.getenv("GENTRACE_API_KEY"),)pipeline = gentrace.Pipeline("my-pipeline",openai_config={"api_key": os.getenv("OPENAI_KEY"),},)
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";constpipeline = newPipeline ({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";constopenaiPlugin = awaitinitPlugin ({apiKey :process .env .OPENAI_KEY ,});constpipeline = newPipeline ({slug : "my-pipeline",logger : {info : (message ,context ) => {console .log (message ,context );},warn : (message ,context ) => {console .warn (message ,context );}},plugins : {openai :openaiPlugin }});
slug?
An optional slug for the pipeline.
openai_config?
The OpenAI configuration object, so the Pipeline
can properly instantiate an OpenAI handle instance.
python
import osimport gentracegentrace.init(api_key=os.getenv("GENTRACE_API_KEY"),)pipeline = gentrace.Pipeline("example-pipeline",# ✏️ Add your OpenAI configuration hereopenai_config={"api_key": os.getenv("OPENAI_KEY"),},)runner = pipeline.start()# ✅ Defining the openai_config parameter allows you to access the OpenAI handle instanceopenai = runner.get_openai()
pinecone_config?
The Pinecone configuration object, so the Pipeline
can properly instantiate a Pinecone handle instance.
python
import osimport gentracegentrace.init(api_key=os.getenv("GENTRACE_API_KEY"),)pipeline = gentrace.Pipeline("example-pipeline",# ✏️ Add your OpenAI configuration herepinecone_config={"api_key": os.getenv("PINECONE_API_KEY"),"environment: os.getenv("PINECONE_ENVIRONMENT"),},)runner = pipeline.start()# ✅ Defining the openai_config parameter allows you to access the OpenAI handle instanceopenai = runner.get_openai()