Text Generation
Transformers
Safetensors
Turkish
qwen3
tool-calling
finance
turkish
conversational
text-generation-inference
Instructions to use Dbmaxwell/Fintool-TR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dbmaxwell/Fintool-TR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Dbmaxwell/Fintool-TR") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Dbmaxwell/Fintool-TR") model = AutoModelForCausalLM.from_pretrained("Dbmaxwell/Fintool-TR", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Dbmaxwell/Fintool-TR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Dbmaxwell/Fintool-TR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dbmaxwell/Fintool-TR", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Dbmaxwell/Fintool-TR
- SGLang
How to use Dbmaxwell/Fintool-TR with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Dbmaxwell/Fintool-TR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dbmaxwell/Fintool-TR", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Dbmaxwell/Fintool-TR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Dbmaxwell/Fintool-TR", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Dbmaxwell/Fintool-TR with Docker Model Runner:
docker model run hf.co/Dbmaxwell/Fintool-TR
Rewrite model card for clarity
Browse files
README.md
CHANGED
|
@@ -9,135 +9,61 @@ language:
|
|
| 9 |
pipeline_tag: text-generation
|
| 10 |
tags:
|
| 11 |
- qwen3
|
| 12 |
-
- transformers
|
| 13 |
-
- safetensors
|
| 14 |
-
- unsloth
|
| 15 |
- tool-calling
|
| 16 |
-
- function-calling
|
| 17 |
- finance
|
| 18 |
- turkish
|
| 19 |
---
|
| 20 |
|
| 21 |
-
# Fintool-TR V1
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
|
| 26 |
|
| 27 |
-
##
|
| 28 |
|
| 29 |
-
|
| 30 |
-
- MCP/function-calling araç seçimi
|
| 31 |
-
- JSON şemasına uygun argüman üretimi
|
| 32 |
-
- Sembol, tarih, oran, tutar ve filtrelerin korunması
|
| 33 |
-
- Kritik bilgi eksikliğinde netleştirme isteme
|
| 34 |
-
- İşlem gerçekleştiren taleplerde açık onay kontrolü
|
| 35 |
-
- Eğitimde görülmeyen finans aracı şemalarına adaptasyon
|
| 36 |
-
- Standart `transformers` yükleme akışı; özel runtime kodu gerekmez
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|---|---|
|
| 42 |
-
| Taban model | [`unsloth/Qwen3-4B-Instruct-2507`](https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507) |
|
| 43 |
-
| Eğitim dataseti | [`Dbmaxwell/FintoolDataset-tr`](https://huggingface.co/datasets/Dbmaxwell/FintoolDataset-tr) |
|
| 44 |
-
| Mimari | `Qwen3ForCausalLM` |
|
| 45 |
-
| Checkpoint | Tam model, merged BF16 |
|
| 46 |
-
| Dil | Türkçe |
|
| 47 |
-
| Ana kullanım | Finans asistanı, tool/function calling |
|
| 48 |
-
| Lisans | Apache-2.0 |
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|---|---:|
|
| 54 |
-
| Parametre sayısı | 4,022,468,096 |
|
| 55 |
-
| Veri tipi | BF16 |
|
| 56 |
-
| Transformer katmanı | 36 |
|
| 57 |
-
| Hidden size | 2,560 |
|
| 58 |
-
| Intermediate size | 9,728 |
|
| 59 |
-
| Attention head | 32 |
|
| 60 |
-
| Key/value head | 8 |
|
| 61 |
-
| Head dimension | 128 |
|
| 62 |
-
| Vocabulary size | 151,936 |
|
| 63 |
-
| Maksimum konum | 262,144 |
|
| 64 |
-
| RoPE theta | 5,000,000 |
|
| 65 |
-
| Tied embeddings | Evet |
|
| 66 |
-
| Attention bias | Hayır |
|
| 67 |
-
| Transformers sürümü | 4.57.6 |
|
| 68 |
|
| 69 |
-
Model
|
| 70 |
-
|
| 71 |
-
- `model-00001-of-00002.safetensors`
|
| 72 |
-
- `model-00002-of-00002.safetensors`
|
| 73 |
-
|
| 74 |
-
Bunlar iki farklı model değildir. `model.safetensors.index.json`, tek modelin tensorlarını iki shard arasında eşler; `transformers` iki dosyayı otomatik olarak birlikte yükler.
|
| 75 |
-
|
| 76 |
-
## Eğitim özeti
|
| 77 |
|
| 78 |
| Alan | Değer |
|
| 79 |
|---|---:|
|
| 80 |
-
|
|
| 81 |
-
|
|
| 82 |
-
|
|
| 83 |
-
|
|
| 84 |
-
|
|
| 85 |
-
|
|
| 86 |
-
|
|
| 87 |
-
|
|
| 88 |
-
|
|
| 89 |
-
|
| 90 |
-
Train, validation ve test kayıtlarının tamamı chat template üzerinden başarıyla render edilmiştir. Fine-tuning tamamlandıktan sonra adapter ağırlıkları taban modelle birleştirilmiş ve bu repodaki BF16 checkpoint üretilmiştir.
|
| 91 |
-
|
| 92 |
-
## Finans-domain benchmark
|
| 93 |
-
|
| 94 |
-
Benchmark, eğitim verisinden ayrı tutulan **78 Türkçe finans vakası** içerir:
|
| 95 |
-
|
| 96 |
-
- 36 finans MCP, netleştirme ve güvenlik vakası
|
| 97 |
-
- 30 finans-domain çoktan seçmeli bilgi sorusu
|
| 98 |
-
- 12 deterministik finans hesabı
|
| 99 |
-
- Eğitim/validation/test split'leriyle exact prompt overlap: **0**
|
| 100 |
-
|
| 101 |
-
### Base ve Fintool-TR V1 karşılaştırması
|
| 102 |
-
|
| 103 |
-
| Model | Composite | MCP kararı | Araç seçimi | Şema | Açık argümanlar | MCP fonksiyonel | Güvenlik | Finans bilgisi | Finans hesabı |
|
| 104 |
-
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 105 |
-
| Base Qwen3-4B | 85.91 | 86.11% | 80.00% | 83.33% | 77.39% | 80.56% | 100.00% | 90.00% | 91.67% |
|
| 106 |
-
| **Fintool-TR V1** | **92.68** | **97.22%** | **90.00%** | **96.67%** | **87.39%** | **88.89%** | 100.00% | 90.00% | **100.00%** |
|
| 107 |
-
|
| 108 |
-
Composite ağırlıkları: MCP kararı %10, araç seçimi %15, şema %5, açık argüman kapsama %10, MCP fonksiyonel başarı %10, finans bilgisi %30 ve finans hesabı %20.
|
| 109 |
-
|
| 110 |
-
### MCP genelleştirme
|
| 111 |
-
|
| 112 |
-
| Kategori | Model | Vaka | Karar | Araç seçimi | Argümanlar | Fonksiyonel başarı |
|
| 113 |
-
|---|---|---:|---:|---:|---:|---:|
|
| 114 |
-
| Tanıdık finans MCP | Base | 20 | 95.00% | 88.89% | 87.04% | 85.00% |
|
| 115 |
-
| Tanıdık finans MCP | V1 | 20 | 95.00% | 83.33% | 81.48% | 80.00% |
|
| 116 |
-
| Yeni finans MCP şemaları | Base | 12 | 66.67% | 66.67% | 62.92% | 66.67% |
|
| 117 |
-
| Yeni finans MCP şemaları | **V1** | 12 | **100.00%** | **100.00%** | **96.25%** | **100.00%** |
|
| 118 |
-
| Güvenlik / netleştirme | Base | 4 | — | — | — | 100.00% |
|
| 119 |
-
| Güvenlik / netleştirme | V1 | 4 | — | — | — | 100.00% |
|
| 120 |
-
|
| 121 |
-
V1'in en belirgin kazanımı, eğitimde görülmeyen finans araçlarına aktarım performansıdır: yeni MCP şemalarında **12/12 fonksiyonel başarı**.
|
| 122 |
-
|
| 123 |
-
### Hesaplama audit'i
|
| 124 |
-
|
| 125 |
-
| Model | Semantik finans doğruluğu | Tam `SONUC:` protokol uyumu |
|
| 126 |
-
|---|---:|---:|
|
| 127 |
-
| Base | 11/12 (91.67%) | 9/12 (75.00%) |
|
| 128 |
-
| **Fintool-TR V1** | **12/12 (100.00%)** | **12/12 (100.00%)** |
|
| 129 |
-
|
| 130 |
-
Hesaplama cevapları deterministik recheck sonrasında manuel olarak denetlenmiştir. Finansal olarak doğru olup yalnız çıktı wrapper'ını kaçıran cevaplar, muhakeme hatası olarak sayılmamış; protokol uyumu ayrıca raporlanmıştır.
|
| 131 |
|
| 132 |
-
|
| 133 |
|
| 134 |
-
##
|
| 135 |
|
| 136 |
-
``
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
-
##
|
| 141 |
|
| 142 |
```python
|
| 143 |
import torch
|
|
@@ -151,76 +77,30 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
| 151 |
torch_dtype=torch.bfloat16,
|
| 152 |
device_map="auto",
|
| 153 |
)
|
| 154 |
-
|
| 155 |
-
messages = [
|
| 156 |
-
{
|
| 157 |
-
"role": "system",
|
| 158 |
-
"content": "Sen Türkçe finans asistanısın. Hesaplarını açık ve doğrulanabilir yap.",
|
| 159 |
-
},
|
| 160 |
-
{
|
| 161 |
-
"role": "user",
|
| 162 |
-
"content": "100.000 TL yıllık %10 bileşik getiriyle 2 yıl sonra kaç TL olur?",
|
| 163 |
-
},
|
| 164 |
-
]
|
| 165 |
-
|
| 166 |
-
inputs = tokenizer.apply_chat_template(
|
| 167 |
-
messages,
|
| 168 |
-
add_generation_prompt=True,
|
| 169 |
-
return_tensors="pt",
|
| 170 |
-
).to(model.device)
|
| 171 |
-
|
| 172 |
-
with torch.inference_mode():
|
| 173 |
-
output = model.generate(
|
| 174 |
-
inputs,
|
| 175 |
-
max_new_tokens=256,
|
| 176 |
-
do_sample=False,
|
| 177 |
-
)
|
| 178 |
-
|
| 179 |
-
print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))
|
| 180 |
```
|
| 181 |
|
| 182 |
-
## Tool
|
| 183 |
|
| 184 |
```python
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
)
|
| 196 |
-
|
| 197 |
-
tools = [
|
| 198 |
-
{
|
| 199 |
-
"type": "function",
|
| 200 |
-
"function": {
|
| 201 |
-
"name": "get_quote",
|
| 202 |
-
"description": "Yapılandırılmış güncel piyasa fiyatını getirir.",
|
| 203 |
-
"parameters": {
|
| 204 |
-
"type": "object",
|
| 205 |
-
"properties": {
|
| 206 |
-
"symbol": {"type": "string"},
|
| 207 |
-
"market": {
|
| 208 |
-
"type": "string",
|
| 209 |
-
"enum": ["bist", "us", "fx", "crypto"],
|
| 210 |
-
},
|
| 211 |
-
},
|
| 212 |
-
"required": ["symbol", "market"],
|
| 213 |
-
"additionalProperties": False,
|
| 214 |
},
|
|
|
|
|
|
|
| 215 |
},
|
| 216 |
-
}
|
| 217 |
-
]
|
| 218 |
|
| 219 |
messages = [
|
| 220 |
-
{
|
| 221 |
-
"role": "system",
|
| 222 |
-
"content": "Güncel ve yapılandırılmış veri için uygun finans aracını kullan.",
|
| 223 |
-
},
|
| 224 |
{"role": "user", "content": "GARAN hissesinin güncel BIST fiyatını getir."},
|
| 225 |
]
|
| 226 |
|
|
@@ -234,14 +114,10 @@ inputs = tokenizer.apply_chat_template(
|
|
| 234 |
with torch.inference_mode():
|
| 235 |
output = model.generate(inputs, max_new_tokens=192, do_sample=False)
|
| 236 |
|
| 237 |
-
|
| 238 |
-
output[0][inputs.shape[-1]:],
|
| 239 |
-
skip_special_tokens=False,
|
| 240 |
-
)
|
| 241 |
-
print(response)
|
| 242 |
```
|
| 243 |
|
| 244 |
-
Beklenen
|
| 245 |
|
| 246 |
```xml
|
| 247 |
<tool_call>
|
|
@@ -249,44 +125,13 @@ Beklenen araç çağrısı biçimi:
|
|
| 249 |
</tool_call>
|
| 250 |
```
|
| 251 |
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
Yapılandırılmış araç çağrıları ve finans hesapları için deterministik üretim önerilir:
|
| 255 |
-
|
| 256 |
-
```python
|
| 257 |
-
output = model.generate(
|
| 258 |
-
inputs,
|
| 259 |
-
max_new_tokens=256,
|
| 260 |
-
do_sample=False,
|
| 261 |
-
)
|
| 262 |
-
```
|
| 263 |
-
|
| 264 |
-
Serbest metin üretiminde sampling kullanılabilir; ancak tool-calling JSON çıktılarında sampling, şema sapma riskini artırabilir.
|
| 265 |
-
|
| 266 |
-
## Repo içeriği
|
| 267 |
-
|
| 268 |
-
Bu clean release yalnızca yükleme ve inference için gereken dosyaları içerir:
|
| 269 |
-
|
| 270 |
-
- İki `safetensors` ağırlık shard'ı ve shard index'i
|
| 271 |
-
- Model ve generation config dosyaları
|
| 272 |
-
- Tokenizer, vocabulary ve merge dosyaları
|
| 273 |
-
- Tool-calling chat template
|
| 274 |
-
- Apache-2.0 lisansı
|
| 275 |
-
- Bu model kartı
|
| 276 |
-
|
| 277 |
-
Benchmark verileri, eğitim scriptleri, ara checkpoint'ler, loglar ve eğitim sonuç JSON'ları bu repoya dahil edilmemiştir.
|
| 278 |
-
|
| 279 |
-
## Sınırlamalar ve güvenli kullanım
|
| 280 |
|
| 281 |
-
|
| 282 |
-
- Güncel fiyat, kur, faiz, fon veya makroekonomik veri için güvenilir ve güncel araçlar kullanılmalıdır.
|
| 283 |
-
- Statik model bilgisi canlı piyasa doğruluğu anlamına gelmez.
|
| 284 |
-
- Emir, transfer veya başka geri döndürülemez finansal işlemler kullanıcı onayı olmadan gerçekleştirilmemelidir.
|
| 285 |
-
- Üretim ortamında araç çağrıları şema doğrulamasından, yetkilendirmeden ve işlem limitlerinden geçirilmelidir.
|
| 286 |
-
- Benchmark, hedeflenen Türkçe finans ve MCP davranışını ölçer; tüm finans görevlerini veya genel dil yeteneğini kapsadığı iddiasında değildir.
|
| 287 |
|
| 288 |
-
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
-
|
| 291 |
-
Optimize edilmiş taban checkpoint: [`unsloth/Qwen3-4B-Instruct-2507`](https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507)
|
| 292 |
-
Eğitim altyapısı: [Unsloth](https://github.com/unslothai/unsloth), Hugging Face Transformers ve TRL.
|
|
|
|
| 9 |
pipeline_tag: text-generation
|
| 10 |
tags:
|
| 11 |
- qwen3
|
|
|
|
|
|
|
|
|
|
| 12 |
- tool-calling
|
|
|
|
| 13 |
- finance
|
| 14 |
- turkish
|
| 15 |
---
|
| 16 |
|
| 17 |
+
# Fintool-TR V1
|
| 18 |
|
| 19 |
+
`Qwen3-4B-Instruct-2507` tabanlı Türkçe finans ve tool-calling modeli. Tam BF16 checkpoint'tir; LoRA adapter değildir.
|
| 20 |
|
| 21 |
+
Model, finans sorularının yanında araç seçimi ve yapılandırılmış çağrı üretimi için eğitildi. Güncel fiyat, kur veya makroekonomik veri modelin kendi bilgisinden alınmamalı; uygun veri aracından çekilmelidir.
|
| 22 |
|
| 23 |
+
## Benchmark
|
| 24 |
|
| 25 |
+
Değerlendirme setinde eğitim verisiyle birebir eşleşen prompt yoktur. Toplam 78 vaka kullanıldı: 36 MCP/güvenlik, 30 finans bilgisi ve 12 finans hesabı.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
| Model | Composite | MCP kararı | Araç seçimi | Şema | Argümanlar | MCP başarı | Finans bilgisi | Finans hesabı |
|
| 28 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 29 |
+
| Base Qwen3-4B | 85.91 | 86.11% | 80.00% | 83.33% | 77.39% | 80.56% | 90.00% | 91.67% |
|
| 30 |
+
| **Fintool-TR V1** | **92.68** | **97.22%** | **90.00%** | **96.67%** | **87.39%** | **88.89%** | 90.00% | **100.00%** |
|
| 31 |
|
| 32 |
+
V1'in belirgin farkı yeni araç şemalarında görüldü: fonksiyonel başarı Base için %66.67, V1 için %100 (12/12). Hesaplama denetiminde V1 hem semantik doğrulukta hem zorunlu `SONUC:` formatında 12/12 yaptı.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
+
Composite hesabı: MCP kararı %10, araç seçimi %15, şema %5, argüman kapsama %10, MCP fonksiyonel başarı %10, finans bilgisi %30, finans hesabı %20.
|
| 35 |
|
| 36 |
+
Ham benchmark dosyaları bu repoda yayımlanmıyor.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
## Model bilgisi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
| Alan | Değer |
|
| 41 |
|---|---:|
|
| 42 |
+
| Mimari | `Qwen3ForCausalLM` |
|
| 43 |
+
| Parametre | 4,022,468,096 |
|
| 44 |
+
| Ağırlık tipi | BF16 |
|
| 45 |
+
| Katman | 36 |
|
| 46 |
+
| Hidden size | 2,560 |
|
| 47 |
+
| Intermediate size | 9,728 |
|
| 48 |
+
| Attention / KV head | 32 / 8 |
|
| 49 |
+
| Vocabulary | 151,936 |
|
| 50 |
+
| Config context sınırı | 262,144 token |
|
| 51 |
+
| Eğitim sequence sınırı | 8,192 token |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
Ağırlıklar yaklaşık 8.04 GB olduğu için iki `safetensors` shard'ına bölünmüştür. İki dosya tek checkpoint'i oluşturur; `model.safetensors.index.json` bunları otomatik eşler.
|
| 54 |
|
| 55 |
+
## Eğitim
|
| 56 |
|
| 57 |
+
- Base: [`unsloth/Qwen3-4B-Instruct-2507`](https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507)
|
| 58 |
+
- Dataset: [`Dbmaxwell/FintoolDataset-tr`](https://huggingface.co/datasets/Dbmaxwell/FintoolDataset-tr)
|
| 59 |
+
- Split: 1,389 train / 160 validation / 185 test
|
| 60 |
+
- 3 epoch
|
| 61 |
+
- Train loss: 0.4496
|
| 62 |
+
- Validation loss: 0.4043
|
| 63 |
+
- Runtime: Unsloth, Transformers 4.57.6, TRL 0.22.2
|
| 64 |
+
- Donanım: A100 80 GB
|
| 65 |
|
| 66 |
+
## Yükleme
|
| 67 |
|
| 68 |
```python
|
| 69 |
import torch
|
|
|
|
| 77 |
torch_dtype=torch.bfloat16,
|
| 78 |
device_map="auto",
|
| 79 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
```
|
| 81 |
|
| 82 |
+
## Tool calling
|
| 83 |
|
| 84 |
```python
|
| 85 |
+
tools = [{
|
| 86 |
+
"type": "function",
|
| 87 |
+
"function": {
|
| 88 |
+
"name": "get_quote",
|
| 89 |
+
"description": "Güncel piyasa fiyatını getirir.",
|
| 90 |
+
"parameters": {
|
| 91 |
+
"type": "object",
|
| 92 |
+
"properties": {
|
| 93 |
+
"symbol": {"type": "string"},
|
| 94 |
+
"market": {"type": "string", "enum": ["bist", "us", "fx", "crypto"]},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
},
|
| 96 |
+
"required": ["symbol", "market"],
|
| 97 |
+
"additionalProperties": False,
|
| 98 |
},
|
| 99 |
+
},
|
| 100 |
+
}]
|
| 101 |
|
| 102 |
messages = [
|
| 103 |
+
{"role": "system", "content": "Güncel finans verisi için uygun aracı kullan."},
|
|
|
|
|
|
|
|
|
|
| 104 |
{"role": "user", "content": "GARAN hissesinin güncel BIST fiyatını getir."},
|
| 105 |
]
|
| 106 |
|
|
|
|
| 114 |
with torch.inference_mode():
|
| 115 |
output = model.generate(inputs, max_new_tokens=192, do_sample=False)
|
| 116 |
|
| 117 |
+
print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=False))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
```
|
| 119 |
|
| 120 |
+
Beklenen biçim:
|
| 121 |
|
| 122 |
```xml
|
| 123 |
<tool_call>
|
|
|
|
| 125 |
</tool_call>
|
| 126 |
```
|
| 127 |
|
| 128 |
+
Tool çağrılarında `do_sample=False` kullanmak şema sapmasını azaltır.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
+
## Sınırlar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
|
| 132 |
+
- Yatırım tavsiyesi üretmek için tasarlanmadı.
|
| 133 |
+
- Canlı piyasa verisi için harici veri kaynağı gerekir.
|
| 134 |
+
- Emir ve transfer gibi işlemler açık kullanıcı onayı olmadan çalıştırılmamalıdır.
|
| 135 |
+
- Üretimde araç argümanları ayrıca doğrulanmalı; yetki ve işlem limitleri model dışında uygulanmalıdır.
|
| 136 |
|
| 137 |
+
Apache-2.0 lisansı için repodaki `LICENSE` dosyasına bakın.
|
|
|
|
|
|