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

[Bug] generateChat does not process tools like generateText does #96

Open
vijaythecoder opened this issue Apr 5, 2024 · 1 comment
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@vijaythecoder
Copy link

I've come across a bug in our code where the generateChat function isn't dealing with tools the same way generateText does. Here's the situation:

For generateChat, the function looks like this:

/**
 * @param  Message[]  $messages
 */
public function generateChat(array $messages): string
{
    $openAiArgs = $this->getOpenAiArgs($messages);
    $answer = $this->client->chat()->create($openAiArgs);

    return $answer->choices[0]->message->content ?? '';
}

and for generateText, it looks like below

public function generateText(string $prompt): string
{
    $answer = $this->generate($prompt);
    $this->handleTools($answer);

    return $answer->choices[0]->message->content ?? '';
}

Expected: generateChat needs to handle the tools.

@vijaythecoder vijaythecoder changed the title [Bug] generateChat Does Not Process Tools Like generateText Does [Bug] generateChat does not process tools like generateText does Apr 5, 2024
@MaximeThoonsen MaximeThoonsen added the bug Something isn't working label Apr 8, 2024
@MaximeThoonsen
Copy link
Contributor

Hey @vijaythecoder ,
do you prefer the behavior of generateText or the behavior of generateTextOrReturnFunctionCalled that gives you more control over the way the function is called?

@MaximeThoonsen MaximeThoonsen added enhancement New feature or request good first issue Good for newcomers and removed bug Something isn't working labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants