Module Openai.Completions

type function_call = {
  1. arguments : string;
  2. name : string;
}
val jsonaf_of_function_call : function_call -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val function_call_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> function_call
val sexp_of_function_call : function_call -> Sexplib0.Sexp.t
val function_call_of_sexp : Sexplib0.Sexp.t -> function_call
val bin_shape_function_call : Bin_prot.Shape.t
val bin_size_function_call : function_call Bin_prot.Size.sizer
val bin_write_function_call : function_call Bin_prot.Write.writer
val bin_writer_function_call : function_call Bin_prot.Type_class.writer
val bin_read_function_call : function_call Bin_prot.Read.reader
val __bin_read_function_call__ : (int -> function_call) Bin_prot.Read.reader
val bin_reader_function_call : function_call Bin_prot.Type_class.reader
val bin_function_call : function_call Bin_prot.Type_class.t
type tool_call_chunk = {
  1. id : string;
  2. function_ : function_call;
  3. type_ : string;
}
val jsonaf_of_tool_call_chunk : tool_call_chunk -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val tool_call_chunk_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> tool_call_chunk
val sexp_of_tool_call_chunk : tool_call_chunk -> Sexplib0.Sexp.t
val tool_call_chunk_of_sexp : Sexplib0.Sexp.t -> tool_call_chunk
val bin_shape_tool_call_chunk : Bin_prot.Shape.t
val bin_size_tool_call_chunk : tool_call_chunk Bin_prot.Size.sizer
val bin_write_tool_call_chunk : tool_call_chunk Bin_prot.Write.writer
val bin_writer_tool_call_chunk : tool_call_chunk Bin_prot.Type_class.writer
val bin_read_tool_call_chunk : tool_call_chunk Bin_prot.Read.reader
val __bin_read_tool_call_chunk__ : (int -> tool_call_chunk) Bin_prot.Read.reader
val bin_reader_tool_call_chunk : tool_call_chunk Bin_prot.Type_class.reader
val bin_tool_call_chunk : tool_call_chunk Bin_prot.Type_class.t
type tool_call_default = {
  1. id : string option;
  2. function_ : function_call option;
  3. type_ : string option;
}
val jsonaf_of_tool_call_default : tool_call_default -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val tool_call_default_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> tool_call_default
val sexp_of_tool_call_default : tool_call_default -> Sexplib0.Sexp.t
val tool_call_default_of_sexp : Sexplib0.Sexp.t -> tool_call_default
val bin_shape_tool_call_default : Bin_prot.Shape.t
val bin_size_tool_call_default : tool_call_default Bin_prot.Size.sizer
val bin_write_tool_call_default : tool_call_default Bin_prot.Write.writer
val bin_writer_tool_call_default : tool_call_default Bin_prot.Type_class.writer
val bin_read_tool_call_default : tool_call_default Bin_prot.Read.reader
val __bin_read_tool_call_default__ : (int -> tool_call_default) Bin_prot.Read.reader
val bin_reader_tool_call_default : tool_call_default Bin_prot.Type_class.reader
val bin_tool_call_default : tool_call_default Bin_prot.Type_class.t
type image_url = {
  1. url : string;
}
val jsonaf_of_image_url : image_url -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val image_url_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> image_url
val sexp_of_image_url : image_url -> Sexplib0.Sexp.t
val image_url_of_sexp : Sexplib0.Sexp.t -> image_url
type content_item = {
  1. type_ : string;
  2. text : string option;
  3. image_url : image_url option;
}
val jsonaf_of_content_item : content_item -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val content_item_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> content_item
val sexp_of_content_item : content_item -> Sexplib0.Sexp.t
val content_item_of_sexp : Sexplib0.Sexp.t -> content_item
type chat_message_content =
  1. | Text of string
  2. | Items of content_item list
