FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
janpaul123
janpaul123semanticSearchBlobs
Remix of janpaul123/jadeMacaw
Public
Like
1
semanticSearchBlobs
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
3
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Part of Val Town Semantic Search.

Uses Val Town's blob storage to search embeddings of all vals, by downloading them all and iterating through all of them to compute distance. Slow and terrible, but it works!

  • Get metadata from blob storage: allValsBlob${dimensions}EmbeddingsMeta (currently allValsBlob1536EmbeddingsMeta), which has a list of all indexed vals and where their embedding is stored (batchDataIndex points to the blob, and valIndex represents the offset within the blob).
    • The blobs have been generated by janpaul123/indexValsBlobs. It is not run automatically.
  • Get all blobs with embeddings pointed to by the metadata, e.g. allValsBlob1536EmbeddingsData_0 for batchDataIndex 0.
  • Call OpenAI to generate an embedding for the search query.
  • Go through all embeddings and compute cosine similarity with the embedding for the search query.
  • Return list sorted by similarity.

Migrated from folder: semanticSearchPrototype/semanticSearchBlobs

Code
README.mdmain.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.