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
Conversation
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
modified: src/Chat/Enums/OpenAIChatModel.php
@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. |
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? |
conversation modified: src/Chat/ChatInterface.php modified: src/Chat/OpenAIChat.php
does not support functions yet.
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.