Skip to content

Commit 4a2f72d

Browse files
committed
java-initial-refactoring merge
2 parents 02d811a + 590d587 commit 4a2f72d

File tree

6 files changed

+10
-28
lines changed

6 files changed

+10
-28
lines changed

app/backend/pom.xml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,6 @@
6666
<groupId>com.azure</groupId>
6767
<artifactId>azure-storage-blob</artifactId>
6868
</dependency>
69-
70-
<dependency>
71-
<groupId>com.microsoft.semantic-kernel</groupId>
72-
<artifactId>semantickernel-api</artifactId>
73-
<version>${semantic-kernel.version}</version>
74-
</dependency>
75-
<dependency>
76-
<groupId>com.microsoft.semantic-kernel</groupId>
77-
<artifactId>semantickernel-core</artifactId>
78-
<scope>runtime</scope>
79-
<version>${semantic-kernel.version}</version>
80-
</dependency>
81-
<dependency>
82-
<groupId>com.microsoft.semantic-kernel</groupId>
83-
<artifactId>semantickernel-connectors-ai-openai</artifactId>
84-
<version>${semantic-kernel.version}</version>
85-
</dependency>
86-
<dependency>
87-
<groupId>com.microsoft.semantic-kernel</groupId>
88-
<artifactId>semantickernel-planners</artifactId>
89-
<version>${semantic-kernel.version}</version>
90-
</dependency>
9169
</dependencies>
9270

9371
<build>

app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/RetrieveThenReadApproach.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public RAGResponse run(String question, RAGOptions options) {
5656

5757
Completions completionsResults = openAIProxy.getCompletions(completionsOptions);
5858

59-
logger.debug("Completion generated with Prompt Tokens[{}], Completions Tokens[{}], Total Tokens[{}]",
59+
logger.info("Completion generated with Prompt Tokens[{}], Completions Tokens[{}], Total Tokens[{}]",
6060
completionsResults.getUsage().getPromptTokens(),
6161
completionsResults.getUsage().getCompletionTokens(),
6262
completionsResults.getUsage().getTotalTokens());

app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/ChatReadRetrieveReadApproach.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public RAGResponse run(ChatGPTConversation conversation, RAGOptions options) {
5757
// STEP 3: Generate a contextual and content specific answer using the search results and chat history
5858
ChatCompletions chatCompletions = openAIProxy.getChatCompletions(chatCompletionsOptions);
5959

60-
logger.debug("Chat completion generated with Prompt Tokens[{}], Completions Tokens[{}], Total Tokens[{}]",
60+
logger.info("Chat completion generated with Prompt Tokens[{}], Completions Tokens[{}], Total Tokens[{}]",
6161
chatCompletions.getUsage().getPromptTokens(),
6262
chatCompletions.getUsage().getCompletionTokens(),
6363
chatCompletions.getUsage().getTotalTokens());

app/backend/src/main/java/com/microsoft/openai/samples/rag/config/CognitiveSearchConfiguration.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.azure.search.documents.SearchClientBuilder;
1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.beans.factory.annotation.Value;
12+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
1213
import org.springframework.context.annotation.Bean;
1314
import org.springframework.context.annotation.Configuration;
1415
import org.springframework.context.annotation.Profile;
@@ -21,9 +22,10 @@ public class CognitiveSearchConfiguration {
2122

2223
@Autowired
2324
TokenCredential tokenCredential;
24-
@Profile("dev")
25+
2526
@Bean
26-
public SearchClient debugEnabledClient() {
27+
@ConditionalOnProperty(name = "openai.tracing.enabled", havingValue = "true")
28+
public SearchClient tracingEnabledClient() {
2729
String endpoint = "https://%s.search.windows.net".formatted(searchServiceName);
2830

2931
var httpLogOptions = new HttpLogOptions();
@@ -41,7 +43,7 @@ public SearchClient debugEnabledClient() {
4143

4244

4345
@Bean
44-
@Profile("default")
46+
@ConditionalOnProperty(name = "openai.tracing.enabled", havingValue = "false")
4547
public SearchClient productionEnabledClient() {
4648
String endpoint = "https://%s.search.windows.net".formatted(searchServiceName);
4749
return new SearchClientBuilder()

app/backend/src/main/resources/application.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ openai.tracing.enabled=${AZURE_OPENAI_TRACING_ENABLED:false}
88

99
cognitive.search.service=${AZURE_SEARCH_SERVICE:gptkb-hxy5hdyir5eaa}
1010
cognitive.search.index=${AZURE_SEARCH_INDEX:gptkbindex}
11+
cognitive.tracing.enabled=${AZURE_SEARCH_TRACING_ENABLED:false}
12+
1113

1214
storage-account.service=${AZURE_STORAGE_ACCOUNT:sthxy5hdyir5eaa}
1315
blob.container.name=${AZURE_STORAGE_CONTAINER:content}

app/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ echo ""
4343

4444
cd ../backend
4545
xdg-open http://localhost:8080
46-
./mvnw spring-boot:run
46+
./mvnw spring-boot:run -Dspring-boot.run.profiles=dev
4747
if [ $? -ne 0 ]; then
4848
echo "Failed to start backend"
4949
exit $?

0 commit comments

Comments
 (0)