Skip to content

Commit d6a3336

Browse files
committed
migrate docs to cljdoc
1 parent 3a88dfa commit d6a3336

File tree

11 files changed

+171
-196
lines changed

11 files changed

+171
-196
lines changed

.github/workflows/main.yml

-8
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,3 @@ jobs:
3737
run: clojure -T:build test
3838
env:
3939
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
40-
41-
- name: Docs
42-
run: clojure -X:codox
43-
44-
- name: Deploy Pages
45-
uses: JamesIves/github-pages-deploy-action@v4
46-
with:
47-
FOLDER: target/doc

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 0.3.1 - 2023-02-23
4+
### Supported API versions
5+
- OpenAI v1
6+
- Azure OpenAI 2022-12-01
7+
### Changes
8+
- Replace codox documentation generation with cljdoc
9+
- Change documentation hosting from github pages to cljdoc
10+
311
## 0.3.0 - 2023-02-20
412
### Supported API versions
513
- OpenAI v1

README.md

+20-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# openai-clojure
22

3-
![CI](https://github.com/wkok/openai-clojure/workflows/CI/badge.svg)
3+
![CI](https://github.com/wkok/openai-clojure/workflows/CI/badge.svg) [![cljdoc badge](https://cljdoc.org/badge/net.clojars.wkok/openai-clojure)](https://cljdoc.org/d/net.clojars.wkok/openai-clojure)
44

55
Clojure functions to drive the [OpenAI API](https://platform.openai.com/docs/introduction)
66
and [Azure OpenAI API](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference)
@@ -10,26 +10,24 @@ tools and applications which can work with both variants.
1010

1111
## Documentation
1212

13-
* [Introduction - OpenAI](https://wkok.github.io/openai-clojure/intro.html)
14-
* [Introduction - Azure OpenAI](https://wkok.github.io/openai-clojure/intro-azure.html)
15-
* [API Reference](https://wkok.github.io/openai-clojure/wkok.openai-clojure.api.html)
13+
* [Usage - OpenAI](/doc/01-usage-openai.md)
14+
* [Usage - Azure OpenAI](/doc/02-usage-azure.md)
15+
* [Streaming Tokens](/doc/03-streaming.md)
16+
* [API Reference](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api)
1617

1718
## Supported APIs
1819

19-
### OpenAI v1
20-
21-
* [Models](https://platform.openai.com/docs/api-reference/models)
22-
* [Completion](https://platform.openai.com/docs/api-reference/completions)
23-
* [Edits](https://platform.openai.com/docs/api-reference/edits)
24-
* [Images](https://platform.openai.com/docs/api-reference/images)
25-
* [Embeddings](https://platform.openai.com/docs/api-reference/embeddings)
26-
* [Files](https://platform.openai.com/docs/api-reference/files)
27-
* [Fine-tunes](https://platform.openai.com/docs/api-reference/fine-tunes)
28-
* [Moderations](https://platform.openai.com/docs/api-reference/moderations)
29-
30-
### Azure OpenAI v2022-12-01
31-
* [Completion](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#completions)
32-
* [Embeddings](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#embeddings)
20+
| | OpenAI | Azure OpenAI |
21+
| ----------- | :----: | :----------: |
22+
| Version | v1 | v2022-12-01 |
23+
| [Completion](https://platform.openai.com/docs/api-reference/completions) | X | X |
24+
| [Embeddings](https://platform.openai.com/docs/api-reference/embeddings) | X | X |
25+
| [Models](https://platform.openai.com/docs/api-reference/models) | X | |
26+
| [Edits](https://platform.openai.com/docs/api-reference/edits) | X | |
27+
| [Images](https://platform.openai.com/docs/api-reference/images) | X | |
28+
| [Files](https://platform.openai.com/docs/api-reference/files) | X | |
29+
| [Fine-tunes](https://platform.openai.com/docs/api-reference/fine-tunes) | X | |
30+
| [Moderations](https://platform.openai.com/docs/api-reference/moderations) | X | |
3331

3432
## Configuration
3533

@@ -40,13 +38,13 @@ Add the `openai-clojure` dependency
4038
### deps.edn
4139

4240
```
43-
net.clojars.wkok/openai-clojure {:mvn/version "0.3.0"}
41+
net.clojars.wkok/openai-clojure {:mvn/version "0.3.1"}
4442
```
4543

4644
### Leiningen project.clj
4745

4846
```
49-
[net.clojars.wkok/openai-clojure "0.3.0"]
47+
[net.clojars.wkok/openai-clojure "0.3.1"]
5048
```
5149

5250
## Java
@@ -79,7 +77,7 @@ Set the environment variable `AZURE_OPENAI_API_ENDPOINT` to your Azure OpenAI en
7977

8078
## Quickstart
8179

82-
See the full [API Reference](https://wkok.github.io/openai-clojure/wkok.openai-clojure.api.html) for examples of all the supported OpenAI APIs.
80+
See the full [API Reference](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api) for examples of all the supported OpenAI APIs.
8381

8482
Require the `api` namespace
8583

@@ -132,7 +130,7 @@ This library uses [Martian](https://github.com/oliyh/martian) - An HTTP abstract
132130

133131
**This is an unofficial library, it is not affiliated with nor endorsed by OpenAI**
134132

135-
[MIT License](https://github.com/wkok/re-frame-crux/blob/master/LICENSE)
133+
[MIT License](https://github.com/wkok/openai-clojure/blob/master/LICENSE)
136134

137135
Copyright (c) 2023 Werner Kok
138136

build.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(:require [org.corfield.build :as bb]))
44

55
(def lib 'net.clojars.wkok/openai-clojure)
6-
(def version "0.3.0")
6+
(def version "0.3.1")
77

88
(defn test "Run the tests." [opts]
99
(bb/run-tests opts))

deps.edn

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@
1010
:test {:extra-paths ["test"]
1111
:extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
1212
io.github.cognitect-labs/test-runner
13-
{:git/tag "v0.5.0" :git/sha "48c3c67"}}}
14-
:codox {:extra-deps {codox/codox {:mvn/version "0.10.8"}}
15-
:exec-fn codox.main/generate-docs
16-
:exec-args {:source-paths ["src"]}}}}
13+
{:git/tag "v0.5.0" :git/sha "48c3c67"}}}}}

doc/01-usage-openai.md

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Usage - OpenAI
2+
3+
Clojure functions to drive the [OpenAI API](https://platform.openai.com/docs/introduction)
4+
5+
## Configuration
6+
7+
Add the `openai-clojure` dependency
8+
9+
### deps.edn
10+
11+
```
12+
net.clojars.wkok/openai-clojure {:mvn/version "0.3.1"}
13+
```
14+
15+
### Leiningen project.clj
16+
17+
```
18+
[net.clojars.wkok/openai-clojure "0.3.1"]
19+
```
20+
21+
## Authentication
22+
23+
### API Key
24+
25+
Set the environment variable `OPENAI_API_KEY` to your OpenAI API key.
26+
27+
An API key can be generated in your [OpenAI account](https://platform.openai.com/account/api-keys)
28+
29+
### Organization
30+
31+
*Optional* - If your OpenAI account uses multiple organizations, set the environment variable `OPENAI_ORGANIZATION` to the one used for your app.
32+
33+
## Quickstart
34+
35+
See the full [API Reference](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api) api documentation for examples of all the supported OpenAI APIs.
36+
37+
Require the `api` namespace
38+
39+
```
40+
(:require [wkok.openai-clojure.api :as api])
41+
```
42+
43+
A simple completion prompt could be:
44+
45+
```
46+
(api/create-completion {:model "text-davinci-003"
47+
:prompt "Say this is a test"
48+
:max_tokens 7
49+
:temperature 0})
50+
```
51+
52+
Result:
53+
```
54+
{:id "cmpl-6jY1xInJeGGpzUgsZtkuxDsf5DdBa",
55+
:object "text_completion",
56+
:created 1676313593,
57+
:model "text-davinci-003",
58+
:choices
59+
[{:text "\n\nThis is indeed a test",
60+
:index 0,
61+
:logprobs nil,
62+
:finish_reason "length"}],
63+
:usage {:prompt_tokens 5, :completion_tokens 7, :total_tokens 12}}
64+
```
65+
66+
## Supported OpenAI APIs
67+
68+
### Models
69+
70+
* [list-models](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#list-models)
71+
* [retrieve-model](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#retrieve-model)
72+
73+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/models)
74+
75+
### Completions
76+
77+
* [create-completion](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-completion)
78+
79+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/completions)
80+
81+
### Edits
82+
83+
* [create-edit](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-edit)
84+
85+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/edits)
86+
87+
### Images
88+
89+
* [create-image](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-image)
90+
* [create-image-edit](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-image-edit)
91+
* [create-image-variation](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-image-variation)
92+
93+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/images)
94+
95+
### Embeddings
96+
97+
* [create-embedding](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-embedding)
98+
99+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/embeddings)
100+
101+
### Files
102+
103+
* [list-files](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#list-files)
104+
* [create-file](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-file)
105+
* [delete-file](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#delete-file)
106+
* [retrieve-file](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#retrieve-file)
107+
* [download-file](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#download-file)
108+
109+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/files)
110+
111+
### Fine-tunes
112+
113+
* [create-fine-tune](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-fine-tune)
114+
* [list-fine-tunes](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#list-fine-tunes)
115+
* [retrieve-fine-tune](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#retrieve-fine-tune)
116+
* [cancel-fine-tune](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#cancel-fine-tune)
117+
* [list-fine-tune-events](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#list-fine-tune-events)
118+
* [delete-model](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#delete-model)
119+
120+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/fine-tunes)
121+
122+
### Moderations
123+
124+
* [create-moderation](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-moderation)
125+
126+
Also see the [OpenAI documentation](https://platform.openai.com/docs/api-reference/moderations)

doc/intro-azure.md doc/02-usage-azure.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Introduction - Azure OpenAI
1+
# Usage - Azure OpenAI
22

33
Clojure functions to drive the [Azure OpenAI API](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference)
44

@@ -9,13 +9,13 @@ Add the `openai-clojure` dependency
99
### deps.edn
1010

1111
```
12-
net.clojars.wkok/openai-clojure {:mvn/version "0.3.0"}
12+
net.clojars.wkok/openai-clojure {:mvn/version "0.3.1"}
1313
```
1414

1515
### Leiningen project.clj
1616

1717
```
18-
[net.clojars.wkok/openai-clojure "0.3.0"]
18+
[net.clojars.wkok/openai-clojure "0.3.1"]
1919
```
2020

2121
## Authentication
@@ -30,7 +30,7 @@ Set the environment variable `AZURE_OPENAI_API_ENDPOINT` to your [Azure OpenAPI
3030

3131
## Quickstart
3232

33-
See the full [openai-clojure](wkok.openai-clojure.api.html) api documentation for examples of all the supported OpenAI APIs.
33+
See the full [API Reference](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api) api documentation for examples of all the supported OpenAI APIs.
3434

3535
Require the `api` namespace
3636

@@ -65,12 +65,12 @@ Result:
6565

6666
### Completions
6767

68-
* [create-completion](wkok.openai-clojure.api.html#var-create-completion)
68+
* [create-completion](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-completion)
6969

7070
Also see the [Azure OpenAI documentation](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#completions)
7171

7272
### Embeddings
7373

74-
* [create-embedding](wkok.openai-clojure.api.html#var-create-embedding)
74+
* [create-embedding](https://cljdoc.org/d/net.clojars.wkok/openai-clojure/0.3.1/api/wkok.openai-clojure.api#create-embedding)
7575

7676
Also see the [Azure OpenAI documentation](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#embeddings)

doc/sse.md doc/03-streaming.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Streaming Token Events
1+
# Streaming Tokens
22

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

55
```
6-
(create-completion {:model \"text-davinci-003\"
7-
:prompt \"Say this is a test\"
6+
(create-completion {:model "text-davinci-003"
7+
:prompt "Say this is a test"
88
:max_tokens 7
99
:temperature 0
1010
:stream true})
1111
```
1212

13-
## Reading streamed token events
13+
## Reading streamed tokens
1414

1515
Reading streamed tokens can be done either by providing your own callback function, or by taking from the returned [core.async](https://clojure.org/guides/async_walkthrough#_getting_started) channel
1616

@@ -19,8 +19,8 @@ Reading streamed tokens can be done either by providing your own callback functi
1919
Provide your callback function in the `:on-next` parameter for example
2020

2121
```
22-
(create-completion {:model \"text-davinci-003\"
23-
:prompt \"Say this is a test\"
22+
(create-completion {:model "text-davinci-003"
23+
:prompt "Say this is a test"
2424
:max_tokens 7
2525
:temperature 0
2626
:stream true
@@ -50,7 +50,7 @@ Provide your callback function in the `:on-next` parameter for example
5050
5151
```
5252

53-
## Example returned token event
53+
## Example returned token
5454

5555
```
5656
{:id "cmpl-6lf3JsE7hsWSikTfbiZ2NZOZKlBcG",

0 commit comments

Comments
 (0)