Skip to content

Commit 6835116

Browse files
committed
fixed unit tests and changed open AI version to the latest one
1 parent 59c53ed commit 6835116

File tree

7 files changed

+30
-35
lines changed

7 files changed

+30
-35
lines changed

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,9 @@ Below you can find the list of available implementations.
6161
|:---------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------|:----------------------|
6262
| One Shot Ask | [PlainJavaAskApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/PlainJavaAskApproach.java) | Use Azure AI Search and Java OpenAI APIs. It first retrieves top documents from search and use them to build a prompt. Then, it uses OpenAI to generate an answer for the user question.Several search retrieval options are available: Text, Vector, Hybrid. When Hybrid and Vector are selected an additional call to OpenAI is required to generate embeddings vector for the question. | :white_check_mark: | :x: |
6363
| Chat | [PlainJavaChatApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/PlainJavaChatApproach.java) | Use Azure AI Search and Java OpenAI APIs. It first calls OpenAI to generate a search keyword for the chat history and then answer to the last chat question.Several search retrieval options are available: Text, Vector, Hybrid. When Hybrid and Vector are selected an additional call to OpenAI is required to generate embeddings vector for the chat extracted keywords. | :white_check_mark: | :x: |
64-
| One Shot Ask | [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelWithMemoryApproach.java) | Use Java Semantic Kernel framework with built-in MemoryStore for embeddings similarity search. A semantic function [RAG.AnswerQuestion](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) is defined to build the prompt using Memory Store vector search results.A customized version of SK built-in [CognitiveSearchMemoryStore](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/memory/CustomAzureCognitiveSearchMemoryStore.java) is used to map index fields populated by the documents ingestion process. | :x: | :white_check_mark: |
64+
| One Shot Ask | [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelWithMemoryApproach.java) | Use Java Semantic Kernel framework with built-in MemoryStore for embeddings similarity search. A semantic function [RAG.AnswerQuestion](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) is defined to build the prompt using Memory Store vector search results.A customized version of SK built-in [CognitiveSearchMemoryStore](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/memory/CustomAzureCognitiveSearchMemoryStore.java) is used to map index fields populated by the documents ingestion process. | :x: | This approach is currently disabled within the UI, memory feature will be available in the next java Semantic Kernel GA release |
6565
| One Shot Ask | [JavaSemanticKernelChainsApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelChainsApproach.java) | Use Java Semantic Kernel framework with semantic and native functions chaining. It uses an imperative style for AI orchestration through semantic kernel functions chaining. [InformationFinder.SearchFromQuestion](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/retrieval/semantickernel/CognitiveSearchPlugin.java) native function and [RAG.AnswerQuestion](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) semantic function are called sequentially. Several search retrieval options are available: Text, Vector, Hybrid. | :x: | :white_check_mark: |
66-
| One Shot Ask | [JavaSemanticKernelPlannerApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelPlannerApproach.java) | Use Java Semantic Kernel framework with built-in Planner for functions orchestration. It uses a declarative style for AI orchestration through the built-in SequentialPlanner. SequentialPlanner call OpenAI to generate a plan for answering a question using available skills/plugins: [InformationFinder](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/CognitiveSearchPlugin.java) and [RAG](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json). Several search retrieval options are available: Text, Vector, Hybrid. ⚠️ This approach is currently disabled within the UI, pending fixes for this feature. | :x: | :white_check_mark: |
67-
| Chat | [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelWithMemoryChatApproach.java) | Use Java Semantic Kernel framework with built-in MemoryStore for embeddings similarity search. A semantic function [RAG.AnswerConversation](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) is defined to build the prompt using Memory Store vector search results. A customized version of SK built-in [CognitiveSearchMemoryStore](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/memory/CustomAzureCognitiveSearchMemoryStore.java) is used to map index fields populated by the documents ingestion process. | :x: | :white_check_mark: |
66+
| Chat | [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelWithMemoryChatApproach.java) | Use Java Semantic Kernel framework with built-in MemoryStore for embeddings similarity search. A semantic function [RAG.AnswerConversation](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerQuestion/config.json) is defined to build the prompt using Memory Store vector search results. A customized version of SK built-in [CognitiveSearchMemoryStore](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/memory/CustomAzureCognitiveSearchMemoryStore.java) is used to map index fields populated by the documents ingestion process. | :x: | :x: This approach is currently disabled within the UI, memory feature will be available in the next java Semantic Kernel GA release |
6867
| Chat | [JavaSemanticKernelChainsApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/chat/approaches/semantickernel/JavaSemanticKernelChainsChatApproach.java) | Use Java Semantic Kernel framework with semantic and native functions chaining. It uses an imperative style for AI orchestration through semantic kernel functions chaining. [InformationFinder.SearchFromConversation](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/retrieval/semantickernel/CognitiveSearchPlugin.java) native function and [RAG.AnswerConversation](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/resources/semantickernel/Plugins/RAG/AnswerConversation/config.json) semantic function are called sequentially. Several search retrieval options are available: Text, Vector, Hybrid. | :x: | :white_check_mark: |
6968

