code: def embedding(
      model: str,
      input: list,
      api_key: Optional[str] = None,
      api_base: Optional[str] = None,
      logging_obj=None,
      model_response=None,
      optional_params=None,
      encoding=None,
  ):
      # Create completion URL
      if "https" in model:
          embeddings_url = model
      elif api_base:
          embeddings_url = f"{api_base}/v1/embeddings"
      else:
          raise OobaboogaError(
              status_code=404,
              message="API Base not set. Set one via completion(..,api_base='your-api-url')",
          )
  
      # Prepare request data
      data = {"input": input}
      if optional_params:
          data.update(optional_params)
  
      # Logging before API call
      if logging_obj:
          logging_obj.pre_call(
              input=input,
              api_key=api_key,
              additional_args={"complete_input_dict": data},
          )
  
      # Send POST request
      headers = validate_environment(api_key)
      response = requests.post(
          embeddings_url, headers=headers, json=data
      )
      if not response.ok:
          raise OobaboogaError(
              message=response.text, status_code=response.status_code
          )
      completion_response = response.json()
  
      # Check for errors in response
      if "error" in completion_response:
          raise OobaboogaError(
              message=completion_response["error"],
              status_code=completion_response.get("status_code", 500),
          )
  
      # Process response data
      model_response["data"] = [
          {
              "embedding": completion_response["data"][0]["embedding"],
              "index": 0,
              "object": "embedding",
          }
      ]
  
      num_tokens = len(completion_response["data"][0]["embedding"])
      # Adding metadata to response
      model_response.usage = Usage(
          prompt_tokens=num_tokens, total_tokens=num_tokens
      )
      model_response["object"] = "list"
      model_response["model"] = model
  
      return model_response
  
file_path: litellm/litellm/llms/oobabooga.py
imports: import os
  import json
  from enum import Enum
  import requests
  import time
  from typing import Callable, Optional
  from litellm.utils import ModelResponse, Usage
  from .prompt_templates.factory import prompt_factory, custom_prompt
label_desc: Use image node_id 3 for calling a global function with example usage: embedding(model, input, api_key, api_base, logging_obj, model_response, optional_params, encoding) and returns: model_response