Skip to main content

TULP: A command line tool, in the best essence of POSIX tooling, that will help you to **process**, **filter**, and **create** data in this new Artificial Intelligence world.

Project description

TULP: TULP Understands Language Perfectly

A command line tool, in the best essence of POSIX tooling, that will help you to process, filter, and create data in this new Artificial Intelligence world, backed by chatGPT.

Installation:

pip install tulp

Usage:

TULP has 2 main operations modes:

  1. stdin processing: Process or filter all the stdin input according to the user instructions:
cat [MYFILE] | tulp [Processing instructions written in natural language]
  1. request: Process the user request:
tulp [A written request or question]

In both cases, TULP will write to the standard output the answers and will write any other information to the standard error.

It is important to note that if your input is larger than 5000 characters, the input will be split into multiple requests and the results may vary. It works great when the input is less than that.

Configuration

The configuration file is located at ~/.tulp.conf. Define your own ~/.tulp.conf file or define the same environment variable but using prefix TULP.

The following are the parameters that can be configured:

  • LOG_LEVEL: The log level of Tulip. Valid options are DEBUG, INFO, WARNING, ERROR, and CRITICAL. The default value is INFO.
  • OPENAI_API_KEY: The API key for OpenAI. The default value is an empty string.
  • CHAR_LIMIT: The maximum number of characters processed in one chunk. The default value is 5000.
  • MODEL: The openai model used by Tulip. The default value is gpt-3.5-turbo, but gpt-4 is also available

As environment variables they will become: TULP_LOG_LEVEL, TULP_OPENAI_API_KEY, TULP_CHAR_LIMIT or TULP_MODEL

Here is an example configuration file with the default values:

[DEFAULT]
LOG_LEVEL = INFO
OPENAI_API_KEY = <<<YOUR API KEY >>>>
CHAR_LIMIT = 5000
MODEL = gpt-3.5-turbo

Examples:

The usage is endless, but anyway, here you have some ideas as inspirations:

Typical Unix tooling replacement:

Sed

cat README.md | tulp replace all the occurrences of TULP for **TULP**

Awk

cat README.md | tulp print the second word of each line

grep, but advanced

cat tulp.py | tulp print the name of the functions and also the return line 

Grammatical and syntax corrections:

cat README.md | tulp fix any grammatical or syntactical error > README.md.fixed

Or even better: cat README.md | TULP_MAX_CHARS=10000 TULP_MODEL=gpt-4 tulp fix typos and syntax errors > README.fix.md

Translations

cat README.md | tulp translate to Spanish > README.es.md

Data filtering from formatted input

csv

cat list.csv | tulp print only the second column
Count
3
1
2

csv

cat persons.json | tulp 'list the names and ages of each person in a csv table, using ; as separator'

Data creation and extraction from unstructured data (a story of oranges and friends):

fede@liebre:~/repos/tulp$ tulp write a poem that names 3 persons \(given each a name\) and list how they shared 10 oranges | tee examples/oranges_poem.txt
Roses are red,
Violets are blue,
Here's a poem,
About sharing oranges too.

There were three friends,
Whose names were Ann, Ben, and Sue,
They had 10 oranges,
And didn't know what to do.

Ann suggested they split them,
Equally, three each,
But Ben said that wasn't fair,
As Sue was too weak.

So they decided to give Sue,
An extra orange or two,
And split the rest evenly,
So everyone had a fair view.

And that's how Ann, Ben, and Sue,
Shared their 10 oranges,
With kindness and fairness,
And no one had any grudges.

fede@liebre:~/repos/tulp$ cat examples/oranges_poem.txt | python3 ./tulp.py write a list of persons and the number of oranges that they have as csv
Ann,3
Ben,3
Sue,4

Origin of the name

I used tulp.py to create "TULP". In some way, everything is recursive in "TULP", so it makes sense to use a recursive acronym.

Therefore, after several iterations with tulp.py, "TULP" and I decided that the best name would be "TULP", and this is how we decided what "TULP" stands for:

fede@liebre:~/repos/openai/tulp$ python3 ./tulp.py "TULP is a recursive acronym naming an opensource posix tool that process stdin input according to natural language instructions, processing the input by instructing an artificial intelligence. Write some options of what TULP could stand for as recursive acronym"
TULP could stand for:
- TULP Understands Language Perfectly
- TULP Uses Language to Process
- TULP Understands Language Promptly
- TULP Utilizes Language for Processing
- TULP Unravels Language Precisely

Why?

I am a heavy user of unix tooling (e.g: awk, jq, sed, grep and so on), I have been using them since my early days and I use to think that I can't survive without them. But then, chatGPT appears and I started to use more and more GPT for things that I use to use unix tooling. Somehow I feel the pain of cut&paste and I was missing a way to do it faster and from within the terminal itself, so I came up with tulp

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

tulp-0.4.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

tulp-0.4.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file tulp-0.4.0.tar.gz.

File metadata

  • Download URL: tulp-0.4.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for tulp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a3dd54dc355c3428c333254e9815da116aabc53052d9b1655856ddf7dfa03b0d
MD5 14a74027421fe0c6213df54f56812f19
BLAKE2b-256 fd0abf3a817b85456456d1bb37ffa558d58d3d54f72afc43382908353665bea5

See more details on using hashes here.

File details

Details for the file tulp-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: tulp-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for tulp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 089148b05c76664afc88eaf0ff8eee50e2ca015d570c13b75afb4ac5934809af
MD5 89db8122179f4959c8ed8dd8715ac3cd
BLAKE2b-256 abe9c9a706117db4d9cd29ea0a4c5ac81c90474355a5e20692ee015e5f7ac223

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