async def METHOD_NAME(request: Request):
    json_post_raw = await request.json()
    config = json.loads(json_post_raw)
    contexts = config["prompt"]
    topk= config.get("top_k_per_token", 20)
    topp = config.get("top_p", 0.9)
    t = config.get("temperature", 0.9)
    seed = config.get("seed", 1234)
    history = config.get("history", [])
    max_length = config.get("max_new_tokens", 256)
    gene_time = config.get("time", 15)
    gene_time = 40
    tokens = covert_prompt_to_input_ids_with_history(contexts, history, tokenizer, max_length)
    with torch.no_grad():
        fun = aquila_generate_by_ids_stream(model, tokenizer, tokens,
                                            out_max_length=max_length,
                                             top_k=topk, top_p=topp,
                                              temperature=t,
                                               seed=seed, device=device )
    def trans():
        start_time = time.time()
        while True:
            try:
                yield next(fun)
            except Exception as e:
                print(e)
                break
            if time.time() - start_time > gene_time:
                print("time up")
                break
    return StreamingResponse(trans(), media_type="text/plain")