Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wkok committed Feb 10, 2024
1 parent 67f90c8 commit 06f1826
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Require the `api` namespace

A simple chat conversation with OpenAI's ChatGPT could be:

```
```clojure
(api/create-chat-completion {:model "gpt-3.5-turbo"
:messages [{:role "system" :content "You are a helpful assistant."}
{:role "user" :content "Who won the world series in 2020?"}
Expand All @@ -100,7 +100,7 @@ A simple chat conversation with OpenAI's ChatGPT could be:
```

Result:
```
```clojure
{:id "chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H",
:object "chat.completion",
:created 1678532968,
Expand Down
6 changes: 3 additions & 3 deletions doc/01-usage-openai.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ It is not necessary to specify the endpoint url if using the default OpenAI serv

Alternatively the `api-key` and/or `organization` and/or `api-endpoint` can be passed in the `options` argument of each api function

```
```clojure
(api/create-completion {:model "text-davinci-003"
:prompt "Say this is a test"}
{:api-key "xxxxx"
Expand All @@ -58,7 +58,7 @@ Require the `api` namespace

A simple chat conversation with ChatGPT could be:

```
```clojure
(api/create-chat-completion {:model "gpt-3.5-turbo"
:messages [{:role "system" :content "You are a helpful assistant."}
{:role "user" :content "Who won the world series in 2020?"}
Expand All @@ -67,7 +67,7 @@ A simple chat conversation with ChatGPT could be:
```

Result:
```
```clojure
{:id "chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H",
:object "chat.completion",
:created 1678532968,
Expand Down
6 changes: 3 additions & 3 deletions doc/02-usage-azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Set the environment variable `AZURE_OPENAI_API_ENDPOINT` to your [Azure OpenAPI

Alternatively the `api-key` and/or `api-endpoint` can be passed in the `options` argument of each api function

```
```clojure
(api/create-completion {:model "text-davinci-003"
:prompt "Say this is a test"}
{:api-key "xxxxx"
Expand All @@ -54,7 +54,7 @@ Require the `api` namespace

A simple chat conversation with ChatGPT could be:

```
```clojure
(api/create-chat-completion {:model "gpt-35-turbo"
:messages [{:role "system" :content "You are a helpful assistant."}
{:role "user" :content "Who won the world series in 2020?"}
Expand All @@ -64,7 +64,7 @@ A simple chat conversation with ChatGPT could be:
```

Result:
```
```clojure
{:id "chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H",
:object "chat.completion",
:created 1678532968,
Expand Down
8 changes: 4 additions & 4 deletions doc/03-streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Chat](https://platform.openai.com/docs/api-reference/chat/create#chat/create-stream) and [Completions](https://platform.openai.com/docs/api-reference/completions/create#completions/create-stream) support the streaming of partial progress via server-sent events using the `:stream` parameter

```
```clojure
(api/create-chat-completion {:model "gpt-3.5-turbo"
:messages [{:role "system" :content "You are a helpful assistant."}
{:role "user" :content "Who won the world series in 2020?"}
Expand All @@ -19,7 +19,7 @@ Reading streamed tokens can be done either by providing your own callback functi

Provide your callback function in the `:on-next` parameter for example

```
```clojure
(api/create-chat-completion {:model "gpt-3.5-turbo"
:messages [{:role "system" :content "You are a helpful assistant."}
{:role "user" :content "Who won the world series in 2020?"}
Expand All @@ -31,7 +31,7 @@ Provide your callback function in the `:on-next` parameter for example

### Option 2 - core.async channel

```
```clojure
(require '[clojure.core.async :as a])

(def events (api/create-chat-completion {:model "gpt-3.5-turbo"
Expand All @@ -55,7 +55,7 @@ Provide your callback function in the `:on-next` parameter for example

## Example returned token

```
```clojure
{:id "chatcmpl-6srv5jx3p4I9deNDzU7ucNXKoGS0L"
:object "chat.completion.chunk"
:created 1678534999
Expand Down

0 comments on commit 06f1826

Please sign in to comment.