|
|
""" |
|
|
Native Arabic Function Schemas |
|
|
============================== |
|
|
|
|
|
Bilingual function definitions with Arabic names, descriptions, and examples. |
|
|
""" |
|
|
|
|
|
NATIVE_ARABIC_SCHEMAS = [ |
|
|
|
|
|
{ |
|
|
"name": "transfer_money", |
|
|
"name_ar": "تحويل_أموال", |
|
|
"description": "Transfer money between bank accounts", |
|
|
"description_ar": "تحويل أموال بين الحسابات البنكية", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"from_account": { |
|
|
"type": "string", |
|
|
"description": "Source account number", |
|
|
"description_ar": "رقم الحساب المصدر", |
|
|
"examples_ar": ["SA0380000000608010167519"] |
|
|
}, |
|
|
"to_account": { |
|
|
"type": "string", |
|
|
"description": "Destination account number", |
|
|
"description_ar": "رقم الحساب المستقبل" |
|
|
}, |
|
|
"amount": { |
|
|
"type": "number", |
|
|
"description": "Amount to transfer", |
|
|
"description_ar": "المبلغ المراد تحويله" |
|
|
}, |
|
|
"currency": { |
|
|
"type": "string", |
|
|
"description": "Currency code", |
|
|
"description_ar": "رمز العملة", |
|
|
"enum": ["SAR", "AED", "EGP", "KWD", "QAR"], |
|
|
"examples_ar": ["ريال سعودي", "درهم إماراتي", "جنيه مصري"] |
|
|
} |
|
|
}, |
|
|
"required": ["from_account", "to_account", "amount"] |
|
|
} |
|
|
}, |
|
|
{ |
|
|
"name": "check_balance", |
|
|
"name_ar": "استعلام_رصيد", |
|
|
"description": "Check account balance", |
|
|
"description_ar": "الاستعلام عن رصيد الحساب", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"account_number": { |
|
|
"type": "string", |
|
|
"description": "Account number to check", |
|
|
"description_ar": "رقم الحساب للاستعلام" |
|
|
} |
|
|
}, |
|
|
"required": ["account_number"] |
|
|
} |
|
|
}, |
|
|
{ |
|
|
"name": "pay_bill", |
|
|
"name_ar": "دفع_فاتورة", |
|
|
"description": "Pay a utility or service bill", |
|
|
"description_ar": "دفع فاتورة خدمات", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"bill_type": { |
|
|
"type": "string", |
|
|
"description": "Type of bill", |
|
|
"description_ar": "نوع الفاتورة", |
|
|
"enum": ["electricity", "water", "telecom", "internet"], |
|
|
"enum_ar": ["كهرباء", "مياه", "اتصالات", "إنترنت"] |
|
|
}, |
|
|
"account_id": { |
|
|
"type": "string", |
|
|
"description": "Bill account/subscriber ID", |
|
|
"description_ar": "رقم المشترك" |
|
|
}, |
|
|
"amount": { |
|
|
"type": "number", |
|
|
"description": "Amount to pay", |
|
|
"description_ar": "المبلغ المراد دفعه" |
|
|
} |
|
|
}, |
|
|
"required": ["bill_type", "account_id"] |
|
|
} |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
"name": "renew_id", |
|
|
"name_ar": "تجديد_هوية", |
|
|
"description": "Renew national ID card", |
|
|
"description_ar": "تجديد بطاقة الهوية الوطنية", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"id_number": { |
|
|
"type": "string", |
|
|
"description": "National ID number", |
|
|
"description_ar": "رقم الهوية الوطنية" |
|
|
}, |
|
|
"reason": { |
|
|
"type": "string", |
|
|
"description": "Reason for renewal", |
|
|
"description_ar": "سبب التجديد", |
|
|
"enum": ["expiry", "damaged", "lost", "data_update"], |
|
|
"enum_ar": ["انتهاء الصلاحية", "تالفة", "مفقودة", "تحديث بيانات"] |
|
|
} |
|
|
}, |
|
|
"required": ["id_number"] |
|
|
} |
|
|
}, |
|
|
{ |
|
|
"name": "book_appointment", |
|
|
"name_ar": "حجز_موعد", |
|
|
"description": "Book an appointment at a government office", |
|
|
"description_ar": "حجز موعد في جهة حكومية", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"service_type": { |
|
|
"type": "string", |
|
|
"description": "Type of service", |
|
|
"description_ar": "نوع الخدمة" |
|
|
}, |
|
|
"location": { |
|
|
"type": "string", |
|
|
"description": "Preferred location/branch", |
|
|
"description_ar": "الفرع المفضل", |
|
|
"examples_ar": ["الرياض - العليا", "جدة - الحمراء"] |
|
|
}, |
|
|
"date": { |
|
|
"type": "string", |
|
|
"description": "Preferred date (YYYY-MM-DD)", |
|
|
"description_ar": "التاريخ المفضل" |
|
|
}, |
|
|
"time_slot": { |
|
|
"type": "string", |
|
|
"description": "Preferred time slot", |
|
|
"description_ar": "الفترة الزمنية", |
|
|
"enum": ["morning", "afternoon"], |
|
|
"enum_ar": ["صباحي", "مسائي"] |
|
|
} |
|
|
}, |
|
|
"required": ["service_type", "date"] |
|
|
} |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
"name": "search_product", |
|
|
"name_ar": "البحث_عن_منتج", |
|
|
"description": "Search for products in the store", |
|
|
"description_ar": "البحث عن منتجات في المتجر", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"query": { |
|
|
"type": "string", |
|
|
"description": "Search query", |
|
|
"description_ar": "كلمات البحث" |
|
|
}, |
|
|
"category": { |
|
|
"type": "string", |
|
|
"description": "Product category", |
|
|
"description_ar": "فئة المنتج", |
|
|
"examples_ar": ["إلكترونيات", "ملابس", "أجهزة منزلية"] |
|
|
}, |
|
|
"min_price": { |
|
|
"type": "number", |
|
|
"description": "Minimum price", |
|
|
"description_ar": "الحد الأدنى للسعر" |
|
|
}, |
|
|
"max_price": { |
|
|
"type": "number", |
|
|
"description": "Maximum price", |
|
|
"description_ar": "الحد الأقصى للسعر" |
|
|
}, |
|
|
"sort_by": { |
|
|
"type": "string", |
|
|
"description": "Sort order", |
|
|
"description_ar": "ترتيب حسب", |
|
|
"enum": ["price_asc", "price_desc", "rating", "newest"], |
|
|
"enum_ar": ["السعر تصاعدي", "السعر تنازلي", "التقييم", "الأحدث"] |
|
|
} |
|
|
}, |
|
|
"required": ["query"] |
|
|
} |
|
|
}, |
|
|
{ |
|
|
"name": "add_to_cart", |
|
|
"name_ar": "إضافة_للسلة", |
|
|
"description": "Add a product to shopping cart", |
|
|
"description_ar": "إضافة منتج إلى سلة التسوق", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"product_id": { |
|
|
"type": "string", |
|
|
"description": "Product identifier", |
|
|
"description_ar": "معرف المنتج" |
|
|
}, |
|
|
"quantity": { |
|
|
"type": "integer", |
|
|
"description": "Quantity to add", |
|
|
"description_ar": "الكمية", |
|
|
"default": 1 |
|
|
}, |
|
|
"size": { |
|
|
"type": "string", |
|
|
"description": "Product size if applicable", |
|
|
"description_ar": "المقاس" |
|
|
}, |
|
|
"color": { |
|
|
"type": "string", |
|
|
"description": "Product color if applicable", |
|
|
"description_ar": "اللون" |
|
|
} |
|
|
}, |
|
|
"required": ["product_id"] |
|
|
} |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
"name": "book_doctor_appointment", |
|
|
"name_ar": "حجز_موعد_طبيب", |
|
|
"description": "Book an appointment with a doctor", |
|
|
"description_ar": "حجز موعد مع طبيب", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"specialty": { |
|
|
"type": "string", |
|
|
"description": "Medical specialty", |
|
|
"description_ar": "التخصص الطبي", |
|
|
"examples_ar": ["طب عام", "طب أطفال", "طب باطني", "طب عيون", "طب أسنان"] |
|
|
}, |
|
|
"doctor_name": { |
|
|
"type": "string", |
|
|
"description": "Specific doctor name (optional)", |
|
|
"description_ar": "اسم الطبيب (اختياري)" |
|
|
}, |
|
|
"hospital": { |
|
|
"type": "string", |
|
|
"description": "Hospital or clinic name", |
|
|
"description_ar": "اسم المستشفى أو العيادة" |
|
|
}, |
|
|
"date": { |
|
|
"type": "string", |
|
|
"description": "Preferred date", |
|
|
"description_ar": "التاريخ المفضل" |
|
|
}, |
|
|
"reason": { |
|
|
"type": "string", |
|
|
"description": "Reason for visit", |
|
|
"description_ar": "سبب الزيارة" |
|
|
} |
|
|
}, |
|
|
"required": ["specialty", "date"] |
|
|
} |
|
|
}, |
|
|
{ |
|
|
"name": "get_lab_results", |
|
|
"name_ar": "نتائج_التحاليل", |
|
|
"description": "Retrieve laboratory test results", |
|
|
"description_ar": "استرجاع نتائج التحاليل المخبرية", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"patient_id": { |
|
|
"type": "string", |
|
|
"description": "Patient ID or file number", |
|
|
"description_ar": "رقم المريض أو الملف" |
|
|
}, |
|
|
"test_type": { |
|
|
"type": "string", |
|
|
"description": "Type of test", |
|
|
"description_ar": "نوع التحليل", |
|
|
"examples_ar": ["تحليل دم شامل", "تحليل سكر", "وظائف كلى", "وظائف كبد"] |
|
|
}, |
|
|
"date_from": { |
|
|
"type": "string", |
|
|
"description": "Start date for results", |
|
|
"description_ar": "تاريخ البداية" |
|
|
} |
|
|
}, |
|
|
"required": ["patient_id"] |
|
|
} |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
"name": "book_flight", |
|
|
"name_ar": "احجز_رحلة", |
|
|
"description": "Book a flight between cities", |
|
|
"description_ar": "حجز رحلة طيران بين المدن", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"origin": { |
|
|
"type": "string", |
|
|
"description": "Departure city", |
|
|
"description_ar": "مدينة المغادرة", |
|
|
"examples_ar": ["القاهرة", "الرياض", "دبي", "جدة"] |
|
|
}, |
|
|
"destination": { |
|
|
"type": "string", |
|
|
"description": "Arrival city", |
|
|
"description_ar": "مدينة الوصول" |
|
|
}, |
|
|
"date": { |
|
|
"type": "string", |
|
|
"description": "Travel date", |
|
|
"description_ar": "تاريخ السفر" |
|
|
}, |
|
|
"return_date": { |
|
|
"type": "string", |
|
|
"description": "Return date (optional)", |
|
|
"description_ar": "تاريخ العودة (اختياري)" |
|
|
}, |
|
|
"passengers": { |
|
|
"type": "integer", |
|
|
"description": "Number of passengers", |
|
|
"description_ar": "عدد المسافرين", |
|
|
"default": 1 |
|
|
}, |
|
|
"class": { |
|
|
"type": "string", |
|
|
"description": "Travel class", |
|
|
"description_ar": "درجة السفر", |
|
|
"enum": ["economy", "business", "first"], |
|
|
"enum_ar": ["اقتصادية", "أعمال", "أولى"] |
|
|
} |
|
|
}, |
|
|
"required": ["origin", "destination", "date"] |
|
|
} |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
"name": "get_weather", |
|
|
"name_ar": "احصل_على_الطقس", |
|
|
"description": "Get weather information for a city", |
|
|
"description_ar": "الحصول على معلومات الطقس لمدينة", |
|
|
"parameters": { |
|
|
"type": "object", |
|
|
"properties": { |
|
|
"city": { |
|
|
"type": "string", |
|
|
"description": "City name", |
|
|
"description_ar": "اسم المدينة", |
|
|
"examples_ar": ["القاهرة", "دبي", "الرياض", "بيروت", "عمان"] |
|
|
}, |
|
|
"days": { |
|
|
"type": "integer", |
|
|
"description": "Number of forecast days", |
|
|
"description_ar": "عدد أيام التوقعات", |
|
|
"default": 1 |
|
|
} |
|
|
}, |
|
|
"required": ["city"] |
|
|
} |
|
|
} |
|
|
] |
|
|
|
|
|
|
|
|
def get_schema_by_name(name: str, use_arabic: bool = False) -> dict: |
|
|
"""Get a schema by its name (English or Arabic).""" |
|
|
for schema in NATIVE_ARABIC_SCHEMAS: |
|
|
if schema['name'] == name or schema.get('name_ar') == name: |
|
|
if use_arabic: |
|
|
|
|
|
return { |
|
|
'name': schema.get('name_ar', schema['name']), |
|
|
'description': schema.get('description_ar', schema['description']), |
|
|
'parameters': schema['parameters'] |
|
|
} |
|
|
return schema |
|
|
return None |
|
|
|
|
|
|
|
|
def get_schemas_by_category(category: str) -> list: |
|
|
"""Get all schemas in a category.""" |
|
|
category_map = { |
|
|
'financial': ['transfer_money', 'check_balance', 'pay_bill'], |
|
|
'government': ['renew_id', 'book_appointment'], |
|
|
'ecommerce': ['search_product', 'add_to_cart'], |
|
|
'healthcare': ['book_doctor_appointment', 'get_lab_results'], |
|
|
'travel': ['book_flight'], |
|
|
'weather': ['get_weather'], |
|
|
} |
|
|
|
|
|
names = category_map.get(category, []) |
|
|
return [get_schema_by_name(name) for name in names if get_schema_by_name(name)] |
|
|
|