docstr: Initializes the cache based on the given type.
  
  Args:
      type (str, optional): The type of cache to initialize. Can be "local" or "redis". Defaults to "local".
      host (str, optional): The host address for the Redis cache. Required if type is "redis".
      port (int, optional): The port number for the Redis cache. Required if type is "redis".
      password (str, optional): The password for the Redis cache. Required if type is "redis".
      supported_call_types (list, optional): List of call types to cache for. Defaults to cache == on for all call types.
      **kwargs: Additional keyword arguments for redis.Redis() cache
  
  Raises:
      ValueError: If an invalid cache type is provided.
  
  Returns:
      None. Cache is set as a litellm param
docstr_tok: ["Initializes","the","cache","based","on","the","given","type",".","Args",":","type","(","str",",","optional",")",":","The","type","of","cache","to","initialize",".","Can","be","``","local","''","or","``","redis","''",".","Defaults","to","``","local","''",".","host","(","str",",","optional",")",":","The","host","address","for","the","Redis","cache",".","Required","if","type","is","``","redis","''",".","port","(","int",",","optional",")",":","The","port","number","for","the","Redis","cache",".","Required","if","type","is","``","redis","''",".","password","(","str",",","optional",")",":","The","password","for","the","Redis","cache",".","Required","if","type","is","``","redis","''",".","supported_call_types","(","list",",","optional",")",":","List","of","call","types","to","cache","for",".","Defaults","to","cache","==","on","for","all","call","types",".","*","*","kwargs",":","Additional","keyword","arguments","for","redis.Redis","(",")","cache","Raises",":","ValueError",":","If","an","invalid","cache","type","is","provided",".","Returns",":","None",".","Cache","is","set","as","a","litellm","param"]
code: def __init__(
      self,
      type: Optional[Literal["local", "redis", "s3"]] = "local",
      host: Optional[str] = None,
      port: Optional[str] = None,
      password: Optional[str] = None,
      supported_call_types: Optional[
          List[
              Literal[
                  "completion", "acompletion", "embedding", "aembedding"
              ]
          ]
      ] = ["completion", "acompletion", "embedding", "aembedding"],
      # s3 Bucket, boto3 configuration
      s3_bucket_name: Optional[str] = None,
      s3_region_name: Optional[str] = None,
      s3_api_version: Optional[str] = None,
      s3_use_ssl: Optional[bool] = True,
      s3_verify: Optional[Union[bool, str]] = None,
      s3_endpoint_url: Optional[str] = None,
      s3_aws_access_key_id: Optional[str] = None,
      s3_aws_secret_access_key: Optional[str] = None,
      s3_aws_session_token: Optional[str] = None,
      s3_config: Optional[Any] = None,
      **kwargs,
  ):
      """
      Initializes the cache based on the given type.
  
      Args:
          type (str, optional): The type of cache to initialize. Can be "local" or "redis". Defaults to "local".
          host (str, optional): The host address for the Redis cache. Required if type is "redis".
          port (int, optional): The port number for the Redis cache. Required if type is "redis".
          password (str, optional): The password for the Redis cache. Required if type is "redis".
          supported_call_types (list, optional): List of call types to cache for. Defaults to cache == on for all call types.
          **kwargs: Additional keyword arguments for redis.Redis() cache
  
      Raises:
          ValueError: If an invalid cache type is provided.
  
      Returns:
          None. Cache is set as a litellm param
      """
      if type == "redis":
          self.cache: BaseCache = RedisCache(
              host, port, password, **kwargs
          )
      if type == "local":
          self.cache = InMemoryCache()
      if type == "s3":
          self.cache = S3Cache(
              s3_bucket_name=s3_bucket_name,
              s3_region_name=s3_region_name,
              s3_api_version=s3_api_version,
              s3_use_ssl=s3_use_ssl,
              s3_verify=s3_verify,
              s3_endpoint_url=s3_endpoint_url,
              s3_aws_access_key_id=s3_aws_access_key_id,
              s3_aws_secret_access_key=s3_aws_secret_access_key,
              s3_aws_session_token=s3_aws_session_token,
              s3_config=s3_config,
              **kwargs,
          )
      if "cache" not in litellm.input_callback:
          litellm.input_callback.append("cache")
      if "cache" not in litellm.success_callback:
          litellm.success_callback.append("cache")
      if "cache" not in litellm._async_success_callback:
          litellm._async_success_callback.append("cache")
      self.supported_call_types = supported_call_types  # default to ["completion", "acompletion", "embedding", "aembedding"]
      self.type = type
  
imports: import litellm
  import time, logging
  import json, traceback, ast, hashlib
  from typing import Optional, Literal, List, Union, Any
  from openai._models import BaseModel
label_desc: Use image node_id 1 to create a new Cache object  with example: obj = Cache(type, host, port, password, supported_call_types, s3_bucket_name, s3_region_name, s3_api_version, s3_use_ssl, s3_verify, s3_endpoint_url, s3_aws_access_key_id, s3_aws_secret_access_key, s3_aws_session_token, s3_config)