diff --git a/404.html b/404.html index 2922af694b..1f326516c6 100644 --- a/404.html +++ b/404.html @@ -21,7 +21,7 @@ - + diff --git a/agents-overview.html b/agents-overview.html index bbd9c45c48..3d8f10fffc 100644 --- a/agents-overview.html +++ b/agents-overview.html @@ -21,7 +21,7 @@ - + diff --git a/agents-tool-calling-agent-component.html b/agents-tool-calling-agent-component.html index ae7820f4c9..878f3add6b 100644 --- a/agents-tool-calling-agent-component.html +++ b/agents-tool-calling-agent-component.html @@ -21,7 +21,7 @@ - + diff --git a/api-reference-api-examples.html b/api-reference-api-examples.html index 2d9df57c9f..4c1ac5f8b4 100644 --- a/api-reference-api-examples.html +++ b/api-reference-api-examples.html @@ -21,7 +21,7 @@ - + @@ -138,7 +138,7 @@ To disable streaming and get all events at once, set stream to Parameters

ParameterTypeDescription
inputsobjectOptional. Input values for flow components.
dataobjectOptional. Flow data to override stored configuration.
filesarray[string]Optional. List of file paths to use.
stop_component_idstringOptional. ID of the component where the execution should stop.
start_component_idstringOptional. ID of the component where the execution should start.
log_buildsbooleanOptional. Control build logging. Default: true.

Configure the build endpoint

-

The /build endpoint accepts optional values for start_component_id and stop_component_id to control where the flow run will start and stop. +

The /build endpoint accepts optional values for start_component_id and stop_component_id to control where the flow run starts and stops. Setting stop_component_id for a component triggers the same behavior as clicking the Play button on that component, where all dependent components leading up to that component are also run. For example, to stop flow execution at the Open AI model component, run the following command:


_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-d '{"stop_component_id": "OpenAIModel-Uksag"}'

@@ -147,46 +147,95 @@ This is useful for running flows without having to pass custom values through th

_14
curl -X POST \
_14
"$LANGFLOW_URL/api/v1/build/$FLOW_ID/flow" \
_14
-H "accept: application/json" \
_14
-H "Content-Type: application/json" \
_14
-d '{
_14
"data": {
_14
"nodes": [],
_14
"edges": []
_14
},
_14
"inputs": {
_14
"input_value": "Your custom input here",
_14
"session": "session_id"
_14
}
_14
}'

Files

Use the /files endpoint to add or delete files between your local machine and Langflow.

-

Upload file

-

Upload a file to an existing flow.

-

This example uploads the_oscar_award.csv.

-

_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: multipart/form-data" \
_10
-F "file=@the_oscar_award.csv"

-

Upload image files

+

There are /v1 and /v2 versions of the /files endpoints. +The v2/files version offers several improvements over /v1:

+ +

Files/V1 endpoints

+

Use the /files endpoint to add or delete files between your local machine and Langflow.

+ +

Upload file (v1)

+

Upload a file to the v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow. +Replace FILE_NAME with the uploaded file name.

+

_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v1/files/upload/$FLOW_ID" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: multipart/form-data" \
_10
-F "file=@FILE_NAME.txt"

+

Upload image files (v1)

Send image files to the Langflow API for AI analysis.

The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable. For more information, see Supported environment variables.

    -
  1. To send an image to your flow with the API, POST the image file to the v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow.
  2. +
  3. To send an image to your flow with the API, POST the image file to the v1/files/upload/<YOUR-FLOW-ID> endpoint of your flow. +Replace FILE_NAME with the uploaded file name.
-

_10
curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \
_10
-H "Content-Type: multipart/form-data" \
_10
-F "file=@image-file.png"

+

_10
curl -X POST "$LANGFLOW_URL/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \
_10
-H "Content-Type: multipart/form-data" \
_10
-F "file=@FILE_NAME.png"

The API returns the image file path in the format "file_path":"<YOUR-FLOW-ID>/<TIMESTAMP>_<FILE-NAME>"}.


_10
{"flowId":"a430cc57-06bb-4c11-be39-d3d4de68d2c4","file_path":"a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"}

  1. Post the image file to the Chat Input component of a Basic prompting flow. -Pass the file path value as an input in the Tweaks section of the curl call to Langflow.
  2. +Pass the file path value as an input in the Tweaks section of the curl call to Langflow. +To find your Chat input component's ID, use the

_12
curl -X POST \
_12
"$LANGFLOW_URL/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \
_12
-H 'Content-Type: application/json'\
_12
-d '{
_12
"output_type": "chat",
_12
"input_type": "chat",
_12
"tweaks": {
_12
"ChatInput-b67sL": {
_12
"files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",
_12
"input_value": "what do you see?"
_12
}
_12
}}'

Your chatbot describes the image file you sent.


_10
"text": "This flowchart appears to represent a complex system for processing financial inquiries using various AI agents and tools. Here's a breakdown of its components and how they might work together..."

-

List files

+

List files (v1)

List all files associated with a specific flow.

-

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \
_10
-H "accept: application/json"

-

Download file

-

Download a specific file for a given flow.

-

To look up the file name in Langflow, use the /list endpoint.

-

This example downloads the 2024-12-30_15-19-43_the_oscar_award.csv file from Langflow to a file named output-file.csv.

-

The --output flag is optional.

-

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_the_oscar_award.csv" \
_10
-H "accept: application/json" \
_10
--output output-file.csv

-

Download image

-

Download an image file for a given flow.