70-
The plain Java Open AI sdk based implementations are stable. Java Semantic Kernel based implementations are still experimental and it will be consolidated as soon as Java Semantic Kernel GA version will be released. Below a brief description of the SK integration status:
7169

72-
| RAG Approach | Status |
73-
|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------|
74-
| [JavaSemanticKernelWithMemoryApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelWithMemoryApproach.java) | :white_check_mark: |
75-
| [JavaSemanticKernelChainsApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelChainsApproach.java) | :white_check_mark: |
76-
| [JavaSemanticKernelPlannerApproach](https://github.com/Azure-Samples/azure-search-openai-demo-java/blob/main/app/backend/src/main/java/com/microsoft/openai/samples/rag/ask/approaches/semantickernel/JavaSemanticKernelPlannerApproach.java) | :x: This approach is currently disabled within the UI, pending fixes for this feature |

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public OpenAIClient openAItracingEnabledClient() {
3838
.endpoint(endpoint)
3939
.credential(tokenCredential)
4040
.httpLogOptions(httpLogOptions)
41-
.serviceVersion(OpenAIServiceVersion.V2023_05_15)
4241
.buildClient();
4342
}
4443

@@ -49,7 +48,6 @@ public OpenAIClient openAIDefaultClient() {
4948
return new OpenAIClientBuilder()
5049
.endpoint(endpoint)
5150
.credential(tokenCredential)
52-
.serviceVersion(OpenAIServiceVersion.V2023_05_15)
5351
.buildClient();
5452
}
5553

@@ -66,7 +64,6 @@ public OpenAIAsyncClient tracingEnabledAsyncClient() {
6664
.endpoint(endpoint)
6765
.credential(tokenCredential)
6866
.httpLogOptions(httpLogOptions)
69-
.serviceVersion(OpenAIServiceVersion.V2023_05_15)
7067
.buildAsyncClient();
7168
}
7269

@@ -77,7 +74,6 @@ public OpenAIAsyncClient defaultAsyncClient() {
7774
return new OpenAIClientBuilder()
7875
.endpoint(endpoint)
7976
.credential(tokenCredential)
80-
.serviceVersion(OpenAIServiceVersion.V2023_05_15)
8177
.buildAsyncClient();
8278
}
8379
}

