Skip to content
هذه الصفحة غير متوفرة بلغتك بعد. يتم عرض النسخة الإنجليزية.

AI Support

बुद्धिमान annotation सहायता के लिए LLMs को एकीकृत करें।

AI Support

Potato 2.0 में annotators को बुद्धिमान hints, keyword highlighting, और label suggestions के साथ सहायता करने के लिए Large Language Models (LLMs) के लिए built-in support शामिल है।

समर्थित Providers

Potato कई LLM providers का समर्थन करता है:

Cloud Providers:

  • OpenAI (GPT-4, GPT-4 Turbo, GPT-3.5)
  • Anthropic (Claude 3, Claude 3.5)
  • Google (Gemini 1.5 Pro, Gemini 2.0 Flash)
  • Hugging Face
  • OpenRouter

Local/Self-Hosted:

  • Ollama (models locally चलाएँ)
  • vLLM (high-performance self-hosted inference)

कॉन्फ़िगरेशन

बुनियादी सेटअप

अपनी configuration file में ai_support section जोड़ें:

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
    temperature: 0.3
    max_tokens: 500

Provider-Specific कॉन्फ़िगरेशन

OpenAI

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4o
    api_key: ${OPENAI_API_KEY}
    temperature: 0.3
    max_tokens: 500

Anthropic Claude

yaml
ai_support:
  enabled: true
  endpoint_type: anthropic
 
  ai_config:
    model: claude-3-sonnet-20240229
    api_key: ${ANTHROPIC_API_KEY}
    temperature: 0.3
    max_tokens: 500

Google Gemini

yaml
ai_support:
  enabled: true
  endpoint_type: google
 
  ai_config:
    model: gemini-1.5-pro
    api_key: ${GOOGLE_API_KEY}

Local Ollama

yaml
ai_support:
  enabled: true
  endpoint_type: ollama
 
  ai_config:
    model: llama2
    base_url: http://localhost:11434

vLLM (Self-Hosted)

yaml
ai_support:
  enabled: true
  endpoint_type: vllm
 
  ai_config:
    model: meta-llama/Llama-2-7b-chat-hf
    base_url: http://localhost:8000/v1

Visual AI Endpoints

v2.1.0 में नया

Image और video annotation tasks के लिए, Potato YOLO, Ollama Vision, OpenAI Vision, और Anthropic Vision सहित dedicated vision endpoints का समर्थन करता है। ये object detection, pre-annotation, और visual classification सक्षम करते हैं।

पूर्ण कॉन्फ़िगरेशन विवरण के लिए Visual AI Support देखें।

AI Features

Potato का AI support पाँच प्राथमिक क्षमताएँ प्रदान करता है:

1. बुद्धिमान Hints

उत्तर प्रकट किए बिना annotators को contextual guidance प्रदान करें:

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
 
  # Hints appear as tooltips or sidebars
  features:
    hints:
      enabled: true

2. Keyword Highlighting

Text में relevant keywords को स्वचालित रूप से highlight करें:

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
 
  features:
    keyword_highlighting:
      enabled: true
      # Highlights are rendered as box overlays on the text

3. Label Suggestions

Annotator के विचार के लिए labels suggest करें (confidence indicators के साथ दिखाएँ):

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
 
  features:
    label_suggestions:
      enabled: true
      show_confidence: true

4. Label Rationales

v2.1.0 में नया

प्रत्येक label text पर क्यों लागू हो सकता है, इसके लिए संतुलित स्पष्टीकरण generate करें, annotators को विभिन्न classifications के पीछे के reasoning को समझने में मदद करें:

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
 
  features:
    rationales:
      enabled: true

Rationales एक tooltip के रूप में दिखाई देते हैं जो प्रत्येक उपलब्ध label और यह क्यों लागू हो सकता है, इसकी व्याख्या सूचीबद्ध करती है। यह annotators को प्रशिक्षित करते समय या जब annotation निर्णय कठिन हों तब उपयोगी है।

5. Option Highlighting

v2.2.0 में नया

Discrete annotation tasks (radio, multiselect, likert, select) के लिए सबसे अधिक संभावित सही options की AI-assisted highlighting। सिस्टम content का विश्लेषण करता है और top-k संभावित options को highlight करता है जबकि कम-संभावित ones को dim करता है, सभी options पूरी तरह clickable रहते हुए।

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4o-mini
    api_key: ${OPENAI_API_KEY}
 
  option_highlighting:
    enabled: true
    top_k: 3
    dim_opacity: 0.4
    auto_apply: true

पूर्ण कॉन्फ़िगरेशन विवरण के लिए Option Highlighting देखें।

पूरक: Diversity Ordering

v2.2.0 में नया

