# Use a pipeline as a high-level helper from transformers import pipeline messages = [ {"role": "user", "content": "Who are you?"}, ] pipe = pipeline("text-generation", model="microsoft/Phi-3.5-mini-instruct", trust_remote_code=True) output = pipe( messages, past_length=0, # Example: starting with an empty cache max_cache_length=1024, # Example: allow up to 1024 tokens in the cache ) print(output)