https://github.com/extism/func-gen
Generate unix text processing utilities from LLMs
https://github.com/extism/func-gen
Last synced: over 1 year ago
JSON representation
Generate unix text processing utilities from LLMs
- Host: GitHub
- URL: https://github.com/extism/func-gen
- Owner: extism
- License: bsd-3-clause
- Created: 2023-04-27T17:03:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-04T03:27:15.000Z (over 3 years ago)
- Last Synced: 2025-04-15T19:54:13.766Z (over 1 year ago)
- Language: Python
- Size: 385 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# func-gen
func-gen can be used to generate unix text processing utilities from English text.
It uses [langchain](https://python.langchain.com/en/latest/index.html) to create javascript functions
to process text, and it uses [Extism](https://extism.org/) and the [JavaScript PDK](https://extism.org/docs/write-a-plugin/js-pdk)
to safely execute the code in a Wasm sandbox.
> **Warning**: This only works for very small, simple functions. We have yet to learn about all the tools and techniques to build a reliable code generation model. We'd love some help making the model better and incorporating things like teaching the model documentation for people's Extism plug-in systems.
## Demo Video
[https://www.loom.com/share/d956147a1a7d449391ec0778ebe12918](https://www.loom.com/share/d956147a1a7d449391ec0778ebe12918)
## Install
> **Note**: First you need to [install Extism](https://extism.org/docs/install) on your machine if you have not:
```bash
pip install --upgrade extism-func-gen
```
## Run
```bash
# Need to set the OpenAI API key
export OPENAI_API_KEY="sk-"
# Create a func
func-gen count_vowels -d "Write a function that counts the number of vowels in an input string"
# Use a func
echo "hello world" | func-gen count_vowels
# 3
# List the funcs
func-gen --list
```