الحصول على مفتاح API
المفاهيم

المهل الزمنية والإلغاء

معظم المكالمات تُعطى بعد 60 ثانية. تلك التي تجعل الخادم يعمل لدقائق لا تفعل ذلك عمداً، لأن التخلي عنها لن يوقف العمل.

60 s defaulttimeout: 0 disablesAbortSignal
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

ال_

الاستدعاءلا شيءالسبب
عدد المُكْفِيّات:: 60ولم يرد رد لم يصل بعد.
models.turn())أ(المنعطف يمكن أن يفكر لوقت طويل قبل أن يجيب
assistant.generate()لا شيءيمكن أن يأخذ جيل الدقائق؛ انظر أدناه.
tools.convert(), tools.fetch()لا شيءالسبب نفسه.
مُنافِيلا شيءوقد فتح باب الاتصال عن قصد.
لماذا لا يوجد موعد نهائي

العمل لا يتوقف لأنك توقفت عن الاستماع: إنه ينتهي، والمكالمة لا تزال مُحررة. لذلك فإن الموعد النهائي للعميل سيكلفك المكالمة ولا يرد شيئا. إربطها بـ Abort Signal بدلا من ذلك، الذي تتحكم به.

وضع وضعك الخاص

// For the whole client
const api = new IaGenify({ apiKey, timeout: 15_000 });

// For one call
await api.models.turn({ model, messages, signal: AbortSignal.timeout(30_000) });
# For the whole client, in seconds
api = IaGenify(api_key=api_key, timeout=15)

# For one call
api.models.turn(model=model, messages=messages, timeout=30)

أثناء

كل نداء يأخذ signalتم تمرير عملية الإجهاض التي طلبتها في الوقت الحاضر، ولم يتم إعادة تغليفها كفترة زمنية، حتى تستطيع أن تقول إلغاءك الخاص بعيدا عن تخلي العميل.

const controller = new AbortController();

const running = agent.run({
  message: "Audit the whole workspace.",
  onEvent: console.log,
  signal: controller.signal,
});

setTimeout(() => controller.abort(new Error("user cancelled")), 10_000);

try {
  await running;
} catch (err) {
  if (controller.signal.aborted) console.log("cancelled by us");
  else if (err.code === "timeout") console.log("the client gave up");
}
import threading
from iagenify import RequestTimeout

# Python has no AbortSignal: stop the agent from another thread
timer = threading.Timer(10, agent.stop)
timer.start()

try:
    result = agent.run(message="Audit the whole workspace.", on_event=print)
    if result["stopReason"] == "stopped":
        print("cancelled by us")
except RequestTimeout:
    print("the client gave up")
finally:
    timer.cancel()

الـ إثنان من الفشل الذي سترونه

رمز الشفرةالوضعالمعنى
ما408لا يوجد جواب في الموعد النهائي
غير قابل لل503لم يصل الطلب إلى هناك أبداً: القاعدة الخاطئة، لا شبكة، لا شيء يستمع.

unreachable في الخدمة الموزعة تقريباً الوسائل المستخدمة في جميع الحالات تقريباً baseUrl ليس هو ما قصدته. api.baseUrl « ومقارنتها ب https://api.iagenify.com.