Skip to content

autoblocksai/python-demo-app

Repository files navigation

Autoblocks Logo

📚 Documentation   •   🖥️ Application   •   🏠 Home

Development Setup

  • Install pyenv
    • Install python 3.12: pyenv install 3.12
  • Install pyenv-virtualenv
  • Install poetry
  • Create a virtualenv: pyenv virtualenv 3.12 python-demo-app
    • Activate the virtualenv: pyenv activate python-demo-app
  • Install dependencies: poetry install
  • Install pre-commit: poetry run pre-commit install

Running the app

Create app in Autoblocks

Create a new app of type Prompt named "Doctor GPT" in the Autoblocks platform.

Set environment variables

You can either create a .env file (copy from .env.example) in the root of the project or set the following environment variables:

export AUTOBLOCKS_TEST_RUN_MESSAGE="Made prompt more concise"
export AUTOBLOCKS_V2_API_KEY=<your-api-key>

Note: You can get your Autoblocks API key from the Autoblocks settings page.

export OPENAI_API_KEY=<your-api-key>

Note: You can get your OpenAI API key from the OpenAI dashboard.

Create prompts

Run the following script to create the prompts:

poetry run create_prompts

Then generate the prompt classes:

poetry run prompts generate-v2 --output-dir python_demo_app/autoblocks_prompts

Create a dataset

Run the following script to setup the dataset and test cases:

poetry run create_dataset

Run the tests

poetry run run_tests

Running in CI

First, fork the repository to your own GitHub account.

Note: After forking, you will need to enable actions on the forked repository. See this issue for more information.

Then, set the following repository secrets:

  1. AUTOBLOCKS_V2_API_KEY
  2. OPENAI_API_KEY

Note: You can view how these are used in the .github/workflows/autoblocks_tests.yml file.

Now you can run the workflow in the Actions tab on the GitHub UI.

View results

Go to your application at app-v2.autoblocks.ai and view the results.

About

Demo application of how to use Autoblocks

Resources

Stars

Watchers

Forks

Languages