View Source WiseGPTEx.OpenAIHTTPClient (WiseGPTEx v0.8.0)

Documentation for WiseGPTEx.OpenAIHTTPClient.

This module contains functions to interact with the OpenAI API to get completions with reasoning and determine the best completion. It is used internally by the WiseGPTEx module and is not intended to be called directly by users.

The main functions in this module are:

  • get_completions_with_reasoning/2 - Retrieves completions with reasoning from the OpenAI API based on a given message and an optional list of options.
  • get_best_completion/3 - Determines the best completion from a list of completions and an optional list of options.
  • completion/2 - Gets a raw completion from the API based on given messages, without additional prompting.

NOTE: completion/2 allows sending custom conversations with both role and content to the API, while the other functions add extra prompting to request reasoning, disambiguation, etc.

Summary

Functions

Link to this function

completion(messages, opts \\ [])

View Source
@spec completion([map()], Keyword.t()) :: {:ok, binary()} | {:error, any()}
Link to this function

get_best_completion(message, completions, opts \\ [])

View Source
@spec get_best_completion(binary(), list(), Keyword.t()) ::
  {:ok, binary()} | {:error, any()}
Link to this function

get_completions_with_reasoning(message, opts \\ [])

View Source
@spec get_completions_with_reasoning(binary(), Keyword.t()) ::
  {:ok, list()} | {:error, map()}
Link to this function

get_resolver_completion(message, completions, best_completion, opts \\ [])

View Source
@spec get_resolver_completion(binary(), list(), binary(), Keyword.t()) ::
  {:ok, binary()} | {:error, any()}