-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Description
I have a AI service with request scope that I want to test. Despite I have annotated the testing method with @ActivateRequestContext
it still fails with the following error:
2025-02-26 16:30:44,049 ERROR [io.qua.lan.tes.sco.Scorer] (pool-8-thread-1) Failed to evaluate sample `Medical`: java.lang.AssertionError: Failed to execute sample EvaluationSample[name=Medical, parameters=io.quarkiverse.langchain4j.testing.scorer.Parameters@fe451ee, expectedOutput=MEDICAL, tags=[]]
at io.quarkiverse.langchain4j.testing.scorer.Scorer.execute(Scorer.java:98)
at io.quarkiverse.langchain4j.testing.scorer.Scorer.lambda$evaluate$0(Scorer.java:43)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=org.agenticai.routing.CategoryRouter$$QuarkusImpl, id=Rf2qKJjPmnBesgNwSLYG4vrrFhA]
- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:76)
at io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:32)
at org.agenticai.routing.CategoryRouter$$QuarkusImpl_ClientProxy.arc$delegate(Unknown Source)
at org.agenticai.routing.CategoryRouter$$QuarkusImpl_ClientProxy.classify(Unknown Source)
at org.agenticai.routing.CategoryRouterTest.lambda$testCategoryRouter$0(CategoryRouterTest.java:39)
at io.quarkiverse.langchain4j.testing.scorer.Scorer.execute(Scorer.java:96)
... 6 more
jakarta.enterprise.context.ContextNotActiveException: RequestScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=org.agenticai.routing.CategoryRouter$$QuarkusImpl, id=Rf2qKJjPmnBesgNwSLYG4vrrFhA]
- you can activate the request context for a specific method using the @ActivateRequestContext interceptor binding
A reproducer for this problem can be found here https://github.com/mariofusco/quarkus-agentic-ai/blob/main/src/test/java/org/agenticai/routing/CategoryRouterTest.java
/cc @geoand @cescoffier
Metadata
Metadata
Assignees
Labels
No labels