New package: @chatcops/store-upstash-vector

已關閉
#362 2 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@srujankaleru2007 已經在處理了。

開始於 2026年10月27日。

  • #385 來自 @srujankaleru2007 —— 未關閉

評估

這個 Issue 還沒有評估資料。

描述

enhancement hacktoberfest help wanted

@chatcops/core now has a VectorStore interface (#333). This adds a new package with a VectorStore backed by Upstash Vector, for serverless sites (Vercel, Netlify) that already use Upstash Redis through @chatcops/store-redis.

What every vector store needs

  • Implement VectorStore from @chatcops/core (packages/core/src/storage/types.ts): dimensions, upsert, query (cosine similarity, best first), deleteBySource, and keywordQuery where the backend has full-text search.
  • Expose it as vectors on the storage the package already returns, so runStorageConformance picks it up. Its vector section (in packages/core/src/testing/conformance.ts) is the spec: run it from the package's tests/conformance.test.ts, with at least 4 dimensions.
  • Filters follow MetadataFilter: every key must match, a value matches only the same type (1 is not "1"), an array means any of its values, and a record without the key never matches.
  • memoryVectors (packages/core/src/storage/memory-vectors.ts) is the reference implementation, and segmentWords there splits text into words with Intl.Segmenter (use it so Japanese and Chinese keyword search works).
  • Add a short section for your store under "Vector stores" in website/src/content/docs/server/storage.mdx, and a changeset for the package (minor).

For this package

  • Start from packages/store-redis for the layout: package.json ("private": true for now, @upstash/vector as a peer dependency), tsconfig.json, vitest.config.ts, README.md, CHANGELOG.md. The root vitest.config.ts and pnpm-workspace.yaml pick up new packages under packages/ on their own.
  • Export upstashVectors({ index, dimensions }) returning a VectorStore, where index is an @upstash/vector Index.
  • Upstash filters are a string syntax (locale = 'de' AND collection IN ('docs', 'pricing')). Build it from MetadataFilter with proper quoting, so a value can't change the filter.
  • keywordQuery only if the index type supports full-text (hybrid or sparse indexes). Otherwise leave it out.
  • There's no local Upstash Vector emulator, so: unit tests with a fake Index for the logic (filter building, mapping, deletes), and the conformance suite gated on CHATCOPS_TEST_UPSTASH_VECTOR_URL and CHATCOPS_TEST_UPSTASH_VECTOR_TOKEN, skipped without them. Upstash has a free tier if you'd like to run it yourself.

Acceptance criteria

  • New package builds, type-checks and passes its tests in CI
  • Conformance passes against a real index when the env variables are set (say in the PR whether you ran it)
  • Filter strings are quoted safely, with a test for a value containing a quote
  • README, a docs section and a changeset
  • pnpm test:coverage and pnpm lint pass
主要語言
TypeScript
星號
13
分支
7
平均合併
3 小時 11 分鐘
30 天內合併 PR
330

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

codercops/chatcops 的其他 Issue

查看 codercops/chatcops 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。