laravel ask database
1.0.0
ملحوظة
من المفترض أن تكون هذه الحزمة مورد تعليمي للهندسة السريعة وكيفية تحقيق توليد الاستعلام الذي تم إنشاؤه بواسطة الذكاء الاصطناعى مع PHP/Laravel. ربما يجب ألا تستخدم هذا في الإنتاج
ASK DB يتيح لك استخدام GPT-3 من Openai لإنشاء استعلامات قاعدة بيانات اللغة الطبيعية.
DB :: ask ( ' How many users do we have on the "pro" plan? ' );يمكنك تثبيت الحزمة عبر الملحن:
composer require beyondcode/laravel-ask-databaseيمكنك نشر ملف التكوين بـ:
php artisan vendor:publish --tag= " ask-database-config "هذه هي محتويات ملف التكوين المنشور:
return [
/**
* The database connection name to use. Depending on your
* use case, you might want to limit the database user
* to have read-only access to the database.
*/
' connection ' => env ( ' ASK_DATABASE_DB_CONNECTION ' , ' mysql ' ),
/**
* Strict mode will throw an exception when the query
* would perform a write/alter operation on the database.
*
* If you want to allow write operations - or if you are using a read-only
* database user - you may disable strict mode.
*/
' strict_mode ' => env ( ' ASK_DATABASE_STRICT_MODE ' , true ),
/**
* The maximum number of tables to use before performing an additional
* table name lookup call to OpenAI.
* If you have a lot of database tables and columns, they might not fit
* into a single request to OpenAI. In that case, we will perform a
* lookup call to OpenAI to get the matching table names for the
* provided question.
*/
' max_tables_before_performing_lookup ' => env ( ' ASK_DATABASE_MAXIMUM_TABLES ' , 15 ),
]; أولاً ، تحتاج إلى تكوين مفتاح API Openai في ملف .env الخاص بك:
OPENAI_API_KEY = sk-... ثم ، يمكنك استخدام طريقة DB::ask() لطلب قاعدة البيانات:
$ response = DB :: ask ( ' How many users are there? ' );composer test يرجى الاطلاع على Changelog لمزيد من المعلومات حول ما تغير مؤخرًا.
يرجى الاطلاع على المساهمة للحصول على التفاصيل.
ترخيص معهد ماساتشوستس للتكنولوجيا (MIT). يرجى الاطلاع على ملف الترخيص لمزيد من المعلومات.