Skip to content

Commit

Permalink
[Docs] FAQ for usage and creating an aiconfig page
Browse files Browse the repository at this point in the history
  • Loading branch information
saqadri committed Nov 15, 2023
1 parent 161e41b commit 5518c91
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
17 changes: 17 additions & 0 deletions aiconfig-docs/docs/introduction/usage-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,20 @@ import constants from '@site/core/tabConstants';
## Config File

## SDK

## FAQs

### Is the `aiconfig` json file meant to be edited by hand?

For quick updates (like changing a prompt string slightly, or changing a model parameter value), it should be ok for editing the `aiconfig` JSON manually.

But for proper editing, it should be done either programmatically via AIConfig SDK, or via the AI Workbooks editor.

1. Editing with SDK
See the [editing `aiconfig`](#programmatically) section, and this [example cookbook](https://github.com/lastmile-ai/aiconfig/blob/main/cookbooks/Create-AIConfig-Programmatically/create_aiconfig_programmatically.ipynb).

2. Editing with UI

In the Jupyter world, an `ipynb` is a JSON file, but it's very rare to edit the JSON directly. Most people use the notebook editor which serializes updates into the `ipynb`.

Using an AI Workbook with an `aiconfig` is meant to satisfy the same behavior. See the [editing visually](#visually) section for more details.
82 changes: 81 additions & 1 deletion aiconfig-docs/docs/overview/create-an-aiconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,84 @@
sidebar_position: 2
---

# Create an AIConfig
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import constants from '@site/core/tabConstants';

# Create an `aiconfig`

There are 2 ways to create an `aiconfig` from scratch.

1. Using the AIConfig SDK
2. Using the AI Workbook editor

## AIConfig SDK

:::tip
Clone this [example notebook](https://github.com/lastmile-ai/aiconfig/blob/main/cookbooks/Create-AIConfig-Programmatically/create_aiconfig_programmatically.ipynb) to create an `aiconfig` for OpenAI's completion params.
:::

### Using OpenAI in Python

If you're using OpenAI chat models, you can use introspection to wrap OpenAI API calls and save an `aiconfig` automatically:

Replace

```python
import openai
```

with

```python
import openai
from aiconfig.ChatCompletion import create_and_save_to_config
openai.ChatCompletion.create = create_and_save_to_config()
```

See the [editing `aiconfig`](#programmatically) section, and this [example cookbook](https://github.com/lastmile-ai/aiconfig/blob/main/cookbooks/Create-AIConfig-Programmatically/create_aiconfig_programmatically.ipynb).

:::caution

Unless you really know the internals of the model,

:::

## AI Workbook editor

AI Workbook is a visual notebook editor for `aiconfig`.

<p align="center">
<video controls height="480" width="800">
<source src="https://github.com/lastmile-ai/aiconfig/assets/81494782/d826b872-eab6-4245-91dc-96a509b4f5ec"/>
</video>
</p>

:::tip
In the Jupyter world, an `ipynb` is a JSON file, but it's very rare to edit the JSON directly. Most people use the notebook editor which serializes updates into the `ipynb`.

Using an AI Workbook with an `aiconfig` is meant to satisfy the same behavior.
:::

1. Go to https://lastmileai.dev.
2. Create a new Workbook
3. Once you are done, click "..." and select 'Download as AIConfig'

Try out the workbook playground here: **[NYC Travel Workbook](https://lastmileai.dev/workbooks/clooqs3p200kkpe53u6n2rhr9)**

:::note
We are currently working on a local editor that you can run yourself. For now, please use the hosted version on https://lastmileai.dev.
:::

### Editing existing AIConfig

1. Go to https://lastmileai.dev.
2. Go to Workbooks page: https://lastmileai.dev/workbooks
3. Click dropdown from '+ New Workbook' and select 'Create from AIConfig'
4. Upload `travel.aiconfig.json`

<p align="center">
<video controls height="480" width="800">
<source src="https://github.com/lastmile-ai/aiconfig/assets/81494782/5d901493-bbda-4f8e-93c7-dd9a91bf242e"/>
</video>
</p>

0 comments on commit 5518c91

Please sign in to comment.