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

[BUG] AI Service fails when user message contains template variables #1125

Open
langchain4j opened this issue May 18, 2024 · 5 comments
Open
Assignees
Labels
bug Something isn't working good first issue Good for newcomers P1 Highest priority

Comments

@langchain4j
Copy link
Owner

Describe the bug
AI Service fails when user message contains template variables.

Log and Stack trace

dev.langchain4j.exception.IllegalConfigurationException: Error: cannot find the value of the prompt template variable "{{it}}".
    at dev.langchain4j.exception.IllegalConfigurationException.illegalConfiguration(IllegalConfigurationException.java:12)
    at dev.langchain4j.service.DefaultAiServices.getValueOfVariableIt(DefaultAiServices.java:247)
    at dev.langchain4j.service.DefaultAiServices.findTemplateVariables(DefaultAiServices.java:223)
    at dev.langchain4j.service.DefaultAiServices.prepareUserMessage(DefaultAiServices.java:258)

To Reproduce

@AiService
public interface AiAssistant {

    TokenStream chat(@MemoryId String chatId, @UserMessage String userMessage);
}

assistant.chat("12345", "Text containing {{it}}");

Please complete the following information:

  • LangChain4j version: latest
@langchain4j langchain4j added bug Something isn't working P1 Highest priority good first issue Good for newcomers labels May 18, 2024
@KaisNeffati
Copy link
Contributor

Hey ! Could you please clarify the expected behavior for this issue ?

@langchain4j
Copy link
Owner Author

Hi @KaisNeffati, it should not fail. In this case {{it}} (or any other variable) should not be treated as variable, but as a text

@anunnakian
Copy link
Contributor

Hello @KaisNeffati, are you going to work on this issue ?

@KaisNeffati
Copy link
Contributor

@anunnakian I was planning to do that, but I didn't have the time. Feel free to go for it if you'd like to

@anunnakian
Copy link
Contributor

Ok thanks! @langchain4j could you assign me to this issue, I'll work on it today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers P1 Highest priority
Projects
None yet
Development

No branches or pull requests

3 participants