Annotation Interface ImageUrl


@Retention(RUNTIME) @Target(PARAMETER) public @interface ImageUrl
This annotation is useful when an AiService is meant to describe an image as the value of the method parameter annotated with @ImageUrl will be used as an ImageContent.

The following code contains an example of how this can be used:

 
 @RegisterAiService(chatMemoryProviderSupplier = RegisterAiService.NoChatMemoryProviderSupplier.class)
 public interface PdfDescriber {

     @UserMessage("This is image was reported on a GitHub issue. If this is a snippet of Java code, please respond"
             + " with only the Java code. If it is not, respond with 'NOT AN IMAGE'")
     Report describe(@ImageUrl String url);
 }
 
 
There can be at most one instance of ImageUrl per method and the supported types are the following:
  • String
  • URL
  • URI
  • dev.langchain4j.data.image.Image