Skip to content

Commit

Permalink
Add configuration for open ai in runtime.exs and update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilger committed Nov 2, 2023
1 parent 20a8f8f commit de09e70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ end

## Configuration

In your `config/runtime.exs` file, you need to set up the OpenAI API key:
In your `config/runtime.exs` file, you need to set up the OpenAI API key and organization ID:

```elixir
config :open_ai_client, OpenAiClient, openai_api_key: System.get_env("OPENAI_API_KEY")
import Config

config :open_ai_client, OpenAiClient,
base_url: System.get_env("OPENAI_BASE_URL") || "https://api.openai.com/v1",
openai_api_key: System.get_env("OPENAI_API_KEY") || raise("OPENAI_API_KEY is not set"),
openai_organization_id: System.get_env("OPENAI_ORGANIZATION_ID")
```

## Usage
Expand Down
5 changes: 4 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import Config

config :open_ai_client, OpenAiClient, openai_api_key: System.get_env("OPENAI_API_KEY")
config :open_ai_client, OpenAiClient,
base_url: System.get_env("OPENAI_BASE_URL") || "https://api.openai.com/v1",
openai_api_key: System.get_env("OPENAI_API_KEY") || raise("OPENAI_API_KEY is not set"),
openai_organization_id: System.get_env("OPENAI_ORGANIZATION_ID")

0 comments on commit de09e70

Please sign in to comment.