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

Added extra function to return function return value from chat #120

Closed
wants to merge 18 commits into from

Conversation

samuelgjekic
Copy link
Contributor

@samuelgjekic samuelgjekic commented May 11, 2024

Im not sure if this was needed, but just in case i added generateChatOrReturnFunction based on your generateTextOrReturnFunction method, i needed it anyways in my project. Feel free to delete this pull request if this was not needed.

  ###  Modified files:
  1. 	modified:   src/Chat/ChatInterface.php
  2. 	modified:   src/Chat/OpenAIChat.php

samuelgjekic and others added 4 commits May 11, 2024 18:00
conversation
	modified:   src/Chat/ChatInterface.php
	modified:   src/Chat/OpenAIChat.php
does not support functions yet.
* Store the last response object from OpenAI

* Fixed lint issue

* Fixed test with composer prefer-lowest

* Changed lastResponse in generate() and generateText()

* Added the getTotalTokens() + doc

* Removed TokenUsage usage
$this->lastFunctionCalled = $toolToCall;
}

if ($this->lastFunctionCalled instanceof FunctionInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @samuelgjekic,
I think it is great to add this possibility.

what if the previous answer was a function and now it is a text but the lastFunctionCalled is still the FunctionInfo from the previous call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm i did not think about this, my bad.. Anyways, does this not apply to the generateTextOrReturnFunction aswell? As they are the same.

I added a line that sets the lastFunction to null in the start of the method, is this good, or do you prefer that i check if $toolstocall is not null instead? If so dont merge yet and i will do it that way instead.

@samuelgjekic
Copy link
Contributor Author

@MaximeThoonsen I added the new GPT4Omni but i forgot i had this pull request so they ended up in the same, i added a solution ( i think? ) to the lastFunction above.

@MaximeThoonsen
Copy link
Contributor

hey @samuelgjekic, thanks a lot for the PR! Can you please rebase your branch with main so I can review only the file that changed?

@samuelgjekic samuelgjekic marked this pull request as draft May 17, 2024 18:01
@samuelgjekic samuelgjekic closed this by deleting the head repository May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants