This technical module provides a connector for the OpenAI API and allows integration of ChatGPT and DALL-E capabilities within Odoo. ChatGPT4 and DALL·E 3 are available.
It can be used as a playground to test OpenAI tools in Odoo but does not have standalone functionality. The module is intended to be inherited by other modules for specific use cases, such as:
- openai_chat: Adding an AI bot user for interactive chat using ChatGPT
- openai_edit_product_image: Generating a new product image from a cropped image using DALL-E
- openai_product_description: Generating sales descriptions for products using ChatGPT
- openai_product_tags: Generating product tags using ChatGPT
To create custom OpenAI completions, edits, or images, refer to the API documentation for proper configuration of API parameters.
Create an account on https://beta.openai.com/
Generate your API key: API keys
In Settings, fill the API Key field with your generated key.
To create a new OpenAI Completion, go to Settings, Technical, OpenAI Completion and create a new record.
Model: The model on witch the completion will be applied.
Target Field: The field where the generated value will be saved.
Domain: The domain to select the records on witch the completion will be run.
Check the API Documentation to set OpenAI Parameters values.
For Completion results go to Settings, Technical, OpenAI Completion Results
To create a new OpenAI Image, go to Settings, Technical, OpenAI Image and create a new record.
For results go to Settings, Technical, OpenAI Image Results
Write a prompt template in Qweb.
Available functions in prompt template:
- object : Current record
- answer_lang : Function returning the language name
- html2plaintext : Function to convert html to text
Test actions use the first record of the model selected by the domain.
Test first your prompt to adjust your template, then test the result of the Completion, Edit or Image to adjust OpenAI parameters.
This module requires the Python client library for OpenAI API
pip install openai>=1.6.1
- This module is maintained by Michel Perrocheau.
- Contact me on LinkedIn.