Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Mac
.DS_Store

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

Expand Down Expand Up @@ -230,5 +233,5 @@ venv.bak/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
# Poetry
.testenv/*
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ format:
lint:
poetry run mypy .
poetry run black . --check
poetry run ruff .
poetry run ruff . --fix

install_frontend:
cd langflow/frontend && npm install
Expand All @@ -29,7 +29,13 @@ build_frontend:
build:
make install_frontend
make build_frontend
cp -r langflow/frontend/build langflow/backend/langflow_backend/frontend
poetry build --format sdist
rm -rf langflow/backend/langflow_backend/frontend

publish:
make build
poetry publish

help:
@echo '----'
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,17 @@

~ A User Interface For [LangChain](https://github.com/hwchase17/langchain) ~


<p>
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/logspace-ai/langflow" />
<img alt="GitHub Last Commit" src="https://img.shields.io/github/last-commit/logspace-ai/langflow" />
<!-- <img alt="GitHub Language Count" src="https://img.shields.io/github/languages/count/logspace-ai/langflow" /> -->
<img alt="" src="https://img.shields.io/github/repo-size/logspace-ai/langflow" />
<!-- <img alt="GitHub Issues" src="https://img.shields.io/github/issues/logspace-ai/langflow" /> -->
<!-- <img alt="GitHub Closed Issues" src="https://img.shields.io/github/issues-closed/logspace-ai/langflow" /> -->
<!-- <img alt="GitHub Pull Requests" src="https://img.shields.io/github/issues-pr/logspace-ai/langflow" /> -->
<!-- <img alt="GitHub Closed Pull Requests" src="https://img.shields.io/github/issues-pr-closed/logspace-ai/langflow" /> -->
<!-- <img alt="GitHub Commit Activity (Year)" src="https://img.shields.io/github/commit-activity/y/logspace-ai/langflow" /> -->
<img alt="GitHub Issues" src="https://img.shields.io/github/issues/logspace-ai/langflow" />
<img alt="GitHub Pull Requests" src="https://img.shields.io/github/issues-pr/logspace-ai/langflow" />
<img alt="Github License" src="https://img.shields.io/github/license/logspace-ai/langflow" />
</p>

![LangFlow Logo](https://github.com/logspace-ai/langflow/blob/main/img/langflow-demo.gif)
<a href="https://github.com/logspace-ai/langflow">
<img width="100%" src="https://github.com/logspace-ai/langflow/blob/main/img/langflow-demo.gif?raw=true"></a>

LangFlow is a GUI for [LangChain](https://github.com/hwchase17/langchain), designed with [react-flow](https://github.com/wbkd/react-flow) to provide an effortless way to experiment and prototype flows with drag-and-drop components and a chat box.

Expand All @@ -32,18 +28,16 @@ Next, run:

`python -m langflow` or just `langflow`


## 🎨 Creating Flows

Creating flows with LangFlow is easy. Simply drag sidebar components onto the canvas and connect them together to create your pipeline. LangFlow provides a range of [LangChain components](https://langchain.readthedocs.io/en/latest/reference.html) to choose from, including LLMs, prompt serializers, agents, and chains.
Creating flows with LangFlow is easy. Simply drag sidebar components onto the canvas and connect them together to create your pipeline. LangFlow provides a range of [LangChain components](https://langchain.readthedocs.io/en/latest/reference.html) to choose from, including LLMs, prompt serializers, agents, and chains.

Explore by editing prompt parameters, link chains and agents, track an agent's thought process, and export your flow.


## 👋 Contributing

We welcome contributions from developers of all levels to our open-source project on GitHub. If you'd like to contribute, please check our contributing guidelines and help make LangFlow more accessible. 

We welcome contributions from developers of all levels to our open-source project on GitHub. If you'd like to contribute, please check our contributing guidelines and help make LangFlow more accessible.

## 📄 License

Expand Down
1 change: 0 additions & 1 deletion langflow/__init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions langflow/backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ __pycache__/
*$py.class
notebooks

# frontend
langflow_backend/frontend

# C extensions
*.so

Expand Down
1 change: 1 addition & 0 deletions langflow/backend/langflow_backend/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from langflow_backend.interface.loading import load_flow_from_json # noqa
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
import multiprocessing
import platform

from langflow_backend.main import create_app

import typer
from fastapi.staticfiles import StaticFiles
from pathlib import Path

from langflow.server import LangflowApplication

def get_number_of_workers(workers=None):
if workers == -1:
workers = (multiprocessing.cpu_count() * 2) + 1
return workers


def serve(
workers: int = None,
timeout: int = None,
workers: int = 1,
timeout: int = 60,
):
app = create_app()
# get the directory of the current file
path = Path(__file__).parent
static_files_dir = path / "frontend/build"
static_files_dir = path / "frontend"
app.mount(
"/",
StaticFiles(directory=static_files_dir, html=True),
name="static",
)
if not workers:
workers = 1
elif workers == -1:
workers = (multiprocessing.cpu_count() * 2) + 1

if not timeout:
timeout = 60

host = "127.0.0.1"
port = 5003
options = {
"bind": "0.0.0.0:5003",
"workers": workers,
"bind": f"{host}:{port}",
"workers": get_number_of_workers(workers),
"worker_class": "uvicorn.workers.UvicornWorker",
"timeout": timeout,
}

LangflowApplication(app, options).run()
if platform.system() == "Darwin":
# Run using uvicorn on MacOS
import uvicorn

uvicorn.run(app, host=host, port=port, log_level="info")
else:
from langflow_backend.server import LangflowApplication

LangflowApplication(app, options).run()


def main():
Expand Down
2 changes: 1 addition & 1 deletion langflow/backend/langflow_backend/interface/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get_tool_signature(name: str):
template["aiosession"]["required"] = False
template["aiosession"]["show"] = False

template["_type"] = tool_type
template["_type"] = tool_type # type: ignore

return {
"template": template,
Expand Down
2 changes: 1 addition & 1 deletion langflow/backend/langflow_backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def create_app():
if __name__ == "__main__":
import uvicorn

uvicorn.run(app, host="0.0.0.0", port=5003)
uvicorn.run(app, host="127.0.0.1", port=5003)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from gunicorn.app.base import BaseApplication
from gunicorn.app.base import BaseApplication # type: ignore


class LangflowApplication(BaseApplication):
Expand Down
Loading