Skip to main content

nl2action

PyPI version License: MIT Downloads LinkedIn

A package for natural language interpretation to structured commands or actions

Overview

This package interprets user-submitted text descriptions and converts them into structured commands or actions for devices, home automation scripts, and other applications. It utilizes pattern matching with language models to translate natural language inputs into executable instructions.

Installation

pip install nl2action

Usage

from nl2action import nl2action

response = nl2action("user_input_text")

Parameters

  • user_input: The user-submitted text to process
  • llm: The langchain llm instance to use (optional, defaults to ChatLLM7 with LLM7_API_KEY)
  • api_key: The API key for LLM7 (optional, default is environment variable LLM7_API_KEY or None)

Using a custom LLM instance

from langchain_openai import ChatOpenAI
from nl2action import nl2action

llm = ChatOpenAI()
response = nl2action(user_input, llm=llm)

Using an Anthropic AI

from langchain_anthropic import ChatAnthropic
from nl2action import nl2action

llm = ChatAnthropic()
response = nl2action(user_input, llm=llm)

Using Google Generative AI

from langchain_google_genai import ChatGoogleGenerativeAI
from nl2action import nl2action

llm = ChatGoogleGenerativeAI()
response = nl2action(user_input, llm=llm)

Environment Variables

  • LLM7_API_KEY: Set to use a custom API key for LLM7, or None for the free tier

LLM7 Setup

  • Get a free API key at https://token.llm7.io/
  • For higher rate limits, set the LLM7_API_KEY environment variable or pass it directly to the nl2action function

Issues

https://github.com/chigwell/ nl2action

Release files for nl2action 2025.12.21163026

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nl2action 2025.12.21163026
File Size Uploaded
nl2action-2025.12.21163026.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nl2action 2025.12.21163026
File Interpreter ABI Platform
nl2action-2025.12.21163026-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / nl2action-2025.12.21163026.tar.gz

Download URL nl2action-2025.12.21163026.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
adb382e3a7b18f8daa23a3887df82338f15c9beb6708e95eafbac62f5ef1cb06
BLAKE2b-256 checksum
How to use checksums
db03f355006d592850a4a6c4fcbcdb4852a648007e81a235f5dd808c19f2a78d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / nl2action-2025.12.21163026-py3-none-any.whl

Download URL nl2action-2025.12.21163026-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd961b7ec058b9977c79727bdd03246be7914f46f98de164be58d1adc8496c5d
BLAKE2b-256 checksum
How to use checksums
0f8a045fe7fc2864b8d75bb1eeae452786ba157703360b79287ddfe8d2a1dfe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.21163026 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page