Skip to content

Commit

Permalink
Merge branch 'main' into fix/chat_input_output_minimized
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaseduoli authored Dec 23, 2024
2 parents 1c12e82 + b4673d3 commit 40eef16
Show file tree
Hide file tree
Showing 20 changed files with 2,019 additions and 2,839 deletions.
2 changes: 1 addition & 1 deletion docs/docs/Components/components-prompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Answer the question
{user_question}
```

When variables are added to a prompt template, new fields are automatically created in the component. These fields can be connected to receive text input from other components to automate prompting, or to output instructions to other components. An example of prompts controlling agents behavior is available in the [sequential tasks agent starter flow](/starter-projects-sequential-agent).
When variables are added to a prompt template, new fields are automatically created in the component. These fields can be connected to receive text input from other components to automate prompting, or to output instructions to other components. An example of prompts controlling agents behavior is available in the [sequential tasks agent starter flow](/tutorials-sequential-agent).

### Inputs

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/Get-Started/welcome-to-langflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Langflow is an intuitive visual flow builder. This drag-and-drop interface allow

Langflow can be used for a wide range of AI applications, including:

* [Craft intelligent chatbots](/starter-projects-memory-chatbot)
* [Build document analysis systems](/starter-projects-document-qa)
* [Generate compelling content](/starter-projects-blog-writer)
* [Craft intelligent chatbots](/tutorials-memory-chatbot)
* [Build document analysis systems](/tutorials-document-qa)
* [Generate compelling content](/tutorials-blog-writer)
* [Orchestrate multi-agent applications](/starter-projects-simple-agent)

## Community and support
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/Guides/guides-chat-memory.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ In any project, as long as there are [**Chat**](/components-io) being used, memo
To see and access this history of messages, Langflow features a component called [Message history](/components-helpers#memory-history). It retrieves previous messages and outputs them in structured format or parsed.


To learn the basics about memory in Langflow, check out the [Memory Chatbot](/starter-projects-memory-chatbot) starter example.
To learn the basics about memory in Langflow, check out the [Memory Chatbot](/tutorials-memory-chatbot) starter example.


Memories can be visualized and managed directly from the **Playground**. You can edit and remove previous messages to inspect and validate the AI’s response behavior. You can remove or edit previous messages to get your models acting just right.
Expand Down Expand Up @@ -72,7 +72,7 @@ This example stores and retrieves chat history from an [AstraDBChatMemory](/comp

### Connect the chat memory component to an external database

1. Load the [Memory Chatbot](/starter-projects-memory-chatbot) starter project.
1. Load the [Memory Chatbot](/tutorials-memory-chatbot) starter project.
This starter project extends the basic prompting flow to include a chat memory component.
2. Add the [Store Message](/components-helpers#store-message) component to the flow.
The **Store message** component stores messages in the external database.
Expand Down
1 change: 0 additions & 1 deletion docs/docs/Starter-Projects/_category_.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Blog Writer
sidebar_position: 1
slug: /starter-projects-blog-writer
slug: /tutorials-blog-writer
---

Build a Blog Writer flow for a one-shot application using OpenAI.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Document QA
sidebar_position: 2
slug: /starter-projects-document-qa
slug: /tutorials-document-qa
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Memory Chatbot
sidebar_position: 3
slug: /starter-projects-memory-chatbot
slug: /tutorials-memory-chatbot
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Sequential tasks agent
sidebar_position: 4
slug: /starter-projects-sequential-agent
slug: /tutorials-sequential-agent
---

Build a **Sequential Tasks Agent** flow for a multi-agent application using multiple **Agent** components.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Travel planning agent
sidebar_position: 8
slug: /starter-projects-travel-planning-agent
slug: /tutorials-travel-planning-agent
---

Build a **Travel Planning Agent** flow for an agentic application using the multiple Tool-calling agents.
Expand Down
25 changes: 22 additions & 3 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const config = {
docs: {
routeBasePath: "/", // Serve the docs at the site's root
sidebarPath: require.resolve("./sidebars.js"), // Use sidebars.js file
sidebarCollapsed: false,
sidebarCollapsed: true,
beforeDefaultRemarkPlugins: [
[
remarkCodeHike,
Expand Down Expand Up @@ -107,8 +107,11 @@ const config = {
from: "/getting-started-quickstart",
},
{
to: "/starter-projects-travel-planning-agent",
from: "/starter-projects-dynamic-agent/",
to: "/tutorials-travel-planning-agent",
from: [
"/starter-projects-dynamic-agent/",
"/starter-projects-travel-planning-agent",
],
},
{
to: "/workspace-overview",
Expand All @@ -127,6 +130,22 @@ const config = {
to: "/configuration-global-variables",
from: "/settings-global-variables",
},
{
to: "/tutorials-sequential-agent",
from: "/starter-projects-sequential-agent",
},
{
to: "/tutorials-blog-writer",
from: "/starter-projects-blog-writer",
},
{
to: "/tutorials-memory-chatbot",
from: "/starter-projects-memory-chatbot",
},
{
to: "/tutorials-document-qa",
from: "/starter-projects-document-qa",
},
{
to: "/components-vector-stores",
from: "/components-rag",
Expand Down
18 changes: 12 additions & 6 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ module.exports = {
label: "Starter Projects",
items: [
'Starter-Projects/starter-projects-basic-prompting',
'Starter-Projects/starter-projects-blog-writer',
'Starter-Projects/starter-projects-document-qa',
'Starter-Projects/starter-projects-memory-chatbot',
'Starter-Projects/starter-projects-simple-agent',
'Starter-Projects/starter-projects-vector-store-rag',
'Starter-Projects/starter-projects-sequential-agent',
'Starter-Projects/starter-projects-travel-planning-agent',
'Starter-Projects/starter-projects-simple-agent',
],
},
{
type: "category",
label: "Tutorials",
items: [
'Tutorials/tutorials-blog-writer',
'Tutorials/tutorials-document-qa',
'Tutorials/tutorials-memory-chatbot',
'Tutorials/tutorials-sequential-agent',
'Tutorials/tutorials-travel-planning-agent',
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ dev-dependencies = [
"asgi-lifespan>=2.1.0",
"pytest-github-actions-annotate-failures>=0.2.0",
"pytest-codspeed>=3.0.0",
"blockbuster>=1.5.5,<1.6",
"blockbuster>=1.5.7,<1.6",
"types-aiofiles>=24.1.0.20240626",
"codeflash>=0.8.4",
]
Expand Down
Empty file.
6 changes: 4 additions & 2 deletions src/backend/base/langflow/alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from logging.config import fileConfig

from alembic import context
from sqlalchemy import engine_from_config, pool
from sqlalchemy import engine_from_config, pool, text

from langflow.services.database.models import *
from langflow.services.database.service import SQLModel

# this is the Alembic Config object, which provides
Expand Down Expand Up @@ -69,6 +68,9 @@ def run_migrations_online() -> None:
context.configure(connection=connection, target_metadata=target_metadata, render_as_batch=True)

with context.begin_transaction():
if connection.dialect.name == "postgresql":
connection.execute(text("SET LOCAL lock_timeout = '60s';"))
connection.execute(text("SELECT pg_advisory_xact_lock(112233);"))
context.run_migrations()


Expand Down
19 changes: 14 additions & 5 deletions src/backend/base/langflow/services/database/models/flow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
from emoji import purely_emoji
from fastapi import HTTPException, status
from loguru import logger
from pydantic import BaseModel, field_serializer, field_validator, model_validator
from pydantic import (
BaseModel,
ValidationInfo,
field_serializer,
field_validator,
)
from sqlalchemy import Text, UniqueConstraint
from sqlmodel import JSON, Column, Field, Relationship, SQLModel

Expand Down Expand Up @@ -203,16 +208,20 @@ class FlowHeader(BaseModel):
id: UUID = Field(description="Unique identifier for the flow")
name: str = Field(description="The name of the flow")
folder_id: UUID | None = Field(
None, description="The ID of the folder containing the flow. None if not associated with a folder"
None,
description="The ID of the folder containing the flow. None if not associated with a folder",
)
is_component: bool | None = Field(None, description="Flag indicating whether the flow is a component")
endpoint_name: str | None = Field(None, description="The name of the endpoint associated with this flow")
description: str | None = Field(None, description="A description of the flow")
data: dict | None = Field(None, description="The data of the component, if is_component is True")

@model_validator(mode="before")
@field_validator("data", mode="before")
@classmethod
def validate_flow_header(cls, data: dict):
return data
def validate_flow_header(cls, value: dict, info: ValidationInfo):
if not info.data["is_component"]:
return None
return value


class FlowUpdate(SQLModel):
Expand Down
2 changes: 1 addition & 1 deletion src/backend/base/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ignore_missing_imports = true

[tool.ruff]
target-version = "py310"
exclude = ["langflow/alembic"]
exclude = ["langflow/alembic/versions"]
line-length = 120

[tool.ruff.lint]
Expand Down
Loading

0 comments on commit 40eef16

Please sign in to comment.