Open MuhammadAslam945 opened 1 month ago
To run the example I think you need to create the vetcor extension and the test_place table:
https://github.com/theodo-group/LLPhant/blob/main/CONTRIBUTING.md#integration-tests
I'm storing vector data into postgres retrieving too but when I gain pass to data after fetching then it give error
On Fri, 16 Aug 2024, 17:43 Franco Lombardo, @.***> wrote:
See also https://llphant.io/docs/usage#doctrine-vectorstore
— Reply to this email directly, view it on GitHub https://github.com/theodo-group/LLPhant/issues/204#issuecomment-2293443318, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATKIQKXDKDBA525MELZVFG3ZRXXYPAVCNFSM6AAAAABMS5ONC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGQ2DGMZRHA . You are receiving this because you authored the thread.Message ID: @.***>
I'm storing vector data into postgres retrieving too but when I gain pass to data after fetching then it give error
What is the error you get? Can you also post the stack trace of the error?
// public function startChat($data){ // $config = ORMSetup::createAttributeMetadataConfiguration( // [DIR.'/src'], // true // );
// $connectionParams = [
// 'dbname' => 'postgres',
// 'user' => 'postgres',
// 'password' => '12345',
// 'host' => '127.0.0.1',
// 'port' => 5432,
// 'driver' => 'pdo_pgsql',
// ];
// $textInput = $data['input'];
// $this->messages[] = [
// 'type' => 'user',
// 'input' => $textInput,
// ];
// $connection = DriverManager::getConnection($connectionParams);
// $entityManager = new EntityManager($connection, $config);
// $vectorStore = new DoctrineVectorStore($entityManager,
DocumentEntity::class);
// $embeddingGenerator = new
OpenAIADA002EmbeddingGenerator($this->config);
// $document = new DocumentEntity();
// $document->userId = Auth::user()->id;
// // $embededDocuments =
$embeddingGenerator->embedDocuments([$document]); // // dd($embededDocuments,$textInput); // // try { // // $vectorStore->addDocuments($embededDocuments); // // } catch (\Exception $e) { // // // Log the error or handle it accordingly // // error_log("Error adding documents: " . $e->getMessage()); // // return response()->json(['error' => $e->getMessage()], 500); // // } // $embeddings = $embeddingGenerator->embedText($textInput); // $results = $vectorStore->similaritySearch($embeddings, 2); // expect($result[0]->content)->toBe($textInput);
// $this->messages[] = [
// 'type' => 'bot',
// 'response' => $result[0]->content
// ];
// return response()->json($this->messages);
//
this is my method where I first save data in postgres then try to query store data it give error embedding in array format
On Fri, Aug 16, 2024 at 8:23 PM Franco Lombardo @.***> wrote:
I'm storing vector data into postgres retrieving too but when I gain pass to data after fetching then it give error What is the error you get? Can yoi also post the stack trace of the error?
— Reply to this email directly, view it on GitHub https://github.com/theodo-group/LLPhant/issues/204#issuecomment-2293709967, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATKIQKUIAPAOPL6G5UCEYUDZRYKQBAVCNFSM6AAAAABMS5ONC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTG4YDSOJWG4 . You are receiving this because you authored the thread.Message ID: @.***>
The Issue cause was the class PlaceEntity it ask to give all values formatted, embeddings,content etc PlaceEntity::class I could not understand It $paris = new PlaceEntity(); $paris->content = 'I live in Paris'; $paris->type = 'city'; $france = new PlaceEntity(); $france->content = 'I live in France'; $france->type = 'country'; when I select data from database then how I pass values in PlaceEntity::class If I want to do semantic similarity search on my documents table which already hold the embeddings and content then how I do
On Mon, Aug 19, 2024 at 2:42 PM muhammad Aslam @.***> wrote:
// public function startChat($data){ // $config = ORMSetup::createAttributeMetadataConfiguration( // [DIR.'/src'], // true // );
// $connectionParams = [ // 'dbname' => 'postgres', // 'user' => 'postgres', // 'password' => '12345', // 'host' => '127.0.0.1', // 'port' => 5432, // 'driver' => 'pdo_pgsql', // ]; // $textInput = $data['input']; // $this->messages[] = [ // 'type' => 'user', // 'input' => $textInput, // ]; // $connection = DriverManager::getConnection($connectionParams); // $entityManager = new EntityManager($connection, $config); // $vectorStore = new DoctrineVectorStore($entityManager,
DocumentEntity::class);
// $embeddingGenerator = new
OpenAIADA002EmbeddingGenerator($this->config);
// $document = new DocumentEntity(); // $document->userId = Auth::user()->id; // // $embededDocuments =
$embeddingGenerator->embedDocuments([$document]); // // dd($embededDocuments,$textInput); // // try { // // $vectorStore->addDocuments($embededDocuments); // // } catch (\Exception $e) { // // // Log the error or handle it accordingly // // error_log("Error adding documents: " . $e->getMessage()); // // return response()->json(['error' => $e->getMessage()], 500); // // } // $embeddings = $embeddingGenerator->embedText($textInput); // $results = $vectorStore->similaritySearch($embeddings, 2); // expect($result[0]->content)->toBe($textInput);
// $this->messages[] = [ // 'type' => 'bot', // 'response' => $result[0]->content // ]; // return response()->json($this->messages); //
this is my method where I first save data in postgres then try to query store data it give error embedding in array format
On Fri, Aug 16, 2024 at 8:23 PM Franco Lombardo @.***> wrote:
I'm storing vector data into postgres retrieving too but when I gain pass to data after fetching then it give error What is the error you get? Can yoi also post the stack trace of the error?
— Reply to this email directly, view it on GitHub https://github.com/theodo-group/LLPhant/issues/204#issuecomment-2293709967, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATKIQKUIAPAOPL6G5UCEYUDZRYKQBAVCNFSM6AAAAABMS5ONC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTG4YDSOJWG4 . You are receiving this because you authored the thread.Message ID: @.***>
<?php namespace App;
use Doctrine\ORM\Mapping as ORM; use LLPhant\Embeddings\VectorStores\Doctrine\DoctrineEmbeddingEntityBase; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\Table; use LLPhant\Embeddings\VectorStores\Doctrine\VectorType;
class DocumentEntity extends DoctrineEmbeddingEntityBase {
public ?int $user_id = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
public string $content = '';
#[ORM\Column(type: VectorType::VECTOR, length: 3072)]
public ?array $embeddings = [];
} my DocumentEntity Class
On Mon, Aug 19, 2024 at 2:48 PM muhammad Aslam @.***> wrote:
The Issue cause was the class PlaceEntity it ask to give all values formatted, embeddings,content etc PlaceEntity::class I could not understand It $paris = new PlaceEntity(); $paris->content = 'I live in Paris'; $paris->type = 'city'; $france = new PlaceEntity(); $france->content = 'I live in France'; $france->type = 'country'; when I select data from database then how I pass values in PlaceEntity::class If I want to do semantic similarity search on my documents table which already hold the embeddings and content then how I do
On Mon, Aug 19, 2024 at 2:42 PM muhammad Aslam @.***> wrote:
// public function startChat($data){ // $config = ORMSetup::createAttributeMetadataConfiguration( // [DIR.'/src'], // true // );
// $connectionParams = [ // 'dbname' => 'postgres', // 'user' => 'postgres', // 'password' => '12345', // 'host' => '127.0.0.1', // 'port' => 5432, // 'driver' => 'pdo_pgsql', // ]; // $textInput = $data['input']; // $this->messages[] = [ // 'type' => 'user', // 'input' => $textInput, // ]; // $connection = DriverManager::getConnection($connectionParams); // $entityManager = new EntityManager($connection, $config); // $vectorStore = new DoctrineVectorStore($entityManager,
DocumentEntity::class);
// $embeddingGenerator = new
OpenAIADA002EmbeddingGenerator($this->config);
// $document = new DocumentEntity(); // $document->userId = Auth::user()->id; // // $embededDocuments =
$embeddingGenerator->embedDocuments([$document]); // // dd($embededDocuments,$textInput); // // try { // // $vectorStore->addDocuments($embededDocuments); // // } catch (\Exception $e) { // // // Log the error or handle it accordingly // // error_log("Error adding documents: " . $e->getMessage()); // // return response()->json(['error' => $e->getMessage()], 500); // // } // $embeddings = $embeddingGenerator->embedText($textInput); // $results = $vectorStore->similaritySearch($embeddings, 2); // expect($result[0]->content)->toBe($textInput);
// $this->messages[] = [ // 'type' => 'bot', // 'response' => $result[0]->content // ]; // return response()->json($this->messages); //
this is my method where I first save data in postgres then try to query store data it give error embedding in array format
On Fri, Aug 16, 2024 at 8:23 PM Franco Lombardo @.***> wrote:
I'm storing vector data into postgres retrieving too but when I gain pass to data after fetching then it give error What is the error you get? Can yoi also post the stack trace of the error?
— Reply to this email directly, view it on GitHub https://github.com/theodo-group/LLPhant/issues/204#issuecomment-2293709967, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATKIQKUIAPAOPL6G5UCEYUDZRYKQBAVCNFSM6AAAAABMS5ONC2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTG4YDSOJWG4 . You are receiving this because you authored the thread.Message ID: @.***>
Use Case want to implement user comes and upload file which embeddings store in vector db currently using postgres after successful uploading user can ask question and get response user can have multiple document uploads when start chat it select desire document and start chat for that I could not find solution will you give me demo or idea how I do that
DoctrineVectorStore stores the embeddings in a postgresql database. (require doctrine/orm)
$vectorStore = new DoctrineVectorStore($entityManager, PlaceEntity::class); $vectorStore->addDocuments($embededDocuments);
Once you have done that you can perform a similarity search over your data. You need to pass the embedding of the text you want to search and the number of results you want to get.
$embedding = $embeddingGenerator->embedText('France the country'); /* @var PlaceEntity[] $result / $result = $vectorStore->similaritySearch($embedding, 2);
[Entity]
[Table(name: 'test_place')]
class PlaceEntity extends DoctrineEmbeddingEntityBase {
[ORM\Column(type: Types::STRING, nullable: true)]
public ?string $type; }
Give One Clear Example If You Can I tried but never succeed