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
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: lint

on:
push:
branches: [main]
pull_request:

env:
POETRY_VERSION: "1.3.1"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==$POETRY_VERSION
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: |
poetry install
- name: Analysing the code with our lint
run: |
make lint
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: release

on:
pull_request:
types:
- closed
branches:
- main
paths:
- "pyproject.toml"

env:
POETRY_VERSION: "1.3.1"

jobs:
if_release:
if: |
${{ github.event.pull_request.merged == true }}
&& ${{ contains(github.event.pull_request.labels.*.name, 'Release') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Build project for distribution
run: poetry build
- name: Check Version
id: check-version
run: |
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
generateReleaseNotes: true
tag: v${{ steps.check-version.outputs.version }}
commit: master
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: all format lint

all: help


format:
poetry run black .
poetry run ruff --select I --fix .

lint:
poetry run mypy .
poetry run black . --check
poetry run ruff .

help:
@echo '----'
@echo 'format - run code formatters'
@echo 'lint - run linters'
2 changes: 1 addition & 1 deletion langflow/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /app
RUN apt-get update && apt-get install git -y

COPY --from=backend_build /app/dist/*.whl /app/
RUN pip install langflow-0.0.19-py3-none-any.whl
RUN pip install langflow-0.0.21-py3-none-any.whl
RUN rm *.whl

EXPOSE 80
Expand Down
6 changes: 6 additions & 0 deletions langflow/backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ def create_app():


app = create_app()


if __name__ == "__main__":
import uvicorn

uvicorn.run(app, host="0.0.0.0", port=5003)
12 changes: 8 additions & 4 deletions langflow/backend/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def get_all():
# # utility: templates.utility(utility) for utility in list.list_utilities()
# }
# },
"memories": {
memory: signature.get_memory(memory)
for memory in list_endpoints.list_memories()
},
# "memories": {
# memory: signature.get_memory(memory)
# for memory in list_endpoints.list_memories()
# },
# "document_loaders": {
# "template": {
# # memory: templates.document_loader(memory)
Expand Down Expand Up @@ -123,6 +123,10 @@ def get_load(data: dict[str, Any]):
result = "Error: Type should be either agent, chain or llm"
thought = ""

# Remove unnecessary data from response
begin = thought.rfind(message)
thought = thought[(begin + len(message)) :]

return {
"result": result,
"thought": re.sub(
Expand Down
2 changes: 1 addition & 1 deletion langflow/backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langflow"
version = "0.0.19"
version = "0.0.21"
description = "Backend for Langflow"
authors = ["Ibis Prevedello <ibiscp@gmail.com>"]
# packages = [
Expand Down
5 changes: 4 additions & 1 deletion langflow/backend/signature.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Any, Dict
from fastapi import APIRouter, HTTPException
from langchain import agents, chains, llms, prompts
from langchain.agents.load_tools import (
Expand Down Expand Up @@ -131,11 +132,13 @@ def get_tool(name: str):
elif tool_type in _EXTRA_OPTIONAL_TOOLS:
_, extra_keys = _EXTRA_OPTIONAL_TOOLS[tool_type]
params = extra_keys
else:
params = []

template = {
param: (type_dict[param] if param == "llm" else type_dict["str"])
for param in params
}
} # type: Dict[str, Any]
template["_type"] = tool_type

return {
Expand Down
14 changes: 8 additions & 6 deletions langflow/backend/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def get_default_factory(module: str, function: str):
pattern = r"<function (\w+)>"

if match := re.search(pattern, function):
module = importlib.import_module(module)
return getattr(module, match[1])()
imported_module = importlib.import_module(module)
return getattr(imported_module, match[1])()
return None


Expand Down Expand Up @@ -235,10 +235,13 @@ def format_dict(d):

# Process remaining keys
for key, value in d.items():
if key == "examples":
pass
if key == "_type":
continue

# Set verbose to True
if key == "verbose":
value["default"] = True

_type = value["type"]

# Remove 'Optional' wrapper
Expand All @@ -264,8 +267,7 @@ def format_dict(d):
or key
in [
"allowed_tools",
"verbose",
"Memory",
# "Memory",
"memory",
"prefix",
"examples",
Expand Down
7 changes: 6 additions & 1 deletion langflow/frontend/build_and_push
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#! /bin/bash

VERSION="0.1.0"
# Read the contents of the JSON file
json=$(cat package.json)

# Extract the value of the "version" field using jq
VERSION=$(echo "$json" | jq -r '.version')

docker build -t logspace/frontend_build -f build.Dockerfile .
docker build --build-arg VERSION=$VERSION -t ibiscp/langflow_frontend:$VERSION .
docker push ibiscp/langflow_frontend:$VERSION
4 changes: 2 additions & 2 deletions langflow/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion langflow/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "space_flow",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"dependencies": {
"@emotion/react": "^11.10.5",
Expand Down
2 changes: 1 addition & 1 deletion langflow/frontend/src/components/chatComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default function Chat({ flow, reactFlowInstance }: ChatType) {
}}
type="text"
disabled={lockChat}
value={lockChat?"please wait for the response": chatValue}
value={lockChat?"Thinking...": chatValue}
onChange={(e) => {
setChatValue(e.target.value);
}}
Expand Down
Loading