app/backend/src/test/java/com/microsoft/openai/samples/rag/approaches/RAGApproachFactorySpringBootImplTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ void testCreateApproachWithJavaPlain() {
3838

3939
@Test
4040
void testCreateApproachWithJavaSemanticKernelMemory() {
41-
RAGApproach approach = ragApproachFactory.createApproach("jsk", RAGType.ASK, null);
41+
assertThrows(IllegalArgumentException.class, () -> {
42+
RAGApproach approach = ragApproachFactory.createApproach("jsk", RAGType.ASK, null);
43+
});
4244
//assertInstanceOf(JavaSemanticKernelWithMemoryApproach.class, approach);
4345
}
4446

@@ -49,13 +51,13 @@ void testCreateApproachWithJavaSemanticKernelChain() {
4951
assertInstanceOf(JavaSemanticKernelChainsApproach.class, approach);
5052
}
5153

52-
@Test
54+
@Test
5355
void testCreateApproachWithJavaSemanticKernelPlanner() {
54-
var ragOptions = new RAGOptions.Builder().semanticKernelMode("planner").build();
56+
var ragOptions = new RAGOptions.Builder().semanticKernelMode("planner").build();
57+
assertThrows(IllegalArgumentException.class, () -> {
5558
RAGApproach approach = ragApproachFactory.createApproach("jskp", RAGType.ASK, ragOptions);
56-
// assertInstanceOf(JavaSemanticKernelPlannerApproach.class, approach);
57-
}
58-
59+
});
60+
}
5961
@Test
6062
void testChatCreateApproachWithChat() {
6163
RAGApproach approach = ragApproachFactory.createApproach("jos", RAGType.CHAT, null);

app/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"node": ">=14.0.0"
88
},
99
"scripts": {
10-
"dev": "vite --port=8080",
10+
"dev": "vite --port=8081",
1111
"build": "tsc && vite build",
1212
"preview": "vite preview"
1313
},

app/frontend/src/pages/oneshot/OneShot.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,18 @@ export function Component(): JSX.Element {
232232
defaultSelectedKey={approach}
233233
onChange={onApproachChange}
234234
/>
235-
235+
{(approach === Approaches.JAVA_SEMANTIC_KERNEL_PLANNER) && (
236+
<Dropdown
237+
className={styles.oneshotSettingsSeparator}
238+
label="Semantic Kernel mode"
239+
options={[
240+
{ key: "chains", text: "Function Chaining", selected: skMode == SKMode.Chains, data: SKMode.Chains },
241+
{ key: "planner", text: "Planner", selected: skMode == SKMode.Planner, data: SKMode.Planner, disabled: true }
242+
]}
243+
required
244+
onChange={onSKModeChange}
245+
/>
246+
)}
236247
{(approach === Approaches.JAVA_OPENAI_SDK || approach === Approaches.JAVA_SEMANTIC_KERNEL) && (
237248
<TextField
238249
className={styles.oneshotSettingsSeparator}
@@ -285,18 +296,7 @@ export function Component(): JSX.Element {
285296
onChange={onRetrievalModeChange}
286297
/>
287298
)}
288-
{(approach === Approaches.JAVA_SEMANTIC_KERNEL_PLANNER) && (
289-
<Dropdown
290-
className={styles.oneshotSettingsSeparator}
291-
label="Semantic Kernel mode"
292-
options={[
293-
{ key: "chains", text: "Function Chaining", selected: skMode == SKMode.Chains, data: SKMode.Chains },
294-
{ key: "planner", text: "Planner", selected: skMode == SKMode.Planner, data: SKMode.Planner, disabled: true }
295-
]}
296-
required
297-
onChange={onSKModeChange}
298-
/>
299-
)}
299+
300300
{useLogin && (
301301
<Checkbox
302302
className={styles.oneshotSettingsSeparator}

app/frontend/vite.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ export default defineConfig({
3636
"/api/content": {
3737
target: 'http://localhost:8080',
3838
changeOrigin: true
39-
}
39+
},
40+
"/api/auth_setup": {
41+
target: 'http://localhost:8080',
42+
changeOrigin: true
43+
}
4044
}
4145
}
4246
});

app/start-compose.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$output = azd env get-values
1+
$output = azd -C ..\deploy\aca env get-values
22

33
foreach ($line in $output) {
44
$name, $value = $line.Split("=")

0 commit comments

Comments
 (0)