Hierarchy

  • APIResource
    • Completions

Constructors

Methods

  • Type Parameters

    • FunctionsArgs extends BaseFunctionsArgs

    Parameters

    • body: ChatCompletionFunctionRunnerParams<FunctionsArgs>
    • Optionaloptions: RequestOptions<unknown>

    Returns ChatCompletionRunner<null>

    • use runTools instead.
  • Type Parameters

    • FunctionsArgs extends BaseFunctionsArgs

    Parameters

    • body: ChatCompletionStreamingFunctionRunnerParams<FunctionsArgs>
    • Optionaloptions: RequestOptions<unknown>

    Returns ChatCompletionStreamingRunner<null>

  • A convenience helper for using tool calls with the /chat/completions endpoint which automatically calls the JavaScript functions you provide and sends their results back to the /chat/completions endpoint, looping as long as the model requests function calls.

    For more details and examples, see the docs

    Type Parameters

    • Params extends ChatCompletionToolRunnerParams<any>
    • ParsedT = ExtractParsedContentFromParams<Params>

    Parameters

    • body: Params
    • Optionaloptions: RunnerOptions

    Returns ChatCompletionRunner<ParsedT>

  • Type Parameters

    • Params extends ChatCompletionStreamingToolRunnerParams<any>
    • ParsedT = ExtractParsedContentFromParams<Params>

    Parameters

    • body: Params
    • Optionaloptions: RunnerOptions

    Returns ChatCompletionStreamingRunner<ParsedT>

  • Creates a chat completion stream

    Type Parameters

    • Params extends ChatCompletionStreamParams
    • ParsedT = ExtractParsedContentFromParams<Params>

    Parameters

    • body: Params
    • Optionaloptions: RequestOptions<unknown>

    Returns ChatCompletionStream<ParsedT>