-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from Azure-Samples/gk/generative-usecases
add synthentic data generation use case using azure openai java sdk
- Loading branch information
Showing
15 changed files
with
249 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
COMPOSEPROJECTNAME=miyagi-backing-services | ||
KAFKABOOTSTRAPSERVERS=<replace_with_your_servicebus_id>.servicebus.windows.net:9093 | ||
KAFKASECURITYPROTOCOL=SASL_SSL | ||
KAFKASASLMECHANISM=PLAIN | ||
KAFKATOPICGROUP=order-service | ||
KAFKATOPICNAME=miyagi | ||
KAFKASASLJAASCONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username="$ConnectionString" password="<replace_with_your_kafka_password>"; | ||
MYSQLURL=jdbc:mysql://<replace>.mysql.database.azure.com/miyagi | ||
MYSQLUSER=miyagi | ||
MYSQLPASSWORD=<replace_with_your_mysql_password> | ||
AZUREREDISHOST=<replace>.redis.cache.windows.net | ||
AZUREREDISPORT=6380 | ||
AZUREREDISACCESSKEY=<replace_with_your_redis_access_key> | ||
AZURECOSMOSDBURI=https://miyagi20988gok29744.documents.azure.com:443/ | ||
AZURECOSMOSDBKEY=<replace_with_your_cosmos_db_key> | ||
AZURECOSMOSDBSECONDARYKEY=<replace_with_your_cosmos_db_secondary_key> | ||
AZURECOSMOSDBDATABASENAME=miyagi | ||
AZURESTORAGEACCOUNTNAME=miyagi20988gok29744 | ||
AZURESTORAGEACCOUNTKEY=<replace_with_your_storage_account_key> | ||
AZURESTORAGEENDPOINT=https://miyagi20988gok29744.blob.core.windows.net | ||
APPLICATIONINSIGHTSPREVIEWPROFILERENABLED=true | ||
APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=<replace_with_your_instrumentation_key>;IngestionEndpoint=https://eastus-8.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus.livediagnostics.monitor.azure.com/ | ||
AZUREKEYVAULTCLIENTID=<replace> | ||
AZUREKEYVAULTCLIENTSECRET=<replace_with_your_key_vault_client_secret> | ||
AZUREKEYVAULTENDPOINT=https://miyagispringkv.vault.azure.net/ | ||
AZUREKEYVAULTTENANTID=72f988bf-86f1-41af-91ab-2d7cd011db47 | ||
SERVICEBUSCONNECTIONSTRING=Endpoint=sb://sbusmiyagi20988gok29744.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<replace_with_your_service_bus_shared_access_key> | ||
POSTGRESQLURL=jdbc:postgresql://miyagi-pg.postgres.database.azure.com:5432/miyagi?sslmode=require | ||
POSTGRESQLUSER=miyagi_user | ||
POSTGRESQLPASSWORD=<replace_with_your_postgresql_password> | ||
AZURE_OPENAI_KEY=<replace_with_your_openai_key> | ||
AZURE_OPENAI_ENDPOINT=https://gk-oai.openai.azure.com/ | ||
AZURE_OPENAI_MODEL_ID=gk-gpt-35 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
.../user-service/src/main/java/com/microsoft/gbb/miyagi/userservice/config/OpenAIConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.microsoft.gbb.miyagi.userservice.config; | ||
|
||
import com.azure.ai.openai.OpenAIClient; | ||
import com.azure.ai.openai.OpenAIClientBuilder; | ||
import com.azure.core.credential.AzureKeyCredential; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class OpenAIConfig { | ||
|
||
@Value("${openai.key}") | ||
private String openAIKey; | ||
|
||
@Value("${openai.endpoint}") | ||
private String openAIEndpoint; | ||
|
||
@Value("${openai.model.id}") | ||
private String openAIModelId; | ||
|
||
@Bean | ||
public OpenAIClient openAIClient() { | ||
return new OpenAIClientBuilder() | ||
.endpoint(openAIEndpoint) | ||
.credential(new AzureKeyCredential(openAIKey)) | ||
.buildClient(); | ||
} | ||
|
||
public String getOpenAIModelId() { | ||
return openAIModelId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...rc/main/java/com/microsoft/gbb/miyagi/userservice/service/ISyntheticGeneratorService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.microsoft.gbb.miyagi.userservice.service; | ||
|
||
import com.microsoft.gbb.miyagi.userservice.entity.Aspirations; | ||
import com.microsoft.gbb.miyagi.userservice.entity.FinancialProfile; | ||
import com.microsoft.gbb.miyagi.userservice.entity.UserProfile; | ||
|
||
import java.util.List; | ||
|
||
public interface ISyntheticGeneratorService { | ||
UserProfile generateFakeUserProfile(); | ||
FinancialProfile generateFakeFinancialProfile(); | ||
Aspirations generateFakeAspirations(); | ||
List<String> generateRandomHobbyList(int count); | ||
List<String> generateRandomCountryList(int count); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.