Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into feature/output_dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
anovazzi1 committed May 24, 2024
2 parents 64c42a9 + d5d6f2b commit bd4f4c8
Show file tree
Hide file tree
Showing 318 changed files with 14,648 additions and 9,275 deletions.
14 changes: 13 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@
# Do not commit .env file to git
# Do not change .env.example file

# Config directory
# Directory where files, logs and database will be stored
# Example: LANGFLOW_CONFIG_DIR=~/.langflow
LANGFLOW_CONFIG_DIR=

# Save database in the config directory
# Values: true, false
# If false, the database will be saved in Langflow's root directory
# This means that the database will be deleted when Langflow is uninstalled
# and that the database will not be shared between different virtual environments
# Example: LANGFLOW_SAVE_DB_IN_CONFIG_DIR=true
LANGFLOW_SAVE_DB_IN_CONFIG_DIR=

# Database URL
# Postgres example: LANGFLOW_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/langflow
# SQLite example:
Expand Down Expand Up @@ -56,7 +69,6 @@ LANGFLOW_REMOVE_API_KEYS=
# LANGFLOW_REDIS_CACHE_EXPIRE (default: 3600)
LANGFLOW_CACHE_TYPE=


# Set AUTO_LOGIN to false if you want to disable auto login
# and use the login form to login. LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD
# must be set if AUTO_LOGIN is set to false
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ backend:
@echo 'Setting up the environment'
@make setup_env
make install_backend
@-kill -9 `lsof -t -i:7860`
@-kill -9 $(lsof -t -i:7860)
ifdef login
@echo "Running backend autologin is $(login)";
LANGFLOW_AUTO_LOGIN=$(login) poetry run uvicorn --factory langflow.main:create_app --host 0.0.0.0 --port 7860 --reload --env-file .env --loop asyncio
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ Alternatively, click the **"Open in Cloud Shell"** button below to launch Google

## Deploy on Railway

Use this template to deploy Langflow 1.0 Preview on Railway:

