Skip to Content
Menu

AI Analysis and Generation

by
Odoo

234.30

v 14.0 Third Party
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Discuss (mail)
Lines of code 1552
Technical Name hk_ai_integration
LicenseLGPL-3
Websitehttps://www.hotkey.ua
You bought this module and need support? Click here!

AI Analysis & Generation

Universal AI analysis and content generation for any Odoo field type - text, images, files, URLs, documents.

NEW: Chat Integration!
Use /ai your question in any Odoo chat for instant AI responses!
Works with any model and any field! Automatically detects content type. No model inheritance required.

Three Universal Methods

ai_analyze()

Analyze any field type
Automatically detects and processes text, images, files, URLs, and documents - returns the AI result for use in custom logic.

result = record.ai_analyze(
    'description',
    'Create brief summary'
)
if result:
    # Use in custom logic
    chat.message_post(body=result)
            

ai_prompt()

Maximum flexibility
Execute any prompt with record context and use the result anywhere in your logic.

result = record.ai_prompt(f'''
Customer: {record.name}
Email: {record.email}

Create welcome message.
''')
if result:
    record.note = result
            

Chat Integration

Use AI in Any Chat!

Simply type /ai followed by your question in any Odoo chat:

💬 Examples:
/ai What is artificial intelligence?
/ai Write a Python function to calculate factorial
/ai Create a marketing slogan for eco-friendly products
/ai Explain quantum computing in simple terms
✨ Features:
  • Works in channels, direct messages, group chats
  • Instant AI responses from OdooBot
  • Beautiful formatted output
  • Automatic error handling

Supported AI Providers

  • Google Gemini - free tier, multimodal (images, video, audio, PDF)
  • OpenAI GPT - best text processing, image analysis, audio transcription
  • Anthropic Claude - superior reasoning and document analysis
All providers include an Auto mode - always using the latest and most capable model.

Fully Interchangeable

Switch between any provider anytime! All methods work identically:

  • Same ai_analyze() and ai_prompt() methods
  • Same /ai chat commands
  • Just change "Default AI Provider" in settings
  • Or force specific provider: record.ai_prompt('question', provider='openai')

System Prompt Configuration

Define consistent AI behavior across all providers!

  • Set global instructions that apply to every AI interaction
  • Works with ai_analyze(), ai_prompt(), and chat commands
  • Combines with specific prompts for enhanced results
  • Examples: "Be professional and concise", "Always respond in Ukrainian", "Use technical language"
System Prompt + User Prompt = Consistent, Targeted AI Responses

Key Features

  • Works with any field type
  • Configurable system prompt - define AI behavior across all providers
  • Flexible model selection - auto-detection or manual specification
  • Adjustable creativity levels - from precise to highly creative responses
  • One-click model loading from API
  • Easy setup with direct API key links
  • Minimal dependencies (only requests)

Installation

pip install requests

Quick Start

  1. Install the module
  2. Go to Settings → General Settings → AI Integration
  3. Configure system prompt (defines AI behavior for all providers)
  4. Select a provider and get your API key
  5. Optionally: load available models and adjust creativity level
  6. Test the connection to verify setup
  7. Use AI on any Odoo model

Usage Examples

Text Analysis

# Analyze and get result in variable
translation = partner.ai_analyze('name', 'Translate to Ukrainian')
sentiment = lead.ai_analyze('description', 'Analyze sentiment: positive/negative/neutral')
summary = ticket.ai_analyze('description', 'Create brief summary')

# Use results in custom logic
if translation:
    partner.comment = translation
if sentiment == 'positive':
    lead.priority = 'high'
    

Media Analysis

# Analyze images and media
description = product.ai_analyze('image_1920', 'Describe this product image')
analysis = partner.ai_analyze('image_url', 'Analyze this photo professionally')
transcript = event.ai_analyze('video_url', 'Transcribe this video content')
text = meeting.ai_analyze('recording_file', 'Transcribe meeting recording')

# Use results immediately
if transcript:
    # Send to chat, create task, etc.
    chat.message_post(body=f"Meeting transcript: {transcript}")
    task = env['project.task'].create({'name': 'Review meeting', 'description': transcript})
    

Document Analysis

# Analyze documents and get results
text = invoice.ai_analyze('pdf_attachment', 'Extract all text content')
summary = contract.ai_analyze('document_file', 'Summarize key points')
analysis = ticket.ai_analyze('attachment_ids', 'Analyze uploaded documents')

# Process results conditionally
if 'urgent' in analysis.lower():
    ticket.priority = 'urgent'
    ticket.message_post(body=f"AI Analysis: {analysis}")

# Cross-model workflows
requirements = purchase.ai_analyze('pdf_file', 'Extract inventory requirements')
if requirements:
    inventory = env['stock.picking'].create({'notes': requirements})
    

Flexible Prompting

# Maximum flexibility with ai_prompt()
result = product.ai_prompt('Write description for wireless headphones')
subject = email.ai_prompt(f'Create subject for {customer.name} holiday sale')

# Use results anywhere
if result:
    product.description = result
    # or send to chat, create task, etc.

# Combine analyze + prompt for complex workflows
features = product.ai_analyze('image_1920', 'List key features from image')
if features:
    marketing_text = product.ai_prompt(f'Write marketing copy based on: {features}')
    product.marketing_copy = marketing_text

Server Actions & Automation

# Server Action: Analyze customer feedback
for feedback in self:
    sentiment = feedback.ai_analyze('comment', 'Determine sentiment')
    summary = feedback.ai_analyze('comment', 'Summarize main points')
    
    if sentiment:
        feedback.sentiment_field = sentiment
    if 'complaint' in summary.lower():
        feedback.priority = 'urgent'

# Auto-generate content with context
for product in self:
    if not product.description:
        desc = product.ai_prompt(f'Write description for {product.name}, price: {product.list_price}')
        if desc:
            product.description = desc

# Server Action: Audio transcription to chat
for contact in self:
    if contact.ref:  # Audio URL
        transcript = contact.ai_analyze('ref', 'Transcribe audio')
        if transcript:
            chat = env['mail.channel'].browse(1)
            chat.message_post(body="Audio from " + contact.display_name + ": " + transcript,
                             author_id=env.ref('base.partner_root').id)
    

Group Analysis Examples

# Analyze group of contacts
results = []
for contact in records:
    if contact.name:
        analysis = contact.ai_analyze('name', 'Analyze this contact profile')
        if analysis:
            results.append(contact.display_name + ": " + analysis)

# Send group results to chat
if results:
    chat = env['mail.channel'].browse(1)
    full_message = "📊 Contact Analysis:\n\n" + "\n\n".join(results)
    chat.message_post(body=full_message, author_id=env.ref('base.partner_root').id)

# Advanced: Group analysis with AI service
from odoo.addons.hk_ai_integration.services.ai_service_manager import AIServiceManager
manager = AIServiceManager(env)

contact_data = "\n".join([r.name + " - " + (r.email or "No email") for r in records])
result = manager.process_text(contact_data, provider=None, 
    custom_prompt='Analyze this group of contacts and provide insights')

if result.get('success'):
    chat = env['mail.channel'].browse(1)
    chat.message_post(body="🔍 Group Analysis: " + result['processed_text'],
                     author_id=env.ref('base.partner_root').id)
    

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.