- Updated localization strings in various classes to use the constant `GROQ_AI_PRODUCT_TEXT_DOMAIN` instead of hardcoded text domain. - Introduced an image context limit setting in the settings manager and adjusted related methods to accommodate this new feature. - Modified prompt builder to handle image context limit when building product context blocks and retrieving image payloads. - Enhanced error handling and response structures to include new fields related to image context. - Added support for title suggestions in the structured response from the AI.
37 lines
677 B
PHP
37 lines
677 B
PHP
<?php
|
|
|
|
class Groq_AI_Provider_OpenAI extends Groq_AI_Abstract_OpenAI_Provider {
|
|
public function get_key() {
|
|
return 'openai';
|
|
}
|
|
|
|
public function get_label() {
|
|
return __( 'OpenAI', GROQ_AI_PRODUCT_TEXT_DOMAIN );
|
|
}
|
|
|
|
public function get_default_model() {
|
|
return 'gpt-4o-mini';
|
|
}
|
|
|
|
public function get_available_models() {
|
|
return [
|
|
'gpt-4o',
|
|
'gpt-4o-mini',
|
|
'gpt-4.1-mini',
|
|
'gpt-3.5-turbo',
|
|
];
|
|
}
|
|
|
|
public function get_option_key() {
|
|
return 'openai_api_key';
|
|
}
|
|
|
|
protected function get_endpoint() {
|
|
return 'https://api.openai.com/v1/chat/completions';
|
|
}
|
|
|
|
protected function get_models_endpoint() {
|
|
return 'https://api.openai.com/v1/models';
|
|
}
|
|
}
|