laravel ask database
1.0.0
메모
이 패키지는 신속한 엔지니어링을위한 학습 리소스이며 PHP/Laravel을 사용하여 AI 생성 쿼리 생성을 달성하는 방법입니다. 당신은 아마도 이것을 생산에 사용해서는 안됩니다
DB를 사용하면 OpenAI의 GPT-3을 사용하여 자연어 데이터베이스 쿼리를 구축 할 수 있습니다.
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 ),
]; 먼저 .env 파일에서 OpenAI API 키를 구성해야합니다.
OPENAI_API_KEY = sk-... 그런 다음 DB::ask() 메소드를 사용하여 데이터베이스를 요청할 수 있습니다.
$ response = DB :: ask ( ' How many users are there? ' );composer test 최근에 변경된 내용에 대한 자세한 내용은 ChangElog를 참조하십시오.
자세한 내용은 기여를 참조하십시오.
MIT 라이센스 (MIT). 자세한 내용은 라이센스 파일을 참조하십시오.