- Notifications
You must be signed in to change notification settings - Fork1k
Update tests to be compatible with new OpenAI, MistralAI and MCP versions#2094
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
base:main
Are you sure you want to change the base?
Conversation
PR Change SummaryUpdated tests to ensure compatibility with the latest versions of OpenAI, MistralAI, and MCP.
Modified Files
How can I customize these reviews?Check out theHyperlint AI Reviewer docs for more information on how to customize the review. If you just want to ignore it on this PR, you can add the Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add |
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@medaminezghal Thanks Mohamed! The only thing I'm not sure about is how we should handleResourceLink
.
Uh oh!
There was an error while loading.Please reload this page.
@medaminezghal Can you please have a look at the failing coverage check? |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
medaminezghal commentedJul 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@DouweM Does it need to add some tests to fix coverage problem? |
Uh oh!
There was an error while loading.Please reload this page.
@medaminezghal Yep, there are already a number of |
medaminezghal commentedJul 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Do I need a real API key to use |
DouweM commentedJul 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@medaminezghal I wouldn't use |
@DouweM I don't have any API key to use it for tests, so, the Do you think I should use one of the file inside For example:
|
@medaminezghal I think you should only need the actual full file path in the If you have your own OpenAI API key, you can generate the cassette for your new test with that, but if not feel free to push up the test and I can generate the cassette myself locally. |
@DouweM I will just duplicate the tests that use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@medaminezghal I was out for a few days but just had a chance to review this again. Please have a look at my comments and let me know if I can provide additional guidance (or take over).
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
async def get_image_resource_1() -> ResourceLink: | ||
return ResourceLink( | ||
type='resource_link', | ||
uri=AnyUrl(Path(__file__).parent.joinpath('assets/kiwi.png').absolute().as_uri()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Does this need to be the full path? Couldn't it beAnyUrl('resource://kiwi.png')
as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Theuri
is used byclient.read_resource()
, so, I think it should be the full path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@medaminezghal The path passed toclient.read_resource()
is handled by the MCP server, so I think it can really be anything
) | ||
return self._get_content(resource) | ||
elif isinstance(part, mcp_types.ResourceLink): | ||
resource_result: mcp_types.ReadResourceResult = await self._client.read_resource(part.uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
To make this work in the tests, I think we need to register each resource URI in the test server using@mcp.resource
like here:https://github.com/modelcontextprotocol/python-sdk#resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@DouweM I think this only can be done usingFASTMCP
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@medaminezghal We are using FastMCP though?
https://github.com/pydantic/pydantic-ai/blob/main/tests/mcp_server.py#L5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@DouweM I didn't understand where should I add the@mcp.resource
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@medaminezghal In the sametests/mcp_server.py
where you added the tools returningResourceLink
s. When an MCP server tool returns a resource link with a URI, the client (Pydantic AI) can then ask the server for that resource by URI, so the tools and resource handlers should be implemented in the same place.
Uh oh!
There was an error while loading.Please reload this page.
I've updated known model list with new OpenAI version, fixed MistralAItest issue in new version, added new ResourceLink MCP type and fixed tests for new MCP version.