Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix LLMJudge input handling to preserve BinaryContent as separate message part instead of stringifying#2173

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
adtyavrdhn wants to merge21 commits intopydantic:main
base:main
Choose a base branch
Loading
fromadtyavrdhn:binary_content_incorrect_parsing_fix
Open
Changes from1 commit
Commits
Show all changes
21 commits
Select commitHold shift + click to select a range
46c5e48
Adding test + BinaryContent Parsing
adtyavrdhnJul 10, 2025
293c75f
Adding test for single UserContent as well as Sequence of UserContent
adtyavrdhnJul 11, 2025
2065a86
Adding test for single UserContent as well as Sequence of UserContent
adtyavrdhnJul 11, 2025
6397c1c
refactoring _build_prompt
adtyavrdhnJul 11, 2025
34bb131
handling when inputs is a sequence of UserContent
adtyavrdhnJul 11, 2025
33d79e1
handling pylance errors
adtyavrdhnJul 11, 2025
1630c75
refactoring _build_prompt
adtyavrdhnJul 11, 2025
c25db69
removing .strips()
adtyavrdhnJul 11, 2025
fa2b533
Merge branch 'main' of https://github.com/pydantic/pydantic-ai into b…
adtyavrdhnJul 11, 2025
d09873e
fix lint
adtyavrdhnJul 11, 2025
75a9b8e
Merge branch 'main' into binary_content_incorrect_parsing_fix
adtyavrdhnJul 16, 2025
e909876
suggested changes
adtyavrdhnJul 17, 2025
97928ec
suggested changes refactoring
adtyavrdhnJul 17, 2025
c4b7574
adding test for non_str data
adtyavrdhnJul 17, 2025
cc1fb55
lint
adtyavrdhnJul 17, 2025
1e33fbe
modifying test
adtyavrdhnJul 17, 2025
612c7f4
modifying test, adding more
adtyavrdhnJul 17, 2025
6002871
lint
adtyavrdhnJul 17, 2025
33c7516
adding <Input> tags
adtyavrdhnJul 17, 2025
72aaebc
adding extra test
adtyavrdhnJul 17, 2025
7307e9f
lint
adtyavrdhnJul 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Adding test for single UserContent as well as Sequence of UserContent
  • Loading branch information
@adtyavrdhn
adtyavrdhn committedJul 11, 2025
commit293c75f260f11a7e803f1a955b9404a75bc9915b
16 changes: 16 additions & 0 deletionstests/evals/test_llm_as_a_judge.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,22 @@ async def test_judge_input_output_binary_content_mock(mocker: MockerFixture, ima
mock_run = mocker.patch('pydantic_ai.Agent.run', return_value=mock_result)

# Test with string input and output
result = await judge_input_output([image_content, image_content], 'Hello world', 'Output contains input')
assert isinstance(result, GradingOutput)
assert result.reason == 'Test passed'
assert result.pass_ is True
assert result.score == 1.0

# Verify the agent was called with correct prompt
mock_run.assert_called_once()
raw_prompt = mock_run.call_args[0][0]

# 1) It must be a list
assert isinstance(raw_prompt, list), 'Expected prompt to be a list when passing binary'

# 2) The BinaryContent you passed in should be one of the elements
assert image_content in raw_prompt, 'Expected the exact BinaryContent instance to be in the prompt list'

result = await judge_input_output(image_content, 'Hello world', 'Output contains input')
assert isinstance(result, GradingOutput)
assert result.reason == 'Test passed'
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp