class_docstr:     Client for the Anthropic models (https://arxiv.org/abs/2204.05862).
      They use their own tokenizer.
      Here are a list of bugs that we deal with in this client:
      - The prompt must contains anthropic.HUMAN_PROMPT ('
  
  Human:') and anthropic.AI_PROMPT ('
  
  Assistant:')
      - The completions is often too verbose, so we add the PROMPT_ANSWER_START to the prompt.
      TODO(#1521): Remove this when we have a better way to do prompt engineering.
      - The completions often start with a colon, space, or newline, so we remove it. This means
      that we need to query more tokens than necessary to ensure that the completion does not start
      with a colon, space, or newline. We query `max_tokens + ADDITIONAL_TOKENS` tokens and then
      remove the excess tokens at the end of the completion.
      TODO(#1512): Once we have a good way to post-process the completion, move this logic to the
      post-processing.
      - The API sometimes returns "Prompt must contain anthropic.AI_PROMPT". This is a bug related to the
      window_service that does not properly truncate some prompts.  It is caused by the suffix being truncated.
      - The API sometimes return Prompt length + max_tokens exceeds max (9192). This is something we do not
      handle yet (we have not limit on prompt length + max_tokens). TODO(#1520): Fix this.
      
code: def __init__(
      self, cache_config: CacheConfig, api_key: Optional[str] = None
  ):
      self.api_key: Optional[str] = api_key
      self.cache = Cache(cache_config)
      self.tokenizer: PreTrainedTokenizerBase = PreTrainedTokenizerFast(
          tokenizer_object=anthropic.get_tokenizer()
      )
      self._client = anthropic.Client(api_key) if api_key else None
  
imports: from typing import Any, Dict, List, Optional
  import json
  import requests
  import time
  import urllib.parse
  import websocket
  import anthropic
  from helm.common.cache import Cache, CacheConfig
  from helm.common.hierarchical_logger import htrack_block, hlog
  from helm.common.request import EMBEDDING_UNAVAILABLE_REQUEST_RESULT, Request, RequestResult, Sequence, Token, ErrorFlags
  from helm.common.tokenization_request import TokenizationRequest, TokenizationRequestResult, DecodeRequest, DecodeRequestResult, TokenizationToken
  from .client import Client, wrap_request_time, truncate_sequence
  from transformers import PreTrainedTokenizerBase, PreTrainedTokenizerFast
  from dataclasses import asdict
label_desc: Use image node_id 1 to create a new AnthropicClient object from inherited base classes: Client with example: obj = AnthropicClient(cache_config, api_key)