Skip to content

Commit

Permalink
Clarify difference between OpenAI and Azure OpenAI
Browse files Browse the repository at this point in the history
  • Loading branch information
agoncal committed Sep 5, 2023
1 parent 85ca6e4 commit 2ff1a21
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[[introduction-installing-ai]]

= OpenAI or AzureAI Subscriptions
= OpenAI or Azure OpenAI Subscriptions

The Narration microservice needs to access an AI service to generate the text narrating the fight.
You can choose between OpenAI or AzureAI.
You can choose between OpenAI or Azure OpenAI.
Azure OpenAI, or "OpenAI on Azure" is a service that provides REST API access to OpenAI's models, including the GPT-4, GPT-3, Codex and Embeddings series.
The difference between OpenAI and Azure OpenAI is that it runs on Azure global infrastructure, which meets your production needs for critical enterprise security, compliance, and regional availability.

== OpenAI

Expand All @@ -16,14 +18,14 @@ TODO
TODO
TODO

== AzureAI
== Azure OpenAI

If you already have an Azure subscription, you can use it to create an AzureAI resource.
Otherwise, you can create a https://azure.microsoft.com/free[free Azure subscription] and use it to create an AzureAI resource.
Then, you need to use the AzureAI service to generate the API key and endpoint URL.
If you already have an Azure subscription, you can use it to create an Azure OpenAI resource.
Otherwise, you can create a https://azure.microsoft.com/free[free Azure subscription] and use it to create an Azure OpenAI resource.
Then, you need to use the Azure OpenAI service to generate the API key and endpoint URL.
You can either do that using the https://portal.azure.com/[Azure Portal] or the https://learn.microsoft.com/cli/azure/[Azure CLI].

The easiest being use the Azure CLI, we recommend that you https://learn.microsoft.com/cli/azure/install-azure-cli[install it] and use it to create the AzureAI resource and generate the API key and endpoint URL.
The easiest being use the Azure CLI, we recommend that you https://learn.microsoft.com/cli/azure/install-azure-cli[install it] and use it to create the Azure OpenAI resource and generate the API key and endpoint URL.
Once Azure CLI is installed and you have your Azure subscription, sign in to your Azure account:

[source,shell]
Expand All @@ -44,14 +46,14 @@ az account show
----
====

Then, execute the following command to create the AzureAI resources:
Then, execute the following command to create the Azure OpenAI resources:

[source,bash]
----
include::../../../../../super-heroes/infrastructure/ai-azure-openai-create.sh[tags=adocSetup;!adocSkip]
----

This script will create the AzureAI resource and deploy the model.
This script will create the Azure OpenAI resource and deploy the model.
Once the script has executed, you can use the following command to get the API key and endpoint URL.
You will need these properties later one when you will configure the Narration microservice:

Expand All @@ -60,7 +62,7 @@ You will need these properties later one when you will configure the Narration m
include::../../../../../super-heroes/infrastructure/ai-azure-openai-create.sh[tag=adocProperties]
----

Once you've finished the workshop, remember to delete the AzureAI resources to avoid being charged for it:
Once you've finished the workshop, remember to delete the Azure OpenAI resources to avoid being charged for it:

[source,bash]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You will be developing several microservices communicating either synchronously
The Super Hero UI is exposed via Quarkus and invokes the Fight REST API
* _Villain REST API_: A classical HTTP microservice exposing CRUD operations on Villains, stored in a PostgreSQL database
* _Hero REST API_: A reactive HTTP microservice exposing CRUD operations on Heroes, stored in a Postgres database
* _Narration REST API_: This microservice talks to OpenAI/AzureAI to generate a random narration of the fight.
* _Narration REST API_: This microservice talks to OpenAI/Azure OpenAI to generate a random narration of the fight.
* _Fight REST API_: This REST API invokes the Hero and Villain APIs to get a random superhero and supervillain.
It also invokes the Narration API to get a random narration of the fight.
Each fight is, then, stored in a PostgreSQL database (not the narration).
Expand Down Expand Up @@ -107,7 +107,7 @@ This workshop will make use of the following software, tools, frameworks that yo
* GraalVM {graalvm-version}
* Docker
* cURL (or any other command line HTTP client)
* OpenAI or AzureAI keys (optional, only if you want to use the narration feature)
* OpenAI or Azure OpenAI keys (optional, only if you want to use the narration feature)
* Angular (optional, only if you are in a _frontend_ mood)

We will also be using Maven {maven-version}, but there is no
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ What you are going to learn:
* How you test your microservice
* How to build a reactive microservice, including reactive data access
* How you improve the resilience of your service
* How to invoke OpenAI/AzureAI APIs using Semantic Kernel
* How to invoke OpenAI/Azure OpenAI APIs using Semantic Kernel
* How to build event-driven microservices with Kafka
* How to build native executable
* How to extend Quarkus with extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ For that, you need to create a set of directories unders `rest-narration/src/mai
--
Under the `NarrationSkill/NarrateFight` directory, create the following files:

* `skprompt.txt`: the prompt that will be sent to OpenAI/AzureAI
* `skprompt.txt`: the prompt that will be sent to OpenAI/Azure OpenAI
* `config.json`: the configuration of the skill

Under `src/main/resources/NarrationSkill/NarrateFight/`, create the `skprompt.txt` file with the following content.
Expand All @@ -256,10 +256,10 @@ include::../../../../../super-heroes/rest-narration/src/main/resources/Narration
----
--

=== Configuring OpenAI/AzureAI access
=== Configuring OpenAI/Azure OpenAI access

Configuring the OpenAI/AzureAI access is made thanks to the `conf.properties`.
Depending if you have chosen OpenAI or AzureAI, you either need to use the `client.openai` or `client.azureopenai` configuration keys:
Configuring the OpenAI/Azure OpenAI access is made thanks to the `conf.properties`.
Depending if you have chosen OpenAI or Azure OpenAI, you either need to use the `client.openai` or `client.azureopenai` configuration keys:

[example, role="cta"]
--
Expand All @@ -272,7 +272,7 @@ client.azureopenai.endpoint=
client.azureopenai.deploymentname=
----

For AzureAI, use the following configuration in the `rest-narration/src/main/resources/conf.properties` file:
For Azure OpenAI, use the following configuration in the `rest-narration/src/main/resources/conf.properties` file:

[source,properties]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ node "Narration" as narration {
narrationQuarkus .up> sk
}

cloud "Open AI \n AzureAI" as openai
cloud "Open AI \n Azure OpenAI" as openai

node "Fight" as fight {
agent "Quarkus" <<application>> as fightQuarkus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ node "Narration" as narration {
narrationQuarkus .up> sk
}

cloud "Open AI \n AzureAI" as openai
cloud "Open AI \n Azure OpenAI" as openai

node "Fight" as fight {
agent "Quarkus" <<application>> as fightQuarkus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ node "Narration" as hero {
narrationQuarkus .up> sk
}

cloud "Open AI \n AzureAI" as openai
cloud "Open AI \n Azure OpenAI" as openai

REST ()-- narrationQuarkus
sk --> openai : HTTP
Expand Down

0 comments on commit 2ff1a21

Please sign in to comment.