Add deprecation warnings for unset moderation flag
What does this MR do and why?
This MR is a follow-up from !119050 (comment 1372601803).
It adds a deprecation warning when the moderation flag is not set. This is needed to nudge product teams to explicitly state their preference in the code. After all teams update client code, this argument can be made mandatory and we can remove this deprecation warning.
Screenshots or screen recordings
[1] pry(main)> current_user = User.first; client = ::Gitlab::Llm::OpenAi::Client.new(current_user); question = 'What is Advanced Search?'
=> "What is Advanced Search?"
[2] pry(main)> embeddings_result = client.embeddings(input: question); true
DEPRECATION WARNING: The moderated argument is not set. Please update this code to explicitly pass this argument (called from __pry__ at (pry):5)
=> true
[3] pry(main)> embeddings_result = client.embeddings(input: question, moderated: :input); true
=> true
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Dmitry Gruzd