Skip to content

Commit

Permalink
add missing imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedmuhsin committed Dec 18, 2024
1 parent 4e5bbba commit 4610905
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@
]
},
"files": {
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantCreate;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantCreateRequest;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage createAssistant(\n @HttpTrigger(\n name = \"req\", \n methods = {HttpMethod.PUT},\n authLevel = AuthorizationLevel.ANONYMOUS, \n route = \"assistants/{chatId}\") \n HttpRequestMessage<Optional<CreateRequest>> request,\n @BindingName(\"chatId\") String chatId,\n @AssistantCreate(name = \"$name$\") OutputBinding<AssistantCreateRequest> message,\n final ExecutionContext context) {\n \n if (request.getBody() == null) {\n return request.createResponseBuilder(HttpStatus.BAD_REQUEST)\n .body(\"Invalid request body. Make sure that you pass in {\\\"instructions\\\": value } as the request body.\")\n .build();\n }\n \n AssistantCreateRequest assistantCreateRequest = new AssistantCreateRequest(chatId, request.getBody().get().getInstructions());\n message.setValue(assistantCreateRequest);\n \n return request.createResponseBuilder(HttpStatus.ACCEPTED)\n .header(\"Content-Type\", \"application/json\")\n .body(String.format(\"{{\\\"chatId\\\": \\\"%s\\\"}}\", chatId))\n .build();\n }\n\n public static class CreateRequest {\n private String instructions;\n \n public String getInstructions() {\n return instructions;\n }\n \n public void setInstructions(String instructions) {\n this.instructions = instructions;\n }\n }\n}\n"
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantCreate;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantCreateRequest;\n\nimport java.util.Optional;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage createAssistant(\n @HttpTrigger(\n name = \"req\", \n methods = {HttpMethod.PUT},\n authLevel = AuthorizationLevel.ANONYMOUS, \n route = \"assistants/{chatId}\") \n HttpRequestMessage<Optional<CreateRequest>> request,\n @BindingName(\"chatId\") String chatId,\n @AssistantCreate(name = \"$name$\") OutputBinding<AssistantCreateRequest> message,\n final ExecutionContext context) {\n \n if (request.getBody() == null) {\n return request.createResponseBuilder(HttpStatus.BAD_REQUEST)\n .body(\"Invalid request body. Make sure that you pass in {\\\"instructions\\\": value } as the request body.\")\n .build();\n }\n \n AssistantCreateRequest assistantCreateRequest = new AssistantCreateRequest(chatId, request.getBody().get().getInstructions());\n message.setValue(assistantCreateRequest);\n \n return request.createResponseBuilder(HttpStatus.ACCEPTED)\n .header(\"Content-Type\", \"application/json\")\n .body(String.format(\"{{\\\"chatId\\\": \\\"%s\\\"}}\", chatId))\n .build();\n }\n\n public static class CreateRequest {\n private String instructions;\n \n public String getInstructions() {\n return instructions;\n }\n \n public void setInstructions(String instructions) {\n this.instructions = instructions;\n }\n }\n}\n"
}
},
{
Expand Down Expand Up @@ -684,7 +684,7 @@
]
},
"files": {
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantQuery;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantState;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage getChatState(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.GET}, \n authLevel = AuthorizationLevel.ANONYMOUS,\n route = \"assistants/{chatId}\") \n HttpRequestMessage<Optional<String>> request,\n @BindingName(\"chatId\") String chatId, \n @AssistantQuery(name = \"$name$\", id = \"{chatId}\", timestampUtc = \"{Query.timestampUTC}\") AssistantState state,\n final ExecutionContext context) {\n return request.createResponseBuilder(HttpStatus.OK)\n .header(\"Content-Type\", \"application/json\")\n .body(state)\n .build();\n }\n}\n"
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantQuery;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantState;\n\nimport java.util.Optional;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage getChatState(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.GET}, \n authLevel = AuthorizationLevel.ANONYMOUS,\n route = \"assistants/{chatId}\") \n HttpRequestMessage<Optional<String>> request,\n @BindingName(\"chatId\") String chatId, \n @AssistantQuery(name = \"$name$\", id = \"{chatId}\", timestampUtc = \"{Query.timestampUTC}\") AssistantState state,\n final ExecutionContext context) {\n return request.createResponseBuilder(HttpStatus.OK)\n .header(\"Content-Type\", \"application/json\")\n .body(state)\n .build();\n }\n}\n"
}
},
{
Expand Down Expand Up @@ -714,7 +714,7 @@
]
},
"files": {
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantPost;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantState;\nimport com.microsoft.azure.functions.openai.annotation.assistant.ChatMessage;\n\nimport java.util.List;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage postUserResponse(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.POST}, \n authLevel = AuthorizationLevel.ANONYMOUS,\n route = \"assistants/{chatId}\") \n HttpRequestMessage<Optional<String>> request,\n @BindingName(\"chatId\") String chatId, \n @AssistantPost(name=\"$name$\", id = \"{chatId}\", model = \"$model$\", userMessage = \"{Query.message}\") AssistantState state,\n final ExecutionContext context) {\n\n List<ChatMessage> recentMessages = state.getRecentMessages();\n String response = recentMessages.isEmpty() ? \"No response returned.\" : recentMessages.get(recentMessages.size() - 1).getContent();\n \n return request.createResponseBuilder(HttpStatus.OK)\n .header(\"Content-Type\", \"application/json\")\n .body(response)\n .build();\n }\n}\n"
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantPost;\nimport com.microsoft.azure.functions.openai.annotation.assistant.AssistantState;\nimport com.microsoft.azure.functions.openai.annotation.assistant.ChatMessage;\n\nimport java.util.List;\nimport java.util.Optional;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage postUserResponse(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.POST}, \n authLevel = AuthorizationLevel.ANONYMOUS,\n route = \"assistants/{chatId}\") \n HttpRequestMessage<Optional<String>> request,\n @BindingName(\"chatId\") String chatId, \n @AssistantPost(name=\"$name$\", id = \"{chatId}\", model = \"$model$\", userMessage = \"{Query.message}\") AssistantState state,\n final ExecutionContext context) {\n\n List<ChatMessage> recentMessages = state.getRecentMessages();\n String response = recentMessages.isEmpty() ? \"No response returned.\" : recentMessages.get(recentMessages.size() - 1).getContent();\n \n return request.createResponseBuilder(HttpStatus.OK)\n .header(\"Content-Type\", \"application/json\")\n .body(response)\n .build();\n }\n}\n"
}
},
{
Expand Down Expand Up @@ -807,7 +807,7 @@
]
},
"files": {
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.textcompletion.TextCompletion;\nimport com.microsoft.azure.functions.openai.annotation.textcompletion.TextCompletionResponse;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage textCompletion(\n @HttpTrigger(\n name = \"req\", \n methods = {HttpMethod.POST},\n authLevel = AuthorizationLevel.ANONYMOUS) \n HttpRequestMessage<Optional<String>> request,\n @TextCompletion(prompt = \"{prompt}\", model = \"$model$\", name = \"$name$\") TextCompletionResponse response,\n final ExecutionContext context) {\n return request.createResponseBuilder(HttpStatus.OK)\n .header(\"Content-Type\", \"application/json\")\n .body(response.getContent())\n .build();\n }\n}\n"
"function.java": "package $packageName$;\n\n/**\n * Visit https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java\n * to learn how to use this binding.\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-openai to your project dependencies.\n * 2. Add app settings appropriate for connecting to azure/non-azure openai following\n * https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-openai?tabs=isolated-process&pivots=programming-language-java#application-settings\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the \n * version to \"[4.*, 5.0.0)\"\n */\n\nimport com.microsoft.azure.functions.annotation.*;\nimport com.microsoft.azure.functions.*;\nimport com.microsoft.azure.functions.openai.annotation.textcompletion.TextCompletion;\nimport com.microsoft.azure.functions.openai.annotation.textcompletion.TextCompletionResponse;\n\nimport java.util.Optional;\n\npublic class $className$ {\n\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage textCompletion(\n @HttpTrigger(\n name = \"req\", \n methods = {HttpMethod.POST},\n authLevel = AuthorizationLevel.ANONYMOUS) \n HttpRequestMessage<Optional<String>> request,\n @TextCompletion(prompt = \"{prompt}\", model = \"$model$\", name = \"$name$\") TextCompletionResponse response,\n final ExecutionContext context) {\n return request.createResponseBuilder(HttpStatus.OK)\n .header(\"Content-Type\", \"application/json\")\n .body(response.getContent())\n .build();\n }\n}\n"
}
},
{
Expand Down

0 comments on commit 4610905

Please sign in to comment.