Skip to content

Added support for gpt-4o-mini chat completions model. #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions class-gwiz-gf-openai.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,16 @@
public function get_openai_models() {
$models = array(
'chat/completions' => array(
'gpt-4o' => array(

Check warning on line 264 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Array double arrow not aligned correctly; expected 8 space(s) between "'gpt-4o'" and double arrow, but found 13.
'description' => __( 'OpenAI\'s fastest and most affordable flagship model. Context length: 128k. <a href="https://platform.openai.com/docs/models/gpt-4o" target="_blank">More Details</a>', 'gravityforms-openai' ),
),
'gpt-4-turbo' => array(

Check warning on line 267 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Array double arrow not aligned correctly; expected 3 space(s) between "'gpt-4-turbo'" and double arrow, but found 1.
'description' => __( 'OpenAI\'s previous high-intelligence model. Context length: 128k. <a href="https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4" target="_blank">More Details</a>', 'gravityforms-openai' ),
),
'gpt-4o-mini' => array(

Check warning on line 270 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Array double arrow not aligned correctly; expected 3 space(s) between "'gpt-4o-mini'" and double arrow, but found 1.
'description' => __( 'OpenAI\'s most cost-efficient small model. Context length: 128k. <a href="https://platform.openai.com/docs/models/gpt-4o-mini" target="_blank">More Details</a>', 'gravityforms-openai' ),
),
'gpt-3.5-turbo' => array(

Check warning on line 273 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Array double arrow not aligned correctly; expected 1 space(s) between "'gpt-3.5-turbo'" and double arrow, but found 7.
'description' => __( 'Inexpensive model for simple tasks. Context length: 16k. <a href="https://platform.openai.com/docs/models/gpt-3-5-turbo" target="_blank">More Details</a>', 'gravityforms-openai' ),
),
),
Expand Down Expand Up @@ -1380,7 +1383,7 @@

$body = apply_filters( 'gf_openai_request_body', $body, $endpoint, $feed );

$this->log_debug( __METHOD__ . '(): ' . sprintf( __( 'Making request to %s', 'gravityforms-openai' ), $url ) );

Check warning on line 1386 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.

// Cache successful responses.
$response = wp_remote_post($url, array_merge( array(
Expand Down Expand Up @@ -1541,7 +1544,7 @@
public function should_transform_feed( $feed ) {
$endpoint = rgars( $feed, 'meta/endpoint' );

if ( in_array( $endpoint, array( 'completions', 'edits' ) ) ) {

Check warning on line 1547 in class-gwiz-gf-openai.php

View workflow job for this annotation

GitHub Actions / PHPCS

Not using strict comparison for in_array; supply true for third argument.
return true;
}

Expand Down
Loading