Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What are the main differences between the ChatClient and ChatModel components? #2030

Open
xiaohai-78 opened this issue Jan 3, 2025 · 2 comments

Comments

@xiaohai-78
Copy link

Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.

Expected Behavior

Will there be plans to merge them into a single component in the future?

Current Behavior

example:
openAiChatModel.call(new Prompt(DEFAULT_PROMPT)).getResult().getOutput().getContent();
openAiChatClient.prompt(DEFAULT_PROMPT).call().content();
The final result returned by the two lines of code above is the same.

Context

I have some questions while learning SpringAi, and I would appreciate your insights. What are the main differences between the ChatClient and ChatModel components? Since ChatModel can be converted into ChatClient and they share the same functionality, could it be that they have redundant designs? What is the reasoning behind this design choice? Will there be plans to merge them into a single component in the future? Thank you in advance for your response.

I’ve searched online, but it seems I couldn’t find any related explanations.

@ilayaperumalg
Copy link
Member

Hi @xiaohai-78, Thanks for reaching out.

ChatClient provides the fluent API around the Chat Model to provide more flexible client centric patterns around prompt, advisor etc., While you can still use ChatModel to achieve some of the operations, ChatClient provides the flexible approach to construct your client side options to interact with the model.

@xiaohai-78
Copy link
Author

ok, I have a rough understanding now. Thank you for your answer.

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

No branches or pull requests

2 participants