spiderpan / doc-gpt
PHP library that for document GPT
Requires
- ext-pdo: *
- guzzlehttp/guzzle: ^7.8
- nyholm/psr7: ^1.8
- openai-php/client: ^0.8.1 || ^0.10.0
- pgvector/pgvector: ^0.1.4 || ^0.2.0
- symfony/http-client: ^7.0
Requires (Dev)
- fakerphp/faker: ^1.23
- friendsofphp/php-cs-fixer: ^3.48
- phpunit/phpunit: ^10.5
- squizlabs/php_codesniffer: *
- dev-main
- v0.5.1
- v0.5.0
- v0.4.0
- dev-dependabot/composer/symfony/http-client-7.3.1
- dev-dependabot/composer/openai-php/client-0.14.0
- dev-dependabot/composer/squizlabs/php_codesniffer-3.13.2
- dev-dependabot/composer/symfony/http-client-7.3.0
- dev-dependabot/composer/openai-php/client-0.13.0
- dev-dependabot/composer/guzzlehttp/guzzle-7.9.3
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.75.0
- dev-new-docker-compose
This package is auto-updated.
Last update: 2025-06-30 16:44:55 UTC
README
The DocGPT Project is a PHP-based application designed to index and retrieve information from documents using vector databases and OpenAI APIs. This project allows users to upload documents, convert their content into vector embeddings, and store these embeddings in a vector database. Users can then ask questions, and the system will provide relevant answers by retrieving and interpreting the indexed content using advanced language models.
Key Features
- Document Indexing: Extracts text from various document formats (PDF, DOCX, TXT) and converts it into vector embeddings.
- Vector Storage: Stores the vector embeddings in a vector database for efficient retrieval.
- Question Answering: Uses OpenAI APIs to find the most relevant documents and generate accurate answers based on the indexed content.
Technology Stack
- PHP: Backend scripting language for handling file uploads, API interactions, and database operations.
- OpenAI API: Generates embeddings and answers questions using advanced language models.
- pgvector: A PostgreSQL extension that enables efficient storage and retrieval of vector embeddings.
Installation
To install the DocGPT
library, you need to have Composer installed on your system. If you don't have Composer
installed, you can download it from here.
Once you have Composer installed, you can install the DocGPT
library by running the following command in your
terminal:
composer require spiderpan/doc-gpt
Usage
See example.php for a working example.
Development
- Clone the repo
- Run
./dev start
to start the docker containers
Common CLI commands
./dev reset
- Rebuild the containers./dev stop
- Stop the app./dev test
- Unit tests are run with PHPUnit./dev test path/to/Test.php
- Run a specific test file./dev shell
- Open a shell in the container./dev lint
- Run PHP CS Fixer