[![Deploy 1.0 Preview on Railway](https://railway.app/button.svg)](https://railway.app/template/UsJ1uB?referralCode=MnPSdg)

Or this one to deploy Langflow 0.6.x:

[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/JMXEWp?referralCode=MnPSdg)

## Deploy on Render
Expand Down
20 changes: 11 additions & 9 deletions build_and_push.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# PYTHON-BASE
# Sets up all our shared environment variables
################################
FROM python:3.10-slim as python-base
FROM python:3.12-slim as python-base

# python
ENV PYTHONUNBUFFERED=1 \
Expand Down Expand Up @@ -47,15 +47,20 @@ ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
# Used to build deps + create our virtual environment
################################
FROM python-base as builder-base
RUN

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
# deps for installing poetry
curl \
# deps for building python deps
build-essential \
# npm
npm
npm \
# gcc
gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*



# Now we need to copy the entire project into the image
Expand All @@ -70,15 +75,12 @@ RUN --mount=type=cache,target=/root/.cache \
RUN python -m pip install requests && cd ./scripts && python update_dependencies.py
RUN $POETRY_HOME/bin/poetry lock
RUN $POETRY_HOME/bin/poetry build
# Final stage for the application
FROM python-base as final

# Copy virtual environment and built .tar.gz from builder base
RUN useradd -m -u 1000 user
COPY --from=builder-base /app/dist/*.tar.gz ./
USER user
# Install the package from the .tar.gz
RUN python -m pip install *.tar.gz --user
RUN python -m pip install /app/dist/*.tar.gz

WORKDIR /app
ENTRYPOINT ["python", "-m", "langflow", "run"]
CMD ["--host", "0.0.0.0", "--port", "7860"]
CMD ["--host", "0.0.0.0", "--port", "7860"]
17 changes: 8 additions & 9 deletions build_and_push_base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# PYTHON-BASE
# Sets up all our shared environment variables
################################
FROM python:3.10-slim as python-base
FROM python:3.12-slim as python-base

# python
ENV PYTHONUNBUFFERED=1 \
Expand Down Expand Up @@ -55,6 +55,8 @@ RUN apt-get update \
build-essential \
# npm
npm \
# gcc
gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -76,17 +78,14 @@ RUN cd src/frontend && npm run build
COPY src/backend ./src/backend
RUN cp -r src/frontend/build src/backend/base/langflow/frontend
RUN rm -rf src/backend/base/dist
RUN cd src/backend/base && $POETRY_HOME/bin/poetry build --format sdist

# Final stage for the application
FROM python-base as final
RUN cd src/backend/base && $POETRY_HOME/bin/poetry build

# Copy virtual environment and built .tar.gz from builder base
RUN useradd -m -u 1000 user
COPY --from=builder-base /app/src/backend/base/dist/*.tar.gz ./
USER user
# Install the package from the .tar.gz
RUN pip install *.tar.gz --user
RUN python -m pip install /app/src/backend/base/dist/*.tar.gz


WORKDIR /app
ENTRYPOINT ["python", "-m", "langflow", "run"]
CMD ["--host", "0.0.0.0", "--port", "7860"]
CMD ["--host", "0.0.0.0", "--port", "7860"]
45 changes: 45 additions & 0 deletions docs/docs/administration/global-env.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import ZoomableImage from "/src/theme/ZoomableImage.js";
import Admonition from "@theme/Admonition";

# Global environment variables

Langflow 1.0 alpha includes the option to add **Global Environment Variables** for your application.

## Add a global variable to a project

In this example, you'll add the `openai_api_key` credential as a global environment variable to the **Basic Prompting** starter project.

For more information on the starter flow, see [Basic prompting](../starter-projects/basic-prompting.mdx).

1. From the Langflow dashboard, click **New Project**.
2. Select **Basic Prompting**.

The **Basic Prompting** flow is created.

3. To create an environment variable for the **OpenAI** component:
1. In the **OpenAI API Key** field, click the **Globe** button, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `openai_api_key`.
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
4. For the variable **Type**, select **Credential**.
5. In the **Apply to Fields** field, select **OpenAI API Key** to apply this variable to all fields named **OpenAI API Key**.
6. Click **Save Variable**.

You now have a `openai_api_key` global environment variable for your Langflow project.

<Admonition type="tip">
You can also create global variables in **Settings** > **Variables and
Secrets**.
</Admonition>

<ZoomableImage
alt="Docusaurus themed image"
sources={{
light: "img/global-env.png",
dark: "img/global-env.png",
}}
style={{ width: "40%", margin: "20px auto" }}
/>

4. To view and manage your project's global environment variables, visit **Settings** > **Variables and Secrets**.

For more on variables in HuggingFace Spaces, see [Managing Secrets](https://huggingface.co/docs/hub/spaces-overview#managing-secrets).
29 changes: 29 additions & 0 deletions docs/docs/administration/playground.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import ThemedImage from "@theme/ThemedImage";
import useBaseUrl from "@docusaurus/useBaseUrl";
import ZoomableImage from "/src/theme/ZoomableImage.js";
import ReactPlayer from "react-player";
import Admonition from "@theme/Admonition";

# Playground

In Langflow 1.0 alpha, the **Playground** replaces the **Interaction Panel**.

The **Playground** provides an interface for interacting with flows without opening them in the flow editor.

It even works for flows hosted on the Langflow store!

As long as you have a flow's environment variables set, you can run it by clicking the **Playground** button.

1. From your **Collections** page, click **Playground** in one of your flows.
The **Playground** window opens.

<ZoomableImage
alt="Docusaurus themed image"
sources={{
light: useBaseUrl("img/playground-chat.png"),
dark: useBaseUrl("img/playground-chat.png"),
}}
style={{ width: "50%", maxWidth: "600px", margin: "0 auto" }}
/>

2. Chat with your bot as you normally would, all without having to open the editor.
47 changes: 44 additions & 3 deletions docs/docs/components/vector-stores.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ The `Astra DB` initializes a vector store using Astra DB from records. It create
- **Collection Indexing Policy:** Indexing policy for the collection.

<Admonition type="note" title="Note">
Ensure you configure the necessary Astra DB token and API endpoint before starting.
Ensure you configure the necessary Astra DB token and API endpoint before
starting.
</Admonition>

---
Expand Down Expand Up @@ -96,6 +97,44 @@ For detailed documentation and integration guides, please refer to the [Chroma C

---

### Couchbase

`Couchbase` builds a Couchbase vector store from records, streamlining the storage and retrieval of documents.

**Parameters:**

- **Embedding:** Model used by Couchbase.
- **Input:** Documents or records.
- **Couchbase Cluster Connection String:** Cluster Connection string.
- **Couchbase Cluster Username:** Cluster Username.
- **Couchbase Cluster Password:** Cluster Password.
- **Bucket Name:** Bucket identifier in Couchbase.
- **Scope Name:** Scope identifier in Couchbase.
- **Collection Name:** Collection identifier in Couchbase.
- **Index Name:** Index identifier.

For detailed documentation and integration guides, please refer to the [Couchbase Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/couchbase).

---

### Couchbase Search

`CouchbaseSearch` leverages the Couchbase component to search for documents based on similarity metric.

**Parameters:**

- **Input:** Search query.
- **Embedding:** Model used in the Vector Store.
- **Couchbase Cluster Connection String:** Cluster Connection string.
- **Couchbase Cluster Username:** Cluster Username.
- **Couchbase Cluster Password:** Cluster Password.
- **Bucket Name:** Bucket identifier.
- **Scope Name:** Scope identifier.
- **Collection Name:** Collection identifier in Couchbase.
- **Index Name:** Index identifier.

---

### FAISS

The `FAISS` component manages document ingestion into a FAISS Vector Store, optimizing document indexing and retrieval.
Expand Down Expand Up @@ -278,7 +317,8 @@ For more details, see the [PGVector Component Documentation](https://python.lang
For detailed documentation, refer to the [Redis Documentation](https://python.langchain.com/docs/integrations/vectorstores/redis).

<Admonition type="note" title="Note">
Ensure the Redis server URL and index name are configured correctly. Provide a schema if no documents are available.
Ensure the Redis server URL and index name are configured correctly. Provide a
schema if no documents are available.
</Admonition>

---
Expand Down Expand Up @@ -389,7 +429,8 @@ For more information, consult the [Vectara Component Documentation](https://pyth
For more details, see the [Weaviate Component Documentation](https://python.langchain.com/docs/integrations/vectorstores/weaviate).

<Admonition type="note" title="Note">
Ensure Weaviate instance is running and accessible. Verify API key, index name, text key, and attributes are set correctly.
Ensure Weaviate instance is running and accessible. Verify API key, index
name, text key, and attributes are set correctly.
</Admonition>

---
Expand Down
18 changes: 8 additions & 10 deletions docs/docs/contributing/contribute-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You have a new document loader called **MyCustomDocumentLoader** and it would lo
6. Add the dependency to [/documentloaders/\_\_init\_\_.py](https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/components/documentloaders/__init__.py) as `from .MyCustomDocumentLoader import MyCustomDocumentLoader`.
7. Add any new dependencies to the outer [pyproject.toml](https://github.com/langflow-ai/langflow/blob/dev/pyproject.toml#L27) file.
8. Submit documentation for your component. For this example, you'd submit documentation to the [loaders page](https://github.com/langflow-ai/langflow/blob/dev/docs/docs/components/loaders.mdx).
8. Submit your changes as a pull request. The Langflow team will have a look, suggest changes, and add your component to Langflow.
9. Submit your changes as a pull request. The Langflow team will have a look, suggest changes, and add your component to Langflow.

## User Sharing

Expand All @@ -27,21 +27,19 @@ If so, you can share your component on the Langflow store.
1. [Register at the Langflow store](https://www.langflow.store/login/).
2. Undergo pre-validation before receiving an API key.
3. To deploy your amazing component directly to the Langflow store, without it being merged into the main source code, navigate to your flow, and then click **Share**.
The share window appears:
The share window appears:

<ZoomableImage
alt="Docusaurus themed image"
sources={{
alt="Docusaurus themed image"
sources={{
light: "img/add-component-to-store.png",
dark: "img/add-component-to-store.png",
}}
style={{ width: "50%", margin: "20px auto" }}
style={{ width: "50%", margin: "20px auto" }}
/>

5. Choose whether you want to flow to be public or private.
You can also **Export** your flow as a JSON file from this window.
When you're ready to share the flow, click **Share Flow**.
You should see a **Flow shared successfully** popup.
You can also **Export** your flow as a JSON file from this window.
When you're ready to share the flow, click **Share Flow**.
You should see a **Flow shared successfully** popup.
6. To confirm, navigate to the **Langflow Store** and filter results by **Created By Me**. You should see your new flow on the **Langflow Store**.


2 changes: 1 addition & 1 deletion docs/docs/tutorials/rag-with-astradb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ The RAG flow is a bit more complex. It consists of:
style={{ width: "80%", margin: "20px auto" }}
/>

To run it all we have to do is click on the _Run_ button and start interacting with your RAG application.
To run it all we have to do is click on the 🤖 _Playground_ button and start interacting with your RAG application.

<ZoomableImage
alt="Docusaurus themed image"
Expand Down
Loading

0 comments on commit bd4f4c8

Please sign in to comment.