Views
No views yet
| Tool | Tag | Description |
|---|---|---|
| Calculator | <calculator>expr</calculator> | Mathematical computation |
| Clock | <clock/> | Current date/time |
| Search | <search_1/> ... </search_1> | Web search |
| Lookup | <lookup/> | Knowledge base lookup |
| Analyze | <analyze/> | Problem analysis |
| Evaluate | <evaluate_1/> | Quality evaluation |
| Synthesize | <synthesize/> | Information synthesis |
| Focus | <focus/> | Focus attention |
| Think | <think/> | Step-by-step reasoning |
| Verify | <verify/> | Result verification |
| Reflect | <reflect/> | Self-reflection |
| Correct | <correct/> | Error correction |
| Tool Type | Percentage |
|---|---|
| Calculator | 33.1% |
| Search | 21.5% |
| Lookup | 20.1% |
| Clock | 14.4% |
| No-tool | 18.4% |
| Multi-tool | 7.5% |
1from tools.app_layer import DongshanAppLayer
2
3app = DongshanAppLayer(model_name="mojoz/qwen2.5-1.5b-instruct-lora-finetuned")
4result = app.query("今天星期几?现在几点了?")
5print(result)1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4# Load base model and LoRA adapter
5base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
6model = PeftModel.from_pretrained(base_model, "mojoz/qwen2.5-1.5b-instruct-lora-finetuned")
7tokenizer = AutoTokenizer.from_pretrained("mojoz/qwen2.5-1.5b-instruct-lora-finetuned")
8
9# Chat with tool calling
10messages = [
11 {"role": "system", "content": "你是东山论知识助手..."},
12 {"role": "user", "content": "帮我计算 123 × 456"}
13]
14text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
15inputs = tokenizer(text, return_tensors="pt")
16outputs = model.generate(**inputs, max_new_tokens=512)
17print(tokenizer.decode(outputs[0]))