استفاده از ابزار و انجام عمل
هوش مصنوعی برای همه: هوش مصنوعی چطور باهوش شد؟
- Why generating text is different from calculating, querying a database, or changing a file.
- A tool interface as a description of available operations and expected arguments.
- The tool-call loop: propose a structured call, validate it, execute it in the application, and return the result.
- A calculator and a document-search tool in the equipment-assistant example.
- Read-only operations versus operations with side effects.
- Invalid arguments, tool errors, and why a model's claim that an operation succeeded is not evidence of execution.
- The distinction between capability residing in model parameters and capability supplied by surrounding software.
گفتن یا واقعاً انجامدادن؟
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><rect class="tm-surface" x="35" y="35" width="350" height="380" rx="16"/><rect class="tm-surface" x="415" y="35" width="350" height="380" rx="16"/><text class="tm-text" x="210" y="75" font-size="20" text-anchor="middle" direction="rtl">مدل</text><rect class="tm-soft" x="105" y="125" width="210" height="90" rx="12"/><text class="tm-text" x="210" y="165" font-size="17" text-anchor="middle" direction="rtl">متن روان</text><text class="tm-muted" x="210" y="195" font-size="14" text-anchor="middle" direction="rtl">«گزارش رو ذخیره کردم»</text><text class="tm-muted" x="210" y="300" font-size="16" text-anchor="middle" direction="rtl">گفتنِ انجام کار</text><text class="tm-text" x="590" y="75" font-size="20" text-anchor="middle" direction="rtl">برنامهٔ بیرونی</text><rect class="tm-accent tm-pulse" x="475" y="125" width="230" height="90" rx="12"/><text class="tm-text" x="590" y="165" font-size="17" text-anchor="middle">calculator</text><text class="tm-muted" x="590" y="193" font-size="14" text-anchor="middle" direction="rtl">محاسبهٔ واقعی</text><text class="tm-muted" x="590" y="300" font-size="16" text-anchor="middle" direction="rtl">اجرای عملیات</text></svg>
```
قرارداد ورودی ابزار
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto"><path class="tm-arrow" d="M0,0 L10,5 L0,10 z"/></marker></defs><rect class="tm-surface" x="40" y="90" width="210" height="115" rx="14"/><text class="tm-text" x="145" y="125" font-size="18" text-anchor="middle">calculator</text><text class="tm-text2" x="145" y="160" font-size="16" text-anchor="middle">multiply</text><rect class="tm-surface" x="310" y="75" width="220" height="145" rx="14"/><text class="tm-text" x="420" y="110" font-size="18" text-anchor="middle" direction="rtl">آرگومانها</text><text class="tm-text2" x="420" y="150" font-size="16" text-anchor="middle" direction="rtl">left: عدد</text><text class="tm-text2" x="420" y="185" font-size="16" text-anchor="middle" direction="rtl">right: عدد</text><line class="tm-line" x1="250" y1="145" x2="305" y2="145" marker-end="url(#arrow)"/><rect class="tm-accent tm-pulse" x="580" y="75" width="180" height="70" rx="14"/><text class="tm-text" x="670" y="105" font-size="16" text-anchor="middle" direction="rtl">نامعتبر</text><text class="tm-text2" x="670" y="130" font-size="15" text-anchor="middle" direction="rtl">right: «۱۵ وات»</text><line class="tm-line-accent" x1="530" y1="110" x2="575" y2="110" marker-end="url(#arrow)"/><rect class="tm-green" x="580" y="165" width="180" height="65" rx="14"/><text class="tm-text" x="670" y="192" font-size="16" text-anchor="middle" direction="rtl">معتبر</text><text class="tm-text2" x="670" y="216" font-size="15" text-anchor="middle" direction="rtl">right: ۱۵</text><line class="tm-line" x1="530" y1="185" x2="575" y2="195" marker-end="url(#arrow)"/><rect class="tm-soft" x="310" y="290" width="220" height="95" rx="14"/><text class="tm-text" x="420" y="325" font-size="17" text-anchor="middle" direction="rtl">جستوجوی سند</text><text class="tm-text2" x="420" y="355" font-size="15" text-anchor="middle">searchdocuments</text><text class="tm-text2" x="420" y="377" font-size="14" text-anchor="middle" direction="rtl">query: متن | collection: متن</text><line class="tm-line" x1="420" y1="220" x2="420" y2="285" marker-end="url(#arrow)"/></svg>
```
چرخهٔ درخواست تا پاسخ
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto"><path d="M0,0 L10,5 L0,10 z" class="tm-arrow"/></marker></defs><rect x="35" y="70" width="190" height="95" rx="12" class="tm-accent"/><text x="130" y="110" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">مدل</text><text x="130" y="140" text-anchor="middle" class="tm-text2" font-size="15" direction="rtl">درخواست calculator</text><rect x="305" y="70" width="190" height="95" rx="12" class="tm-accent"/><text x="400" y="110" text-anchor="middle" class="tm-text" font-size="18" direction="rtl">برنامه</text><text x="400" y="140" text-anchor="middle" class="tm-text2" font-size="15" direction="rtl">بررسی و اجرا</text><rect x="575" y="70" width="190" height="95" rx="12" class="tm-green tm-pulse"/><text x="670" y="110" text-anchor="middle" class="tm-text" font-size="18">calculator</text><text x="670" y="140" text-anchor="middle" class="tm-text2" font-size="15" direction="rtl">multiply: ۶ × ۱۵</text><path d="M225 118 H295" fill="none" class="tm-line-accent" marker-end="url(#arrow)"/><path d="M495 118 H565" fill="none" class="tm-line-accent tm-flow" marker-end="url(#arrow)"/><path d="M575 175 C500 260 300 260 225 175" fill="none" class="tm-line-accent tm-flow" marker-end="url(#arrow)"/><text x="400" y="285" text-anchor="middle" class="tm-text-green" font-size="18" direction="rtl">نتیجهٔ برگشتی: ۹۰</text><rect x="305" y="330" width="190" height="70" rx="12" class="tm-soft"/><text x="400" y="373" text-anchor="middle" class="tm-text" font-size="17" direction="rtl">مدل میسازد پاسخ نهایی</text></svg>
```
شاهد تغییر فایل
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" class="tm-arrow"/></marker></defs><rect x="45" y="80" width="250" height="105" rx="12" class="tm-soft"/><text x="170" y="120" class="tm-text" font-size="18" text-anchor="middle" direction="rtl">فایل مقصد</text><text x="170" y="153" class="tm-muted" font-size="16" text-anchor="middle" direction="rtl">محتوای ذخیرهشده</text><rect x="505" y="80" width="250" height="105" rx="12" class="tm-surface"/><text x="630" y="120" class="tm-text" font-size="18" text-anchor="middle" direction="rtl">گفتوگو</text><text x="630" y="153" class="tm-muted" font-size="16" text-anchor="middle" direction="rtl">«ذخیره شد»</text><rect x="285" y="255" width="230" height="95" rx="12" class="tm-green tm-enter"/><text x="400" y="294" class="tm-text" font-size="18" text-anchor="middle" direction="rtl">اجرای واقعی ابزار</text><text x="400" y="325" class="tm-text" font-size="16" text-anchor="middle" direction="rtl">نتیجهٔ مربوط به همان فایل</text><path d="M295 150 C345 180 360 210 385 250" fill="none" class="tm-line-accent" marker-end="url(#arrow)"/><path d="M505 150 C455 180 440 210 415 250" fill="none" class="tm-line" marker-end="url(#arrow)"/><rect x="285" y="375" width="230" height="58" rx="10" class="tm-gold tm-enter"/><text x="400" y="411" class="tm-text" font-size="16" text-anchor="middle" direction="rtl">بازخوانی و مقایسهٔ محتوا</text><path d="M400 350 L400 370" fill="none" class="tm-line" marker-end="url(#arrow)"/></svg>
```
ردیابی اعتبار نتیجه
```svg
<svg viewBox="0 0 800 450" xmlns="http://www.w3.org/2000/svg"><defs><marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path class="tm-arrow" d="M0,0 L0,6 L9,3 z"/></marker></defs><rect class="tm-surface" x="35" y="45" width="215" height="105" rx="12"/><text class="tm-text" x="142" y="85" font-size="18" text-anchor="middle" direction="rtl">درخواست calculator</text><text class="tm-text2" x="142" y="120" font-size="16" text-anchor="middle" direction="rtl">multiply · left: 6 · right: پانزده وات</text><rect class="tm-gold" x="292" y="45" width="215" height="105" rx="12"/><text class="tm-text" x="399" y="85" font-size="18" text-anchor="middle" direction="rtl">بررسی ورودی</text><text class="tm-text2" x="399" y="120" font-size="16" text-anchor="middle" direction="rtl">right باید عدد باشد</text><path class="tm-line" d="M250 98 H285" marker-end="url(#arrow)"/><rect class="tm-taupe" x="550" y="45" width="215" height="105" rx="12"/><text class="tm-text" x="657" y="85" font-size="18" text-anchor="middle" direction="rtl">رد درخواست</text><text class="tm-muted" x="657" y="120" font-size="16" text-anchor="middle" direction="rtl">ضربی انجام نشده</text><path class="tm-line" d="M507 98 H543" marker-end="url(#arrow)"/><rect class="tm-soft" x="35" y="245" width="215" height="105" rx="12"/><text class="tm-text" x="142" y="285" font-size="18" text-anchor="middle" direction="rtl">درخواست اصلاحشده</text><text class="tm-text2" x="142" y="320" font-size="16" text-anchor="middle">multiply · 6 × 15</text><rect class="tm-soft" x="292" y="245" width="215" height="105" rx="12"/><text class="tm-text" x="399" y="285" font-size="18" text-anchor="middle" direction="rtl">اجرای معتبر</text><text class="tm-text2" x="399" y="320" font-size="16" text-anchor="middle" direction="rtl">نرمافزار بیرونی</text><rect class="tm-green" x="550" y="245" width="215" height="105" rx="12"/><text class="tm-text" x="657" y="285" font-size="18" text-anchor="middle" direction="rtl">نتیجه</text><text class="tm-text2" x="657" y="320" font-size="16" text-anchor="middle">90</text><path class="tm-line" d="M250 298 H285" marker-end="url(#arrow)"/><path class="tm-line" d="M507 298 H543" marker-end="url(#arrow)"/><rect class="tm-surface" x="35" y="385" width="215" height="50" rx="10"/><text class="tm-text" x="142" y="417" font-size="16" text-anchor="middle" direction="rtl">جستوجو: درخواست معتبر</text><rect class="tm-taupe" x="292" y="385" width="215" height="50" rx="10"/><text class="tm-muted" x="399" y="417" font-size="16" text-anchor="middle" direction="rtl">سامانه در دسترس نیست</text><rect class="tm-gold" x="550" y="385" width="215" height="50" rx="10"/><text class="tm-text" x="657" y="407" font-size="14" text-anchor="middle" direction="rtl">بدون سند ≠</text><text class="tm-text" x="657" y="427" font-size="14" text-anchor="middle" direction="rtl">اجرا نشد</text><rect class="tm-accent" x="35" y="165" width="215" height="55" rx="10"/><text class="tm-text" x="142" y="199" font-size="16" text-anchor="middle" direction="rtl">فایل مقصد</text><rect class="tm-green" x="292" y="165" width="215" height="55" rx="10"/><text class="tm-text" x="399" y="188" font-size="15" text-anchor="middle" direction="rtl">نتیجهٔ نوشتن</text><text class="tm-text" x="399" y="207" font-size="14" text-anchor="middle" direction="rtl">+ بازخوانی در صورت نیاز</text><rect class="tm-taupe" x="550" y="165" width="215" height="55" rx="10"/><text class="tm-muted" x="657" y="199" font-size="15" text-anchor="middle" direction="rtl">پیام مدل کافی نیست</text><path class="tm-line-accent" d="M250 192 H285" marker-end="url(#arrow)"/><path class="tm-line-accent" d="M507 192 H543" marker-end="url(#arrow)"/><rect class="tm-accent" x="35" y="8" width="215" height="28" rx="8"/><text class="tm-text" x="142" y="28" font-size="15" text-anchor="middle" direction="rtl">درخواست مدل</text><rect class="tm-accent" x="292" y="8" width="215" height="28" rx="8"/><text class="tm-text" x="399" y="28" font-size="15" text-anchor="middle" direction="rtl">اجرای بیرونی</text><rect class="tm-green" x="550" y="8" width="215" height="28" rx="8"/><text class="tm-text" x="657" y="28" font-size="15" text-anchor="middle" direction="rtl">شاهد نتیجه</text></svg>
```
بازگشت به دوره