docstr: Make a request following https://docs.aleph-alpha.com/api/complete.
docstr_tok: ["Make","a","request","following","https",":","\/\/docs.aleph-alpha.com\/api\/complete","."]
code: def make_request(self, request: Request) -> RequestResult:
      """Make a request following https://docs.aleph-alpha.com/api/complete."""
      raw_request = {
          "model": request.model_engine,
          "prompt": request.prompt,
          "maximum_tokens": request.max_tokens,
          "temperature": request.temperature,
          "top_k": request.top_k_per_token,
          "top_p": request.top_p,
          "presence_penalty": request.presence_penalty,
          "frequency_penalty": request.frequency_penalty,
          "n": request.num_completions,
          "stop_sequences": request.stop_sequences,
          "log_probs": request.top_k_per_token,
          "echo": request.echo_prompt,
          "tokens": True,  # Setting to True returns individual tokens of the completion
      }
  
      try:
  
          def do_it():
              result = self._send_request(
                  AlephAlphaClient.COMPLETION_ENDPOINT, raw_request
              )
              assert (
                  "completions" in result
              ), f"Invalid response: {result}"
              return result
  
          response, cached = self.cache.get(
              raw_request, wrap_request_time(do_it)
          )
      except (
          requests.exceptions.RequestException,
          AssertionError,
      ) as e:
          error: str = f"AlephAlphaClient error: {e}"
          return RequestResult(
              success=False,
              cached=False,
              error=error,
              completions=[],
              embedding=[],
          )
  
      completions: List[Sequence] = []
      for completion in response["completions"]:
          sequence_logprob: float = 0
          tokens: List[Token] = []
  
          # `completion_tokens` is the list of selected tokens.
          for i, token in enumerate(completion["completion_tokens"]):
              # Get the top K logprobs for the ith token
              top_logprobs: Dict[str, float] = completion["log_probs"][
                  i
              ]
              # Use the selected token value to get the logprob
              logprob: float = top_logprobs[token]
              sequence_logprob += logprob
              tokens.append(
                  Token(
                      text=token,
                      logprob=logprob,
                      top_logprobs=top_logprobs,
                  )
              )
  
          sequence: Sequence = Sequence(
              text=completion["completion"],
              logprob=sequence_logprob,
              tokens=tokens,
          )
          sequence = truncate_sequence(sequence, request)
          completions.append(sequence)
  
      return RequestResult(
          success=True,
          cached=cached,
          request_time=response["request_time"],
          request_datetime=response["request_datetime"],
          completions=completions,
          embedding=[],
      )
  
file_path: H2O/h2o_hf/helm/src/helm/proxy/clients/aleph_alpha_client.py
imports: import json
  import requests
  from typing import Any, Dict, List
  from aleph_alpha_client import Client
  from tokenizers import Tokenizer, Encoding
  from helm.common.cache import Cache, CacheConfig
  from helm.common.hierarchical_logger import hlog
  from helm.common.request import Request, RequestResult, Sequence, Token
  from helm.common.tokenization_request import DecodeRequest, DecodeRequestResult, TokenizationRequest, TokenizationRequestResult, TokenizationToken
  from .client import Client, wrap_request_time, truncate_sequence
label_desc: Use image node_id 4 for calling the AlephAlphaClient obj's underlying member method code with example usage: obj.make_request(request) and returns: RequestResult, result, RequestResult