Skip to content

Commit 8219092

Browse files
author
Milder Hernandez Cagua
committed
Fix RAGApproachFactorySpringBootImpl.createApproach
1 parent 802b107 commit 8219092

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@ public class RAGApproachFactorySpringBootImpl implements RAGApproachFactory, App
3030
public RAGApproach createApproach(String approachName, RAGType ragType, RAGOptions ragOptions) {
3131

3232
if (ragType.equals(RAGType.CHAT)) {
33-
if (JAVA_SEMANTIC_KERNEL.equals(approachName)) {
33+
if (JAVA_OPENAI_SDK.equals(approachName)) {
34+
return applicationContext.getBean(PlainJavaChatApproach.class);
35+
} else if (JAVA_SEMANTIC_KERNEL.equals(approachName)) {
3436
return applicationContext.getBean(JavaSemanticKernelWithMemoryChatApproach.class);
3537
} else if (
3638
JAVA_SEMANTIC_KERNEL_PLANNER.equals(approachName) &&
3739
ragOptions != null &&
3840
ragOptions.getSemantickKernelMode() != null &&
3941
ragOptions.getSemantickKernelMode() == SemanticKernelMode.chains) {
4042
return applicationContext.getBean(JavaSemanticKernelChainsChatApproach.class);
41-
} else {
42-
return applicationContext.getBean(PlainJavaChatApproach.class);
4343
}
4444
} else if (ragType.equals(RAGType.ASK)) {
4545
if (JAVA_OPENAI_SDK.equals(approachName))
@@ -50,7 +50,6 @@ else if (JAVA_SEMANTIC_KERNEL_PLANNER.equals(approachName) && ragOptions.getSema
5050
return applicationContext.getBean(JavaSemanticKernelPlannerApproach.class);
5151
else if (JAVA_SEMANTIC_KERNEL_PLANNER.equals(approachName) && ragOptions != null && ragOptions.getSemantickKernelMode() != null && ragOptions.getSemantickKernelMode() == SemanticKernelMode.chains)
5252
return applicationContext.getBean(JavaSemanticKernelChainsApproach.class);
53-
5453
}
5554
//if this point is reached then the combination of approach and rag type is not supported
5655
throw new IllegalArgumentException("Invalid combination for approach[%s] and rag type[%s]: ".formatted(approachName, ragType));

0 commit comments

Comments
 (0)