class_docstr: Client for the models where we evaluate offline. Since the queries are handled offline, the `TogetherClient` just
  checks if the request/result is cached. We return the result if it's in the cache. Otherwise, we return an error.
class_docstr_tok: ["Client","for","the","models","where","we","evaluate","offline",".","Since","the","queries","are","handled","offline",",","the","`","TogetherClient","`","just","checks","if","the","request\/result","is","cached",".","We","return","the","result","if","it","'s","in","the","cache",".","Otherwise",",","we","return","an","error","."]
code: def make_request(self, request: Request) -> RequestResult:
      raw_request = TogetherClient.convert_to_raw_request(request)
      cache_key: Dict = Client.make_cache_key(raw_request, request)
  
      try:
  
          def do_it():
              result = requests.post(
                  TogetherClient.INFERENCE_ENDPOINT, json=raw_request
              ).json()
              assert "output" in result, f"Invalid response: {result}"
              return result["output"]
  
          def fail():
              raise RuntimeError(
                  f"The result has not been uploaded to the cache for the following request: {cache_key}"
              )
  
          response, cached = self.cache.get(
              cache_key,
              wrap_request_time(do_it if self.api_key else fail),
          )
      except RuntimeError as e:
          error: str = f"TogetherClient error: {e}"
          return RequestResult(
              success=False,
              cached=False,
              error=error,
              completions=[],
              embedding=[],
          )
  
      # Expect the result to be structured the same way as a response from OpenAI API.
      completions: List[Sequence] = []
      for raw_completion in response["choices"]:
          sequence_logprob = 0
          tokens: List[Token] = []
  
          # TODO: take this out when "logprobs" is supported properly in batch/offline mode
          # Currently, token_logprobs is provided in interactive/online mode but it has a different format
          # Waiting for a fix.
          if "logprobs" in raw_completion:
              raw_data = raw_completion["logprobs"]
              for text, logprob, top_logprobs in zip(
                  raw_data["tokens"],
                  raw_data["token_logprobs"],
                  raw_data["top_logprobs"],
              ):
                  text = fix_text(text, request.model)
                  tokens.append(
                      Token(
                          text=text,
                          logprob=logprob or 0,
                          top_logprobs=dict(top_logprobs or {}),
                      )
                  )
                  sequence_logprob += logprob or 0
          else:
              # hack: just make the entire text one token so that something shows up in the frontend
              text = fix_text(raw_completion["text"], request.model)
              tokens.append(
                  Token(text=text, logprob=0, top_logprobs={})
              )
  
          completion = Sequence(
              text=fix_text(raw_completion["text"], request.model),
              logprob=sequence_logprob,
              tokens=tokens,
              finish_reason={"reason": raw_completion["finish_reason"]},
          )
          completion = truncate_sequence(completion, request)
          completions.append(completion)
  
      request_time: Union[float, Dict[str, Any]] = response[
          "request_time"
      ]
      if isinstance(request_time, dict):
          batch_performance_metadata: Dict = response["request_time"]
          return RequestResult(
              success=True,
              cached=cached,
              request_time=0,
              completions=completions,
              batch_size=batch_performance_metadata["batch_size"],
              batch_request_time=batch_performance_metadata[
                  "batch_time"
              ],
              embedding=[],
          )
      else:
          return RequestResult(
              success=True,
              cached=cached,
              request_time=response["raw_compute_time"]
              if "raw_compute_time" in response
              else request_time,
              completions=completions,
              embedding=[],
          )
  
file_path: H2O/h2o_hf/helm/src/helm/proxy/clients/together_client.py
imports: from typing import List, Dict, Any, Optional, Union
  import requests
  from helm.common.cache import Cache, CacheConfig
  from helm.common.request import Request, RequestResult, Sequence, Token
  from helm.common.tokenization_request import TokenizationRequest, TokenizationRequestResult, DecodeRequest, DecodeRequestResult
  from .client import Client, wrap_request_time, truncate_sequence
label_desc: Use image node_id 3 for calling the TogetherClient obj's underlying member method code with example usage: obj.make_request(request) and returns: RequestResult, RequestResult, result, RequestResult