semvec/pypi-packages huggingface dataset:
jsonsteg 1.0.0
Write payload into JSON without modifying it
License: MIT
Requires Python: >=3.9,<4.0

# JSON steganography

_Write payload into JSON without modifying it_	

![Python version](https://img.shields.io/pypi/pyversions/jsonsteg)
![Build status](https://github.com/PyryL/jsonsteg/actions/workflows/main.yml/badge.svg)
![Branch coverage](https://codecov.io/gh/PyryL/jsonsteg/branch/main/graph/badge.svg?token=YT08CLBMMK)
[![PyPI](https://img.shields.io/pypi/v/jsonsteg)](https://pypi.org/project/jsonsteg/)


## Installation

Install jsonsteg via [PyPI](https://pypi.org/project/jsonsteg/):

```
pip install jsonsteg
```


## CLI usage

Use command line interface via `jsonsteg` command.

### Writing

Write payload `mysecret` to JSON found in file `data.json`:

```
jsonsteg write --input mysecret data.json
```

Write the contents of file `message.txt` as a payload to JSON of file `data.json`:

```
jsonsteg write --input-file message.txt data.json
```

Instead of modifying `data.json` file, you can output the altered JSON to `output.json` file:

```
jsonsteg write --input mysecret --output output.json data.json
```

### Reading

Write the payload of JSON in file `data.json` and print it to console:

```
jsonsteg read data.json
```

Instead of printing, the output can also be saved to file `output.txt`:

```
jsonsteg read --output output.txt data.json
```

### Help

Learn more about possible options with these commands:

```
jsonsteg --help
jsonsteg read --help
jsonsteg write --help
```


## Python usage

Jsonsteg can also be used as a Python package:

```
import jsonsteg

jsonsteg.DictionaryReader(json_dictionary)
jsonsteg.DictionaryWriter(json_dictionary, payload_bytes)
jsonsteg.ArrayReader(json_array)
jsonsteg.ArrayWriter(json_array, payload_bytes)
```

Writer objects have `output` property and reader objects have `payload` property.


## Development

After cloning the git repository, install development dependencies
by running the following command in project root:

```
poetry install
```

Run unit tests with

```
poetry run invoke test
```

Run coverage test with

```
poetry run invoke coverage
```

and create HTML coverage report with

```
poetry run invoke coverage-report
```

Publish the package on pypi.org or test.pypi.org by one of the following commands:

```
poetry run invoke publish
poetry run invoke publish-test
```

When running either one of the commands above,
you must have PYPI token stored in an environment variable named
`POETRY_PYPI_TOKEN_PYPI` or `POETRY_PYPI_TOKEN_TEST_PYPI`, respectively.


## How is it done?

Read more about the mechanism [here](docs/mechanism.md).
llm-functions 0.1.21
Build semantic functions.
License: MIT
Requires Python: >=3.9,<4.0

# LLM Functions ⚙️
Easily define custom LLM (Language Learning Model) functions with structured input and output.

## Getting Started
### 1. Installation
Install the package using pip:
```bash
pip install llm-functions
```
### 2. Setting Up Your First Function
Let's create a sentiment classification function:

**Step 1**: Create a directory named sentiment. Inside this directory, you need two files:
```bash
└─ sentiment
   ├── function_args.json
   ├── model_args.json
   └── template.txt
```
**Step 2:** Define your prompt template in template.txt:
```bash
Aalyze and determine whether the sentiment of the following sentence is positive, negative, or neutral.
Sentence:
{sentence}
```
**Step 3:** Set model paramters in model_args.json:
```json
{
    "temperature": 0.0,
    "model": "gpt-3.5-turbo"
}
```

**Step 4:** Specify the function's output format in function_args.json:
```json
{
    "function_name": "sentiment_classifier",
    "description": "Classify the sentiment of a sentence",
    "properties": {
        "thoughts": {
            "type": "string",
            "description": "Your thoughts when classifying sentiment of the given sentence."
        },
        "sentiment": {
            "type": "string",
            "enum": ["positive", "negative", "neutral"],
            "description": "The sentiment of the given sentence."
        }
    }
}
```
### 3. Using Your LLM Function in Python

Here's how you can load and use your LLM function:

```python
from llm_functions import LLMFunction

# Load your function
sentiment = LLMFunction.from_dir("./sentiment/")

# Make a prediction
pred = sentiment(sentence="I am super happy!")

# Expected Output:
# {
#   "rationale": "The sentiment in the sentence is positive",
#   "sentiment": "positive"
# }
```