33 questions
0 votes
1 answer
33 views
Langchain4j and Quarkus AI Services - Not using annotated @Tool to call remote GraphQL API
I have a question about Quarkus Langchain4j. I have made this Quarkus (Java 25) project with the purpose of exposing an API that receives a search text, processes it with an "extractor” AI ...
0 votes
1 answer
111 views
With Gemini and LangChain4j, how to use Structured output while retrieving metadata?
I use Gemini to get information about historical figures : public interface Historian { @UserMessage(""" You are a historian who is collecting information about ...
0 votes
0 answers
88 views
langchain4j mcp & memory - tool call
How does langhchain4j know how to generate the arguments for MCP tool calling? I have implemented an chatAgent with MessageWindowChatMemory.withMaxMessages(50). The tools are added dynamically from an ...
0 votes
1 answer
120 views
How do I prevent duplicate messages in context window, when using rag and memory?
When using rag and memory, multiple identical copies of the same information is sent to the ai, when asking related questions. I have import java.util.ArrayList; import java.util.List; import dev....
0 votes
1 answer
143 views
How to conditionally include a variable in a @UserMessage prompt in LangChain4j (skip if null)?
I'm using LangChain4j to define prompts using @UserMessage annotations, like this: @UserMessage( "The alert is described as follows: {{description}}\n\n" + "HTTP response evidence:...
0 votes
0 answers
88 views
Budling an agent with mcp tools, but my context is too large/irrelevant how to filter?
I have a liveOrdersTool in langchain4j, my chat looks something like this : get live orders and tell me about them good response ... 1hr later ... get live orders and tell me about them, it ...
0 votes
0 answers
101 views
Error using @Tool Annotation in Kotlin with quarkus LangChain4J
I tried to develop a basic assistant and expose it as a tool in Kotlin, following the examples shown in: quarkus agentic ai step by step. However, when I try to use the @Tool annotation in my Kotlin ...
1 vote
1 answer
706 views
How to make Langchain4j's TokenStream work with StreamingChatLanguageModel using ToolProvider?
Im using the code below to generate an answer from Anthropic's Sonnet 3-7. When I add a tools/toolProvider to my streamAssistant, the code breaks every time I run a prompt that depends on a tool call. ...
0 votes
1 answer
433 views
I am using LangChain4j to develop a knowledge base and encountered the "different vector dimensions 1024 and 384"
I want to know if there are any other settings required for pgvector or what content needs to be set in the code to enable pgvector to support higher vector dimensions. I found on the official website ...
0 votes
1 answer
854 views
gpt-4o-search-preview Model In LangChain4J - Spring
Tonight I received the following from openAI via email: Web search delivers accurate and clearly-cited answers from the web. Using the same tool as search in ChatGPT, it’s great at conversation and ...
0 votes
1 answer
67 views
Is there a way to stop required parameters from being inferred and added to structured output?
I'll use a synthetic example - the real one is more complex. Consider trying to validate a freeform address. You want to be sure the user provided all the information needed and if not prompt them to ...
0 votes
1 answer
462 views
LangChain4j @AiService ChatModel Injection Issue - NullPointerException
I am developing an AI-assisted interface using LangChain4j and injecting OllamaChatModel, but I am encountering an issue where the application fails to start due to a NullPointerException related to @...
1 vote
1 answer
535 views
Provide tools programatically with quarkus-langchain4j
In vanilla langchain4j we can provide tools programatically https://docs.langchain4j.dev/tutorials/tools#specifying-tools-programmatically I don't seem to find a way to do the same with quarkus-...
0 votes
1 answer
399 views
Langchain4J - AnthropicChatModel - Issues with Custom Base URL based API calls - "Required Authorization Header Missing"
I am trying to use Langchain4J to connect to Open AI models and Anthropic model that are hosted behind my organization's base URL. The OpenAI Model is working fine. However, the Anthropic Model always ...
0 votes
1 answer
274 views
Maven dependency problem between spring data mongo and langchain4j mongo atlas
I am trying to integrate LangChain4j to my spring boot app that, by the way, is using Spring Data mongo. One of the things I realize (obviously) is that I dont want to use an in memory store bur ...