การใช้งาน
การใช้งานการดีบัก API Requests

การดีบัก API Requests

เพื่อดีบักคำขอที่ส่งไปยังผู้ให้บริการการแปล (เช่น ChatGPT, Claude หรือ Google Translate) และการตอบกลับของพวกเขา คุณสามารถเปิดใช้งานระดับความรุนแรง 🔵 Info ในการตั้งค่าสำหรับ Logs & Notifications

เปิดใช้งานระดับความรุนแรง Info ในการตั้งค่า Logs & Notifications
เปิดใช้งานระดับความรุนแรง Info ในการตั้งค่า Logs & Notifications

การเข้าถึงบันทึก API Requests

บันทึกจะถูกจัดเก็บไว้ภายใต้รายการ api-requests

AI requests ในบันทึก
AI requests ในบันทึก

สิ่งที่ถูกบันทึก

สำหรับผู้ให้บริการ AI รายการ api-requests จะมีข้อมูลโดยละเอียดเกี่ยวกับ:

  • พรอมต์ที่ส่งไปยังผู้ให้บริการ AI
  • การตอบกลับที่ได้รับอย่างสมบูรณ์
  • ข้อผิดพลาดหรือปัญหาใดๆ ที่เกิดขึ้นระหว่างการสื่อสาร
  • โมเดลที่ใช้
  • จำนวนโทเค็นที่ใช้
รายละเอียดของ AI request ในบันทึก
รายละเอียดของ AI request ในบันทึก

ตัวอย่างเช่น JSON "Additional context" ต่อไปนี้แสดงรายละเอียดของคำขอที่ส่งไปยัง Claude และการตอบกลับของมัน:

{
  "request": {
    "model": "claude-3-7-sonnet-latest",
    "max_tokens": 128000,
    "messages": [
      {
        "role": "user",
        "content": "You are a language translator.\r\n\r\nI'm working on internationalizing my application.\r\n\r\nI've created a JSON with sentences in English. Please translate the sentences to Spanish from Argentina.\r\n\r\nIf a sentence contains HTML, do not translate inside the HTML tags.\n\nReturn ONLY a JSON object with a single key \"translations\" containing an array of translated strings.\nDo not include any explanations, markdown formatting, or code blocks.\nThe response must be a valid JSON object starting with { and ending with }.\n\nThis is the JSON:\n\n[\"HTTP caching improves performance\",\"Categories Block\",\"Latest Posts Block\",\"Democratizing publishing\"]"
      }
    ]
  },
  "response": {
    "id": "msg_01EC2Qp2fMw6VQY8tGESFrh2",
    "type": "message",
    "role": "assistant",
    "model": "claude-3-7-sonnet-20250219",
    "content": [
      {
        "type": "text",
        "text": "{\n  \"translations\": [\n  \"El caché HTTP mejora el rendimiento\",\n  \"Bloque de categorías\",\n  \"Bloque de entradas recientes\",\n  \"Democratizando la publicación\"\n  ]\n}"
      }
    ],
    "stop_reason": "end_turn",
    "stop_sequence": null,
    "usage": {
      "input_tokens": 138,
      "cache_creation_input_tokens": 0,
      "cache_read_input_tokens": 0,
      "output_tokens": 61,
      "service_tier": "standard"
    }
  }
}