Skip to content

Cookbook for Pipelex, the open-source language for AI Agents to create and run repeatable, structured, composable AI workflows

License

Notifications You must be signed in to change notification settings

Pipelex/pipelex-cookbook

Repository files navigation

Pipelex Cookbook πŸ“š

Examples, recipes, and best-practice pipelines for the Pipelex LLM Pipeline framework.

If you just want to run an example, jump to Quick Start. If you'd like to share your own pipeline, head straight to Contributing. πŸ“š Check out the Pipelex Documentation for more information, in particular the Cookbook examples section.


Table of Contents

  1. Repository Layout
  2. Quick Start
  3. Contributing
  4. Contact & Support

Repository Layout

.
β”œβ”€β”€ pipelex_libraries/         # Main library code
β”‚   β”œβ”€β”€ pipelines/             # Pipeline implementations
β”‚   β”‚   β”œβ”€β”€ base_library/      # Core pipeline components
β”‚   β”‚   β”œβ”€β”€ examples/          # Example pipelines
β”‚   β”‚   └── quick_start/       # Quick start tutorials
β”‚   β”œβ”€β”€ llm_deck/              # LLM deck components
β”‚   β”œβ”€β”€ llm_integrations/      # LLM provider integrations
β”‚   └── templates/             # Prompt templates
β”œβ”€β”€ examples/                  # Advanced examples (PDF extraction, expense processing, etc.)
|   β”œβ”€β”€ wip/                   # Work in progress examples
└── quick_start/               # Getting started tutorials

Quick Start

git clone https://github.com/Pipelex/pipelex-cookbook.git
cd pipelex-cookbook

Create virtual environment, install Pipelex and other dependencies

make install

This will install the Pipelex python library and its dependencies using uv.

Set up environment variables

cp .env.example .env

Enter your API keys into your .env file. The OPENAI_API_KEY is enough to get you started, but some pipelines require models from other providers.

Run Hello World

python quick_start/hello_world.py

Example: optimizing a tweet in 2 steps

1. Define the pipeline in TOML

domain = "tech_tweet"
definition = "A pipeline for optimizing tech tweets using Twitter/X best practices"

[concept]
DraftTweet = "A draft version of a tech tweet that needs optimization"
OptimizedTweet = "A tweet optimized for Twitter/X engagement following best practices"
TweetAnalysis = "Analysis of the tweet's structure and potential improvements"
WritingStyle = "A style of writing"

[pipe]
[pipe.analyze_tweet]
PipeLLM = "Analyze the draft tweet and identify areas for improvement"
inputs = { draft_tweet = "DraftTweet" }
output = "TweetAnalysis"
llm = "llm_for_writing_analysis"
system_prompt = """
You are an expert in social media optimization, particularly for tech content on Twitter/X.
Your role is to analyze tech tweets and check if they display typical startup communication pitfalls.
"""
prompt_template = """
Evaluate the tweet for these key issues:

**Fluffiness** - Overuse of buzzwords without concrete meaning (e.g., "synergizing disruptive paradigms")

**Cringiness** - Content that induces secondhand embarrassment (overly enthusiastic, trying too hard to be cool, excessive emoji use)

**Humblebragginess** - Disguising boasts as casual updates or false modesty ("just happened to close our $ 10M round 🀷")

**Vagueness** - Failing to clearly communicate what the product/service actually does

For each criterion, provide:
1. A score (1-5) where 1 = not present, 5 = severely present
2. If the problem is not present, no comment. Otherwise, explain of the issue and give concise guidance on fixing it, without providing an actual rewrite

@draft_tweet

"""

[pipe.optimize_tweet]
PipeLLM = "Optimize the tweet based on the analysis"
inputs = { draft_tweet = "DraftTweet", tweet_analysis = "TweetAnalysis", writing_style = "WritingStyle" }
output = "OptimizedTweet"
llm = "llm_for_social_post_writing"
system_prompt = """
You are an expert in writing engaging tech tweets that drive meaningful discussions and engagement.
Your goal is to rewrite tweets to be impactful and avoid the pitfalls identified in the analysis.
"""
prompt_template = """
Rewrite this tech tweet to be more engaging and effective, based on the analysis:

Original tweet:
@draft_tweet

Analysis:
@tweet_analysis

Requirements:
- Include a clear call-to-action
- Make it engaging and shareable
- Use clear, concise language

### Reference style example

@writing_style

### Additional style instructions

No hashtags.
Minimal emojis.
Keep the core meaning of the original tweet.
"""

[pipe.optimize_tweet_sequence]
PipeSequence = "Analyze and optimize a tech tweet in sequence"
inputs = { draft_tweet = "DraftTweet", writing_style = "WritingStyle" }
output = "OptimizedTweet"
steps = [
    { pipe = "analyze_tweet", result = "tweet_analysis" },
    { pipe = "optimize_tweet", result = "optimized_tweet" },
]

2. Run the pipeline

Here is the flowchart generated during this run:

---
config:
  layout: dagre
  theme: base
---
flowchart LR
    subgraph "optimize_tweet_sequence"
    direction LR
        FGunn["draft_tweet:<br>**Draft tweet**"]
        EWhtJ["tweet_analysis:<br>**Tweet analysis**"]
        65Eb2["optimized_tweet:<br>**Optimized tweet**"]
        i34D5["writing_style:<br>**Writing style**"]
    end
class optimize_tweet_sequence sub_a;

    classDef sub_a fill:#e6f5ff,color:#333,stroke:#333;

    classDef sub_b fill:#fff5f7,color:#333,stroke:#333;

    classDef sub_c fill:#f0fff0,color:#333,stroke:#333;
    FGunn -- "Analyze tweet" ----> EWhtJ
    FGunn -- "Optimize tweet" ----> 65Eb2
    EWhtJ -- "Optimize tweet" ----> 65Eb2
    i34D5 -- "Optimize tweet" ----> 65Eb2
Loading

3. wait… no, there is not 3, you're done!


Contributing

We ❀️ contributions! Before opening a pull request, please:

  1. Read CONTRIBUTING.md.
  2. Add your file under examples/wip/<your-folder>; feel free to group related examples by topic.
  3. Include a short README snippet at the top of your TOML describing purpose, inputs, and expected outputs.
  4. Verify the pipeline runs locally with a free/open LLM preset when possible, to lower the entry barrier for reviewers.

Tip: If you're unsure whether your idea fits, open a GitHub Discussion firstβ€”feedback is fast and public.([GitHub Docs][4])


Contact & Support

Channel Use case
GitHub Discussions β†’ "Show & Tell" Share ideas, brainstorm, get early feedback.
GitHub Issues Report bugs or request features.
Email (privacy & security) security@pipelex.com
Discord Real-time chat β€” https://go.pipelex.com/discord

πŸ“ License

This project is licensed under the MIT license. Runtime dependencies are distributed under their own licenses via PyPI.


Happy piping! πŸš€

About

Cookbook for Pipelex, the open-source language for AI Agents to create and run repeatable, structured, composable AI workflows

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •