Skip to content

test: cover all messages_to_dict conversion branches - #26

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789677963-test-messages-to-dict
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1789677963-test-messages-to-dict

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

messages_to_dict (the dict/str/LangChain -> Discussion boundary used by reproducibility_agent replay) had no test, including the recently patched LangChain role_map fallback. Adds unit tests in tests/llm/test_llm_utils.py covering every branch:

  • dict passthrough and bare-string -> {"role": "<unknown role>"}
  • LangChain message with convert_message_to_dict available (monkeypatched)
  • LangChain fallback with convert_message_to_dict set to None, parametrized over human -> user, ai -> assistant, system -> system, and an unmapped tool -> tool (guards against the old hardcoded 'user')
  • ValueError on an unsupported object

LangChain is not installed in this env, so the tests monkeypatch llm_utils.LangchainBaseMessage to a local FakeLangchainMessage (.type / .content) to exercise the branch deterministically.

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/6d82f0caa4c445eca0a304dedd7d6168
Open in Devin Desktop: https://app.devin.ai/desktop/session/6d82f0caa4c445eca0a304dedd7d6168?variant=devin

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

0 participants