Skip to main content

LangFlow

  • LangFlow 是開放原始碼的架構,可視覺化根據流程打造LLM的應用程式

Install PIP

brew install python
echo 'export PATH="$PATH:/Users/user/Library/Python/3.9/bin"' >> ~/.zshrc source ~/.zshrc
echo "alias python=python3" >> ~/.zshrc

1. Install Langflow

mkdir langflow-docker //create a project
cd langflow-docker //cd into project
python3 -m venv venv //create a virtual environment
source ven/bin/activate //active the environment
pip install langchain-ollama langchain-core //install langchain
pip install langflow
python -m langflow run

2. Run Langflow on Docker

  1. Create a Project folder
mkdir langflow-docker
cd langflow-docker
  1. Create docker-compose.yml file inside folder
version: '3.8'

services:
langflow:
image: langflowai/langflow:latest
container_name:langflow
ports:
- "7860:7860"
environment:
LANGFLOW_HOST=0.0.0.0
LANGFLOW_PORT=7860
LANGFLOW_NEW_API_URL=https://langflow.yourdomain.com
volumes:
- langflow_data:/var/lib/langflow
restart: always

volumes:
langflow_data:
  • restart always: tells docker to always start the container if it stops
  • volumes: save flows and comoponents in a database, by mounting langflow_data, your workflow won't vanish when container restarts or updates.
  • start langflow in detached mode
docker compose up -d

2. Connecting Gemma 4 in Langflow:

  • In the left sidebar, search for Ollama and drag the Ollama model component onto the canvas.
  • In its settings box on the canvas, change the Model Name to gemma4.
  • Set the Base URL to http://localhost:11434 (this is the default address where your Ollama runs behind the scenes).
  • Drag a Prompt block and a Chat Output block, wire them together, and you have a coding-free AI app!