المكتبة التقنية ←

إعداد Cohere للعمل مع Oracle APEX App Builder

English version

My original LinkedIn walkthrough connected a Cohere service to Oracle APEX App Builder. The useful starting point is a workspace service definition: provider, endpoint, model, and credential are configured together before you ask the assistant to help with code.

Create the workspace service

In APEX 26.2, open App Builder → Workspace Utilities → All Workspace Utilities → Generative AI. Create a service, select Cohere, and give it a clear name and Static ID. Navigation labels can differ by APEX version. Oracle describes the configuration workflow.

This is an illustrative configuration record, not an import file or executable script:

Name: Cohere Development Assistant
Static ID: COHERE_DEV_ASSISTANT
AI Provider: Cohere
Used by App Builder: On
Default for New Apps: Off (enable if required)
Base URL: https://api.cohere.ai/v2
AI Model: command-r-08-2024
Credential: a workspace Web Credential

The endpoint and model above come from my original example. Confirm that your installed APEX version supports the endpoint and that your provider account can access the chosen model. Check Cohere's current model catalog; availability can vary by hosting platform.

Separate the two switches

Used by App Builder enables the service for builder features. Default for New Apps chooses the default service for newly created applications. Decide each setting independently; they serve different purposes. See Oracle's service attribute reference.

Select or create the Web Credential in APEX. Keep the API key out of JavaScript, screenshots, articles, and repositories. Oracle documents credential storage and runtime controls, including token and timeout settings.

Test with a small, reviewable request

Run Test Connection before saving. Then try a prompt using invented schema names:

Given demo_orders(order_id, customer_id, amount), write a read-only
SQL query returning total amount by customer_id. Explain how SUM
handles null amounts. Do not invent columns or execute the query.

Review the proposed SQL, assumptions, null handling, and access rules before using it. A successful connection proves connectivity; the generated answer still needs technical review. Use synthetic examples while evaluating the assistant, and choose deliberately which application information may be sent to the external provider.

النسخة العربية

الشرح الأصلي على LinkedIn كان عن ربط خدمة Cohere مع Oracle APEX App Builder. البداية العملية هي تعريف خدمة داخل الـWorkspace: تختار المزوّد والرابط والموديل وبيانات الاتصال، وبعدها تطلب من المساعد دعمك في كتابة الكود.

أنشئ خدمة داخل الـWorkspace

في APEX 26.2 افتح App Builder → Workspace Utilities → All Workspace Utilities → Generative AI. أنشئ خدمة، واختر Cohere، وحدّد اسمًا واضحًا وStatic ID. أسماء القوائم قد تختلف حسب إصدار APEX. توضح Oracle خطوات الإعداد.

المثال التالي لتوضيح الإعدادات، وليس ملف استيراد أو سكربت قابلًا للتنفيذ:

Name: Cohere Development Assistant
Static ID: COHERE_DEV_ASSISTANT
AI Provider: Cohere
Used by App Builder: On
Default for New Apps: Off (enable if required)
Base URL: https://api.cohere.ai/v2
AI Model: command-r-08-2024
Credential: a workspace Web Credential

الرابط والموديل هنا من المثال الأصلي. تأكد أن إصدار APEX المثبّت يدعم الرابط، وأن حسابك عند المزوّد يتيح الموديل المطلوب. راجع قائمة موديلات Cohere الحالية، لأن الإتاحة قد تختلف بين منصات الاستضافة.

افصل بين الاختيارين

Used by App Builder يتيح الخدمة لخصائص بيئة التطوير. أما Default for New Apps فيختار الخدمة الافتراضية للتطبيقات الجديدة. قرّر كل إعداد بشكل مستقل لأن لكل واحد وظيفة مختلفة. راجع مرجع خصائص الخدمة لدى Oracle.

اختر أو أنشئ Web Credential داخل APEX. احتفظ بمفتاح API بعيدًا عن JavaScript والصور والمقالات والمستودعات. توثّق Oracle حفظ بيانات الاتصال وإعدادات التشغيل، ومنها حدود التوكنز والمهلة الزمنية.

اختبر بطلب صغير يمكن مراجعته

شغّل Test Connection قبل الحفظ، ثم جرّب طلبًا بأسماء جداول افتراضية:

لدي جدول افتراضي demo_orders(order_id, customer_id, amount).
اكتب استعلام SQL للقراءة فقط يعرض إجمالي amount لكل customer_id.
اشرح تعامل SUM مع قيم amount الفارغة. لا تخترع أعمدة ولا تنفّذ الاستعلام.

راجع SQL المقترح وافتراضاته وتعامله مع القيم الفارغة وقواعد الوصول قبل استخدامه. نجاح الاتصال يثبت الوصول للخدمة، وتظل الإجابة المولّدة محتاجة مراجعة فنية. استخدم أمثلة افتراضية أثناء التقييم، وحدّد بوضوح معلومات التطبيق المسموح بإرسالها للمزوّد الخارجي.