# OpenAiClient

OpenAiClient is a client for the OpenAI API. It supports all options provided by
the `Req` library, as well as additional options such as a circuit breaker
module (defaults to `ExBreak`) and the OpenAI organization ID.

## Installation

The package can be installed by adding `open_ai_client` to your list of
dependencies in `mix.exs`:

def deps do
    {:open_ai_client, "~> 0.1"}

## Configuration

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

import Config

config :open_ai_client, OpenAiClient,
  base_url: System.get_env("OPENAI_BASE_URL") || "",
  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

You can send a POST request to the OpenAI API like this:

```elixir"", [json: %{model: "gpt-3.5-turbo", messages: [%{role: "system", content: "You are a helpful assistant."}, %{role: "user", content: "Who won the world series in 2020?"}]}])

And a GET request like this:


Documentation can be generated with
[ExDoc]( and published on
[HexDocs]( Once published, the docs can be found at