Package dev.langchain4j.service


package dev.langchain4j.service
  • Class
    Description
     
    AI Services provide a simpler and more flexible alternative to chains.
     
    The value of a method parameter annotated with @MemoryId will be used to find the memory belonging to that user/conversation.
    When a method in the AI Service is annotated with @Moderate, each invocation of this method will call not only the LLM, but also the moderation model (which must be provided during the construction of the AI Service) in parallel.
    Thrown when content moderation fails, i.e., when content is flagged by the moderation model.
     
     
     
     
    Specifies either a complete system message (prompt) or a system message template to be used each time an AI service is invoked.
    Represents a token stream from language model to which you can subscribe and receive updates when a new token is available, when language model finishes streaming, or when an error occurs during streaming.
    Specifies either a complete user message or a user message template to be used each time an AI service is invoked.
    The value of a method parameter annotated with @UserName will be injected into the field 'name' of a UserMessage.
    When a parameter of a method in an AI Service is annotated with @V, it becomes a prompt template variable.