docs: API examples (#5499)
* bump-api-to-1.1.1 * docs: api reference content * more-endpoints * cleanup * all-endpoints-accounted-for * docs: update API reference with user response examples and authorization header * all-200s-complete * fix-spacing-for-gh-preview * sidebars * monitor-endpoints * fix-build-error * fix-sidebar-error * create-flows * flows-endpoint-finished * move * files-endpoint * run-flow * folder-endpoint * docs: update API reference with new endpoints and examples for flows, folders, and files * value * docs: update openapi.json * docs: enhance API reference with folder-id export instructions and examples * docs: update API reference with new flow structure and log retrieval instructions * docs: clarify ZIP file download endpoint description in API examples * docs: refine API examples for clarity and consistency * docs: refine API examples for clarity and consistency * webhook * docs: format curl example for improved readability * docs: update curl examples to use double quotes for variable interpolation * docs: Update API example descriptions for improved clarity * docs: Update API example descriptions for improved clarity * docs: Enhance API reference with Langflow API key setup and build flow examples * docs: update API reference examples with new event data and structure * docs: add clarification on LLM chat response streaming in API examples * error-and-build-vertex * docs: remove wrong information from API examples * Apply suggestions from code review Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com> * docs: Update API reference examples for environment variable exports * docs: Fix JSON structure in API reference examples * docs: Update API reference examples for file download and log retrieval --------- Co-authored-by: anovazzi1 <otavio2204@gmail.com> Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>
This commit is contained in:
parent
65530e210f
commit
26ed6dc2f7
4 changed files with 1888 additions and 95 deletions
1596
docs/docs/API-Reference/api-reference-api-examples.md
Normal file
1596
docs/docs/API-Reference/api-reference-api-examples.md
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -37,58 +37,12 @@ The **Tweaks** tab displays the available parameters for your flow. Modifying
|
|||
|
||||
## Send image files to your flow with the API
|
||||
|
||||
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](/environment-variables#supported-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.
|
||||
|
||||
```curl
|
||||
curl -X POST "http://127.0.0.1:7860/api/v1/files/upload/a430cc57-06bb-4c11-be39-d3d4de68d2c4" \
|
||||
-H "Content-Type: multipart/form-data" \
|
||||
-F "file=@image-file.png"
|
||||
```
|
||||
|
||||
The API returns the image file path in the format `"file_path":"<YOUR-FLOW-ID>/<TIMESTAMP>_<FILE-NAME>"}`.
|
||||
|
||||
```json
|
||||
{"flowId":"a430cc57-06bb-4c11-be39-d3d4de68d2c4","file_path":"a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png"}
|
||||
```
|
||||
|
||||
2. 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.
|
||||
|
||||
```curl
|
||||
curl -X POST \
|
||||
"http://127.0.0.1:7860/api/v1/run/a430cc57-06bb-4c11-be39-d3d4de68d2c4?stream=false" \
|
||||
-H 'Content-Type: application/json'\
|
||||
-d '{
|
||||
"output_type": "chat",
|
||||
"input_type": "chat",
|
||||
"tweaks": {
|
||||
"ChatInput-b67sL": {
|
||||
"files": "a430cc57-06bb-4c11-be39-d3d4de68d2c4/2024-11-27_14-47-50_image-file.png",
|
||||
"input_value": "what do you see?"
|
||||
}
|
||||
}}'
|
||||
```
|
||||
|
||||
Your chatbot describes the image file you sent.
|
||||
|
||||
```plain
|
||||
"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..."
|
||||
```
|
||||
|
||||
## Chat Widget {#48f121a6cb3243979a341753da0c2700}
|
||||
|
||||
|
||||
---
|
||||
For information on sending files to the Langflow API, see [API examples](/api-reference-api-examples#upload-image-files).
|
||||
|
||||
## Chat Widget
|
||||
|
||||
The **Chat Widget HTML** tab displays code that can be inserted in the `<body>` of your HTML to interact with your flow.
|
||||
|
||||
|
||||
The **Langflow Chat Widget** is a powerful web component that enables communication with a Langflow project. This widget allows for a chat interface embedding, allowing the integration of Langflow into web applications effortlessly.
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue