from unsloth import FastLanguageModel adapter_id = "Aswinkv07/qwen3.5-4b-neo4j-text2cypher-lora" model, tokenizer = FastLanguageModel.from_pretrained( model_name=adapter_id, max_seq_length=4096,)FastLanguageModel.for_inference(model) schema = '''Node properties:- Person: name (STRING)- Movie: title (STRING)Relationships:- (:Person)-[:ACTED_IN]->(:Movie)'''question = "Which movies did Tom Hanks act in?" messages = [ { "role": "system", "content": ( "You are an expert Neo4j Cypher query generator. " "Given a graph schema and a natural language question, generate " "exactly one valid Cypher query. Return only the Cypher query. " "Do not include markdown, explanations, comments, or extra text. " "Use only labels, relationship types, and properties that appear " "in the provided schema." ), }, { "role": "user", "content": ( f"Graph schema:\n{schema}\n\n" f"Question:\n{question}\n\n" "Generate the Cypher query." ), },] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt",).to(model.device) outputs = model.generate( input_ids=inputs, max_new_tokens=512, do_sample=False,)query = tokenizer.decode(outputs[0, inputs.shape[-1]:], skip_special_tokens=True)print(query.strip())