laravel embeddings
1.0.0
يقيس نصي Openai ارتباط سلاسل النص. باستخدام هذه الحزمة ، يمكنك حفظ التضمين تلقائيًا لطرازك البليغ في قاعدة بيانات متجه PostgresQL. لاستخدام التضمينات في طلبات AI الخاصة بك إلى نقاط نهاية API Openai.
يمكنك تثبيت الحزمة عبر الملحن:
composer require vormkracht10/laravel-embeddingsيمكنك نشر وتشغيل الترحيل مع:
php artisan vendor:publish --tag= " laravel-embeddings-migrations "
php artisan migrateيمكنك نشر ملف التكوين بـ:
php artisan vendor:publish --tag= " laravel-embeddings-config "هذه هي محتويات ملف التكوين المنشور:
return [
' enabled ' => env ( ' EMBEDDINGS_ENABLED ' , true ),
' driver ' => env ( ' EMBEDDINGS_DRIVER ' , ' null ' ), // 'null' / 'openai'
' queue ' => true ,
' database ' => [
' connection ' => env ( ' EMBEDDINGS_DATABASE_CONNECTION ' , ' pgsql ' ),
' table ' => env ( ' EMBEDDINGS_DB_TABLE ' , ' embeddings ' ),
],
' openai ' => [
' key ' => env ( ' OPENAI_API_KEY ' ),
' model ' => env ( ' OPENAI_EMBEDDING_MODEL ' , ' text-embedding-ada-002 ' )
],
/*
|--------------------------------------------------------------------------
| Chunk Sizes
|--------------------------------------------------------------------------
|
| These options allow you to control the maximum chunk size when you are
| mass importing data into the embed engine. This allows you to fine
| tune each of these chunk sizes based on the power of the servers.
|
*/
' chunk ' => [
' embeddable ' => 500 ,
' unembeddable ' => 500 ,
],
];املأ متغيرات البيئة التالية
EMBEDDINGS_DRIVER = openai
OPENAI_API_KEY = // Add the Embeddable trait to your Model(s).
class MyModel {
use Embeddable {
Laravel Scout Searchable::usesSoftDelete insteadof Vormkracht10 Embedding Embeddable ;
}
}
// You can override the embeddable content
class MyModel {
// ...
public function toEmbeddableString ()
{
return strip_tags ( implode ( ' , ' , $ this -> toArray ()));
}
}composer test يرجى الاطلاع على Changelog لمزيد من المعلومات حول ما تغير مؤخرًا.
يرجى الاطلاع على المساهمة للحصول على التفاصيل.
يرجى مراجعة سياسة الأمان الخاصة بنا حول كيفية الإبلاغ عن نقاط الضعف الأمنية.
ترخيص معهد ماساتشوستس للتكنولوجيا (MIT). يرجى الاطلاع على ملف الترخيص لمزيد من المعلومات.