Skip to main content

A new package designed to interpret user-submitted text descriptions, such as notices or requests related to device control or automation, and convert them into structured commands or actions. By leve

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nl2action-2025.12.21163026.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nl2action-2025.12.21163026-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file nl2action-2025.12.21163026.tar.gz.

File metadata

  • Download URL: nl2action-2025.12.21163026.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for nl2action-2025.12.21163026.tar.gz
Algorithm Hash digest
SHA256 adb382e3a7b18f8daa23a3887df82338f15c9beb6708e95eafbac62f5ef1cb06
MD5 5147bd7e4b0fbaee9b868f6a723eb16c
BLAKE2b-256 db03f355006d592850a4a6c4fcbcdb4852a648007e81a235f5dd808c19f2a78d

See more details on using hashes here.

File details

Details for the file nl2action-2025.12.21163026-py3-none-any.whl.

File metadata

File hashes

Hashes for nl2action-2025.12.21163026-py3-none-any.whl
Algorithm Hash digest
SHA256 dd961b7ec058b9977c79727bdd03246be7914f46f98de164be58d1adc8496c5d
MD5 4a8285a43d84277b38a2af95e88ddcd8
BLAKE2b-256 0f8a045fe7fc2864b8d75bb1eeae452786ba157703360b79287ddfe8d2a1dfe6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page