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).
  
  According to https://docs.cohere.ai/tokenize-reference#request, for tokenize, text: "the string to
  be tokenized, the minimum text length is 1 character, and the maximum text length is 65,536 characters.",
  so first check if the text has fewer than 65,536 characters.
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",")",".","According","to","https",":","\/\/docs.cohere.ai\/tokenize-reference","#","request",",","for","tokenize",",","text",":","``","the","string","to","be","tokenized",",","the","minimum","text","length","is","1","character",",","and","the","maximum","text","length","is","65,536","characters",".","``",",","so","first","check","if","the","text","has","fewer","than","65,536","characters","."]
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).
  
      According to https://docs.cohere.ai/tokenize-reference#request, for tokenize, text: "the string to
      be tokenized, the minimum text length is 1 character, and the maximum text length is 65,536 characters.",
      so first check if the text has fewer than 65,536 characters.
      """
      return (
          len(text) <= CohereClient.TOKENIZE_API_MAX_TEXT_LENGTH
          and self.get_num_tokens(text)
          + expected_completion_token_length
          <= self.max_request_length
      )
  
imports: from typing import List, Optional
  from helm.proxy.clients.cohere_client import CohereClient
  from .local_window_service import LocalWindowService
  from .tokenizer_service import TokenizerService
  from .window_service import EncodeResult
  from helm.common.tokenization_request import TokenizationRequest, TokenizationRequestResult, TokenizationToken
label_desc: Use image node_id 10 for calling the CohereWindowService obj's underlying member method code with example usage: obj.fits_within_context_window(text, expected_completion_token_length) and returns: unknown