हालांकि यह strictly एक AI feature नहीं है, Diversity Ordering items को cluster करने और उन्हें diverse order में प्रस्तुत करने के लिए sentence-transformer embeddings का उपयोग करता है, annotator fatigue कम करता है और coverage सुधारता है। यह reordered items के लिए AI hints को स्वचालित रूप से prefetch करके AI support के साथ एकीकृत होता है।

Caching और प्रदर्शन

AI responses को प्रदर्शन सुधारने और API costs कम करने के लिए cache किया जा सकता है:

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
 
  cache_config:
    disk_cache:
      enabled: true
      path: "ai_cache/cache.json"
 
    # Pre-generate hints on startup and prefetch upcoming
    prefetch:
      warm_up_page_count: 100
      on_next: 5
      on_prev: 2

Caching Strategies

  1. Warmup: Server शुरू होने पर instances के प्रारंभिक batch के लिए AI hints pre-generate करता है (warm_up_page_count)
  2. Prefetch: Annotators आगे (on_next) या पीछे (on_prev) navigate करते समय upcoming instances के लिए hints generate करता है
  3. Disk Persistence: Caches disk पर सहेजे जाते हैं और server restarts के बाद persist करते हैं

Custom Prompts

Potato में प्रत्येक annotation type के लिए default prompts potato/ai/prompt/ में संग्रहीत हैं। आप इन्हें अपने विशिष्ट task के लिए customize कर सकते हैं:

Annotation TypePrompt File
Radio buttonsradio_prompt.txt
Likert scaleslikert_prompt.txt
Checkboxescheckbox_prompt.txt
Span annotationspan_prompt.txt
Slidersslider_prompt.txt
Dropdownsdropdown_prompt.txt
Number inputnumber_prompt.txt
Text inputtext_prompt.txt

Prompts variable substitution का समर्थन करते हैं:

  • {text} - दस्तावेज़ text
  • {labels} - scheme के लिए उपलब्ध labels
  • {description} - scheme description

बहु-Schema समर्थन

कई annotation schemes वाले tasks के लिए, आप AI support को चुनिंदा रूप से सक्षम कर सकते हैं:

yaml
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
 
  # Only enable for specific schemes
  special_include:
    - page: 1
      schema: sentiment
    - page: 1
      schema: topics

पूर्ण उदाहरण

AI-assisted sentiment analysis के लिए पूर्ण कॉन्फ़िगरेशन:

yaml
annotation_task_name: "AI-Assisted Sentiment Analysis"
task_dir: "."
port: 8000
 
data_files:
  - "data/reviews.json"
 
item_properties:
  id_key: id
  text_key: text
 
annotation_schemes:
  - annotation_type: radio
    name: sentiment
    description: "What is the sentiment of this review?"
    labels:
      - Positive
      - Negative
      - Neutral
 
ai_support:
  enabled: true
  endpoint_type: openai
 
  ai_config:
    model: gpt-4
    api_key: ${OPENAI_API_KEY}
    temperature: 0.3
    max_tokens: 500
 
  features:
    hints:
      enabled: true
    keyword_highlighting:
      enabled: true
      # Highlights are rendered as box overlays on the text
    label_suggestions:
      enabled: true
      show_confidence: true
 
  cache_config:
    disk_cache:
      enabled: true
      path: "ai_cache/cache.json"
    prefetch:
      warm_up_page_count: 50
      on_next: 3
      on_prev: 2
 
output_annotation_dir: "output/"
output_annotation_format: "json"
allow_all_users: true

Environment Variables

Environment variables का उपयोग करके API keys सुरक्षित रूप से संग्रहीत करें:

bash
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
export GOOGLE_API_KEY="..."

अपने config में ${VARIABLE_NAME} syntax के साथ इन्हें reference करें।

लागत संबंधी विचार

  • AI calls default रूप से प्रति-instance की जाती हैं
  • बार-बार API calls कम करने के लिए caching सक्षम करें
  • Hints pre-generate करने के लिए warmup और prefetch का उपयोग करें
  • सरल tasks के लिए छोटे/सस्ते models का उपयोग करने पर विचार करें
  • Local providers (Ollama, vLLM) में कोई API costs नहीं हैं

सर्वोत्तम प्रथाएँ

  1. AI को सहायता के रूप में उपयोग करें, प्रतिस्थापन के रूप में नहीं - Annotators को अंतिम निर्णय लेने दें
  2. Production के लिए caching सक्षम करें - Latency और costs कम करता है
  3. Prompts को अच्छी तरह test करें - Custom prompts को validate किया जाना चाहिए
  4. API costs की निगरानी करें - विशेष रूप से cloud providers के साथ usage ट्रैक करें
  5. Local providers पर विचार करें - High-volume annotation के लिए Ollama या vLLM
  6. API credentials सुरक्षित रखें - Environment variables का उपयोग करें, keys कभी commit न करें

आगे पढ़ें

कार्यान्वयन विवरण और custom prompt templates के लिए, source documentation देखें।