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/embedding.ml.html
Source file embedding.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 30let endpoint = "/v1/embeddings" let send (client : Client.t) ?(model = "text-embedding-ada-002") ~input ?user () = let user = Json.to_field_opt "user" (fun x -> `String x) user in let body = List.filter (fun (_, v) -> v <> `Null) [ "model", `String model; "input", `String input; user ] |> 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 Lwt.return json | Error (_code, e) -> Lwt.fail_with e ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>