Formatting

This commit is contained in:
2024-02-23 13:12:48 +01:00
parent 03dd641c70
commit 9f91132a0a
23 changed files with 39 additions and 63 deletions

View File

@@ -34,8 +34,9 @@ class AnthropicLLMEngine(BaseLLMEngine):
) -> str | dict:
prompt = f"""{anthropic.HUMAN_PROMPT} {system_prompt} {anthropic.HUMAN_PROMPT} {chat_prompt} {anthropic.AI_PROMPT}"""
if json_mode:
# anthopic does not officially support JSON mode, but we can bias the output towards a JSON-like format
# anthropic does not officially support JSON mode, but we can bias the output towards a JSON-like format
prompt += " {"
# noinspection PyArgumentList
response: anthropic.types.Completion = self.client.completions.create(
max_tokens_to_sample=max_tokens,
prompt=prompt,