Skip to content
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

GPT-3.5-Turbo logit_bias parameter #72

Closed
PomzedCommunication opened this issue Mar 15, 2023 · 3 comments
Closed

GPT-3.5-Turbo logit_bias parameter #72

PomzedCommunication opened this issue Mar 15, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@PomzedCommunication
Copy link

Describe the bug

Hi,

First of all thanks for your work on this.
I encounter a problem when i try to send an object with various tokenized words with their bias with the "logit_bias" parameter. (https://platform.openai.com/docs/api-reference/chat/create#chat/create-logit_bias)

To Reproduce

  1. Use your quickstart template
  2. Add the "logit_bias" parameter and any kind of json object, or even 'null' which from the doc is the accepted default.
  3. The response is an error message stating that whatever we put as a value for "logit_bias" is not of type 'object' - 'logis_bias'

Code snippets

<?php

require __DIR__ . '/vendor/autoload.php'; // remove this line if you use a PHP Framework.

use Orhanerday\OpenAi\OpenAi;

$open_ai_key = getenv('OPENAI_API_KEY');
$open_ai = new OpenAi($open_ai_key);

$complete = $open_ai->chat([
   'model' => 'gpt-3.5-turbo',
   'messages' => [
       [
           "role" => "system",
           "content" => "You are a helpful assistant."
       ],
       [
           "role" => "user",
           "content" => "Who won the world series in 2020?"
       ],
       [
           "role" => "assistant",
           "content" => "The Los Angeles Dodgers won the World Series in 2020."
       ],
       [
           "role" => "user",
           "content" => "Where was it played?"
       ],
   ],
   'temperature' => 1.0,
   'max_tokens' => 4000,
   'frequency_penalty' => 0,
   'presence_penalty' => 0,
   'logit_bias' => null // or { 3789: 10 } or anything of the sort
]);

var_dump($complete);

OS

Windows

PHP version

PHP 8.1

Library version

open-ai v4.7.1

@PomzedCommunication PomzedCommunication added the bug Something isn't working label Mar 15, 2023
@orhanerday
Copy link
Owner

Hi @PomzedCommunication,
Could you please reproduce the same steps on openai python library or curl?

@PomzedCommunication
Copy link
Author

In curl, using 'logit_bias'=null return the error "None is not of type 'object' - 'logit_bias'", with {"3789":10} however it works fine.

@orhanerday
Copy link
Owner

Ok, I think this issue is not related to my library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants