-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ff55d58
Showing
64 changed files
with
1,819 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
APIs for sampling from and fine-tuning language models | ||
|
||
This OCaml package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: | ||
|
||
- API version: 1.2.0 | ||
- Package version: 1.0.0 | ||
- Build package: org.openapitools.codegen.languages.OCamlClientCodegen | ||
|
||
## Requirements. | ||
|
||
OCaml 4.x | ||
|
||
## Installation | ||
|
||
Please run the following commands to build the package `openapi`: | ||
|
||
```sh | ||
opam install ppx_deriving_yojson cohttp ppx_deriving cohttp-lwt-unix pin ocaml-migrate-parsetree 1.3.1 | ||
eval $(opam env) | ||
dune build | ||
``` | ||
|
||
## Getting Started | ||
|
||
TODO | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(include_subdirs unqualified) | ||
(library | ||
(name openapi) | ||
(public_name openapi) | ||
(flags (:standard -w -27)) | ||
(libraries str cohttp-lwt-unix lwt yojson ppx_deriving_yojson.runtime) | ||
(preprocess (pps ppx_deriving_yojson ppx_deriving.std)) | ||
(wrapped true) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(lang dune 1.10) | ||
(name openapi) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
opam-version: "2.0" | ||
name: "openapi" | ||
version: "1.0.0" | ||
synopsis: "" | ||
description: """ | ||
Longer description | ||
""" | ||
maintainer: "Name <email>" | ||
authors: "Name <email>" | ||
license: "" | ||
homepage: "" | ||
bug-reports: "" | ||
dev-repo: "" | ||
depends: [ "ocaml" "ocamlfind" ] | ||
build: ["dune" "build" "-p" name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,251 @@ | ||
(* | ||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator. | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
* | ||
*) | ||
|
||
let cancel_fine_tune ~fine_tune_id = | ||
let open Lwt in | ||
let uri = Request.build_uri "/fine-tunes/{fine_tune_id}/cancel" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "fine_tune_id" (fun x -> x) fine_tune_id in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Fine_tune.of_yojson) resp body | ||
|
||
let create_answer ~create_answer_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/answers" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_answer_request.to_yojson create_answer_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_answer_response.of_yojson) resp body | ||
|
||
let create_chat_completion ~create_chat_completion_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/chat/completions" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_chat_completion_request.to_yojson create_chat_completion_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_chat_completion_response.of_yojson) resp body | ||
|
||
let create_classification ~create_classification_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/classifications" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_classification_request.to_yojson create_classification_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_classification_response.of_yojson) resp body | ||
|
||
let create_completion ~create_completion_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/completions" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_completion_request.to_yojson create_completion_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_completion_response.of_yojson) resp body | ||
|
||
let create_edit ~create_edit_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/edits" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_edit_request.to_yojson create_edit_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_edit_response.of_yojson) resp body | ||
|
||
let create_embedding ~create_embedding_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/embeddings" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_embedding_request.to_yojson create_embedding_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_embedding_response.of_yojson) resp body | ||
|
||
let create_file ~file ~purpose = | ||
let open Lwt in | ||
let uri = Request.build_uri "/files" in | ||
let headers = Request.default_headers in | ||
let body = Request.init_form_encoded_body () in | ||
let body = Request.add_form_encoded_body_param body "file" (fun x -> x) file in | ||
let body = Request.add_form_encoded_body_param body "purpose" (fun x -> x) purpose in | ||
let body = Request.finalize_form_encoded_body body in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Open_ai_file.of_yojson) resp body | ||
|
||
let create_fine_tune ~create_fine_tune_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/fine-tunes" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_fine_tune_request.to_yojson create_fine_tune_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Fine_tune.of_yojson) resp body | ||
|
||
let create_image ~create_image_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/images/generations" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_image_request.to_yojson create_image_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Images_response.of_yojson) resp body | ||
|
||
let create_image_edit ~image ~prompt ?mask () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/images/edits" in | ||
let headers = Request.default_headers in | ||
let body = Request.init_form_encoded_body () in | ||
let body = Request.add_form_encoded_body_param body "image" (fun x -> x) image in | ||
let body = Request.maybe_add_form_encoded_body_param body "mask" (fun x -> x) mask in | ||
let body = Request.add_form_encoded_body_param body "prompt" (fun x -> x) prompt in | ||
let body = Request.finalize_form_encoded_body body in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Images_response.of_yojson) resp body | ||
|
||
let create_image_variation ~image = | ||
let open Lwt in | ||
let uri = Request.build_uri "/images/variations" in | ||
let headers = Request.default_headers in | ||
let body = Request.init_form_encoded_body () in | ||
let body = Request.add_form_encoded_body_param body "image" (fun x -> x) image in | ||
let body = Request.finalize_form_encoded_body body in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Images_response.of_yojson) resp body | ||
|
||
let create_moderation ~create_moderation_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/moderations" in | ||
let headers = Request.default_headers in | ||
let body = Request.write_as_json_body Create_moderation_request.to_yojson create_moderation_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_moderation_response.of_yojson) resp body | ||
|
||
let create_search ~engine_id ~create_search_request_t = | ||
let open Lwt in | ||
let uri = Request.build_uri "/engines/{engine_id}/search" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "engine_id" (fun x -> x) engine_id in | ||
let body = Request.write_as_json_body Create_search_request.to_yojson create_search_request_t in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_search_response.of_yojson) resp body | ||
|
||
let create_transcription ~file ~model ?prompt ?(response_format = "json") ?(temperature = 0.) ?language () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/audio/transcriptions" in | ||
let headers = Request.default_headers in | ||
let body = Request.init_form_encoded_body () in | ||
let body = Request.add_form_encoded_body_param body "file" (fun x -> x) file in | ||
let body = Request.add_form_encoded_body_param body "model" (fun x -> x) model in | ||
let body = Request.maybe_add_form_encoded_body_param body "prompt" (fun x -> x) prompt in | ||
let body = Request.add_form_encoded_body_param body "response_format" (fun x -> x) response_format in | ||
let body = Request.add_form_encoded_body_param body "temperature" string_of_float temperature in | ||
let body = Request.maybe_add_form_encoded_body_param body "language" (fun x -> x) language in | ||
let body = Request.finalize_form_encoded_body body in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_transcription_response.of_yojson) resp body | ||
|
||
let create_translation ~file ~model ?prompt ?(response_format = "json") ?(temperature = 0.) () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/audio/translations" in | ||
let headers = Request.default_headers in | ||
let body = Request.init_form_encoded_body () in | ||
let body = Request.add_form_encoded_body_param body "file" (fun x -> x) file in | ||
let body = Request.add_form_encoded_body_param body "model" (fun x -> x) model in | ||
let body = Request.maybe_add_form_encoded_body_param body "prompt" (fun x -> x) prompt in | ||
let body = Request.add_form_encoded_body_param body "response_format" (fun x -> x) response_format in | ||
let body = Request.add_form_encoded_body_param body "temperature" string_of_float temperature in | ||
let body = Request.finalize_form_encoded_body body in | ||
Cohttp_lwt_unix.Client.call `POST uri ~headers ~body >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Create_translation_response.of_yojson) resp body | ||
|
||
let delete_file ~file_id = | ||
let open Lwt in | ||
let uri = Request.build_uri "/files/{file_id}" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "file_id" (fun x -> x) file_id in | ||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Delete_file_response.of_yojson) resp body | ||
|
||
let delete_model ~model = | ||
let open Lwt in | ||
let uri = Request.build_uri "/models/{model}" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "model" (fun x -> x) model in | ||
Cohttp_lwt_unix.Client.call `DELETE uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Delete_model_response.of_yojson) resp body | ||
|
||
let download_file ~file_id = | ||
let open Lwt in | ||
let uri = Request.build_uri "/files/{file_id}/content" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "file_id" (fun x -> x) file_id in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.to_string) resp body | ||
|
||
let list_engines () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/engines" in | ||
let headers = Request.default_headers in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap List_engines_response.of_yojson) resp body | ||
|
||
let list_files () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/files" in | ||
let headers = Request.default_headers in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap List_files_response.of_yojson) resp body | ||
|
||
let list_fine_tune_events ~fine_tune_id ?(stream = false) () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/fine-tunes/{fine_tune_id}/events" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "fine_tune_id" (fun x -> x) fine_tune_id in | ||
let uri = Request.add_query_param uri "stream" string_of_bool stream in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap List_fine_tune_events_response.of_yojson) resp body | ||
|
||
let list_fine_tunes () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/fine-tunes" in | ||
let headers = Request.default_headers in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap List_fine_tunes_response.of_yojson) resp body | ||
|
||
let list_models () = | ||
let open Lwt in | ||
let uri = Request.build_uri "/models" in | ||
let headers = Request.default_headers in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap List_models_response.of_yojson) resp body | ||
|
||
let retrieve_engine ~engine_id = | ||
let open Lwt in | ||
let uri = Request.build_uri "/engines/{engine_id}" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "engine_id" (fun x -> x) engine_id in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Engine.of_yojson) resp body | ||
|
||
let retrieve_file ~file_id = | ||
let open Lwt in | ||
let uri = Request.build_uri "/files/{file_id}" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "file_id" (fun x -> x) file_id in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Open_ai_file.of_yojson) resp body | ||
|
||
let retrieve_fine_tune ~fine_tune_id = | ||
let open Lwt in | ||
let uri = Request.build_uri "/fine-tunes/{fine_tune_id}" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "fine_tune_id" (fun x -> x) fine_tune_id in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Fine_tune.of_yojson) resp body | ||
|
||
let retrieve_model ~model = | ||
let open Lwt in | ||
let uri = Request.build_uri "/models/{model}" in | ||
let headers = Request.default_headers in | ||
let uri = Request.replace_path_param uri "model" (fun x -> x) model in | ||
Cohttp_lwt_unix.Client.call `GET uri ~headers >>= fun (resp, body) -> | ||
Request.read_json_body_as (JsonSupport.unwrap Model.of_yojson) resp body | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
(* | ||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator. | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
* | ||
*) | ||
|
||
val cancel_fine_tune : fine_tune_id:string -> Fine_tune.t Lwt.t | ||
val create_answer : create_answer_request_t:Create_answer_request.t -> Create_answer_response.t Lwt.t | ||
val create_chat_completion : create_chat_completion_request_t:Create_chat_completion_request.t -> Create_chat_completion_response.t Lwt.t | ||
val create_classification : create_classification_request_t:Create_classification_request.t -> Create_classification_response.t Lwt.t | ||
val create_completion : create_completion_request_t:Create_completion_request.t -> Create_completion_response.t Lwt.t | ||
val create_edit : create_edit_request_t:Create_edit_request.t -> Create_edit_response.t Lwt.t | ||
val create_embedding : create_embedding_request_t:Create_embedding_request.t -> Create_embedding_response.t Lwt.t | ||
val create_file : file:string -> purpose:string -> Open_ai_file.t Lwt.t | ||
val create_fine_tune : create_fine_tune_request_t:Create_fine_tune_request.t -> Fine_tune.t Lwt.t | ||
val create_image : create_image_request_t:Create_image_request.t -> Images_response.t Lwt.t | ||
val create_image_edit : image:string -> prompt:string -> ?mask:string -> unit -> Images_response.t Lwt.t | ||
val create_image_variation : image:string -> Images_response.t Lwt.t | ||
val create_moderation : create_moderation_request_t:Create_moderation_request.t -> Create_moderation_response.t Lwt.t | ||
val create_search : engine_id:string -> create_search_request_t:Create_search_request.t -> Create_search_response.t Lwt.t | ||
val create_transcription : file:string -> model:string -> ?prompt:string -> ?response_format:string -> ?temperature:float -> ?language:string -> unit -> Create_transcription_response.t Lwt.t | ||
val create_translation : file:string -> model:string -> ?prompt:string -> ?response_format:string -> ?temperature:float -> unit -> Create_translation_response.t Lwt.t | ||
val delete_file : file_id:string -> Delete_file_response.t Lwt.t | ||
val delete_model : model:string -> Delete_model_response.t Lwt.t | ||
val download_file : file_id:string -> string Lwt.t | ||
val list_engines : unit -> List_engines_response.t Lwt.t | ||
val list_files : unit -> List_files_response.t Lwt.t | ||
val list_fine_tune_events : fine_tune_id:string -> ?stream:bool -> unit -> List_fine_tune_events_response.t Lwt.t | ||
val list_fine_tunes : unit -> List_fine_tunes_response.t Lwt.t | ||
val list_models : unit -> List_models_response.t Lwt.t | ||
val retrieve_engine : engine_id:string -> Engine.t Lwt.t | ||
val retrieve_file : file_id:string -> Open_ai_file.t Lwt.t | ||
val retrieve_fine_tune : fine_tune_id:string -> Fine_tune.t Lwt.t | ||
val retrieve_model : model:string -> Model.t Lwt.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(* | ||
* This file has been generated by the OCamlClientCodegen generator for openapi-generator. | ||
* | ||
* Generated by: https://openapi-generator.tech | ||
* | ||
*) | ||
|
||
type t = { | ||
(* The role of the author of this message. *) | ||
role: Enums.role; | ||
(* The contents of the message *) | ||
content: string; | ||
(* The name of the user in a multi-user chat *) | ||
name: string option [@default None]; | ||
} [@@deriving yojson { strict = false }, show ];; | ||
|
||
let create (role : Enums.role) (content : string) : t = { | ||
role = role; | ||
content = content; | ||
name = None; | ||
} | ||
|
Oops, something went wrong.