From 06f18269f1d61e90312b33ec7253b95a3be9814f Mon Sep 17 00:00:00 2001 From: Werner Kok Date: Sat, 10 Feb 2024 00:03:46 +0000 Subject: [PATCH] Updated docs --- README.md | 4 ++-- doc/01-usage-openai.md | 6 +++--- doc/02-usage-azure.md | 6 +++--- doc/03-streaming.md | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cb8937a..5dda119 100644 --- a/README.md +++ b/README.md @@ -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?"} @@ -100,7 +100,7 @@ A simple chat conversation with OpenAI's ChatGPT could be: ``` Result: -``` +```clojure {:id "chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H", :object "chat.completion", :created 1678532968, diff --git a/doc/01-usage-openai.md b/doc/01-usage-openai.md index 9bc93f5..0b8d228 100644 --- a/doc/01-usage-openai.md +++ b/doc/01-usage-openai.md @@ -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" @@ -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?"} @@ -67,7 +67,7 @@ A simple chat conversation with ChatGPT could be: ``` Result: -``` +```clojure {:id "chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H", :object "chat.completion", :created 1678532968, diff --git a/doc/02-usage-azure.md b/doc/02-usage-azure.md index 69c777f..bfc339e 100644 --- a/doc/02-usage-azure.md +++ b/doc/02-usage-azure.md @@ -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" @@ -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?"} @@ -64,7 +64,7 @@ A simple chat conversation with ChatGPT could be: ``` Result: -``` +```clojure {:id "chatcmpl-6srOKLabYTpTRwRUQxjkcBxw3uf1H", :object "chat.completion", :created 1678532968, diff --git a/doc/03-streaming.md b/doc/03-streaming.md index 2373e9c..874896c 100644 --- a/doc/03-streaming.md +++ b/doc/03-streaming.md @@ -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?"} @@ -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?"} @@ -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" @@ -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