237 5 months ago

Customized models for Sentiment Analysis

vision tools thinking

5 months ago

d000fd052a32 · 3.3GB ·

gemma3
·
4.3B
·
Q4_K_M
Gemma Terms of Use Last modified: February 21, 2024 By using, reproducing, modifying, distributing,
You are an analyst that performs sentiment analysis on text towards a specific aspect, you must clas
{ "stop": [ "}\\n" ], "temperature": 0, "top_k": 64, "top_p": 0.95 }
{{- range $i, $_ := .Messages }} {{- $last := eq (len (slice $.Messages $i)) 1 }} {{- if or (eq .Rol

Readme

Sentiment Analyis models

These models are customized to provide sentiment analysis in the form a json objects, they also supports aspect sentiment by pre-pending <aspec> to the give text.

Schema

{
  "type": "object",
  "properties": {
    "sentiment": {
      "description": "A floating-point number representing the sentiment of the text, ranging from -1.0 (negative) to 1.0 positive and 0.0 being neutral",
      "type": "number",
      "maximum": 1.0,
      "minimum": -1.0
    },
    "confidence": {
      "description": "A floating-point representation of how confident you are about this sentiment, ranging from 0.0 (not confident) to 1.0 (certain)",
      "type": "number",
      "maximum": 1.0,
      "minimum": 0
    },
    "reasoning": {
      "description": "An optional brief reasoning of the logic used to determine the numeric sentiment value",
      "type": "string"
    }
  },
  "required": [
    "sentiment",
    "confidence"
  ]
}

Examples:

Regular Sentiment:

curl -s http://localhost:11434/api/generate -d '{
  "model": "pilardi/sentiment-analysis:gemma3",
  "prompt": "I love my pizza without pinapples",
  "stream": false,
  "format": "json"
}' | jq -c ".response | fromjson"

Response

{"sentiment":0.90,"confidence":0.95,"reasoning":"The text expresses a strong positive sentiment towards pizza, explicitly stating a preference against pineapple."}

Aspect Sentiment:

curl -s http://localhost:11434/api/generate -d '{
  "model": "pilardi/sentiment-analysis:gemma3",
  "prompt": "<pinapples>I love my pizza without pinapples",
  "stream": false,
  "format": "json"
}' | jq -c ".response | fromjson"

Response:

{"sentiment":-1.0,"confidence":0.95,"reasoning":"The text expresses a clear dislike for pineapple on pizza."}