You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return Bad Request (400) Response: {"code":3,"message":"Vector dimension 0 does not match the dimension of the index 1536","details":[]}
my get getEmbedding is
private function getEmbedding(string $text): array
{
$response = OpenAI::embeddings()->create([
'model' => 'text-embedding-ada-002',
'input' => $text,
]);
return $response['data'][0]['embedding'];
}
The text was updated successfully, but these errors were encountered:
$embedding =$this->getEmbedding($chunk);
if (count($embedding) == 1536) {
$embedding = array_map('floatval', $embedding);
$this->pinecone->data()->vectors()->upsert([
'namespace' => $fileName, // Use namespace to group by file
'vectors' => [
[
'id' => "{$fileName}chunk{$index}",
'values' => array_values($embedding),
'metadata' => [
'source' => $fileName,
'chunk_index' => $index,
'upload_date' => now()->toDateString(),
'text' => substr($chunk, 0, 50) . '...', // Chunk preview
],
],
],
]);
}
The text was updated successfully, but these errors were encountered: