public void TestBasicSearch() { var api = new OpenAI_API.OpenAIAPI(engine: Engine.Curie); Assert.IsNotNull(api.Search); var result = api.Search.GetBestMatchAsync("Washington DC", "Canada", "China", "USA", "Spain").Result; Assert.IsNotNull(result); Assert.AreEqual("USA", result); }
public void GetBasicCompletion() { var api = new OpenAI_API.OpenAIAPI(engine: Engine.Davinci); Assert.IsNotNull(api.Completions); var results = api.Completions.CreateCompletionsAsync(new CompletionRequest("One Two Three Four Five Six Seven Eight Nine One Two Three Four Five Six Seven Eight", temperature: 0.1, max_tokens: 5), 5).Result; Assert.IsNotNull(results); Assert.NotNull(results.Completions); Assert.NotZero(results.Completions.Count); Assert.That(results.Completions.Any(c => c.Text.Trim().ToLower().StartsWith("nine"))); }
/// <summary> /// Constructor of the api endpoint. Rather than instantiating this yourself, access it through an instance of <see cref="OpenAIAPI"/> as <see cref="OpenAIAPI.Completions"/>. /// </summary> /// <param name="api"></param> internal CompletionEndpoint(OpenAIAPI api) { this.Api = api; }
/// <summary> /// Constructor of the api endpoint. Rather than instantiating this yourself, access it through an instance of <see cref="OpenAIAPI"/> as <see cref="OpenAIAPI.Search"/>. /// </summary> /// <param name="api"></param> internal SearchEndpoint(OpenAIAPI api) { this.Api = api; }
/// <summary> /// Constructor of the api endpoint. Rather than instantiating this yourself, access it through an instance of <see cref="OpenAIAPI"/> as <see cref="OpenAIAPI.Engines"/>. /// </summary> /// <param name="api"></param> internal EnginesEndpoint(OpenAIAPI api) { this.Api = api; }