Skip to content

Commit

Permalink
[docs] update getting started with setup API key (#895)
Browse files Browse the repository at this point in the history
[docs] update getting started with setup API key




adding the api key instructions setup
  • Loading branch information
tanya-rai authored Jan 11, 2024
2 parents 0ab5244 + 15d9326 commit 2364ee3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
30 changes: 23 additions & 7 deletions aiconfig-docs/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,33 @@ $ yarn add aiconfig

**Note:** You need to install the python AIConfig package to create and edit your configs using the AIConfig Editor. You can still use the AIConfig Node SDK to interact with your config in your application code.

## Setup your OpenAI API Key
## Setup your API Key(s)

You will need to specifiy API keys for the model providers (i.e. OpenAI, Google, HuggingFace) you plan to use. We recommend adding your API keys as environment variables so that they are accessible for all projects. The python library will automatically detect and use them without you having to write any code.

For this tutorial, you will need to have an OpenAI API key that has access to GPT-4. Setup help for other API keys is available [here](https://aiconfig.lastmileai.dev/docs/editor#env-api-keys).

<details>
<summary> Setup your OpenAI API Key as a environment variable (MacOS / Linux / Windows)</summary>
<div>
1. Get your OpenAI API Key: https://platform.openai.com/account/api-keys
2. Open Terminal
3. Edit Bash Profile: Use the command `nano ~/.bash_profile` or `nano ~/.zshrc` (for newer MacOS versions) to open the profile file in a text editor.
4. Add Environment Variable: In the editor, add the line below, replacing *your-api-key-here* with your actual API key:
```bash
export OPENAI_API_KEY='your-api-key-here'
```
5. *[Optional] add in environment variables for your other model providers (Google, HuggingFace, Anyscale, etc.).*
6. Save and Exit: Press `Ctrl+O` followed by `ENTER` to write the change. Then `Ctrl+X` to close the editor.
7. Load Your Profile: Use the command `source ~/.bash_profile` or `source ~/.zshrc` to load the updated profile.
8. Verification: Verify the setup by typing `echo $OPENAI_API_KEY` in the terminal. It should display your API key.
</div>

For this tutorial, you will need to have an OpenAI key that has access to GPT-4.

1. Get your OpenAI API Key: https://platform.openai.com/account/api-keys
2. Open Terminal
3. Add this line, replace ‘your-api-key-here’ with your API key: `export OPENAI_API_KEY='your-api-key-here'`
</details>

## Open AIConfig Editor

AIConfig Editor allows you to visually create and edit the prompt chains and model parameters that are stored as AIConfigs. You can also chain prompts and use global and local variables in your prompts.
AIConfig Editor allows you to visually create and edit the prompt chains and model parameters that are stored as AIConfigs. You can also chain prompts and use global and local variables in your prompts. Learn more about [AIConfig Editor](https://aiconfig.lastmileai.dev/docs/editor).

1. Open your Terminal
2. Run this command: `aiconfig edit --aiconfig-path travel.aiconfig.json`
Expand Down
21 changes: 21 additions & 0 deletions my_aiconfig.aiconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "a",
"schema_version": "latest",
"metadata": {
"parameters": {},
"models": {}
},
"description": "",
"prompts": [
{
"name": "prompt_1",
"input": "",
"metadata": {
"model": "gpt-4",
"parameters": {}
},
"outputs": []
}
],
"$schema": "https://json.schemastore.org/aiconfig-1.0"
}

0 comments on commit 2364ee3

Please sign in to comment.