Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

v4.0.0 Update #41

Merged
merged 3 commits into from
May 30, 2024
Merged

v4.0.0 Update #41

merged 3 commits into from
May 30, 2024

Conversation

D7EAD
Copy link
Owner

@D7EAD D7EAD commented Jun 22, 2023

v4.0.0 focuses mainly on the new OpenAI functions capability for their Chat endpoint. You can read about it here.

Basic additions/changes:

  • Replaces each class' move and copy constructors, assignment operators with a more concise set of macros:
    • NON_MOVABLE.
    • NON_COPYABLE.
  • Created two type aliases for stream parameters that can equal:
    • ChatStreamCallback which expands to std::function<std::string, intptr_t, Conversation&>,
    • and StreamCallback which expands to std::function<std::string, intptr_t>.
      • As implied by their names, ChatStreamCallback applies to Conversation-related streamable methods, and StreamCallback applies to all other streamable methods.
  • Adds a new parameter to ChatCompletions::create and create_async:
    • function_call, an optional parameter that tells the model which function to use in their response, if any. Should be either none, auto (default), or the name of a previously set function the response should use. A function should be set in the Conversation passed to this method prior to calling it.

New classes, methods:

  • Class Functions:
    • This class holds any functions that will be used during any conversation with a chat model.
      • This includes the function's name, description, and parameters--each a Functions::FunctionParameter.
    • This class includes a structure, FunctionParameter, which describes a single parameter of a set function in the class Functions.
    • Methods:
      • bool AddFunction(...),
      • bool AddFunctions(...),
      • bool PopFunction(...) ,
      • bool PopFunctions(...),
      • bool SetDescription(...),
      • bool PopDescription(...),
      • bool SetRequired(...),
      • bool PopRequired(...),
      • bool AppendRequired(...),
      • bool SetParameter(...),
      • bool SetParameters(...),
      • bool PopParameters(...),
      • bool AppendParameter(...),
      • bool AppendParameters(...),
      • const nlohmann::json& GetJSON(...)
    • Members:
      • struct FunctionParameter
  • New Conversation Methods:
    • bool AddUserData(string_view data, string_view name),
    • bool LastResponseIsFunctionCall(...),
    • std::string GetLastFunctionCallName(...),
    • std::string GetLastFunctionCallArguments(...),
    • std::string Export(...),
    • bool Import(...),
    • bool AppendStreamData(...),
    • bool SetFunctions(...),
    • bool PopFunctions(...),
    • std::string GetRawFunctions(...),
    • const nlohmann::json& GetFunctionsJSON(...)

@D7EAD D7EAD mentioned this pull request Jun 22, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants