package openai
OCaml OpenAI binding
Install
Dune Dependency
Authors
Maintainers
Sources
openai-ocaml-0.0.1.tbz
sha256=aa7947b57001796a65e39cfed9c80338d08c5e2b7f2e32d0e6c19e1446395b18
sha512=46b236cb9bb25233fd4026d9593d161ced0f54b223c6d97ae3d981e2b36355ff60fd80cdefe7c6a247ef36251fe02999a65416b8fbfad50079232b9cb6cbc318
Description
Published: 17 May 2023
README
OpenAI-OCaml
$ cat src/test.ml
open Openai
let run () =
let api_key = Sys.getenv "OPENAI_API_KEY" in
let client = Client.create api_key in
ignore
@@ Lwt_main.run
@@ Lwt.bind
Chat_completion.(
send
client
~temperature:0.0
~max_tokens:22
~messages:
[ { role = `System; content = "" }
; { role = `User; content = {|枕草子曰く、春は"あけぼの"、夜は"月"。では、秋は?|} }
]
())
(Lwt_io.printlf "res: %s")
;;
let () = run ()
$ export OPENAI_API_KEY=...
$ dune test
res: 枕草子によると、秋は「夕暮れ」です。
Dependencies (7)
- ezcurl-lwt
- conf-openssl
- lwt_ppx
-
ppx_yojson_conv
< "v0.16.0"
- ppx_yojson
-
dune
>= "3.7.0"
-
ocaml
>= "4.14.0"
Dev Dependencies
None
Used by
None
Conflicts
None
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page