docstr: Checks if the given text fits within the context window given by `max_request_length`
  taking to account the expected completion length (defaults to 0).
docstr_tok: ["Checks","if","the","given","text","fits","within","the","context","window","given","by","`","max_request_length","`","taking","to","account","the","expected","completion","length","(","defaults","to","0",")","."]
code: def fits_within_context_window(
      self, text: str, expected_completion_token_length: int = 0
  ) -> bool:
      """
      Checks if the given text fits within the context window given by `max_request_length`
      taking to account the expected completion length (defaults to 0).
      """
      return (
          self.get_num_tokens(text) + expected_completion_token_length
          <= self.max_request_length
      )
  
file_path: H2O/h2o_hf/helm/src/helm/benchmark/window_services/local_window_service.py
imports: from typing import List, Optional, cast
  from .window_service import WindowService, EncodeResult
  from .tokenizer_service import TokenizerService
  from helm.common.tokenization_request import DecodeRequest, DecodeRequestResult, TokenizationRequest, TokenizationRequestResult, TokenizationToken
label_desc: Use image node_id 6 for calling the LocalWindowService obj's underlying member method code with example usage: obj.fits_within_context_window(text, expected_completion_token_length) and returns: unknown