val sexp_of_chat_message_content : chat_message_content -> Sexplib0.Sexp.t
val chat_message_content_of_sexp : Sexplib0.Sexp.t -> chat_message_content
val jsonaf_of_chat_message_content : chat_message_content -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val chat_message_content_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> chat_message_content
type chat_message = {
  1. role : string;
  2. content : chat_message_content option;
  3. name : string option;
  4. tool_call_id : string option;
  5. function_call : function_call option;
  6. tool_calls : tool_call_default list option;
}
val sexp_of_chat_message : chat_message -> Sexplib0.Sexp.t
val chat_message_of_sexp : Sexplib0.Sexp.t -> chat_message
val jsonaf_of_chat_message : chat_message -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val chat_message_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> chat_message
type message = {
  1. content : string option;
  2. refusal : string option;
  3. role : string;
  4. function_call : function_call option;
  5. tool_calls : tool_call_default list option;
}
val jsonaf_of_message : message -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val message_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> message
val sexp_of_message : message -> Sexplib0.Sexp.t
val message_of_sexp : Sexplib0.Sexp.t -> message
val bin_shape_message : Bin_prot.Shape.t
val bin_size_message : message Bin_prot.Size.sizer
val bin_write_message : message Bin_prot.Write.writer
val bin_writer_message : message Bin_prot.Type_class.writer
val bin_read_message : message Bin_prot.Read.reader
val __bin_read_message__ : (int -> message) Bin_prot.Read.reader
val bin_reader_message : message Bin_prot.Type_class.reader
val bin_message : message Bin_prot.Type_class.t
type func = {
  1. name : string;
  2. description : string option;
  3. parameters : Jsonaf.t;
}
val sexp_of_func : func -> Sexplib0.Sexp.t
val func_of_sexp : Sexplib0.Sexp.t -> func
type tool_func = {
  1. name : string;
  2. description : string option;
  3. parameters : Jsonaf.t;
  4. strict : bool;
}
val jsonaf_of_tool_func : tool_func -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val tool_func_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> tool_func
val sexp_of_tool_func : tool_func -> Sexplib0.Sexp.t
val tool_func_of_sexp : Sexplib0.Sexp.t -> tool_func
type tool = {
  1. type_ : string;
  2. function_ : tool_func;
}
val sexp_of_tool : tool -> Sexplib0.Sexp.t
val tool_of_sexp : Sexplib0.Sexp.t -> tool
type schema = {
  1. description : string option;
  2. name : string;
  3. schema : Jsonaf.t;
  4. strict : bool;
}
val sexp_of_schema : schema -> Sexplib0.Sexp.t
val schema_of_sexp : Sexplib0.Sexp.t -> schema
type response_format = {
  1. type_ : string;
  2. json_schema : schema;
}
val jsonaf_of_response_format : response_format -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val response_format_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> response_format
val sexp_of_response_format : response_format -> Sexplib0.Sexp.t
val response_format_of_sexp : Sexplib0.Sexp.t -> response_format
type delta = {
  1. content : string option;
  2. function_call : function_call option;
  3. refusal : string option;
  4. role : string option;
  5. tool_calls : tool_call_chunk list option;
}
val sexp_of_delta : delta -> Sexplib0.Sexp.t
val delta_of_sexp : Sexplib0.Sexp.t -> delta
val bin_shape_delta : Bin_prot.Shape.t
val bin_size_delta : delta Bin_prot.Size.sizer
val bin_write_delta : delta Bin_prot.Write.writer
val bin_writer_delta : delta Bin_prot.Type_class.writer
val bin_read_delta : delta Bin_prot.Read.reader
val __bin_read_delta__ : (int -> delta) Bin_prot.Read.reader
val bin_reader_delta : delta Bin_prot.Type_class.reader
type stream_choice = {
  1. delta : delta;
  2. finish_reason : string option;
  3. index : int;
}
val jsonaf_of_stream_choice : stream_choice -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val stream_choice_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> stream_choice
val sexp_of_stream_choice : stream_choice -> Sexplib0.Sexp.t
val stream_choice_of_sexp : Sexplib0.Sexp.t -> stream_choice
val bin_shape_stream_choice : Bin_prot.Shape.t
val bin_size_stream_choice : stream_choice Bin_prot.Size.sizer
val bin_write_stream_choice : stream_choice Bin_prot.Write.writer
val bin_writer_stream_choice : stream_choice Bin_prot.Type_class.writer
val bin_read_stream_choice : stream_choice Bin_prot.Read.reader
val __bin_read_stream_choice__ : (int -> stream_choice) Bin_prot.Read.reader
val bin_reader_stream_choice : stream_choice Bin_prot.Type_class.reader
val bin_stream_choice : stream_choice Bin_prot.Type_class.t
type chat_completion_chunk = {
  1. choices : stream_choice list;
}
val jsonaf_of_chat_completion_chunk : chat_completion_chunk -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val chat_completion_chunk_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> chat_completion_chunk
val sexp_of_chat_completion_chunk : chat_completion_chunk -> Sexplib0.Sexp.t
val chat_completion_chunk_of_sexp : Sexplib0.Sexp.t -> chat_completion_chunk
val bin_shape_chat_completion_chunk : Bin_prot.Shape.t
val bin_size_chat_completion_chunk : chat_completion_chunk Bin_prot.Size.sizer
val bin_write_chat_completion_chunk : chat_completion_chunk Bin_prot.Write.writer
val bin_writer_chat_completion_chunk : chat_completion_chunk Bin_prot.Type_class.writer
val bin_read_chat_completion_chunk : chat_completion_chunk Bin_prot.Read.reader
val __bin_read_chat_completion_chunk__ : (int -> chat_completion_chunk) Bin_prot.Read.reader
val bin_reader_chat_completion_chunk : chat_completion_chunk Bin_prot.Type_class.reader
val bin_chat_completion_chunk : chat_completion_chunk Bin_prot.Type_class.t
type default_choice = {
  1. finish_reason : string option;
  2. message : message;
}
val jsonaf_of_default_choice : default_choice -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val default_choice_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> default_choice
val sexp_of_default_choice : default_choice -> Sexplib0.Sexp.t
val default_choice_of_sexp : Sexplib0.Sexp.t -> default_choice
val bin_shape_default_choice : Bin_prot.Shape.t
val bin_size_default_choice : default_choice Bin_prot.Size.sizer
val bin_write_default_choice : default_choice Bin_prot.Write.writer
val bin_writer_default_choice : default_choice Bin_prot.Type_class.writer
val bin_read_default_choice : default_choice Bin_prot.Read.reader
val __bin_read_default_choice__ : (int -> default_choice) Bin_prot.Read.reader
val bin_reader_default_choice : default_choice Bin_prot.Type_class.reader
val bin_default_choice : default_choice Bin_prot.Type_class.t
type chat_completion = {
  1. choices : default_choice list;
}
val jsonaf_of_chat_completion : chat_completion -> Ppx_jsonaf_conv_lib.Jsonaf_kernel.t
val chat_completion_of_jsonaf : Ppx_jsonaf_conv_lib.Jsonaf_kernel.t -> chat_completion
val sexp_of_chat_completion : chat_completion -> Sexplib0.Sexp.t
val chat_completion_of_sexp : Sexplib0.Sexp.t -> chat_completion
val bin_shape_chat_completion : Bin_prot.Shape.t
val bin_size_chat_completion : chat_completion Bin_prot.Size.sizer
val bin_write_chat_completion : chat_completion Bin_prot.Write.writer
val bin_writer_chat_completion : chat_completion Bin_prot.Type_class.writer
val bin_read_chat_completion : chat_completion Bin_prot.Read.reader
val __bin_read_chat_completion__ : (int -> chat_completion) Bin_prot.Read.reader
val bin_reader_chat_completion : chat_completion Bin_prot.Type_class.reader
val bin_chat_completion : chat_completion Bin_prot.Type_class.t
type _ response_type =
  1. | Stream : (stream_choice -> unit) -> unit response_type
  2. | Default : default_choice response_type
type model =
  1. | O3_Mini
  2. | Gpt4
  3. | Gpt4o
  4. | Gpt3
  5. | Gpt3_16k
val sexp_of_model : model -> Sexplib0.Sexp.t
val model_of_sexp : Sexplib0.Sexp.t -> model
val model_of_str_exn : string -> model
val post_chat_completion : 'a. 'a response_type -> ?max_tokens:int -> ?temperature:float -> ?functions:func list -> ?tools:tool list -> ?model:model -> ?reasoning_effort:string -> dir:Eio.Fs.dir_ty Eio.Path.t -> 'n Eio.Net.t -> inputs:chat_message list -> 'a