Phonsiri/gemma-3n-sales-agent-v1
AI Agent ผู้ช่วยขายอะไหล่รถยนต์ภาษาไทย fine-tuned จาก Gemma 3n e4b พร้อมความสามารถด้าน Tool Use / Function Calling ผ่าน XML tag format
Model Details
| รายการ | รายละเอียด |
|---|---|
| Base Model | google/gemma-3n-e4b |
| Model Type | Causal Language Model (SFT) |
| Language | ไทย (Thai) |
| License | MIT |
| Task | Tool-Use Agent, Conversational AI |
Intended Use
โมเดลนี้ออกแบบมาสำหรับงาน AI Sales Agent ในโดเมนอะไหล่รถยนต์ โดยสามารถ:
- เช็คสต็อกและราคาอะไหล่
- ค้นหาอะไหล่ตามหมวดหมู่
- ตรวจสอบความเข้ากันได้กับรุ่นรถ
- สร้างออเดอร์สั่งซื้อ
ไม่แนะนำ ให้ใช้นอกโดเมนนี้ หรือใช้กับภาษาอื่นนอกจากภาษาไทย
Tools
โมเดลถูก fine-tune ให้เรียกใช้เครื่องมือผ่าน XML tag <tool_call> และรับผลผ่าน <tool_response>
| Tool | คำอธิบาย |
|---|---|
check_stock |
เช็คสต็อกและราคาอะไหล่ |
search_parts |
ค้นหาอะไหล่ตามคำค้นและหมวดหมู่ |
check_compatibility |
เช็คความเข้ากันได้กับรุ่นรถ |
create_order |
สร้างออเดอร์สั่งซื้อใหม่ |
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "Phonsiri/gemma-3n-sales-agent-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
prompt = """คุณเป็น AI ผู้ช่วยขายอะไหล่รถยนต์
คุณมีเครื่องมือ (Tools) ให้ใช้งานดังนี้:
[
{
"name": "check_stock",
"description": "เช็คสต็อกและราคาอะไหล่",
"parameters": {
"type": "object",
"properties": {
"part_name": {"type": "string"},
"car_model": {"type": "string"}
},
"required": ["part_name"]
}
}
]
ถ้าต้องใช้เครื่องมือ ให้ตอบกลับด้วย XML tag: <tool_call>{"name": "...", "arguments": {...}}</tool_call>
ลูกค้า: มีผ้าเบรกหน้า Toyota Vios ไหมครับ"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
ตัวอย่าง Output:
<tool_call>{"name": "check_stock", "arguments": {"part_name": "ผ้าเบรกหน้า", "car_model": "Toyota Vios"}}</tool_call>
Training Data
Fine-tuned ด้วย dataset ที่สร้างขึ้นเอง ประกอบด้วยบทสนทนาหลายรูปแบบ:
- Single-turn — ถาม-ตอบเดี่ยว เช่น เช็คสต็อกสินค้า
- Multi-turn — สนทนาต่อเนื่อง เช่น เช็คความเข้ากัน → ดูราคา → สั่งซื้อ
- Tool chaining — เรียกใช้หลาย tool ในการสนทนาเดียว
แต่ละ sample ประกอบด้วย system prompt (tools definition) + บทสนทนาลูกค้า + tool call/response cycle
Limitations
- โมเดลถูก fine-tune เฉพาะโดเมนอะไหล่รถยนต์ ประสิทธิภาพอาจลดลงนอกโดเมนนี้
- ออกแบบมาสำหรับภาษาไทยเป็นหลัก
- Tool response ต้องอยู่ในรูปแบบ
<tool_response name="...">เท่านั้น
Citation
@misc{phonsiri2024gemma3nsalesagent,
author = {Phonsiri},
title = {gemma-3n-sales-agent-v1: Thai Auto Parts Sales Agent},
year = {2024},
publisher = {Hugging Face},
url = {https://huggingface.co/Phonsiri/gemma-3n-sales-agent-v1}
}