feat: patch missing inner thoughts on new openai models #1562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TODOs:
Refactor code to convert to inner thought kwarg format
Add utility method inside of data types to convertMessage
objectsToolCall
s into versions that have a kwarg included (add_inner_thoughts_to_tool_call
)put_inner_thoughts_in_kwargs
toMessage.to_openai_dict
which will call utility to make putself.text
(thecontent
/ inner thoughts) intoToolCall
s via the utilitywill require dumping and reading json strings of arguments)add_inner_thoughts_to_functions
unpack_inner_thoughts_from_kwargs
--no-content
flag (yes
= put inner thoughts in kwargs,no
= leave as normal (gpt4 style),default
= let us decide, eg for gpt4o turn it on, for gpt4 turn it off)*note: I was going to create a
Message -> Message
utility function that putsself.text
intoself.tool_calls
(as an alternative to putting the logic for extracting inner thoughts fromself.text
into the function/tool call in theto_*_dict()
methods), however upon further thought I think it's better to leave this logic inside the_to_dict()
methods because it might vary significantly from provider to provider. Example of what I was going to do:Please describe the purpose of this pull request.
Fixes issues with missing
content
/ inner thoughts on newer OpenAI models like 4o-miniHow to test
memgpt run
withgpt-4o-mini
Have you tested this PR?
Yes, gpt4o-mini works fine now:
Related issues or PRs
Closes #1555