Skip to content

Commit

Permalink
Merge pull request #594 from quarkiverse/default-memory-per-method
Browse files Browse the repository at this point in the history
Segregate memory of concurrent requests to different AI services
  • Loading branch information
geoand committed May 16, 2024
2 parents 9f82cf7 + aa95402 commit 4975f10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ private static Object memoryId(AiServiceMethodCreateInfo createInfo, Object[] me
for (DefaultMemoryIdProvider provider : DEFAULT_MEMORY_ID_PROVIDERS) {
Object memoryId = provider.getMemoryId();
if (memoryId != null) {
return memoryId;
String perServiceSuffix = "#" + createInfo.getInterfaceName() + "." + createInfo.getMethodName();
return memoryId + perServiceSuffix;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.quarkiverse.langchain4j.RegisterAiService;
import io.quarkiverse.langchain4j.openai.testing.internal.OpenAiBaseTest;
import io.quarkiverse.langchain4j.testing.internal.WiremockAware;
import io.quarkus.arc.InjectableContext;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.websockets.next.OnOpen;
Expand Down Expand Up @@ -77,7 +76,7 @@ public void restRequest() {
.statusCode(200);

assertThat(chatMemoryStore.idsFromGetMessages).hasSize(1)
.hasOnlyElementsOfType(InjectableContext.ContextState.class);
.hasOnlyElementsOfType(String.class);
assertThat(chatMemoryStore.idsFromGetMessages).hasSameElementsAs(chatMemoryStore.idsFromDeleteMessaged);

when()
Expand All @@ -86,7 +85,7 @@ public void restRequest() {
.statusCode(200);

assertThat(chatMemoryStore.idsFromGetMessages).hasSize(2)
.hasOnlyElementsOfType(InjectableContext.ContextState.class);
.hasOnlyElementsOfType(String.class);
assertThat(chatMemoryStore.idsFromGetMessages).hasSameElementsAs(chatMemoryStore.idsFromDeleteMessaged);
}

Expand Down

0 comments on commit 4975f10

Please sign in to comment.