Fluent CLI is a command-line interface (CLI) tool designed to simplify interaction with various workflow engines, including FlowiseAI, Langflow, and custom webhooks. It provides a streamlined way to send requests, manage configurations, and handle responses, making it easier to integrate AI workflows into your projects.
- Multi-Engine Support: Interact with FlowiseAI, Langflow, and Webhook workflows seamlessly.
- Simplified Request Handling: Send requests to your workflows with a simple command structure.
- Context Management: Provide additional context via stdin or files for richer interactions.
- Configuration Management: Load and modify workflow configurations from a centralized JSON file.
- Environment Variable Integration: Securely store sensitive information like API keys in environment variables and reference them in your configurations.
- System Prompt Override: Easily override system messages for greater control over your workflows.
- File Upload: Upload images and other files to your workflows.
- Upsert Functionality: Send JSON payloads and upload files to endpoints for data management.
- Output Customization: Control output format, including stylized markdown, parsed code blocks, and full JSON responses.
- Media Download: Download media files linked in responses directly from the CLI.
- Autocomplete Generation: Generate Bash and Fig autocomplete scripts for enhanced usability.
- Amber Integration: Securely decrypt and manage sensitive keys using the Amber secrets management tool.
- Ensure you have Rust and Cargo installed.
- Clone this repository:
git clone https://github.com/njfio/fluent_cli.git
- Navigate to the project directory:
cd fluent_cli
- Build the project:
cargo build --release
- The executable will be located in
target/release/fluent
.
Pre-built binaries for various platforms are available in the Releases section of this repository.
Fluent CLI uses a config.json
file to store workflow configurations. A sample configuration file is provided in the repository. You can customize this file to include your own workflows and settings.
[
{
"name": "FlowName",
"engine": "flowise|langflow|webhook",
"protocol": "http|https",
"hostname": "your-hostname",
"port": 80|443,
"chat_id": "your-chat-id",
"request_path": "/api/v1/prediction/",
"upsert_path": "/api/v1/vector/upsert/", // Optional, for upsert functionality
"sessionId": "your-session-id",
"bearer_token": "your-bearer-token",
"overrideConfig": {}, // Workflow-specific overrides
"tweaks": {}, // Workflow-specific tweaks
"timeout_ms": 50000
},
// ... more workflows
]
Explanation:
- name: A unique name for your workflow.
- engine: The type of workflow engine (flowise, langflow, webhook).
- protocol, hostname, port, chat_id, request_path: Connection details for your workflow.
- upsert_path: (Optional) The path for upsert requests.
- sessionId: The session ID for your workflow (if applicable).
- bearer_token: The authentication token for your workflow.
- overrideConfig: A JSON object containing workflow-specific configuration overrides.
- tweaks: A JSON object containing workflow-specific tweaks.
- timeout_ms: The request timeout in milliseconds.
Notes:
- You can use environment variables in your configuration by prefixing the variable name with
AMBER_
. For example, to use the environment variableMY_API_KEY
in your bearer token, setbearer_token
toAMBER_MY_API_KEY
. - Fluent CLI will automatically attempt to decrypt keys starting with
AMBER_
using the Amber secrets management tool.
To send a request to a workflow, use the following command:
fluent <flowname> "<request>"
Example:
fluent MyFlow "What is the weather like today?"
You can provide additional context to your request through stdin or a file:
Stdin:
echo "Here is some context." | fluent MyFlow "What is the weather like today?"
File:
fluent MyFlow "What is the weather like today?" --context "context.txt"
To override the system message of a Flowise workflow, use the following options:
Inline:
fluent MyFlow "What is the weather like today?" --system-prompt-override-inline "You are a helpful weather bot."
File:
fluent MyFlow "What is the weather like today?" --system-prompt-override-file "system_prompt.txt"
To upload an image to a workflow, use the --upload-image-path
option:
fluent MyFlow "Describe this image." --upload-image-path "image.png"
With Upload:
fluent MyFlow --upsert-with-upload "file1.txt,file2.csv"
Without Upload:
fluent MyFlow --upsert-no-upload
Markdown:
fluent MyFlow "What is the weather like today?" --markdown-output
Parsed Code Blocks:
fluent MyFlow "Generate some Python code." --parse-code-output
Full JSON Output:
fluent MyFlow "What is the weather like today?" --full-output
fluent MyFlow "Find me some images of cats." --download-media "/path/to/directory"
Bash:
fluent --generate-autocomplete > fluent_autocomplete.sh
source fluent_autocomplete.sh
Fig:
fluent --generate-fig-autocomplete > fluent.ts
fluent MyFlow "What is the weather like today?" --override modelName="gpt-4" --override tweaks.Prompt-PbKIE.template="You are a helpful pirate."
Contributions to Fluent CLI are welcome! Please open an issue or submit a pull request if you have any suggestions, bug reports, or feature requests.
Fluent CLI is licensed under the MIT License.
Nicholas Ferguson - [email protected]
Project Link: https://github.com/njfio/fluent-cli