Skip to content

Fix Anthropic client to permit appropriate response handling

What does this MR do and why?

Fix Anthropic client to permit appropriate response handling. The Anthropic documentation mentions to formulate your prompt with \n\nHuman: #{prompt}\n\nAssistant:. The Anthropic client did not do this currently, which resulted in the API not responding correctly and a Net::Read error being raised.

This MR ensures the formatting is present in the prompt so that the request is handled appropriately. If the appropriate formatting is already present, it won't add it again.

How to set up and validate locally

Assuming you have Anthropic credentials and an environment that can make a request with the Anthropic client, this should allow the request to be completed successfully.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Gregory Havenga

Merge request reports