code: def trim_stop_tokens(text: str, stop_tokens: List[str]) -> str:
      for stop_token in stop_tokens:
          if text.endswith(stop_token):
              return text[: -len(stop_token)]
      return text
  
file_path: dstack/gateway/src/dstack/gateway/openai/clients/tgi.py
imports: import asyncio
  import datetime
  import json
  import uuid
  from typing import AsyncIterator, Dict, List, Optional
  import httpx
  import jinja2
  from dstack.gateway.errors import GatewayError
  from dstack.gateway.openai.clients import ChatCompletionsClient
  from dstack.gateway.openai.schemas import ChatCompletionsChoice, ChatCompletionsChunk, ChatCompletionsChunkChoice, ChatCompletionsRequest, ChatCompletionsResponse, ChatCompletionsUsage, ChatMessage, FinishReason
label_desc: Use image node_id 4 for calling the TGIChatCompletions obj's underlying member method code with example usage: obj.trim_stop_tokens(text, stop_tokens) and returns: text, text