/// <summary> /// Creates a new entry point to the OpenAPI API, handling auth and allowing access to the various API endpoints /// </summary> /// <param name="apiKeys">The API authentication information to use for API calls, or <see langword="null"/> to attempt to use the <see cref="APIAuthentication.Default"/>, potentially loading from environment vars or from a config file.</param> /// <param name="engine">The <see cref="Engine"/>/model to use for API calls, defaulting to <see cref="Engine.Davinci"/> if not specified.</param> public OpenAIAPI(APIAuthentication apiKeys = null, Engine engine = null) { this.Auth = apiKeys.ThisOrDefault(); this.UsingEngine = engine ?? Engine.Default; Completions = new CompletionEndpoint(this); Engines = new EnginesEndpoint(this); Search = new SearchEndpoint(this); }
/// <summary> /// Gets more details about this Engine from the API, specifically properties such as <see cref="Owner"/> and <see cref="Ready"/> /// </summary> /// <param name="auth">API authentication in order to call the API endpoint. If not specified, attempts to use a default.</param> /// <returns>Asynchronously returns an Engine with all relevant properties filled in</returns> public async Task <Engine> RetrieveEngineDetailsAsync(APIAuthentication auth = null) { return(await EnginesEndpoint.RetrieveEngineDetailsAsync(this.EngineName, auth)); }