Repository navigation
Conversation
|
@BlueX888 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
extract_input_parameters_from_completionraisedKeyError: 'content'when a Chat Completions payload contained an assistant message without acontentkey. Becausesafe_extract_input_parametersswallows all exceptions, this degraded the whole payload toInputParameters(model="NA"), so the LLM span lost its input, messages, tools and tool descriptions.Why
An assistant history message that only carries
tool_callsmay legally omitcontent: in the openai SDK,ChatCompletionAssistantMessageParam.__required_keys__is empty and onlyroleis markedRequired(deepeval pinsopenai = "*", so any current SDK version applies).extract_input_parameters_from_completionread the key unconditionally withmessage["content"](deepeval/openai/extractors.py:49). TheKeyErrorpropagated to the bareexceptinsafe_extract_input_parameters(deepeval/openai/extractors.py:25-26), which returned the placeholderInputParameters(model="NA"). The siblingrender_messages(deepeval/openai/utils.py:118-119) reads the same messages withmessage.get(...), andstringify_multimodal_content(deepeval/openai/utils.py:61-62) already returns""forNonecontent, so a.get()here changes nothing downstream.Changes
deepeval/openai/extractors.py: readcontentwithmessage.get("content")instead ofmessage["content"]inextract_input_parameters_from_completion, mirroringrender_messages.tests/test_core/test_models/test_openai_extractors.py: two regression tests — one againstextract_input_parameters_from_completion(asserts model, input and rendered messages are preserved), one againstsafe_extract_input_parameters(asserts the payload no longer degrades tomodel="NA").Testing
Both new tests fail on
main:test_extract_input_parameters_with_assistant_message_without_content→KeyError: 'content'at deepeval/openai/extractors.py:49test_safe_extract_input_parameters_with_assistant_message_without_content→AssertionError: assert 'NA' == 'gpt-4o'With the fix: