> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# تطبيق التصحيح

> اسمح لنماذج Responses بإرجاع عمليات تصحيح تم التحقق منها.

استخدم `phaseo:apply_patch` عندما يحتاج سير عمل Responses إلى إرجاع تغييرات الملفات كعمليات تصحيح منظّمة. يتحقق Phaseo من العملية ويعيدها إلى العميل؛ ولا يغيّر نظام الملفات أو المستودع.

<Note>
  `phaseo:apply_patch` is available on `/v1/responses`.
</Note>

## الطلب

```bash theme={null}
curl https://api.phaseo.app/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5-nano",
    "input": "Create a small README patch for this project.",
    "tools": [
      { "type": "phaseo:apply_patch" }
    ]
  }'
```

## بنية العملية

عندما يستدعي النموذج الأداة، يرسل كائن عملية:

```json theme={null}
{
  "operation": {
    "type": "update_file",
    "path": "/README.md",
    "diff": "@@ ...\n-Old text\n+New text\n"
  }
}
```

أنواع العمليات المدعومة:

| النوع | الحقول المطلوبة |
| - | - |
| `create_file` | `path`, `diff` |
| `update_file` | `path`, `diff` |
| `delete_file` | `path` |

## نتيجة الأداة

يعيد Phaseo العملية التي تم التحقق منها إلى حلقة النموذج:

```json theme={null}
{
  "status": "completed",
  "operation": {
    "type": "update_file",
    "path": "/README.md",
    "diff": "@@ ...\n-Old text\n+New text\n"
  },
  "message": "Patch operation validated. The client must apply or reject this patch and report the result."
}
```

تظل مسؤولية تطبيق التصحيح أو عرضه على المستخدم أو رفضه أو طلب عملية منقّحة من النموذج على عاتق تطبيقك.

## الاستخدام والأسعار

يسجّل Phaseo:

```json theme={null}
{
  "usage": {
    "server_tool_use": {
      "apply_patch_requests": 1
    }
  }
}
```

يمكن لبطاقات الأسعار احتساب ذلك باستخدام مقياس `server_tool_apply_patch_requests`.

## صفحات ذات صلة

* [أدوات الخادم](./index.mdx)
* [واجهة Responses](../../api-reference/endpoint/responses.mdx)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.