Quick Start

Create your first custom pipeline in under 5 minutes.

⚠️ Disclaimer: This guide is specifically for adding new custom pipelines within the GLChat. The instructions and examples provided here are tailored to GLChat's architecture and infrastructure. They are not intended for use in other projects or standalone applications.

chevron-rightPrerequisiteshashtag

Before creating your custom pipeline, ensure you have completed the following setup:

1. Setup GLChat Backend

Follow the setup instructions in the GLChat Backend READMEarrow-up-right to:

  • Install dependencies

  • Configure environment variables

  • Set up the database

  • Start the required services

2. Get OpenAI API Key

  1. Sign up or log in to OpenAI Platformarrow-up-right

  2. Create a new API key

  3. Add the API key to your .env file:

OPENAI_API_KEY=your-api-key-here

Note: Replace your-api-key-here with your actual OpenAI API key. Keep your API key secure and never commit it to version control.

Step 1: Generate Pipeline Files

Use the automated CLI tool to create your pipeline structure:

make new-pipeline

Or directly:

uv run python scripts/create_pipeline.py

The script will prompt you for:

  • Pipeline Name: Lowercase, alphanumeric with underscores (e.g., my_custom_pipeline)

  • Description: Brief description of the pipeline's purpose

  • Author Name: Your full name

  • Author Email: Your email (should be @gdplabs.id)

Naming Convention:

  • Folder Name: Use snake_case (e.g., my_custom_pipeline)

  • Pipeline ID: System converts to kebab-case (folder: my_custom_pipeline → ID: my-custom-pipeline)

The CLI tool automatically:

  • Creates the pipeline folder: glchat_be/config/pipeline/<pipeline_name>/

  • Generates __init__.py and pipeline.py with proper stubs and docstrings

  • Creates a migration file with auto-detected down_revision

  • Provides next steps guidance

chevron-rightExample Sessionhashtag

For more details about the CLI tool, see scripts/README.md.

Step 2: Run Migration

Apply the database migration to register your pipeline:

This registers your pipeline in the database, making it available in the Admin Dashboard.

That's it! Your pipeline is now ready to use. The CLI tool generates a complete, working LLM pipeline that you can use immediately.

chevron-rightWhat does the generated pipeline look like?hashtag

The CLI tool generates a complete pipeline.py file with two main functions:

The build() Function - Constructs the pipeline using GL SDK components:

The build_initial_state() Function - Prepares the initial context/state that flows through the pipeline.

This is a simple LLM-only pipeline that's ready to use out-of-the-box. For building more complex RAG pipelines with retrievers, rerankers, and other components, refer to the official GL SDK guidearrow-up-right.


Next Steps

Your pipeline is ready to use! Here are some optional next steps:

  1. Customize your pipeline (optional) - The generated pipeline is a simple LLM-only pipeline. To add retrieval, reranking, or other advanced features, modify glchat_be/config/pipeline/<pipeline_name>/pipeline.py. See the official GL SDK guidearrow-up-right for examples.

  2. Customize the migration (optional) - If you need organization-specific settings or other customizations, modify the generated migration file. See Database Migration Guidearrow-up-right

  3. Add advanced configuration (optional) - Configure custom settings, parameters, and more. See Advanced Configuration Guidearrow-up-right

Last updated