mono/packages/kbot/cpp/packages/liboai/documentation/edits
2026-03-29 22:00:13 +02:00
..
examples liboai 1/2 2026-03-29 22:00:13 +02:00
README.md liboai 1/2 2026-03-29 22:00:13 +02:00

Edits

The Edits class is defined in edits.h at liboai::Edits, and its interface can ideally be accessed through a liboai::OpenAI object.

This class and its associated liboai::OpenAI interface allow access to the Edits endpoint of the OpenAI API; this endpoint's functionality can be found below.

  • Given a prompt and an instruction, the model will return an edited version of the prompt.

Methods

This document covers the method(s) located in edits.h. You can find their function signature(s) below.

Create an Edit

Creates a new edit for the provided input, instruction, and parameters. Returns a liboai::Response containing response data.

liboai::Response create(
  const std::string& model_id,
  std::optional<std::string> input = std::nullopt,
  std::optional<std::string> instruction = std::nullopt,
  std::optional<uint16_t> n = std::nullopt,
  std::optional<float> temperature = std::nullopt,
  std::optional<float> top_p = std::nullopt
) const & noexcept(false);

Create an Edit (async)

Asynchronously creates a new edit for the provided input, instruction, and parameters. Returns a liboai::FutureResponse containing future response data.

liboai::FutureResponse create_async(
  const std::string& model_id,
  std::optional<std::string> input = std::nullopt,
  std::optional<std::string> instruction = std::nullopt,
  std::optional<uint16_t> n = std::nullopt,
  std::optional<float> temperature = std::nullopt,
  std::optional<float> top_p = std::nullopt
) const & noexcept(false);

All function parameters marked optional are not required and are resolved on OpenAI's end if not supplied.


Example Usage

For example usage of the above function(s), please refer to the examples folder.