Sentiment analysis with few-shot prompting
In a rencent article, we talked about text classification using Gemini and LangChain4j.
A typical example of text classification is the case of sentiment analysis.
In my LangChain4j-powered Gemini workshop, I used this use case to illustrate the classification problem:
ChatLanguageModel model = VertexAiGeminiChatModel.builder() .project(System.getenv("PROJECT_ID")) .location(System.getenv("LOCATION")) .modelName("gemini-1.5-flash-001") .maxOutputTokens(10) .maxRetries(3) .build(); PromptTemplate promptTemplate = PromptTemplate.from(""" Analyze the sentiment of the text below. Respond only with one word to describe the sentiment. INPUT: This is fantastic news!
Read more...