package openai
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml OpenAI binding
Install
dune-project
Dependency
Authors
Maintainers
Sources
openai-ocaml-0.0.1.tbz
sha256=aa7947b57001796a65e39cfed9c80338d08c5e2b7f2e32d0e6c19e1446395b18
sha512=46b236cb9bb25233fd4026d9593d161ced0f54b223c6d97ae3d981e2b36355ff60fd80cdefe7c6a247ef36251fe02999a65416b8fbfad50079232b9cb6cbc318
doc/src/openai/audio_translation.ml.html
Source file audio_translation.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47let endpoint = "/v1/audio/transclations" open Basic.Audio let send (client : Client.t) ~(file : Basic.file_format) ?(model = "whisper-1") ?prompt ?(response_format = `Json) ?temperature () = let%lwt file = Basic.read_file file in let prompt = Json.to_field_opt "prompt" yojson_of_string prompt in let temperature = Json.to_field_opt "temperature" yojson_of_float temperature in let body = List.filter (fun (_, v) -> v <> `Null) [ "file", `String file ; "model", `String model ; "response_format", yojson_of_response_format response_format ; prompt ; temperature ] |> fun l -> Yojson.Safe.to_string (`Assoc l) in let headers = [ "content-type", "application/json" ; "Authorization", String.concat " " [ "Bearer"; client.api_key ] ] in let%lwt resp = Ezcurl_lwt.post ~client:client.c ~headers ~content:(`String body) ~url:(client.gen_url endpoint) ~params:[] () in match resp with | Ok { body; _ } -> let json = Yojson.Safe.from_string body in json |> json_to_response response_format |> Lwt.return | Error (_code, e) -> Lwt.fail_with e ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>