def METHOD_NAME():
    from fastapi import FastAPI, Request
    app = FastAPI()
    @app.post("/func")
    async def get_generate_h(request: Request):
        json_post_raw = await request.json()
        config = json.loads(json_post_raw)
        text = config["prompt"]
        topp = config.get("top_p", 0.95)
        max_length = config.get("max_new_tokens", 256)
        topk = config.get("top_k_per_token", 1000)
        temperature = config.get("temperature", 0.9)
        sft = config.get("sft", False)
        seed = config.get("seed", 1234)
        print(f"sft is {sft}")
        out, tokens, probs = await sync_to_async(predict)(text,
                                           max_gen_len=max_length, top_p=topp,
                                           topk=topk,
                                           temperature=temperature, sft=sft,
                                           seed=seed)
        result = {
            "completions": [{
                "text": out,
                "tokens": tokens,
                "logprobs": probs,
                "top_logprobs_dicts": [{k: v} for k, v in zip(tokens, probs)],
            }],
            "input_length": len(config["prompt"]),
            "model_info":model_name}
        return result
    return app 