Improve chat client entity with structured output integration tests#5422
Improve chat client entity with structured output integration tests#5422nicolaskrier wants to merge 1 commit intospring-projects:mainfrom
Conversation
...pring-ai-mistral-ai/src/test/java/org/springframework/ai/mistralai/MistralAiChatModelIT.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
@nicolaskrier After a second look, I am wondering if we can avoid this kind of breakage without changing the code on user site, could you please share the error you see on integration tests?
|
@sdeleuze Here is the integration test failure:
You can find the complete test run here |
15b8fc6 to
134adbd
Compare
@ilayaperumalg: Thank you for quoting the test failure, I should have done it initially. |
134adbd to
0cfff2d
Compare
|
@nicolaskrier Thanks for adding the Ollama test, indeed that helps a lot. Looks like indeed a side effect of #5403 due to IMO it is not acceptable to force users to do an explicit |
sdeleuze
left a comment
There was a problem hiding this comment.
I think the proper way to fix those integration tests is to refine #5403 by updating the processing of the model options to still convert to OllamaChatOptions (or similar more specific model options) via ModelOptionsUtils.copyToTarget, but to do it when they are not instances of OllamaChatOptions, not when they are null.
7b84a57 to
14d279e
Compare
|
I had another idea in mind before seeing your suggestion. I added a third commit containing my proposal. There are still several unit tests failing but If you prefer yours, I propose that you create another PR with your approach and then I will modify this PR to polish |
|
I think the approach you proposed will still induce side effects given current Spring AI design, so maybe yeah please polish this PR without the third commit (it is ok to force push) and I will create another PR to fix the regression I introduced with #5403 and merge both PRs. |
- Add chatClientEntityWithStructuredOutput integration test to OllamaChatModelIT, similar to MistralAiChatModelIT - Polish MistralAiChatModelIT integration tests Signed-off-by: Nicolas Krier <7557886+nicolaskrier@users.noreply.github.com>
14d279e to
b0832b6
Compare
|
Thank you for having taken time to review my proposal. I think the incoming changes are quite impactful, so I appreciate you spotting the side effects early on. |
…pring-projects#5422) - Add chatClientEntityWithStructuredOutput integration test to OllamaChatModelIT, similar to MistralAiChatModelIT - Polish MistralAiChatModelIT integration tests Signed-off-by: Nicolas Krier <7557886+nicolaskrier@users.noreply.github.com>
|
Merged in I will monitor CI runs of |
|
So with @ilayaperumalg we confirm that in IDEA, |
|
This is weird! I have seen #5441 planned for M4. You may consider disabling this test until this issue is resolved if it becomes a blocking point. |
|
Seems like this was due to the command documented to run integration tests in https://github.com/spring-projects/spring-ai?tab=readme-ov-file#building missing the I will confirm tomorrow with @ilayaperumalg and @ericbottard, and update the README accordingly if confirmed. |
Description
MistralAiChatOptionsinstead ofDefaultChatOptionsto fixchatClientEntityWithStructuredOutputtest,MistralAiChatModelITintegration tests.Explanations
I have noticed a failing integration for Mistral AI on the latest integration tests.
The test is failing due to this assertion that is not true. The
ChatOptionsis not an instance ofMistralAiChatOptionshere sonativeStructuredOutputUsedflag is not set to true.ChatOptionsused to be nullable and a vendor specific implementation likeMistralAiChatOptionswas created in the end when it was null.ChatOptionsisn't nullable anymore andDefaultChatOptionsis used by default. Consequently, the caller is forced to provide theChatOptionsspecific to the vendor if it wants to benefit from its behavior.I think it is acceptable to do so here to fix this integration test.
Related work
The non-nullability behavior has been introduced with #5403.