code: def embedding(
      model: str,
      input: Union[list, str],
      api_key: Optional[str] = None,
      logging_obj=None,
      model_response=None,
      optional_params=None,
      encoding=None,
  ):
      ### BOTO3 INIT ###
      # pop aws_secret_access_key, aws_access_key_id, aws_region_name from kwargs, since completion calls fail with them
      aws_secret_access_key = optional_params.pop(
          "aws_secret_access_key", None
      )
      aws_access_key_id = optional_params.pop("aws_access_key_id", None)
      aws_region_name = optional_params.pop("aws_region_name", None)
      aws_bedrock_runtime_endpoint = optional_params.pop(
          "aws_bedrock_runtime_endpoint", None
      )
  
      # use passed in BedrockRuntime.Client if provided, otherwise create a new one
      client = init_bedrock_client(
          aws_access_key_id=aws_access_key_id,
          aws_secret_access_key=aws_secret_access_key,
          aws_region_name=aws_region_name,
          aws_bedrock_runtime_endpoint=aws_bedrock_runtime_endpoint,
      )
      if type(input) == str:
          embeddings = [
              _embedding_func_single(
                  model,
                  input,
                  optional_params=optional_params,
                  client=client,
                  logging_obj=logging_obj,
              )
          ]
      else:
          ## Embedding Call
          embeddings = [
              _embedding_func_single(
                  model,
                  i,
                  optional_params=optional_params,
                  client=client,
                  logging_obj=logging_obj,
              )
              for i in input
          ]  # [TODO]: make these parallel calls
  
      ## Populate OpenAI compliant dictionary
      embedding_response = []
      for idx, embedding in enumerate(embeddings):
          embedding_response.append(
              {
                  "object": "embedding",
                  "index": idx,
                  "embedding": embedding,
              }
          )
      model_response["object"] = "list"
      model_response["data"] = embedding_response
      model_response["model"] = model
      input_tokens = 0
  
      input_str = "".join(input)
  
      input_tokens += len(encoding.encode(input_str))
  
      usage = Usage(
          prompt_tokens=input_tokens,
          completion_tokens=0,
          total_tokens=input_tokens + 0,
      )
      model_response.usage = usage
  
      return model_response
  
imports: import json, copy, types
  import os
  from enum import Enum
  import time
  from typing import Callable, Optional, Any, Union
  import litellm
  from litellm.utils import ModelResponse, get_secret, Usage
  from .prompt_templates.factory import prompt_factory, custom_prompt
  import httpx
label_desc: Use image node_id 5 for calling a global function with example usage: embedding(model, input, api_key, logging_obj, model_response, optional_params, encoding) and returns: model_response