Create AI prediction functions by describing what they should do. Register at https://fxn.ai.
Project description
AutoFunction
Create AI prediction functions by describing what they do. This project explores using an AI agent to write AI prediction functions, which can then be used to make predictions from anywhere using Function.
This project is what powers creating predictors from prompts on fxn.ai/create.
Installing AutoFunction
AutoFunction is distributed on PyPi. This distribution contains both the Python library and the command line interface (CLI):
# Open a terminal and run the following command:
pip install autofxn
Writing Predictor Code with AI
First, you will need to generate an OpenAI API key with GPT-4 access:
# Specify your OpenAI API key
export OPENAI_API_KEY="<Your OpenAI API key>"
✅ If you don't have an OpenAI account, you can generate predictors from prompts at zero cost at fxn.ai/create.
Next, run the following command to generate a predictor notebook:
# Create a predictor notebook that returns a greeting
# This will generate a `predictor.ipynb` notebook in the current directory
autofxn create --output-dir . \
"Create a predictor that accepts a user's 'name' and returns a greeting"
Usage from Code
This library exports a single function, create_predictor_notebook
which generates a predictor notebook from a given prompt:
from autofxn import create_predictor_notebook
from nbformat import NotebookNode, write
# Generate the notebook
prompt = "Create a predictor that accepts a user's 'name' and returns a greeting"
notebook: NotebookNode = create_predictor_notebook(prompt)
# Write to file
with open("predictor.ipynb", "w") as f:
write(notebook, f)
Making Predictions from Anywhere with Function
With Function, you can use the predictor notebook to make predictions from JavaScript, Python, Unity, Zapier, Slack, and more.
First, register or login to Function and generate an access key:
Then login to the Function CLI:
# Open a terminal and run the following command:
fxn auth login <ACCESS KEY>
Now you can create and provision an AI-generated predictor notebook on Function by simply specifying a predictor tag:
# Create a predictor notebook that returns a greeting
autofxn create --tag @username/greeting \
"Create a predictor that accepts a user's 'name' and returns a greeting"
Replace
username
with your Function username.
The predictor tag uniquely identifies every predictor on Function.
Once the predictor is active, you can use it to make predictions!
# Make a prediction with our AI-generated predictor
fxn predict @username/greeting --name "Carti"
Roadmap
- Generate simple predictors that can be provisioned and used for predictions on Function.
- Support other LLM providers (Anthropic, on-device LLM using
edgefxn
etc). - Plug into organization data sources (Snowflake, Databricks) to leverage highly-relevant information.
- Fault tolerance with OpenAI API requests.
- External program correctness and validation testing.
- Discover and compose Function predictors.
- Discover and compose GitHub repositories.
Useful Links
- Discover predictors to use in your apps.
- Join our Discord community.
- Check out our docs.
- Learn more about us on our blog.
- Reach out to us at hi@fxn.ai.
Thank you very much!
Project details
Release history Release notifications | RSS feed
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 autofxn-0.0.3.tar.gz
.
File metadata
- Download URL: autofxn-0.0.3.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18c293af2a77c7c002ad3451b7375709a967e9442939293941d337cff1b713a2 |
|
MD5 | 747502e3da4e41439a8587f719fcd23b |
|
BLAKE2b-256 | d81f0199a058166394eedfbd1a140277223e62a293f896cfd490bf56d265ec81 |
File details
Details for the file autofxn-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: autofxn-0.0.3-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9e1ca500174276e26b31476528635fe23fcb98a2a878e012df8b8ade2d26d47 |
|
MD5 | e609277c6b44874076e73db5894c2553 |
|
BLAKE2b-256 | 0dead8ba8b6ebc236b71fb79d783ce6c0ce46d4a419232605c14c25712c00270 |