Harden vision vector search and embedding jobs.
Add point search, circuit-breaking, and safer gateway limits so artwork similarity lookups fail closed instead of hanging the request path.
This commit is contained in:
@@ -59,6 +59,31 @@ final class ArtworkVectorIndexService
|
||||
return $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a vector that has already been generated for this artwork.
|
||||
*
|
||||
* This avoids downloading and embedding the artwork a second time.
|
||||
*
|
||||
* @param array<int, float> $vector
|
||||
* @return array{url: string, metadata: array<string, mixed>}
|
||||
*/
|
||||
public function upsertArtworkVector(Artwork $artwork, array $vector): array
|
||||
{
|
||||
$payload = $this->payloadForArtwork($artwork);
|
||||
|
||||
$this->client->upsertByVector(
|
||||
$vector,
|
||||
(int) $artwork->id,
|
||||
$payload['metadata']
|
||||
);
|
||||
|
||||
$artwork->forceFill([
|
||||
'last_vector_indexed_at' => now(),
|
||||
])->save();
|
||||
|
||||
return $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{contents: string, filename: string}|null
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user