Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readme to examples dir #282

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## generate.py

This program takes a JSON list of strings from standard input, sends each input string to an LLM as a prompt, and returns a list of dictionaries, with a `"prompt"` and `"answer"` key for each original prompt.

To execute it, run

```bash
python generate.py
```

And then type some prompts in list form, e.g.

```bash
["What is spaCy?", "What is Rust?"]
```

followed by an EOF-marker (Ctrl-d on Linux or Mac, Ctrl-z on Windows) and an enter.
The output will look something like this:

```python
[
{"prompt": "What is spaCy?",
"answer": "spaCy is a Python library for natural language processing. It is designed to be easy to use and highly customizable, making it a great tool for developers and researchers."},
{"prompt": "What is Rust?",
"answer": "Rust is a programming language that is designed to be a safe, concurrent, and efficient replacement for C++. It is a statically-typed language that is designed to be memory-safe and thread-safe, which means that it can be used to write high-performance, low-latency applications. Rust is designed to be a modern, high-performance programming language that is designed to be easy to use and easy to learn."}
]
```

To get the full list of options and defaults for this command, run

```bash
python generate.py --help
```

## passive2active.py

This program takes a JSON list of passive sentences from standard input, and returns a list of dictionaries, with a `"passive"` and `"active"` key for each original sentence.

To execute it, run

```bash
python passive2active.py
```

And then type some prompts in list form, e.g.

```bash
["The medal was won by the Dutch speed skater.", "Anita was driven to the theatre by Carla."]
```

followed by an EOF-marker (Ctrl-d on Linux or Mac, Ctrl-z on Windows) and an enter.
The output will look something like this:

```python
[
{
"passive": "The medal was won by the Dutch speed skater.",
"active": "The Dutch speed skater won the medal."
},
{
"passive": "Anita was driven to the theatre by Carla.",
"active": "Carla drove Anita to the theatre."
}
]
```

To get the full list of options and defaults for this command, run

```bash
python passive2active.py --help
```