-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Blocking Memory Store Usage in Streamed Mode #1144
Fix Blocking Memory Store Usage in Streamed Mode #1144
Conversation
Draft - I would like to implement some tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks - I have verified the fix to work!
BTW: I suspect using a |
@florian-h05 that's why I want to add some tests. I believe it's fine, as it uses a slightly weird manner to switch to another thread (loosing the context). I may adapt it at the same time. |
43e09c6
to
d68fd30
Compare
.../java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java
Show resolved
Hide resolved
d68fd30
to
28451d3
Compare
/** | ||
* Utility class for streaming tests. | ||
*/ | ||
public class StreamTestUtils { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
This comment has been minimized.
This comment has been minimized.
@geoand .... I may have to fix the ordering issue actually, the completion signal got sent before the items. |
Darn.... Happened sooner than we expected :( |
This commit addresses issues with using the blocking memory store in streamed responses. * Ensures the execution captures whether the caller is running on a worker thread. * Switches to worker threads for every emission and completion event when the caller is using a worker thread. * Relies on executeBlocking to propagate the context automatically when possible. Note: * The blocking memory store cannot be used when invoked on the event loop. It now requires that the caller must be on a worker thread.
28451d3
to
0690a53
Compare
Status for workflow
|
@cescoffier The same issue occurs when using the retrieval augmentor:
|
The retrieval augmented is called before we create the stream. Did you try
adding @Blocking?
Unfortunately, I don't believe I will have the time to revisit this soon.
…On Wed 8 Jan 2025 at 15:09, Florian Hotze ***@***.***> wrote:
@cescoffier <https://github.com/cescoffier> The same issue occurs when
using the retrieval augmentor:
org.jboss.resteasy.reactive.common.core.BlockingNotAllowedException
at org.jboss.resteasy.reactive.client.impl.InvocationBuilderImpl.unwrap(InvocationBuilderImpl.java:199)
at org.jboss.resteasy.reactive.client.impl.InvocationBuilderImpl.method(InvocationBuilderImpl.java:328)
at io.quarkiverse.langchain4j.openai.common.OpenAiRestApi$$QuarkusRestClientInterface.blockingEmbedding(Unknown Source)
at io.quarkiverse.langchain4j.openai.common.QuarkusOpenAiClient$5.execute(QuarkusOpenAiClient.java:339)
at io.quarkiverse.langchain4j.openai.common.QuarkusOpenAiClient$5.execute(QuarkusOpenAiClient.java:336)
at io.quarkiverse.langchain4j.azure.openai.AzureOpenAiEmbeddingModel.lambda$embedTexts$0(AzureOpenAiEmbeddingModel.java:119)
at dev.langchain4j.internal.RetryUtils$RetryPolicy.withRetry(RetryUtils.java:192)
at dev.langchain4j.internal.RetryUtils.withRetry(RetryUtils.java:229)
at io.quarkiverse.langchain4j.azure.openai.AzureOpenAiEmbeddingModel.embedTexts(AzureOpenAiEmbeddingModel.java:119)
at io.quarkiverse.langchain4j.azure.openai.AzureOpenAiEmbeddingModel.embedAll(AzureOpenAiEmbeddingModel.java:103)
at dev.langchain4j.model.embedding.EmbeddingModel.embed(EmbeddingModel.java:34)
at dev.langchain4j.model.embedding.EmbeddingModel.embed(EmbeddingModel.java:24)
—
Reply to this email directly, view it on GitHub
<#1144 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADCG7J53QIS7PT2HVRJ2CD2JUWRZAVCNFSM6AAAAABTJLTOASVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXG43DIMBWGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Fix #1120
This commit addresses issues with using the blocking memory store in streamed responses.
Note: