Optional_deps (#589)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-07-31 15:41:51 -03:00 • committed by GitHub
commit c5585565c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 142 additions and 418 deletions

View file

@ -13,7 +13,6 @@
<img alt="Github License" src="https://img.shields.io/github/license/logspace-ai/langflow" /> <img alt="Github License" src="https://img.shields.io/github/license/logspace-ai/langflow" />
</p> </p>
<p> <p>
<a href="https://discord.gg/EqksyE2EX9"><img alt="Discord Server" src="https://dcbadge.vercel.app/api/server/EqksyE2EX9?compact=true&style=flat"/></a> <a href="https://discord.gg/EqksyE2EX9"><img alt="Discord Server" src="https://dcbadge.vercel.app/api/server/EqksyE2EX9?compact=true&style=flat"/></a>
<a href="https://huggingface.co/spaces/Logspace/Langflow"><img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg" alt="HuggingFace Spaces"></a> <a href="https://huggingface.co/spaces/Logspace/Langflow"><img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-in-hf-spaces-sm.svg" alt="HuggingFace Spaces"></a>
@ -22,54 +21,75 @@
<a href="https://github.com/logspace-ai/langflow"> <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> <img width="100%" src="https://github.com/logspace-ai/langflow/blob/main/img/langflow-demo.gif?raw=true"></a>
<p> <p>
</p> </p>
# Table of Contents # Table of Contents
- [⛓️ Langflow](#️-langflow) - [⛓️ Langflow](#️-langflow)
- [Table of Contents](#table-of-contents) - [Table of Contents](#table-of-contents)
- [📦 Installation](#-installation) - [📦 Installation](#-installation)
- [Locally](#locally) - [Locally](#locally)
- [HuggingFace Spaces](#huggingface-spaces) - [HuggingFace](#huggingface)
- [🖥️ Command Line Interface (CLI)](#️-command-line-interface-cli) - [🖥️ Command Line Interface (CLI)](#️-command-line-interface-cli)
- [Usage](#usage) - [Usage](#usage)
- [Environment Variables](#environment-variables) - [Environment Variables](#environment-variables)
- [Deployment](#deployment) - [Deployment](#deployment)
- [Deploy Langflow on Google Cloud Platform](#deploy-langflow-on-google-cloud-platform) - [Deploy Langflow on Google Cloud Platform](#deploy-langflow-on-google-cloud-platform)
- [Deploy Langflow on Jina AI Cloud](#deploy-langflow-on-jina-ai-cloud) - [Deploy Langflow on Jina AI Cloud](#deploy-langflow-on-jina-ai-cloud)
- [API Usage](#api-usage) - [API Usage](#api-usage)
- [Deploy on Railway](#deploy-on-railway)
- [Deploy on Render](#deploy-on-render)
- [🎨 Creating Flows](#-creating-flows) - [🎨 Creating Flows](#-creating-flows)
- [👋 Contributing](#-contributing) - [👋 Contributing](#-contributing)
- [📄 License](#-license) - [📄 License](#-license)
# 📦 Installation # 📦 Installation
### <b>Locally</b>
## Locally
You can install Langflow from pip: You can install Langflow from pip:
```shell ```shell
# This installs the package without dependencies for local models
pip install langflow pip install langflow
``` ```
To use local models (e.g llama-cpp-python) run:
```shell
pip install langflow[local]
```
This will install the following dependencies:
- [CTransformers](https://github.com/marella/ctransformers)
- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)
- [sentence-transformers](https://github.com/UKPLab/sentence-transformers)
You can still use models from projects like LocalAI
Next, run: Next, run:
```shell ```shell
python -m langflow python -m langflow
``` ```
or or
```shell ```shell
langflow # or langflow --help langflow # or langflow --help
``` ```
### HuggingFace Spaces ## HuggingFace
You can also check it out on [HuggingFace Spaces](https://huggingface.co/spaces/Logspace/Langflow) and run it in your browser! You can even clone it and have your own copy of Langflow to play with. You can also check it out on [HuggingFace Spaces](https://huggingface.co/spaces/Logspace/Langflow) and run it in your browser! You can even clone it and have your own copy of Langflow to play with.
# 🖥️ Command Line Interface (CLI) # 🖥️ Command Line Interface (CLI)
Langflow provides a command-line interface (CLI) for easy management and configuration. Langflow provides a command-line interface (CLI) for easy management and configuration.
### Usage ## Usage
You can run the Langflow using the following command: You can run the Langflow using the following command:
@ -114,7 +134,6 @@ Alternatively, click the **"Open in Cloud Shell"** button below to launch Google
[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/logspace-ai/langflow&working_dir=scripts&shellonly=true&tutorial=walkthroughtutorial_spot.md) [![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/logspace-ai/langflow&working_dir=scripts&shellonly=true&tutorial=walkthroughtutorial_spot.md)
## Deploy Langflow on [Jina AI Cloud](https://github.com/jina-ai/langchain-serve) ## Deploy Langflow on [Jina AI Cloud](https://github.com/jina-ai/langchain-serve)
Langflow integrates with langchain-serve to provide a one-command deployment to Jina AI Cloud. Langflow integrates with langchain-serve to provide a one-command deployment to Jina AI Cloud.
@ -122,6 +141,8 @@ Langflow integrates with langchain-serve to provide a one-command deployment to
Start by installing `langchain-serve` with Start by installing `langchain-serve` with
```bash ```bash
pip install langflow[deploy]
# or
pip install -U langchain-serve pip install -U langchain-serve
``` ```
@ -223,9 +244,11 @@ print(run_flow("Your message", flow_id=FLOW_ID, tweaks=TWEAKS))
> Read more about resource customization, cost, and management of Langflow apps on Jina AI Cloud in the **[langchain-serve](https://github.com/jina-ai/langchain-serve)** repository. > Read more about resource customization, cost, and management of Langflow apps on Jina AI Cloud in the **[langchain-serve](https://github.com/jina-ai/langchain-serve)** repository.
## Deploy on Railway ## Deploy on Railway
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/Emy2sU?referralCode=MnPSdg) [![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/Emy2sU?referralCode=MnPSdg)
## Deploy on Render ## Deploy on Render
<a href="https://render.com/deploy?repo=https://github.com/logspace-ai/langflow/tree/main"> <a href="https://render.com/deploy?repo=https://github.com/logspace-ai/langflow/tree/main">
<img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" /> <img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" />
</a> </a>
@ -248,12 +271,10 @@ flow = load_flow_from_json("path/to/flow.json")
flow("Hey, have you heard of Langflow?") flow("Hey, have you heard of Langflow?")
``` ```
# 👋 Contributing # 👋 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](./CONTRIBUTING.md) 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](./CONTRIBUTING.md) and help make Langflow more accessible.
Join our [Discord](https://discord.com/invite/EqksyE2EX9) server to ask questions, make suggestions and showcase your projects! 🦾 Join our [Discord](https://discord.com/invite/EqksyE2EX9) server to ask questions, make suggestions and showcase your projects! 🦾
<p> <p>
@ -261,7 +282,6 @@ Join our [Discord](https://discord.com/invite/EqksyE2EX9) server to ask question
[![Star History Chart](https://api.star-history.com/svg?repos=logspace-ai/langflow&type=Timeline)](https://star-history.com/#logspace-ai/langflow&Date) [![Star History Chart](https://api.star-history.com/svg?repos=logspace-ai/langflow&type=Timeline)](https://star-history.com/#logspace-ai/langflow&Date)
# 📄 License # 📄 License
Langflow is released under the MIT License. See the LICENSE file for details. Langflow is released under the MIT License. See the LICENSE file for details.

501
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -37,9 +37,9 @@ langchain = "^0.0.240"
openai = "^0.27.8" openai = "^0.27.8"
pandas = "^2.0.0" pandas = "^2.0.0"
chromadb = "^0.3.21" chromadb = "^0.3.21"
huggingface-hub = "^0.15.0" huggingface-hub = { version = "^0.16.0", extras = ["inference"] }
rich = "^13.4.2" rich = "^13.4.2"
llama-cpp-python = "~0.1.0" llama-cpp-python = { version = "~0.1.0", optional = true }
networkx = "^3.1" networkx = "^3.1"
unstructured = "^0.7.0" unstructured = "^0.7.0"
pypdf = "^3.11.0" pypdf = "^3.11.0"
@ -56,8 +56,8 @@ qdrant-client = "^1.3.0"
websockets = "^10.3" websockets = "^10.3"
weaviate-client = "^3.21.0" weaviate-client = "^3.21.0"
jina = "3.15.2" jina = "3.15.2"
sentence-transformers = "^2.2.2" sentence-transformers = { version = "^2.2.2", optional = true }
ctransformers = "^0.2.10" ctransformers = { version = "^0.2.10", optional = true }
cohere = "^4.11.0" cohere = "^4.11.0"
python-multipart = "^0.0.6" python-multipart = "^0.0.6"
sqlmodel = "^0.0.8" sqlmodel = "^0.0.8"
@ -76,7 +76,7 @@ google-cloud-aiplatform = "^1.26.1"
psycopg = "^3.1.9" psycopg = "^3.1.9"
psycopg-binary = "^3.1.9" psycopg-binary = "^3.1.9"
[tool.poetry.dev-dependencies] [tool.poetry.group.dev.dependencies]
black = "^23.1.0" black = "^23.1.0"
ipykernel = "^6.21.2" ipykernel = "^6.21.2"
mypy = "^1.1.1" mypy = "^1.1.1"
@ -94,6 +94,9 @@ types-pyyaml = "^6.0.12.8"
[tool.poetry.extras] [tool.poetry.extras]
deploy = ["langchain-serve"] deploy = ["langchain-serve"]
local = ["llama-cpp-python", "sentence-transformers", "ctransformers"]
all = ["deploy", "local"]
[tool.pytest.ini_options] [tool.pytest.ini_options]
minversion = "6.0" minversion = "6.0"