Pipelines
🛑Alpha
OpenTelemetry support is currently in alpha and may undergo significant changes.
Pipelines
The pipelines SDK provides programmatic access to Gentrace pipelines. Pipelines are the top-level organizational unit that contains datasets, experiments, and traces.
Overview​
The SDK is built by Stainless and provides type-safe access to Gentrace entities. The pipelines
object exposes methods to create, retrieve, update, and list pipelines.
Basic usage​
- TypeScript
- Python
typescript
import { init, pipelines } from 'gentrace';init({apiKey: process.env.GENTRACE_API_KEY,});// List pipelinesconst pipelineList = await pipelines.list();// Access the pipelinesfor (const pipeline of pipelineList.data) {console.log(pipeline.slug);console.log(pipeline.displayName);}
python
import osfrom gentrace import init, pipelinesinit(api_key=os.environ["GENTRACE_API_KEY"])# List pipelinespipeline_list = await pipelines.list()# Access the pipelinesfor pipeline in pipeline_list.data:print(pipeline.slug)print(pipeline.display_name)
Pipeline structure​
Each pipeline contains:
id
: Unique identifier (UUID)slug
: URL-friendly unique identifierdisplayName
: Optional human-readable namefolderId
: Optional folder UUID for organizationgoldenDatasetId
: UUID of the golden dataset (if set)archivedAt
: Timestamp when archived (null if active)createdAt
: Creation timestampupdatedAt
: Last update timestamp
Resource methods​
Create a pipeline​
- TypeScript
- Python
typescript
const pipeline = await pipelines.create({slug: 'customer-support-ai',displayName: 'Customer Support AI Pipeline',folderId: 'folder-uuid', // optional});
python
pipeline = await pipelines.create(slug="customer-support-ai",display_name="Customer Support AI Pipeline",folder_id="folder-uuid", # optional)
Retrieve a pipeline​
- TypeScript
- Python
typescript
const pipeline = await pipelines.retrieve('pipeline-id');console.log(pipeline.slug);
python
pipeline = await pipelines.retrieve("pipeline-id")print(pipeline.slug)
Update a pipeline​
- TypeScript
- Python
typescript
const pipeline = await pipelines.update('pipeline-id', {displayName: 'Updated Pipeline Name',isArchived: false,});
python
pipeline = await pipelines.update("pipeline-id",display_name="Updated Pipeline Name",is_archived=False,)
List with filters​
- TypeScript
- Python
typescript
// Filter by folder or slugconst pipelineList = await pipelines.list({folderId: 'folder-id',slug: 'customer-support', // exact match or use advanced filters});
python
# Filter by folder or slugpipeline_list = await pipelines.list(folder_id="folder-id",slug="customer-support", # exact match)
Usage in AI workflows​
Pipelines are used throughout Gentrace to organize your AI workflows:
- TypeScript
- Python
typescript
// Use pipeline ID with interaction()const tracedFunction = interaction('My AI Function', myAIFunction, {pipelineId: pipeline.id,});// Use pipeline ID with experiment()experiment(pipeline.id, async () => {// Your experiment code});
python
# Use pipeline ID with interaction()@interaction(pipeline_id=pipeline.id, name="My AI Function")async def traced_function():# Your AI function codepass# Use pipeline ID with experiment()@experiment(pipeline_id=pipeline.id)async def my_experiment():# Your experiment codepass
See also​
- Pipelines API Reference - Full API documentation
- Datasets - Managing datasets within pipelines
- Experiments - Running experiments on pipelines
interaction()
- Tracing functions within pipelinesexperiment()
- Creating experiments for pipelines