Align anthropic prompts to AIGateway
What does this MR do and why?
See #427453 (closed)
AI Gateway expects to receive model_provider
in order to decided which model provider to use. By default AI Gateway uses vertex
models
It also puts <new_code>
opening tag into Assistant:
section of anthropic code generation response to steer model into right format, and also help stripping tags with stop sequence
Screenshots or screen recordings
I, [2023-10-05T14:07:08.976964 #65712] INFO -- : jaccard similarity tri-grams: 0.554
I, [2023-10-05T14:07:08.977016 #65712] INFO -- :
<<< expected response:
def self.find_by_name(name)
find_by(name: name)
end
>>> real response:
def self.find_by_name(name)
where(name: name).first
end
I, [2023-10-05T14:07:09.478315 #65712] INFO -- : path: snippets/ruby/valid_name.rb, cursor: 1
I, [2023-10-05T14:07:12.058357 #65712] INFO -- : duration: 2.5799930095672607
I, [2023-10-05T14:07:12.058501 #65712] INFO -- : jaccard similarity tri-grams: 0.221
I, [2023-10-05T14:07:12.058511 #65712] INFO -- :
<<< expected response:
def valid_name?
name.present? && name.length <= 255
end
>>> real response:
def valid_name?
name =~ /\A[a-zA-Z0-9_\-\.]*\z/
end
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 Matt Nohr