Merge remote-tracking branch 'origin/dev' into two_edges
This commit is contained in:
commit
0014d8e50a
16 changed files with 182 additions and 31 deletions
4
.github/workflows/docker-build.yml
vendored
4
.github/workflows/docker-build.yml
vendored
|
|
@ -30,6 +30,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
id: qemu
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
|
@ -52,6 +53,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
file: ${{ env.DOCKERFILE }}
|
file: ${{ env.DOCKERFILE }}
|
||||||
tags: ${{ env.TAGS }}
|
tags: ${{ env.TAGS }}
|
||||||
- name: Wait for Docker Hub to propagate
|
- name: Wait for Docker Hub to propagate
|
||||||
|
|
@ -62,6 +64,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
file: ./docker/build_and_push_backend.Dockerfile
|
file: ./docker/build_and_push_backend.Dockerfile
|
||||||
build-args: |
|
build-args: |
|
||||||
LANGFLOW_IMAGE=langflowai/langflow:${{ inputs.version }}
|
LANGFLOW_IMAGE=langflowai/langflow:${{ inputs.version }}
|
||||||
|
|
@ -75,6 +78,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
tags: |
|
tags: |
|
||||||
langflowai/langflow-frontend:${{ inputs.version }}
|
langflowai/langflow-frontend:${{ inputs.version }}
|
||||||
langflowai/langflow-frontend:1.0-alpha
|
langflowai/langflow-frontend:1.0-alpha
|
||||||
|
|
|
||||||
21
.github/workflows/docker_test.yml
vendored
21
.github/workflows/docker_test.yml
vendored
|
|
@ -8,6 +8,7 @@ on:
|
||||||
- "poetry.lock"
|
- "poetry.lock"
|
||||||
- "pyproject.toml"
|
- "pyproject.toml"
|
||||||
- "src/backend/**"
|
- "src/backend/**"
|
||||||
|
- ".github/workflows/docker_test.yml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [dev]
|
branches: [dev]
|
||||||
paths:
|
paths:
|
||||||
|
|
@ -15,12 +16,13 @@ on:
|
||||||
- "poetry.lock"
|
- "poetry.lock"
|
||||||
- "pyproject.toml"
|
- "pyproject.toml"
|
||||||
- "src/**"
|
- "src/**"
|
||||||
|
- ".github/workflows/docker_test.yml"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
POETRY_VERSION: "1.8.2"
|
POETRY_VERSION: "1.8.2"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
@ -59,3 +61,20 @@ jobs:
|
||||||
docker build -t langflowai/langflow-frontend:latest-dev \
|
docker build -t langflowai/langflow-frontend:latest-dev \
|
||||||
-f docker/frontend/build_and_push_frontend.Dockerfile \
|
-f docker/frontend/build_and_push_frontend.Dockerfile \
|
||||||
.
|
.
|
||||||
|
test-multi-arch-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
id: qemu
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: false
|
||||||
|
file: ./docker/build_and_push.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
|
tags: langflowai/langflow:latest-dev
|
||||||
|
|
|
||||||
2
.github/workflows/pre-release-base.yml
vendored
2
.github/workflows/pre-release-base.yml
vendored
|
|
@ -60,6 +60,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
id: qemu
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
|
@ -73,5 +74,6 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/build_and_push_base.Dockerfile
|
file: ./docker/build_and_push_base.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
tags: |
|
tags: |
|
||||||
langflowai/langflow:base-${{ needs.release.outputs.version }}
|
langflowai/langflow:base-${{ needs.release.outputs.version }}
|
||||||
|
|
|
||||||
4
.github/workflows/pre-release-langflow.yml
vendored
4
.github/workflows/pre-release-langflow.yml
vendored
|
|
@ -66,6 +66,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
id: qemu
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
|
@ -79,6 +80,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/build_and_push.Dockerfile
|
file: ./docker/build_and_push.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
tags: |
|
tags: |
|
||||||
langflowai/langflow:${{ needs.release.outputs.version }}
|
langflowai/langflow:${{ needs.release.outputs.version }}
|
||||||
langflowai/langflow:1.0-alpha
|
langflowai/langflow:1.0-alpha
|
||||||
|
|
@ -88,6 +90,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
tags: |
|
tags: |
|
||||||
langflowai/langflow-frontend:${{ needs.release.outputs.version }}
|
langflowai/langflow-frontend:${{ needs.release.outputs.version }}
|
||||||
langflowai/langflow-frontend:1.0-alpha
|
langflowai/langflow-frontend:1.0-alpha
|
||||||
|
|
@ -99,6 +102,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/build_and_push_backend.Dockerfile
|
file: ./docker/build_and_push_backend.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
build-args: |
|
build-args: |
|
||||||
LANGFLOW_IMAGE=langflowai/langflow:${{ needs.release.outputs.version }}
|
LANGFLOW_IMAGE=langflowai/langflow:${{ needs.release.outputs.version }}
|
||||||
tags: |
|
tags: |
|
||||||
|
|
|
||||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
|
@ -38,6 +38,7 @@ jobs:
|
||||||
poetry publish
|
poetry publish
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
id: qemu
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
|
@ -51,6 +52,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/build_and_push.Dockerfile
|
file: ./docker/build_and_push.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
tags: |
|
tags: |
|
||||||
langflowai/langflow:${{ steps.check-version.outputs.version }}
|
langflowai/langflow:${{ steps.check-version.outputs.version }}
|
||||||
langflowai/langflow:latest
|
langflowai/langflow:latest
|
||||||
|
|
@ -62,6 +64,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/build_and_push_backend.Dockerfile
|
file: ./docker/build_and_push_backend.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
build-args: |
|
build-args: |
|
||||||
LANGFLOW_IMAGE=langflowai/langflow:${{ steps.check-version.outputs.version }}
|
LANGFLOW_IMAGE=langflowai/langflow:${{ steps.check-version.outputs.version }}
|
||||||
tags: |
|
tags: |
|
||||||
|
|
@ -73,6 +76,7 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
file: ./docker/frontend/build_and_push_frontend.Dockerfile
|
||||||
|
platforms: "linux/amd64,linux/arm64/v8"
|
||||||
tags: |
|
tags: |
|
||||||
langflowai/langflow-frontend:${{ steps.check-version.outputs.version }}
|
langflowai/langflow-frontend:${{ steps.check-version.outputs.version }}
|
||||||
langflowai/langflow-frontend:latest
|
langflowai/langflow-frontend:latest
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
# BUILDER-BASE
|
# BUILDER-BASE
|
||||||
# Used to build deps + create our virtual environment
|
# Used to build deps + create our virtual environment
|
||||||
################################
|
################################
|
||||||
FROM python:3.12-slim as builder-base
|
|
||||||
|
# force platform to the current architecture to increase build speed time on multi-platform builds
|
||||||
|
FROM --platform=$BUILDPLATFORM python:3.12-slim as builder-base
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
\
|
\
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@
|
||||||
################################
|
################################
|
||||||
# BUILDER-BASE
|
# BUILDER-BASE
|
||||||
################################
|
################################
|
||||||
FROM node:lts-bookworm-slim as builder-base
|
|
||||||
|
# force platform to the current architecture to increase build speed time on multi-platform builds
|
||||||
|
FROM --platform=$BUILDPLATFORM node:lts-bookworm-slim as builder-base
|
||||||
COPY src/frontend /frontend
|
COPY src/frontend /frontend
|
||||||
|
|
||||||
RUN cd /frontend && npm install && npm run build
|
RUN cd /frontend && npm install && npm run build
|
||||||
|
|
|
||||||
14
poetry.lock
generated
14
poetry.lock
generated
|
|
@ -4409,7 +4409,7 @@ six = "*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langflow-base"
|
name = "langflow-base"
|
||||||
version = "0.0.60"
|
version = "0.0.61"
|
||||||
description = "A Python package with a built-in web application"
|
description = "A Python package with a built-in web application"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.10,<3.13"
|
python-versions = ">=3.10,<3.13"
|
||||||
|
|
@ -4490,13 +4490,13 @@ openai = ["openai (>=0.27.8)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langsmith"
|
name = "langsmith"
|
||||||
version = "0.1.75"
|
version = "0.1.76"
|
||||||
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
|
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "<4.0,>=3.8.1"
|
python-versions = "<4.0,>=3.8.1"
|
||||||
files = [
|
files = [
|
||||||
{file = "langsmith-0.1.75-py3-none-any.whl", hash = "sha256:d08b08dd6b3fa4da170377f95123d77122ef4c52999d10fff4ae08ff70d07aed"},
|
{file = "langsmith-0.1.76-py3-none-any.whl", hash = "sha256:4b8cb14f2233d9673ce9e6e3d545359946d9690a2c1457ab01e7459ec97b964e"},
|
||||||
{file = "langsmith-0.1.75.tar.gz", hash = "sha256:61274e144ea94c297dd78ce03e6dfae18459fe9bd8ab5094d61a0c4816561279"},
|
{file = "langsmith-0.1.76.tar.gz", hash = "sha256:5829f997495c0f9a39f91fe0a57e0cb702e8642e6948945f5bb9f46337db7732"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
|
@ -4506,13 +4506,13 @@ requests = ">=2,<3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "litellm"
|
name = "litellm"
|
||||||
version = "1.40.7"
|
version = "1.40.8"
|
||||||
description = "Library to easily interface with LLM API providers"
|
description = "Library to easily interface with LLM API providers"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8"
|
python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "litellm-1.40.7-py3-none-any.whl", hash = "sha256:c98dd8733e632aba16f14bf82e56f7159222097a6d085b242a3140b5d3e7baa4"},
|
{file = "litellm-1.40.8-py3-none-any.whl", hash = "sha256:cd0c313423dad49224696c45ac02c574abcaed6666c597543c2318b3521f4320"},
|
||||||
{file = "litellm-1.40.7.tar.gz", hash = "sha256:557bb19e8e484d0dfe8e4eaa9ccefc888617852988a46d6e7adc41585a2c0600"},
|
{file = "litellm-1.40.8.tar.gz", hash = "sha256:8878d2437ac50bcc6f39ded1729e2113eb5fee645fcebcd32fc241c529a21c00"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "langflow"
|
name = "langflow"
|
||||||
version = "1.0.0a49"
|
version = "1.0.0a50"
|
||||||
description = "A Python package with a built-in web application"
|
description = "A Python package with a built-in web application"
|
||||||
authors = ["Langflow <contact@langflow.org>"]
|
authors = ["Langflow <contact@langflow.org>"]
|
||||||
maintainers = [
|
maintainers = [
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ def read_text_file(file_path: str) -> str:
|
||||||
result = chardet.detect(raw_data)
|
result = chardet.detect(raw_data)
|
||||||
encoding = result["encoding"]
|
encoding = result["encoding"]
|
||||||
|
|
||||||
if encoding in ["Windows-1252", "Windows-1254"]:
|
if encoding in ["Windows-1252", "Windows-1254", "MacRoman"]:
|
||||||
encoding = "utf-8"
|
encoding = "utf-8"
|
||||||
|
|
||||||
with open(file_path, "r", encoding=encoding) as f:
|
with open(file_path, "r", encoding=encoding) as f:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
from typing import Any, Dict, List, Callable
|
||||||
|
import ast
|
||||||
|
from langchain.agents import Tool
|
||||||
|
from langchain.tools import StructuredTool
|
||||||
|
from langflow.interface.custom.custom_component import CustomComponent
|
||||||
|
from langflow.schema.dotdict import dotdict
|
||||||
|
from langchain.pydantic_v1 import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class PythonCodeStructuredTool(CustomComponent):
|
||||||
|
display_name = "PythonCodeTool"
|
||||||
|
description = "structuredtool dataclass code to tool"
|
||||||
|
documentation = "https://python.langchain.com/docs/modules/tools/custom_tools/#structuredtool-dataclass"
|
||||||
|
icon = "🐍"
|
||||||
|
field_order = ["name", "description", "tool_code",
|
||||||
|
"return_direct", "tool_function", "tool_class"]
|
||||||
|
|
||||||
|
def build_config(self) -> Dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"tool_code": {
|
||||||
|
"display_name": "Tool Code",
|
||||||
|
"info": "Enter the dataclass code.",
|
||||||
|
"placeholder": "def my_function(args):\n pass",
|
||||||
|
"multiline": True,
|
||||||
|
"refresh_button": True,
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"display_name": "Tool Name",
|
||||||
|
"info": "Enter the name of the tool.",
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"display_name": "Description",
|
||||||
|
"info": "Provide a brief description of what the tool does.",
|
||||||
|
},
|
||||||
|
"return_direct": {
|
||||||
|
"display_name": "Return Directly",
|
||||||
|
"info": "Should the tool return the function output directly?",
|
||||||
|
},
|
||||||
|
"tool_function": {
|
||||||
|
"display_name": "Tool Function",
|
||||||
|
"info": "Select the function for additional expressions.",
|
||||||
|
"options": [],
|
||||||
|
"refresh_button": True,
|
||||||
|
},
|
||||||
|
"tool_class": {
|
||||||
|
"display_name": "Tool Class",
|
||||||
|
"info": "Select the class for additional expressions.",
|
||||||
|
"options": [],
|
||||||
|
"refresh_button": True,
|
||||||
|
"required": False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def parse_source_name(self, code: str) -> Dict:
|
||||||
|
parsed_code = ast.parse(code)
|
||||||
|
class_names = [
|
||||||
|
node.name for node in parsed_code.body if isinstance(node, ast.ClassDef)]
|
||||||
|
function_names = [
|
||||||
|
node.name for node in parsed_code.body if isinstance(node, ast.FunctionDef)]
|
||||||
|
return {"class": class_names, "function": function_names}
|
||||||
|
|
||||||
|
def update_build_config(self, build_config: dotdict, field_value: Any, field_name: str | None = None) -> dotdict:
|
||||||
|
if field_name == "tool_code" or field_name == "tool_function" or field_name == "tool_class":
|
||||||
|
try:
|
||||||
|
names = self.parse_source_name(build_config.tool_code.value)
|
||||||
|
build_config.tool_class.options = names["class"]
|
||||||
|
build_config.tool_function.options = names["function"]
|
||||||
|
except Exception as e:
|
||||||
|
self.status = f"Failed to extract class names: {str(e)}"
|
||||||
|
build_config.tool_class.options = ["Failed to parse", str(e)]
|
||||||
|
build_config.tool_function.options = []
|
||||||
|
return build_config
|
||||||
|
|
||||||
|
async def build(self, tool_code: Code, name: str, description: str, tool_function: List[str], return_direct: bool, tool_class: List[str] = None) -> Tool:
|
||||||
|
local_namespace = {}
|
||||||
|
exec(tool_code, globals(), local_namespace)
|
||||||
|
|
||||||
|
func = local_namespace[tool_function]
|
||||||
|
_class = None
|
||||||
|
|
||||||
|
if tool_class:
|
||||||
|
_class = local_namespace[tool_class]
|
||||||
|
|
||||||
|
tool = StructuredTool.from_function(
|
||||||
|
func=func,
|
||||||
|
args_schema=_class,
|
||||||
|
name=name,
|
||||||
|
description=description,
|
||||||
|
return_direct=return_direct
|
||||||
|
)
|
||||||
|
return tool
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from typing import List, Optional, Union
|
from typing import List, Optional, Union
|
||||||
|
|
||||||
from couchbase.auth import PasswordAuthenticator # type: ignore
|
|
||||||
from couchbase.cluster import Cluster # type: ignore
|
|
||||||
from couchbase.options import ClusterOptions # type: ignore
|
|
||||||
from langchain_community.vectorstores import CouchbaseVectorStore
|
|
||||||
from langchain_core.retrievers import BaseRetriever
|
from langchain_core.retrievers import BaseRetriever
|
||||||
|
|
||||||
from langflow.custom import CustomComponent
|
from langflow.custom import CustomComponent
|
||||||
|
|
@ -52,6 +48,16 @@ class CouchbaseComponent(CustomComponent):
|
||||||
couchbase_username: str = "",
|
couchbase_username: str = "",
|
||||||
couchbase_password: str = "",
|
couchbase_password: str = "",
|
||||||
) -> Union[VectorStore, BaseRetriever]:
|
) -> Union[VectorStore, BaseRetriever]:
|
||||||
|
try:
|
||||||
|
from couchbase.auth import PasswordAuthenticator # type: ignore
|
||||||
|
from couchbase.cluster import Cluster # type: ignore
|
||||||
|
from couchbase.options import ClusterOptions # type: ignore
|
||||||
|
from langchain_community.vectorstores import CouchbaseVectorStore
|
||||||
|
except ImportError as e:
|
||||||
|
raise ImportError(
|
||||||
|
"Failed to import Couchbase dependencies. Install it using `pip install langflow[couchbase] --pre`"
|
||||||
|
) from e
|
||||||
|
|
||||||
try:
|
try:
|
||||||
auth = PasswordAuthenticator(couchbase_username, couchbase_password)
|
auth = PasswordAuthenticator(couchbase_username, couchbase_password)
|
||||||
options = ClusterOptions(auth)
|
options = ClusterOptions(auth)
|
||||||
|
|
|
||||||
6
src/backend/base/poetry.lock
generated
6
src/backend/base/poetry.lock
generated
|
|
@ -1275,13 +1275,13 @@ types-requests = ">=2.31.0.2,<3.0.0.0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "langsmith"
|
name = "langsmith"
|
||||||
version = "0.1.75"
|
version = "0.1.76"
|
||||||
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
|
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "<4.0,>=3.8.1"
|
python-versions = "<4.0,>=3.8.1"
|
||||||
files = [
|
files = [
|
||||||
{file = "langsmith-0.1.75-py3-none-any.whl", hash = "sha256:d08b08dd6b3fa4da170377f95123d77122ef4c52999d10fff4ae08ff70d07aed"},
|
{file = "langsmith-0.1.76-py3-none-any.whl", hash = "sha256:4b8cb14f2233d9673ce9e6e3d545359946d9690a2c1457ab01e7459ec97b964e"},
|
||||||
{file = "langsmith-0.1.75.tar.gz", hash = "sha256:61274e144ea94c297dd78ce03e6dfae18459fe9bd8ab5094d61a0c4816561279"},
|
{file = "langsmith-0.1.76.tar.gz", hash = "sha256:5829f997495c0f9a39f91fe0a57e0cb702e8642e6948945f5bb9f46337db7732"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "langflow-base"
|
name = "langflow-base"
|
||||||
version = "0.0.60"
|
version = "0.0.61"
|
||||||
description = "A Python package with a built-in web application"
|
description = "A Python package with a built-in web application"
|
||||||
authors = ["Langflow <contact@langflow.org>"]
|
authors = ["Langflow <contact@langflow.org>"]
|
||||||
maintainers = [
|
maintainers = [
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,27 @@
|
||||||
* Function to get the python code for the API
|
* Function to get the python code for the API
|
||||||
* @param {string} flowId - The id of the flow
|
* @param {string} flowId - The id of the flow
|
||||||
* @param {boolean} isAuth - If the API is authenticated
|
* @param {boolean} isAuth - If the API is authenticated
|
||||||
* @param {any[]} tweak - The tweaks
|
* @param {any[]} tweaksBuildedObject - The tweaks
|
||||||
|
* @param {string} [endpointName] - The optional endpoint name
|
||||||
* @returns {string} - The python code
|
* @returns {string} - The python code
|
||||||
*/
|
*/
|
||||||
export default function getPythonApiCode(
|
export default function getPythonApiCode(
|
||||||
flowId: string,
|
flowId: string,
|
||||||
isAuth: boolean,
|
isAuth: boolean,
|
||||||
tweaksBuildedObject,
|
tweaksBuildedObject: any[],
|
||||||
endpointName?: string
|
endpointName?: string,
|
||||||
): string {
|
): string {
|
||||||
|
let tweaksString = "{}";
|
||||||
|
if (tweaksBuildedObject && tweaksBuildedObject.length > 0) {
|
||||||
const tweaksObject = tweaksBuildedObject[0];
|
const tweaksObject = tweaksBuildedObject[0];
|
||||||
const tweaksString = JSON.stringify(tweaksObject, null, 2)
|
if (!tweaksObject) {
|
||||||
|
throw new Error("expected tweaks");
|
||||||
|
}
|
||||||
|
tweaksString = JSON.stringify(tweaksObject, null, 2)
|
||||||
.replace(/true/g, "True")
|
.replace(/true/g, "True")
|
||||||
.replace(/false/g, "False");
|
.replace(/false/g, "False");
|
||||||
|
}
|
||||||
|
|
||||||
return `import argparse
|
return `import argparse
|
||||||
import json
|
import json
|
||||||
from argparse import RawTextHelpFormatter
|
from argparse import RawTextHelpFormatter
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,26 @@
|
||||||
/**
|
/**
|
||||||
* Function to get the python code for the API
|
* Function to get the python code for the API
|
||||||
* @param {string} flow - The current flow
|
* @param {string} flow - The current flow
|
||||||
* @param {any[]} tweak - The tweaks
|
* @param {any[]} tweaksBuildedObject - The tweaks
|
||||||
* @returns {string} - The python code
|
* @returns {string} - The python code
|
||||||
*/
|
*/
|
||||||
export default function getPythonCode(
|
export default function getPythonCode(
|
||||||
flowName: string,
|
flowName: string,
|
||||||
tweaksBuildedObject
|
tweaksBuildedObject: any[],
|
||||||
): string {
|
): string {
|
||||||
|
let tweaksString = "{}";
|
||||||
|
if (tweaksBuildedObject && tweaksBuildedObject.length > 0) {
|
||||||
const tweaksObject = tweaksBuildedObject[0];
|
const tweaksObject = tweaksBuildedObject[0];
|
||||||
|
if (!tweaksObject) {
|
||||||
|
throw new Error("expected tweaks");
|
||||||
|
}
|
||||||
|
tweaksString = JSON.stringify(tweaksObject, null, 2)
|
||||||
|
.replace(/true/g, "True")
|
||||||
|
.replace(/false/g, "False");
|
||||||
|
}
|
||||||
|
|
||||||
return `from langflow.load import run_flow_from_json
|
return `from langflow.load import run_flow_from_json
|
||||||
TWEAKS = ${JSON.stringify(tweaksObject, null, 2)}
|
TWEAKS = ${tweaksString}
|
||||||
|
|
||||||
result = run_flow_from_json(flow="${flowName}.json",
|
result = run_flow_from_json(flow="${flowName}.json",
|
||||||
input_value="message",
|
input_value="message",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue