Skip to content

Conversation

@sidg1215
Copy link

@sidg1215 sidg1215 commented Nov 28, 2025

Fixes #3149.

# Only the first function call requires a signature
function_call_requires_signature = False
else:
part['text'] = f'Tool {item.tool_name} called with args {item.args_as_json_str()}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the arguments and return value can be very long, I want those on a separate line.

Also because there could be parallel tool calls with the same name, we should include the tool call ID.

I'd also want to format this in a more special way so the model understands this is not actually a user/assistant "message".

So I suggest doing something similar to how we send text files to OpenAI:

def _inline_text_file_part(text: str, *, media_type: str, identifier: str) -> ChatCompletionContentPartTextParam:
text = '\n'.join(
[
f'-----BEGIN FILE id="{identifier}" type="{media_type}"-----',
text,
f'-----END FILE id="{identifier}"-----',
]
)
return ChatCompletionContentPartTextParam(text=text, type='text')

And we're doing that for Google as well: #3269.

)


def test_google_mapping_when_does_not_support_tools():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also test the mapping of the tool result

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DouweM Is there a way I can generate a casette file (I was initially attempting to right my own, but after thinking about it that feels...wrong)? I wanted to test for this behavior via Agent.run.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidg1215 If you run the test with uv run pytest <path>::<test> --record-mide=recreate, vcrpy will automatically record them for you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants