laravel embeddings
1.0.0
OpenAi의 텍스트 임베드는 텍스트 문자열의 관련성을 측정합니다. 이 패키지를 사용하면 PostgreSQL 벡터 데이터베이스에서 웅변 모델에 대한 임베드를 자동으로 저장할 수 있습니다. AI 요청에 OpenAI API 엔드 포인트에 임베딩을 사용합니다.
작곡가를 통해 패키지를 설치할 수 있습니다.
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 ,
],
];다음 ENV 변수를 작성하십시오
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 라이센스 (MIT). 자세한 내용은 라이센스 파일을 참조하십시오.