Azure / azure-functions-openai-extension

An extension that adds support for Azure OpenAI/ OpenAI bindings in Azure Functions for LLM (GPT-3.5-Turbo, GPT-4, etc)
MIT License
79 stars 29 forks source link

ASP.NET WhoIs example should use IActionResult #21

Closed paulyuk closed 8 months ago

paulyuk commented 9 months ago

Looking at this example, the code is perfectly fine, just it's not modern ASP.NET like.

[FunctionName(nameof(WhoIs))]
public static string WhoIs(
    [HttpTrigger(AuthorizationLevel.Function, Route = "whois/{name}")] HttpRequest req,
    [TextCompletion("Who is {name}?", Model = "gpt-35-turbo")] TextCompletionResponse response)
{
    return response.Content;
}

Suggest changing this in all places to be this instead:

        [FunctionName(nameof(WhoIs))]
        public static IActionResult WhoIsFunction(
            [HttpTrigger(AuthorizationLevel.Function, Route = "whois/{name}")] HttpRequest req,
            [TextCompletion("Who is {name}?")] TextCompletionResponse response)
        {
            return new OkObjectResult(response.Content);
        }
manvkaur commented 8 months ago

@paulyuk , addressed the issue in above PR, closing the issue now.