code: def _embedding_func_single(
      model: str,
      input: str,
      client: Any,
      optional_params=None,
      encoding=None,
      logging_obj=None,
  ):
      # logic for parsing in - calling - parsing out model embedding calls
      ## FORMAT EMBEDDING INPUT ##
      provider = model.split(".")[0]
      inference_params = copy.deepcopy(optional_params)
      inference_params.pop(
          "user", None
      )  # make sure user is not passed in for bedrock call
      modelId = (
          optional_params.pop("model_id", None) or model
      )  # default to model if not passed
      if provider == "amazon":
          input = input.replace(os.linesep, " ")
          data = {"inputText": input, **inference_params}
          # data = json.dumps(data)
      elif provider == "cohere":
          inference_params["input_type"] = inference_params.get(
              "input_type", "search_document"
          )  # aws bedrock example default - https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/providers?model=cohere.embed-english-v3
          data = {"texts": [input], **inference_params}  # type: ignore
      body = json.dumps(data).encode("utf-8")
      ## LOGGING
      request_str = f"""
      response = client.invoke_model(
          body={body},
          modelId={modelId},
          accept="*/*",
          contentType="application/json",
      )"""  # type: ignore
      logging_obj.pre_call(
          input=input,
          api_key="",  # boto3 is used for init.
          additional_args={
              "complete_input_dict": {"model": modelId, "texts": input},
              "request_str": request_str,
          },
      )
      try:
          response = client.invoke_model(
              body=body,
              modelId=modelId,
              accept="*/*",
              contentType="application/json",
          )
          response_body = json.loads(response.get("body").read())
          ## LOGGING
          logging_obj.post_call(
              input=input,
              api_key="",
              additional_args={"complete_input_dict": data},
              original_response=json.dumps(response_body),
          )
          if provider == "cohere":
              response = response_body.get("embeddings")
              # flatten list
              response = [
                  item for sublist in response for item in sublist
              ]
              return response
          elif provider == "amazon":
              return response_body.get("embedding")
      except Exception as e:
          raise BedrockError(
              message=f"Embedding Error with model {model}: {e}",
              status_code=500,
          )
  
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 4 for calling a global function with example usage: _embedding_func_single(model, input, client, optional_params, encoding, logging_obj) and returns: response, response_body