Function createChatCompletion

  • Sends a Create Chat Completion request to the OpenAI API.

    Type Parameters

    Parameters

    • chatCompletionRequestParams: T

      The Create Chat Completion parameters.

    • options: {
          headers?: Record<string, string>;
          proxy?: { host: string; port?: number | undefined; protocol?: "http" | "https" | undefined; auth?: { username: string; password: string; } | undefined; };
      } = {}

      Options to pass for the HTTP request.

      • Optional headers?: Record<string, string>
      • Optional proxy?: { host: string; port?: number | undefined; protocol?: "http" | "https" | undefined; auth?: { username: string; password: string; } | undefined; }

    Returns Promise<T["stream"] extends true
        ? ReadableStream<any>
        : CreateChatCompletionResponse>

    The response from the OpenAI API. A ReadableStream if chatCompletionRequestParams.stream is set to true in the request, otherwise a JSON object.

Generated using TypeDoc