code: def import_results(
      cache_config: KeyValueStoreCacheConfig,
      organization: str,
      request_results_path: str,
      dry_run: bool,
  ):
      """
      Given a jsonl file with request and results, uploads request/result pairs to the cache at `cache_path`.
      We assume each line of the input jsonl file is structured {request: ..., result: ...}.
      """
      count: int = 0
  
      # For MT-NLG, we send the same request `num_completions` times because the API does not support the OpenAI
      # parameter 'n'. In our cache, we use `completion_index` to differentiate responses for the same request,
      # We need to keep track of how many times we've seen a request to determine the value of `completion_index`.
      request_counts: Dict[str, int] = defaultdict(int)
  
      # Updates cache with request/result pairs from input jsonl file at `request_results_path`
      with create_key_value_store(cache_config) as store:
          with open(request_results_path, "r") as f:
              for line in f:
                  if len(line.strip()) == 0:
                      continue
  
                  request_and_result: Dict = json.loads(line)
                  request: Dict = request_and_result["request"]
                  result: Dict = request_and_result["result"]
  
                  if organization == "microsoft":
                      # Get the value of `completion_index` which is the current count
                      key: str = request_to_key(request)
                      completion_index: int = request_counts[key]
                      request_counts[key] += 1
                      cache_key: dict = {
                          "completion_index": completion_index,
                          **request,
                      }
                      store.put(cache_key, result)
                  else:
                      store.put(request, result)
  
                  count += 1
                  if count > 0 and count % 10_000 == 0:
                      hlog(f"Processed {count} entries")
  
          if dry_run:
              hlog(
                  f"--dry-run was set. Skipping writing out {count} entries."
              )
          else:
              hlog(
                  f"Wrote {count} entries to cache at {cache_config.cache_stats_key}."
              )
  
file_path: H2O/h2o_hf/helm/scripts/offline_eval/import_results.py
imports: import argparse
  import json
  from collections import defaultdict
  import os
  from typing import Dict
  from helm.common.cache import KeyValueStoreCacheConfig, MongoCacheConfig, SqliteCacheConfig, create_key_value_store, request_to_key
  from helm.common.hierarchical_logger import hlog, htrack
  from typing import List
label_desc: Use image node_id 1 for calling a global function with example usage: import_results(cache_config, organization, request_results_path, dry_run) without return types