Skip to content

Commit

Permalink
Add prompt sdk example (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Nolte <[email protected]>
  • Loading branch information
Nicole White and adamnolte authored Nov 20, 2023
1 parent 6b8debb commit df99efe
Show file tree
Hide file tree
Showing 12 changed files with 1,447 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ jobs:
- JavaScript/openai-automated
- JavaScript/openai-automated-ts
- JavaScript/openai-manual
- JavaScript/prompt-sdk
- JavaScript/spans

defaults:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^JavaScript/prompt-sdk/prompt-templates/
- id: check-yaml

- repo: https://github.com/psf/black
Expand Down
81 changes: 81 additions & 0 deletions JavaScript/prompt-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!-- banner start -->
<p align="center">
<img src="https://app.autoblocks.ai/images/logo.png" width="300px">
</p>

<p align="center">
📚
<a href="https://docs.autoblocks.ai/">Documentation</a>
&nbsp;
&nbsp;
🖥️
<a href="https://app.autoblocks.ai/">Application</a>
&nbsp;
&nbsp;
🏠
<a href="https://www.autoblocks.ai/">Home</a>
</p>
<!-- banner end -->

<!-- getting started start -->

## Getting started

- Sign up for an Autoblocks account at https://app.autoblocks.ai
- Grab your Autoblocks ingestion key from https://app.autoblocks.ai/settings/api-keys
- Grab your OpenAI API key from https://platform.openai.com/account/api-keys
- Create a file named `.env` in this folder and include the following environment variables:

```
OPENAI_API_KEY=<your-api-key>
AUTOBLOCKS_INGESTION_KEY=<your-ingestion-key>
```

<!-- getting started end -->

## Install dependencies

```
npm install
```

## Start the template watcher

```
npm run gen:watch
```

## Run the script

```
npm run start
```

## View the prompts in Autoblocks

You should see the prompt tracking ID (`feature-a`) at https://app.autoblocks.ai/prompts.
Click on the tracking ID to view its history.
At this point it should only have one version.

## Make a change to one of the templates

Make a change to one of the templates in the [`prompt-templates`](./prompt-templates/) folder.
For example, update [`common/language`](./prompt-templates/common/language) to say:

```
ALWAYS respond in {{ language }}.
```

## Run the script

Run the script again:

```
npm run start
```

After running the script, you should see a new version at https://app.autoblocks.ai/prompts/feature-a.

![new-version](https://github.com/autoblocksai/autoblocks-examples/assets/7498009/9c3a3c0b-1984-4cf6-8461-32ab9d2f18b6)
Loading

1 comment on commit df99efe

@vercel
Copy link

@vercel vercel bot commented on df99efe Nov 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.