-

To look up the file name in Langflow, use the /list endpoint.

-

This example downloads the 2024-12-30_15-42-44_image-file.png file from Langflow to a file named output-image.png.

-

The --output flag is optional.

-

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/files/images/$FLOW_ID/2024-12-30_15-42-44_image-file.png" \
_10
-H "accept: application/json" \
_10
--output output-image.png

-

Delete file

+

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/files/list/$FLOW_ID" \
_10
-H "accept: application/json"

+

Download file (v1)

+

Download a specific file from a flow.

+

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/files/download/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \
_10
-H "accept: application/json" \
_10
--output downloaded_file.txt

+

Delete file (v1)

Delete a specific file from a flow.

-

This example deletes the 2024-12-30_15-42-44_image-file.png file from Langflow.

-

_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-42-44_image-file.png" \
_10
-H "accept: application/json"

+

_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v1/files/delete/$FLOW_ID/2024-12-30_15-19-43_your_file.txt" \
_10
-H "accept: application/json"

+

Files/V2 endpoints

+

In v2, files are organized by user_id and tracked in the Langflow database, and can be added or deleted in bulk, instead of one by one. +The v2 endpoints require authentication by an API key or JWT. +To create a Langflow API key and export it as an environment variable, see Export values.

+

Upload file (v2)

+

Upload a file to your user account. The file can be used across multiple flows.

+

The file is uploaded in the format USER_ID/FILE_ID.FILE_EXTENSION, such as 6f17a73e-97d7-4519-a8d9-8e4c0be411bb/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34.txt. +Replace FILE_NAME.EXTENSION with the uploaded file name and its extension.

+

_10
curl -X POST \
_10
"$LANGFLOW_URL/api/v2/files" \
_10
-H "accept: application/json" \
_10
-H "Content-Type: multipart/form-data" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-F "file=@FILE_NAME.EXTENSION"

+

Send files to your flows (v2)

+

Send a file to your flow for analysis using the File component.

+

The default file limit is 100 MB. To configure this value, change the LANGFLOW_MAX_FILE_SIZE_UPLOAD environment variable. +For more information, see Supported environment variables.

+
    +
  1. To send an image to your flow with the API, POST the image file to the /api/v2/files endpoint. +Replace FILE_NAME with the uploaded file name.
  2. +
+

_10
curl -X POST "$LANGFLOW_URL/api/v2/files" \
_10
-H "Content-Type: multipart/form-data" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
-F "file=@FILE_NAME.png"

+

The file is uploaded in the format USER_ID/FILE_ID.FILE_EXTENSION, and the API returns metadata about the uploaded file:

+

_10
{
_10
"id": "5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e",
_10
"name": "FILE_NAME",
_10
"path": "232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png",
_10
"size": 84408,
_10
"provider": null
_10
}

+
    +
  1. To use this file in your flow, add a File component to load a file into the flow.
  2. +
  3. To load the file into your flow, send it to the File component.
  4. +
+

_16
curl --request POST \
_16
--url '$LANGFLOW_URL/api/v1/run/$FLOW_ID' \
_16
--header 'Content-Type: application/json' \
_16
--header 'x-api-key: $LANGFLOW_API_KEY' \
_16
--data '{
_16
"input_value": "what do you see?",
_16
"output_type": "chat",
_16
"input_type": "text",
_16
"tweaks": {
_16
"File-t2Ngc": {
_16
"path": [
_16
"232f54ba-dd54-4760-977e-ed637f83e785/5f829bc4-ac1e-4a80-b1d1-fedc03cd5b6e.png"
_16
]
_16
}
_16
}
_16
}'

+

List files (v2)

+

List all files associated with your user account.

+

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v2/files" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

+

Download file (v2)

+

Download a specific file by its ID and file extension.

+
tip

You must specify the file type you expect in the --output value.

+

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v2/files/c7b22c4c-d5e0-4ec9-af97-5d85b7657a34" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY" \
_10
--output downloaded_file.txt

+

Edit file name (v2)

+

Change a file name.

+

_10
curl -X PUT \
_10
"$LANGFLOW_URL/api/v2/files/$FILE_ID?name=new_file_name" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

+

Delete file (v2)

+

Delete a specific file by its ID.

+

_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v2/files/$FILE_ID" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

+

Delete all files (v2)

+

Delete all files associated with your user account.

+

_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v2/files" \
_10
-H "accept: application/json" \
_10
-H "x-api-key: $LANGFLOW_API_KEY"

Flows

Use the /flows endpoint to create, read, update, and delete flows.

Create flow

@@ -240,7 +289,7 @@ The target folder_id must already exist before uploading a flow. Ca

Retrieve details of a specific folder.

To find the UUID of your folder, call the read folders endpoint.


_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/folders/$FOLDER_ID" \
_10
-H "accept: application/json"

-

Update folder

+

Update folder

Update the information of a specific folder with a PATCH request.

Each PATCH request updates the folder with the values you send. Only the fields you include in your request are updated. @@ -309,7 +358,7 @@ Results can be ordered with the order_by query string.


_10
curl -X DELETE \
_10
"$LANGFLOW_URL/api/v1/monitor/messages/session/different_session_id_2" \
_10
-H "accept: */*"

Get transactions

Retrieve all transactions (interactions between components) for a specific flow.

-

_10
curl -X GET \
_10
"$LANGFLOW_URL/api/v1/monitor/transactions?flow_id=$FLOW_ID&page=1&size=50" \
_10
-H "accept: application/json"