Skip to content
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

SystemMessage too large. #635

Open
fmatar opened this issue May 28, 2024 · 4 comments
Open

SystemMessage too large. #635

fmatar opened this issue May 28, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@fmatar
Copy link
Contributor

fmatar commented May 28, 2024

  @SystemMessage(value = "", fromResource = "large_prompt.txt")
  String chat(@MemoryId String cid, @UserMessage String userMessage);

If the file is large (mine is around 87kb) I get the following exception.

io.vertx.core.impl.NoStackTraceException
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#build threw an exception: java.lang.RuntimeException: Failed to record call to method public void io.quarkiverse.langchain4j.runtime.AiServicesRecorder.setMetadata(java.util.Map)
at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:480)
at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:501)
at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:201)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1570)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: String too large to record:

@geoand
Copy link
Collaborator

geoand commented May 29, 2024

We should fix this, but I'll just note that using such a huge prompt as a system or user message is almost certainly not a good idea

@jmartisk
Copy link
Collaborator

Why is this being recorded at all, shouldn't the system message be overridable at runtime?

@fmatar
Copy link
Contributor Author

fmatar commented May 29, 2024

I got around it by setting the SystemPrompt to a variable.

@SystemMessage="{system_prompt}"

And then in my @PostConstruct I'm setting the prompt as a global variable.

Not the usual approach for doing thing however this specific prompt is dictated by a massive schema definition.

@geoand geoand added the bug Something isn't working label Jun 4, 2024
@geoand
Copy link
Collaborator

geoand commented Jun 5, 2024

Why is this being recorded at all, shouldn't the system message be overridable at runtime?

No, it's not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants