A CLI tool to convert natural language to REST API queries.
Project description
nlrest
Description
nlrest
is a Python Command Line Interface (CLI) tool that allows users to convert natural language descriptions into REST API queries and execute them. It uses OpenAI's GPT-3.5 Turbo model to interpret natural language and generate the details of the REST API call, including the method, URL, headers, and request body.
Installation
Prerequisites
- Python 3.6 or higher
- An OpenAI API key
Install from PyPI
You can install nlrest
directly from PyPI:
pip install nlrest
Set Up Environment Variable
Before using nlrest
, set the OPENAI_API_KEY
environment variable with your OpenAI API key:
export OPENAI_API_KEY='your-api-key-here'
Usage
Basic Usage
To use nlrest
, run the command followed by the -p
option and your natural language prompt:
nlrest -p "Your natural language instruction here"
Example:
nlrest -p "Fetch the latest news from NewsAPI"
The tool will output the response from the executed REST API call.
Example Prompts
- "Fetch the latest stock prices from the Finance API."
- "Post a new message to my social media account saying 'Hello World!'."
Features
- Converts natural language to REST API query details.
- Supports various HTTP methods (GET, POST, PUT, DELETE).
- Executes the REST API requests and displays the response.
Contributing
Contributions to nlrest
are welcome! Please feel free to submit pull requests or open issues to improve the tool or add new features.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
File details
Details for the file nlrest-0.1.3.tar.gz
.
File metadata
- Download URL: nlrest-0.1.3.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c177804cfefcfa9fb18fe3a18c4f874656713cd122b50780caa47ec87612681e |
|
MD5 | 5c72038e1ff271111cc7c5a1e598eb76 |
|
BLAKE2b-256 | 696710a845d823e57a6237821ea3970df5807a09b75acc21164b177e67df9c4d |
File details
Details for the file nlrest-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: nlrest-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b37bd768c65532cf79cddf0fb4358447bc24130b00df7d2a89b3e4ae97a81f35 |
|
MD5 | 621d7db1d9df91ca5ad722c788873d6f |
|
BLAKE2b-256 | d0fb42baa510b5358a3361a94b70bbca4a2683071f1e4c4a5a75c873a29c0bc9 |